Creating an animation rig in Blender: Difference between revisions

Added the "Adding bone constraints to rig controller bones" header
(Added the "Changing custom shapes of rig controller bones" header)
(Added the "Adding bone constraints to rig controller bones" header)
Line 404: Line 404:
# With X-Axis mirror enabled, select the MCH-forearm_ik.R bone and extrude it perpendicularly to the axis of the arm. You should now have the MCH-forearm_ik.R.001 and MCH-forearm_ik.L.001 bones. These bones are needed for the wrist snapping function which we'll implement later.
# With X-Axis mirror enabled, select the MCH-forearm_ik.R bone and extrude it perpendicularly to the axis of the arm. You should now have the MCH-forearm_ik.R.001 and MCH-forearm_ik.L.001 bones. These bones are needed for the wrist snapping function which we'll implement later.


==Editing the bone constrants==
==Editing the bone constrants of ORG and MCH bone layers==
Now's the time to edit and add bone constraints.
Now's the time to edit and add bone constraints.


Line 458: Line 458:
We're getting close to the end. There's still a bit of work to do, but all that remains relates to the rig controller bones in Pose mode.
We're getting close to the end. There's still a bit of work to do, but all that remains relates to the rig controller bones in Pose mode.
This short header will focus on changing the shapes of the controller bones - these changes are purely visual and have no functional effect on the rig, however, they do make it more more ergonomic and easier to read.
This short header will focus on changing the shapes of the controller bones - these changes are purely visual and have no functional effect on the rig, however, they do make it more more ergonomic and easier to read.
 
[[Image:Rig After Editing Custom Shapes.png|200px|right|thumb|Rig's expected state at point 69]]
#<li value="65>Switch over to all other bone layers except the MCH and ORG layers - all that was related to them is now done.</li>
#<li value="65>Switch over to all other bone layers except the MCH and ORG layers - all that was related to them is now done.</li>
#Select the tweak_spine.001 bone:
#Select the tweak_spine.001 bone:
Line 468: Line 468:
## Disable the ''Scale to Bone Length'' checkbox.
## Disable the ''Scale to Bone Length'' checkbox.
## Set the scale to 2.
## Set the scale to 2.
#For both toe.R and toe.L, set the scale to 0.
#For both toe.R and toe.L, set the scale to 0. At this point, the rig should look as shown in the screenshot on the right.
 
==Adding bone constraints to rig controller bones==
Now we'll need to edit the Rig Layers panel a bit and add the wrist snapping functionality by putting three code snippets into rig_ui.py and running it.
 
#<li value="70"> Go to the Scripting tab and select the rig_ui.py script.
#Right at the start of the script you will see the <code>rig id</code> field. Copy its value and save it in some text editor, as you'll be pasting it in the next few steps.
#Find the following line (use another text editor if you can't find it in Blender's Text Editor):
 
<pre>        props.bones = '["upper_arm_ik.L", "upper_arm_ik_target.L", "hand_ik.L"]'</pre>
 
Add the following code snippet below it - this will add a button and functionality for the wrist snapping on the '''left''' arm - using the MCH-forearm_ik.L.001 bone that was created in points 52 and 53.
Also, replace <code>'''YOURRIGID'''</code> with your <code>rig_id</code> from point 71.
 
<pre>
            group2 = group1.row(align=True)
            props = group2.operator('pose.rigify_generic_snap_YOURRIGID', text='IK wrist (hand.L)', icon='SNAP_ON')
            props.output_bones = '["hand_ik.L"]'
            props.input_bones = '["MCH-forearm_ik.L.001"]'
            props.ctrl_bones = '["MCH-forearm_ik.L.001"]'
            props.tooltip = 'IK hand to wrist'
</pre>
 
#<li value="73"> Find the following line:
<pre>        props.bones = '["upper_arm_ik.R", "hand_ik.R", "upper_arm_ik_target.R"]' </pre>
Add the following code snippet below it - this will add a button and functionality for the wrist snapping on the '''right''' arm. Also, replace <code>'''YOURRIGID'''</code> with your <code>rig_id</code> from point 71.
 
<pre>
            group2 = group1.row(align=True)
            props = group2.operator('pose.rigify_generic_snap_YOURRIGID', text='IK wrist (hand.R)', icon='SNAP_ON')
            props.output_bones = '["hand_ik.R"]'
            props.input_bones = '["MCH-forearm_ik.R.001"]'
            props.ctrl_bones = '["MCH-forearm_ik.R.001"]'
            props.tooltip = 'IK hand to wrist'
            if is_selected({'upper_arm_ik.R', 'hand_ik.R', 'upper_arm_parent.R', 'upper_arm_ik_target.R'}):
</pre>
 
 
 
#<li value="74"> Find the following line:
 
<pre>        row.prop(context.active_object.data, 'layers', index=8, toggle=True, text='Torso') </pre>
 
Change it to the following:
 
<pre>
        row.prop(context.active_object.data, 'layers', index=9, toggle=True, text='Pose Matching')
 
        row = col.row()
        row.separator()
</pre>
 
#<li value="75"> Find the following line:
<pre>        row.prop(context.active_object.data, 'layers', index=9, toggle=True, text='Torso (Tweak)')</pre>
 
Change it to the following:
<pre>        row.prop(context.active_object.data, 'layers', index=8, toggle=True, text='Torso')</pre>
 
#<li value="76">Find the following code:</li>
<pre>
        row.prop(context.active_object.data, 'layers', index=21, toggle=True, text='Leg.R (FK)')
 
        row = col.row()
        row.separator()
</pre>
 
Remove the <code>row = col.row()</code> and <code>row.seperator()</code> lines.
 
#<li value="78"> Find the following line:
 
<pre>row.prop(context.active_object.data, 'layers', index=28, toggle=True, text='Root')</pre>
 
Change the value of <code>index</code> to 24. Index is the layer number, and Root should be layer 24, not 28.
 
#<li value="79">We recommend backing up your file at this point.
#Run the script, and move to the Layout tab. Your rig should look as shown in the screenshot
 
 
==


[[Category:Modding tutorials]]
[[Category:Modding tutorials]]
191

edits