# RIG_PICKER
> Blender addon for picking rig contollers

Rig_picker is an OpenGl tool for having a 2d interface for the 3d animators allowing them to pick a controller easily.
The addon is drawing 2d shapes inside a dedicated Node Editor Area using the gpu module.
You can use multiple pickers for one rig, each picker shapes are in there own collection. 

Video of the previous version : https://vimeo.com/241970235

<!-- TABLE OF CONTENTS -->
***
<summary>Table of Contents</summary>
<ol>
<li>
    <a href="#installation">Installation</a>
</li>
<li>
    <a href="#create-a-picker-from-scratch">Create a picker from scratch</a>
</li>
<li>
    <a href="#how-to-use-an-existing-picker">How to use an existing picker </a>
</li>
<li>
    <a href="#precisions">Precisions</a>
</li>
</ol>


<!-- INSTALLATION -->
## Installation
### Developper installation
For external user, you can clone the repository using:
```sh
git clone https://git.autourdeminuit.com/autour_de_minuit/rig_picker.git
```

For Internal user:
1. Create your own local directory in 
    ```sh
   /home/<USER>/dev
   ```
2. Create your own local directory in 
    ```sh
   git clone ssh://git@git.autourdeminuit.com:222/autour_de_minuit/rig_picker.git
   ```
### User installation

 Addon available on blender 4.X , you can process this way to add this on your blender 
<br/>

![doc_picker_01.png](attachments/doc_picker_01.png)

 <p align="center">
<img src="attachments/doc_picker_02.png">
</p>

<br/><br/>

<!-- Create a picker from scratch -->
## Create a picker from scratch

#### 1. Canvas Creation
<br/>
1. Once the addon is installed , you'll find the "rigging" tab on the right of your 3D viewport, on it to start your picker first click on the "+" on top here

<br/>


 <p align="center">
<img src="attachments/Doc_picker_01.gif" width=630/>
</p>

<br/>

 It will create a plane inside a "**controller**" collection, this plane will be the background of your picker. The collection is important, you can rename it **but don't delete it.** You can also rename the plane at your liking.

<br/>

 If you click on this new plane, on the tab you will find (cf menu picture) : 
  - The name of the armature you want to pick
  - The name of the canvas of your picker
  - Symmetry
  - The path needed to save your futur picker
  - The save button

  <br/>


 <p align="center">
<img src="attachments/doc_picker_03.png" width=630/>
</p>

<br/><br/>
#### 2. Picker Controller Creation
<br/>
1. Next, select the controllers of your armature, and click on the button "Create Shape". It will create empty meshes with the same names as your controllers, it should already be connected to the good controller of your armature, but for more details on that read the rest of this documentation. 

<br/>

 <p align="center">
<img src="attachments/Doc_picker_02.gif" width=630/>
</p>

<br/><br/>

2. Create meshes inside the object of the picker's controller freshly generated
<br/>

 <p align="center">
<img src="attachments/doc_picker_04.png" width=630/>
</p>

<br/>

3. On those shape, you can add a material with this button in the "rigging" tab, you can add one, delete one if there already is a material here or pick from the scene a material on another element. (it works with a multiple selection)

<br/>

<p align="center">
<img src="attachments/Doc_picker_03.gif" width=630/>
</p>

<br/>

You can also create some shapes display to represent the body of your character
<br/>

<p align="center">
<img src="attachments/doc_picker_06.png" width=630/>
</p>

<br/>

#### 3. Controller's Setup

<br/>

- Back on the "rigging" tab, you will find buttons : 
  - A create shape button
  - A mirror shape button
  - An auto Bone assign button
  - A "Name from bones" button

 <br/>

- The last part is where you define to what bone the shape is connected. If you used the button "create shape" the good bone should already be picked, but if you created your own mesh or if you want the mesh to pick another bone instead, you need to pick it from this selection window.

<br/>

  It is also where you decide if this shape is supposed to be :
  -  A bone : meaning selectable on the picker
  - A display : only there for a visual purpose (like representing the character's shape)
  - An Operator : to be connected to a script.

<br/>

 <p align="center">
<img src="attachments/doc_picker_07.png">
</p>

<br/>

#### 4. Final Touch

<br/>

- Place all of your meshes on top of the canvas, be careful as it works as photoshops layers, meaning, you need to put the mesh up on the Z axis if you want your shape on top on the 2D picker. The mesh with the vertex that is the higher up on the Z axis will be the  top one on the picker display.

<br/>

<p align="center">
<img src="attachments/Doc_picker_04.gif" width=630/>
</p>

<br/>

- When you are all done, save the picker then click on the armature , one the "Sources" window a button to add your picker. Select the path and the file.

<br/>


<p align="center">
<img src="attachments/doc_picker_11.png" width=630/>
</p>

<br/>

<!-- Howto -->
## How to use an existing picker

- Open a "picker" view, select your armature in pose mode and in the "rigging" tab click on the small "+" sign. That will allow you to choose the picker file that you want. You can "reload" the picker if it doesn't show (or click on the "1" on the top right which center the page of the pickers in the view, in case you have more han one)
<br/>

<p align="center">
<img src="attachments/doc_picker_12.png" width=630/>
</p>

<br/>

- You can have more than one page for your picker if you need to detail things a bit more. For exemple in here we have a second canvas (in its own collection), that we'll save with a different name and load it as well.

<br/>

<p align="center">
<img src="attachments/doc_picker_13.png" width=630/>
</p>

<br/>

You can select now your controller directly on the picker.

<br/>

<!-- PRECISIONS -->
## Precisions
<br/>
- In this menu, you will find some features that have actions on your picker's controllers

<br/>

<p align="center">
<img src="attachments/doc_picker_14.png" width=630/>
</p>
<br/>

- If you double click on a controller, it will HIDE the whole layer of this bone

<br/>

<p align="center">
<img src="attachments/doc_picker_15.png" width=630/>
</p>


