Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vegdahl <cessen@cessen.com>2013-02-16 23:35:26 +0400
committerNathan Vegdahl <cessen@cessen.com>2013-02-16 23:35:26 +0400
commit47b467eb42d4a8ec7041c98e13653f481cf56597 (patch)
tree6cae6dbdca8e562aca1d0aae9620b03597c6ce6b /rigify/rigs/spine.py
parent21e99d0bd6b6a71cbf871cc4aaf6f2b744cd3d14 (diff)
Rigify: changed rig type API. Disabled delta rig type.
I have updated the rig type API to be a bit clearer based on my interactions with Kfir from PitchiPoy. I've also disabled the "delta" rig type, as it is very obscure and mostly just confuses people.
Diffstat (limited to 'rigify/rigs/spine.py')
-rw-r--r--rigify/rigs/spine.py172
1 files changed, 85 insertions, 87 deletions
diff --git a/rigify/rigs/spine.py b/rigify/rigs/spine.py
index 29ad1729..0983e83e 100644
--- a/rigify/rigs/spine.py
+++ b/rigify/rigs/spine.py
@@ -478,93 +478,91 @@ class Rig:
controls_string = ", ".join(["'" + x + "'" for x in controls[1:]])
return [script % (controls[0], controls_string)]
- @classmethod
- def add_parameters(self, params):
- """ Add the parameters of this rig type to the
- RigifyParameters PropertyGroup
- """
- params.spine_main_control_name = bpy.props.StringProperty(name="Main control name", default="torso", description="Name that the main control bone should be given")
- params.rest_pivot_slide = bpy.props.FloatProperty(name="Rest Pivot Slide", default=0.0, min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, description="The pivot slide value in the rest pose")
- params.chain_bone_controls = bpy.props.StringProperty(name="Control bone list", default="", description="Define which bones have controls")
-
- @classmethod
- def parameters_ui(self, layout, obj, bone):
- """ Create the ui for the rig parameters.
- """
- params = obj.pose.bones[bone].rigify_parameters
-
- r = layout.row()
- r.prop(params, "spine_main_control_name")
-
- r = layout.row()
- r.prop(params, "rest_pivot_slide", slider=True)
-
- r = layout.row()
- r.prop(params, "chain_bone_controls")
- @classmethod
- def create_sample(self, obj):
- # generated by rigify.utils.write_metarig
- bpy.ops.object.mode_set(mode='EDIT')
- arm = obj.data
-
- bones = {}
-
- bone = arm.edit_bones.new('hips')
- bone.head[:] = 0.0000, 0.0000, 0.0000
- bone.tail[:] = -0.0000, -0.0590, 0.2804
- bone.roll = -0.0000
- bone.use_connect = False
- bones['hips'] = bone.name
- bone = arm.edit_bones.new('spine')
- bone.head[:] = -0.0000, -0.0590, 0.2804
- bone.tail[:] = 0.0000, 0.0291, 0.5324
- bone.roll = 0.0000
- bone.use_connect = True
- bone.parent = arm.edit_bones[bones['hips']]
- bones['spine'] = bone.name
- bone = arm.edit_bones.new('ribs')
- bone.head[:] = 0.0000, 0.0291, 0.5324
- bone.tail[:] = -0.0000, 0.0000, 1.0000
- bone.roll = -0.0000
- bone.use_connect = True
- bone.parent = arm.edit_bones[bones['spine']]
- bones['ribs'] = bone.name
+def add_parameters(params):
+ """ Add the parameters of this rig type to the
+ RigifyParameters PropertyGroup
+ """
+ params.spine_main_control_name = bpy.props.StringProperty(name="Main control name", default="torso", description="Name that the main control bone should be given")
+ params.rest_pivot_slide = bpy.props.FloatProperty(name="Rest Pivot Slide", default=0.0, min=0.0, max=1.0, soft_min=0.0, soft_max=1.0, description="The pivot slide value in the rest pose")
+ params.chain_bone_controls = bpy.props.StringProperty(name="Control bone list", default="", description="Define which bones have controls")
- bpy.ops.object.mode_set(mode='OBJECT')
- pbone = obj.pose.bones[bones['hips']]
- pbone.rigify_type = 'spine'
- pbone.lock_location = (False, False, False)
- pbone.lock_rotation = (False, False, False)
- pbone.lock_rotation_w = False
- pbone.lock_scale = (False, False, False)
- pbone.rotation_mode = 'QUATERNION'
- pbone = obj.pose.bones[bones['spine']]
- pbone.rigify_type = ''
- pbone.lock_location = (False, False, False)
- pbone.lock_rotation = (False, False, False)
- pbone.lock_rotation_w = False
- pbone.lock_scale = (False, False, False)
- pbone.rotation_mode = 'QUATERNION'
- pbone = obj.pose.bones[bones['ribs']]
- pbone.rigify_type = ''
- pbone.lock_location = (False, False, False)
- pbone.lock_rotation = (False, False, False)
- pbone.lock_rotation_w = False
- pbone.lock_scale = (False, False, False)
- pbone.rotation_mode = 'QUATERNION'
- pbone = obj.pose.bones[bones['hips']]
- pbone['rigify_type'] = 'spine'
- pbone.rigify_parameters.chain_bone_controls = "1, 2, 3"
- bpy.ops.object.mode_set(mode='EDIT')
- for bone in arm.edit_bones:
- bone.select = False
- bone.select_head = False
- bone.select_tail = False
- for b in bones:
- bone = arm.edit_bones[bones[b]]
- bone.select = True
- bone.select_head = True
- bone.select_tail = True
- arm.edit_bones.active = bone
+def parameters_ui(layout, params):
+ """ Create the ui for the rig parameters.
+ """
+ r = layout.row()
+ r.prop(params, "spine_main_control_name")
+
+ r = layout.row()
+ r.prop(params, "rest_pivot_slide", slider=True)
+
+ r = layout.row()
+ r.prop(params, "chain_bone_controls")
+
+
+def create_sample(obj):
+ # generated by rigify.utils.write_metarig
+ bpy.ops.object.mode_set(mode='EDIT')
+ arm = obj.data
+
+ bones = {}
+
+ bone = arm.edit_bones.new('hips')
+ bone.head[:] = 0.0000, 0.0000, 0.0000
+ bone.tail[:] = -0.0000, -0.0590, 0.2804
+ bone.roll = -0.0000
+ bone.use_connect = False
+ bones['hips'] = bone.name
+ bone = arm.edit_bones.new('spine')
+ bone.head[:] = -0.0000, -0.0590, 0.2804
+ bone.tail[:] = 0.0000, 0.0291, 0.5324
+ bone.roll = 0.0000
+ bone.use_connect = True
+ bone.parent = arm.edit_bones[bones['hips']]
+ bones['spine'] = bone.name
+ bone = arm.edit_bones.new('ribs')
+ bone.head[:] = 0.0000, 0.0291, 0.5324
+ bone.tail[:] = -0.0000, 0.0000, 1.0000
+ bone.roll = -0.0000
+ bone.use_connect = True
+ bone.parent = arm.edit_bones[bones['spine']]
+ bones['ribs'] = bone.name
+
+ bpy.ops.object.mode_set(mode='OBJECT')
+ pbone = obj.pose.bones[bones['hips']]
+ pbone.rigify_type = 'spine'
+ pbone.lock_location = (False, False, False)
+ pbone.lock_rotation = (False, False, False)
+ pbone.lock_rotation_w = False
+ pbone.lock_scale = (False, False, False)
+ pbone.rotation_mode = 'QUATERNION'
+ pbone = obj.pose.bones[bones['spine']]
+ pbone.rigify_type = ''
+ pbone.lock_location = (False, False, False)
+ pbone.lock_rotation = (False, False, False)
+ pbone.lock_rotation_w = False
+ pbone.lock_scale = (False, False, False)
+ pbone.rotation_mode = 'QUATERNION'
+ pbone = obj.pose.bones[bones['ribs']]
+ pbone.rigify_type = ''
+ pbone.lock_location = (False, False, False)
+ pbone.lock_rotation = (False, False, False)
+ pbone.lock_rotation_w = False
+ pbone.lock_scale = (False, False, False)
+ pbone.rotation_mode = 'QUATERNION'
+ pbone = obj.pose.bones[bones['hips']]
+ pbone['rigify_type'] = 'spine'
+ pbone.rigify_parameters.chain_bone_controls = "1, 2, 3"
+
+ bpy.ops.object.mode_set(mode='EDIT')
+ for bone in arm.edit_bones:
+ bone.select = False
+ bone.select_head = False
+ bone.select_tail = False
+ for b in bones:
+ bone = arm.edit_bones[bones[b]]
+ bone.select = True
+ bone.select_head = True
+ bone.select_tail = True
+ arm.edit_bones.active = bone