[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [4335] trunk/py/scripts/addons/rigify: Rigify: significant upgrade to arm and leg rigs, and misc changes/bugfixes .
Nathan Vegdahl
cessen at cessen.com
Fri Mar 1 01:17:15 CET 2013
Revision: 4335
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=4335
Author: cessen
Date: 2013-03-01 00:17:14 +0000 (Fri, 01 Mar 2013)
Log Message:
-----------
Rigify: significant upgrade to arm and leg rigs, and misc changes/bugfixes.
Arm/leg rig upgrades:
- Arms and legs no longer scale with their parents, which was
problematic when e.g. the torso of a character did
squash-and-stretch causing the arms/legs to distort and shear.
- Squash-and-stretch for both FK and IK rigs.
- Rubber hose controls.
Misc changes/bugfixes:
- Rigify now locks all pose transforms for non-control bones
automatically.
- The README file now correctly reflects the new rig-type API.
- Scrubbed the code for unused variables and imports.
- PEP8 cleanups.
Modified Paths:
--------------
trunk/py/scripts/addons/rigify/CREDITS
trunk/py/scripts/addons/rigify/README
trunk/py/scripts/addons/rigify/__init__.py
trunk/py/scripts/addons/rigify/generate.py
trunk/py/scripts/addons/rigify/metarigs/human.py
trunk/py/scripts/addons/rigify/rig_lists.py
trunk/py/scripts/addons/rigify/rig_ui_template.py
trunk/py/scripts/addons/rigify/rigs/biped/arm/__init__.py
trunk/py/scripts/addons/rigify/rigs/biped/arm/deform.py
trunk/py/scripts/addons/rigify/rigs/biped/arm/fk.py
trunk/py/scripts/addons/rigify/rigs/biped/arm/ik.py
trunk/py/scripts/addons/rigify/rigs/biped/leg/__init__.py
trunk/py/scripts/addons/rigify/rigs/biped/leg/deform.py
trunk/py/scripts/addons/rigify/rigs/biped/leg/fk.py
trunk/py/scripts/addons/rigify/rigs/biped/leg/ik.py
trunk/py/scripts/addons/rigify/rigs/misc/delta.py
trunk/py/scripts/addons/rigify/rigs/neck_short.py
trunk/py/scripts/addons/rigify/rigs/spine.py
trunk/py/scripts/addons/rigify/utils.py
Added Paths:
-----------
trunk/py/scripts/addons/rigify/rigs/biped/limb_common.py
Modified: trunk/py/scripts/addons/rigify/CREDITS
===================================================================
--- trunk/py/scripts/addons/rigify/CREDITS 2013-02-28 21:27:10 UTC (rev 4334)
+++ trunk/py/scripts/addons/rigify/CREDITS 2013-03-01 00:17:14 UTC (rev 4335)
@@ -7,6 +7,7 @@
- Benjamin Tolputt
- Nesterenko Viktoriya
- Jeff Hogan
+- Pitchi Poy productions
IK/FK snapping financial support:
- Benjamin Tolputt
Modified: trunk/py/scripts/addons/rigify/README
===================================================================
--- trunk/py/scripts/addons/rigify/README 2013-02-28 21:27:10 UTC (rev 4334)
+++ trunk/py/scripts/addons/rigify/README 2013-03-01 00:17:14 UTC (rev 4335)
@@ -70,8 +70,9 @@
THE GUTS OF A RIG TYPE, BASIC
-----------------------------
-A rig type is simply a python module containing a class named "Rig". The Rig
-class is only required to have two methods: __init__() and generate()
+A rig type is simply a python module containing a class named "Rig", and some
+optional module functions. The Rig class has only two methods:
+__init__() and generate()
__init__() is the "information gathering" code for the rig type. When Rigify
loops through the bones and finds a tagged bone, it will create a python
@@ -85,7 +86,7 @@
# code goes here
At the bare minimum, you are going to want to store the object and bone name
-in the rig type object for later reference in the generate method. So:
+in the rig type object for later reference in the generate() method. So:
def __init__(self, obj, bone_name, params):
self.obj = obj
@@ -163,17 +164,11 @@
THE GUTS OF A RIG TYPE, ADVANCED
--------------------------------
If you look at any of the rig types included with Rigify, you'll note that they
-have several more methods than just __init__() and generate().
-THESE ADDITIONAL METHODS ARE _NOT_ REQUIRED for a rig type to function. But
+have several functions outside of the Rig class.
+THESE ADDITIONAL FUNCTIONS ARE _NOT_ REQUIRED for a rig type to function. But
they can add some nifty functionality to your rig.
-Not all of the additional methods you see in the included rig types have any
-special purpose for Rigify, however. For example, I often create separate
-methods for generating the deformation and control rigs, and then call them
-both from the main generate() method. But that is just for organization, and
-has nothing to do with Rigify itself.
-
-Here are the additional methods relevant to Rigify, with brief decriptions of
+Here are the additional functions relevant to Rigify, with brief decriptions of
what they are for:
@@ -183,25 +178,21 @@
generated. For example, the included biped arm rig allows the user to specify
the axis of rotation for the elbow.
-There are two methods necessary to give a rig type user-tweakable parameters,
-both of which must be class methods:
+There are two functions necessary to give a rig type user-tweakable parameters:
add_parameters()
parameters_ui()
add_parameters() takes an IDPropertyGroup as input, and adds its parameters
to that group as RNA properties. For example:
- @classmethod
- def add_parameters(self, group):
- group.toggle_param = bpy.props.BoolProperty(name="Test toggle:", default=False, description="Just a test, not really used for anything.")
+ def add_parameters(params):
+ params.toggle_param = bpy.props.BoolProperty(name="Test toggle:", default=False, description="Just a test, not really used for anything.")
-parameter_ui() recieves a Blender UILayout object, the metarig object, and the
-tagged bone name. It creates a GUI in the UILayout for the user to tweak the
-parameters. For example:
+parameters_ui() recieves a Blender UILayout object and an IDPropertyGroup
+containing the parameters added by add_parameters(). It creates a GUI in the
+UILayout for the user to tweak those parameters. For example:
- @classmethod
- def parameters_ui(self, layout, obj, bone):
- params = obj.pose.bones[bone].rigify_parameters[0]
+ def parameters_ui(layout, params):
r = layout.row()
r.prop(params, "toggle_param")
@@ -209,14 +200,12 @@
SAMPLE METARIG
--------------
It is a good idea for all rig types to have a sample metarig that the user can
-add to their own metarig. This is what the create_sample() method is for.
-Like the parameter methods above, create_sample() must be a class method.
+add to their own metarig. This is what the create_sample() function is for.
create_sample() takes the current armature object as input, and adds the bones
for its rig-type's metarig. For example:
- @classmethod
- def create_sample(self, obj):
+ def create_sample(obj):
bpy.ops.object.mode_set(mode='EDIT')
arm = obj.data
@@ -232,21 +221,24 @@
pbone.rigify_parameters.add()
Obviously, this isn't something that you generally want to hand-code,
-especially with more complex samples. There is a function in utils.py
-that will generate the code for create_sample() for you, based on a selected
-armature. The function is called write_metarig()
+especially with more complex samples. When in edit-mode on an armature,
+there is a "Rigify Dev Tools" panel in the View3d tools panel containing a
+button labeled "Encode Sample to Python". This button will generate the python
+code for create_sample() from the armature you are editing. The generated code
+appears in a text block called "metarig_sample.py"
GENERATING A PYTHON UI
----------------------
-The generate() method can also, optionally, return python code as a string.
-This python code is added to the "rig properties" panel that gets
+The generate() method can also, optionally, return python code as a single
+string. This python code is added to the "rig properties" panel that gets
auto-generated along with the rig. This is useful for exposing things like
IK/FK switches in a nice way to the animator.
-The string must be returned in a list:
+The string must be returned in a list, e.g.:
return ["my python code"]
-Otherwise it won't work.
+The reason it needs to be put in a list is to leave room for expanding the API
+in the future, for returning additional information.
Modified: trunk/py/scripts/addons/rigify/__init__.py
===================================================================
--- trunk/py/scripts/addons/rigify/__init__.py 2013-02-28 21:27:10 UTC (rev 4334)
+++ trunk/py/scripts/addons/rigify/__init__.py 2013-03-01 00:17:14 UTC (rev 4335)
@@ -20,15 +20,14 @@
bl_info = {
"name": "Rigify",
+ "version": (0, 4),
"author": "Nathan Vegdahl",
- "blender": (2, 57, 0),
- "location": "View3D > Add > Armature",
- "description": "Adds various Rig Templates",
- "location": "Armature properties",
+ "blender": (2, 66, 0),
+ "description": "Automatic rigging from building-block components",
+ "location": "Armature properties, Bone properties, View3d tools panel, Armature Add menu",
"wiki_url": "http://wiki.blender.org/index.php/Extensions:2.5/Py/"
"Scripts/Rigging/Rigify",
- "tracker_url": "http://projects.blender.org/tracker/index.php?"
- "func=detail&aid=25546",
+ "tracker_url": "http://github.com/cessen/rigify/issues",
"category": "Rigging"}
Modified: trunk/py/scripts/addons/rigify/generate.py
===================================================================
--- trunk/py/scripts/addons/rigify/generate.py 2013-02-28 21:27:10 UTC (rev 4334)
+++ trunk/py/scripts/addons/rigify/generate.py 2013-03-01 00:17:14 UTC (rev 4335)
@@ -265,7 +265,6 @@
try:
# Collect/initialize all the rigs.
rigs = []
- deformation_rigs = []
for bone in bones_sorted:
bpy.ops.object.mode_set(mode='EDIT')
rigs += get_bone_rigs(obj, bone)
@@ -307,6 +306,16 @@
obj.data.edit_bones[bone].parent = obj.data.edit_bones[root_bone]
bpy.ops.object.mode_set(mode='OBJECT')
+ # Lock transforms on all non-control bones
+ r = re.compile("[A-Z][A-Z][A-Z]-")
+ for bone in bones:
+ if r.match(bone):
+ pb = obj.pose.bones[bone]
+ pb.lock_location = (True, True, True)
+ pb.lock_rotation = (True, True, True)
+ pb.lock_rotation_w = True
+ pb.lock_scale = (True, True, True)
+
# Every bone that has a name starting with "DEF-" make deforming. All the
# others make non-deforming.
for bone in bones:
Modified: trunk/py/scripts/addons/rigify/metarigs/human.py
===================================================================
--- trunk/py/scripts/addons/rigify/metarigs/human.py 2013-02-28 21:27:10 UTC (rev 4334)
+++ trunk/py/scripts/addons/rigify/metarigs/human.py 2013-03-01 00:17:14 UTC (rev 4335)
@@ -29,10 +29,14 @@
for i in range(28):
arm.rigify_layers.add()
- arm.rigify_layers[0].name = "Torso"
- arm.rigify_layers[0].row = 2
- arm.rigify_layers[2].name = "Head"
- arm.rigify_layers[2].row = 1
+ arm.rigify_layers[0].name = "head"
+ arm.rigify_layers[0].row = 1
+ arm.rigify_layers[1].name = " "
+ arm.rigify_layers[1].row = 1
+ arm.rigify_layers[2].name = "Torso"
+ arm.rigify_layers[2].row = 2
+ arm.rigify_layers[3].name = " "
+ arm.rigify_layers[3].row = 1
arm.rigify_layers[4].name = "Fingers"
arm.rigify_layers[4].row = 3
arm.rigify_layers[5].name = "(Tweak)"
@@ -41,18 +45,46 @@
arm.rigify_layers[6].row = 4
arm.rigify_layers[7].name = "Arm.L (IK)"
arm.rigify_layers[7].row = 5
- arm.rigify_layers[8].name = "Arm.R (FK)"
- arm.rigify_layers[8].row = 4
- arm.rigify_layers[9].name = "Arm.R (IK)"
- arm.rigify_layers[9].row = 5
- arm.rigify_layers[10].name = "Leg.L (FK)"
- arm.rigify_layers[10].row = 6
- arm.rigify_layers[11].name = "Leg.L (IK)"
- arm.rigify_layers[11].row = 7
- arm.rigify_layers[12].name = "Leg.R (FK)"
- arm.rigify_layers[12].row = 6
- arm.rigify_layers[13].name = "Leg.R (IK)"
- arm.rigify_layers[13].row = 7
+ arm.rigify_layers[8].name = "Arm.L (Tweak)"
+ arm.rigify_layers[8].row = 6
+ arm.rigify_layers[9].name = "Arm.R (FK)"
+ arm.rigify_layers[9].row = 4
+ arm.rigify_layers[10].name = "Arm.R (IK)"
+ arm.rigify_layers[10].row = 5
+ arm.rigify_layers[11].name = "Arm.R (Tweak)"
+ arm.rigify_layers[11].row = 6
+ arm.rigify_layers[12].name = "Leg.L (FK)"
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list