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>2014-09-26 07:24:03 +0400
committerNathan Vegdahl <cessen@cessen.com>2014-09-26 07:24:03 +0400
commitc35610f163a05f81951a2b069306b675294f4cb3 (patch)
tree645ec626585d90e3ba3c678ee739e9c36e81b7d1 /rigify/utils.py
parentfd695c3a81b63db072311e8516e0dbb8d4474047 (diff)
Rigify: new additions from PitchiPoy Animation Productions.
PitchiPoy Animation Productions is sharing its custom rig types with the Blender community at large. The new rig types all start with "pitchipoy." and are used in PitchiPoy's productions. Of particular interest is a face rig type for auto-rigging faces. Other rig types include: - Tentacles - Fingers - Arms/Legs - Spine/Torso Many thanks to PitchiPoy for their hard work and for sharing this back!
Diffstat (limited to 'rigify/utils.py')
-rw-r--r--rigify/utils.py33
1 files changed, 31 insertions, 2 deletions
diff --git a/rigify/utils.py b/rigify/utils.py
index 0b27bc21..f0bff0dd 100644
--- a/rigify/utils.py
+++ b/rigify/utils.py
@@ -135,12 +135,41 @@ def new_bone(obj, bone_name):
else:
raise MetarigError("Can't add new bone '%s' outside of edit mode" % bone_name)
+def copy_bone_simple(obj, bone_name, assign_name=''):
+ """ Makes a copy of the given bone in the given armature object.
+ but only copies head, tail positions and roll. Does not
+ address parenting either.
+ """
+ #if bone_name not in obj.data.bones:
+ if bone_name not in obj.data.edit_bones:
+ raise MetarigError("copy_bone(): bone '%s' not found, cannot copy it" % bone_name)
+
+ if obj == bpy.context.active_object and bpy.context.mode == 'EDIT_ARMATURE':
+ if assign_name == '':
+ assign_name = bone_name
+ # Copy the edit bone
+ edit_bone_1 = obj.data.edit_bones[bone_name]
+ edit_bone_2 = obj.data.edit_bones.new(assign_name)
+ bone_name_1 = bone_name
+ bone_name_2 = edit_bone_2.name
+
+ # Copy edit bone attributes
+ edit_bone_2.layers = list(edit_bone_1.layers)
+
+ edit_bone_2.head = Vector(edit_bone_1.head)
+ edit_bone_2.tail = Vector(edit_bone_1.tail)
+ edit_bone_2.roll = edit_bone_1.roll
+
+ return bone_name_2
+ else:
+ raise MetarigError("Cannot copy bones outside of edit mode")
def copy_bone(obj, bone_name, assign_name=''):
""" Makes a copy of the given bone in the given armature object.
Returns the resulting bone's name.
"""
- if bone_name not in obj.data.bones:
+ #if bone_name not in obj.data.bones:
+ if bone_name not in obj.data.edit_bones:
raise MetarigError("copy_bone(): bone '%s' not found, cannot copy it" % bone_name)
if obj == bpy.context.active_object and bpy.context.mode == 'EDIT_ARMATURE':
@@ -698,7 +727,7 @@ def write_metarig(obj, layers=False, func_name="create"):
"""
code = []
- code.append("import bpy\n")
+ code.append("import bpy\n\n")
code.append("def %s(obj):" % func_name)
code.append(" # generated by rigify.utils.write_metarig")