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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-12-11 02:24:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-12-11 02:24:31 +0300
commit8b32402f381e22928390188144b1ab89aac55cd4 (patch)
treed25dcbfd289178d13efc38b563ea52e690343c83 /release/scripts/modules/rigify
parent5a0436b8ea44bf4a90993c255f9fc7cda048bc73 (diff)
* root bone override fixed
* delta was disabled * simple copy metarig type * proper exception when a type isnt found
Diffstat (limited to 'release/scripts/modules/rigify')
-rw-r--r--release/scripts/modules/rigify/__init__.py14
-rw-r--r--release/scripts/modules/rigify/copy.py53
-rw-r--r--release/scripts/modules/rigify/delta.py1
-rw-r--r--release/scripts/modules/rigify/leg_biped_generic.py4
4 files changed, 66 insertions, 6 deletions
diff --git a/release/scripts/modules/rigify/__init__.py b/release/scripts/modules/rigify/__init__.py
index f4922f80040..5d1ec2e1e5a 100644
--- a/release/scripts/modules/rigify/__init__.py
+++ b/release/scripts/modules/rigify/__init__.py
@@ -23,6 +23,7 @@ from Mathutils import Vector
# TODO, have these in a more general module
from rna_prop_ui import rna_idprop_ui_prop_get
+SPECIAL_TYPES = "root",
class RigifyError(Exception):
"""Exception raised for errors in the metarig.
@@ -43,7 +44,11 @@ def submodule_func_from_type(bone_type):
submod_name, func_name = type_pair
# from rigify import leg
- submod = __import__(name="%s.%s" % (__package__, submod_name), fromlist=[submod_name])
+ try:
+ submod = __import__(name="%s.%s" % (__package__, submod_name), fromlist=[submod_name])
+ except ImportError:
+ raise RigifyError("python module for type '%s' not found" % submod_name)
+
reload(submod)
return submod, getattr(submod, func_name)
@@ -61,6 +66,9 @@ def validate_rig(context, obj):
bone_type_list = []
for bone_type in bone_type_list:
+ if bone_type.split(".")[0] in SPECIAL_TYPES:
+ continue
+
submod, type_func = submodule_func_from_type(bone_type)
reload(submod)
submod.metarig_definition(obj, bone_name)
@@ -78,7 +86,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
reload(rigify_utils)
# Not needed but catches any errors before duplicating
- # validate_rig(context, obj_orig)
+ validate_rig(context, obj_orig)
global_undo = context.user_preferences.edit.global_undo
context.user_preferences.edit.global_undo = False
@@ -246,7 +254,7 @@ def generate_rig(context, obj_orig, prefix="ORG-", META_DEF=True):
root_ebone_tmp = root_ebone
ebone.connected = False
- ebone.parent = root_ebone
+ ebone.parent = root_ebone_tmp
bpy.ops.object.mode_set(mode='OBJECT')
diff --git a/release/scripts/modules/rigify/copy.py b/release/scripts/modules/rigify/copy.py
new file mode 100644
index 00000000000..2be5669e5a6
--- /dev/null
+++ b/release/scripts/modules/rigify/copy.py
@@ -0,0 +1,53 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+
+import bpy
+from rigify_utils import copy_bone_simple, get_side_name, bone_class_instance
+from rna_prop_ui import rna_idprop_ui_prop_get
+
+METARIG_NAMES = ("cpy",)
+
+def metarig_template():
+ pass
+
+def metarig_definition(obj, orig_bone_name):
+ return [orig_bone_name]
+
+
+def main(obj, bone_definition, base_names):
+ arm = obj.data
+ mt = bone_class_instance(obj, METARIG_NAMES)
+ mt.cpy = bone_definition[0]
+ mt.update()
+ cp = mt.copy(to_fmt="%s_cpy")
+ bpy.ops.object.mode_set(mode='OBJECT')
+
+ cp.update()
+ mt.update()
+
+ con = cp.cpy_p.constraints.new('COPY_ROTATION')
+ con.target = obj
+ con.subtarget = mt.cpy
+
+ con = cp.cpy_p.constraints.new('COPY_LOCATION')
+ con.target = obj
+ con.subtarget = mt.cpy
+
+ return [mt.cpy]
diff --git a/release/scripts/modules/rigify/delta.py b/release/scripts/modules/rigify/delta.py
index 4f1e56b7bb1..261e2b22479 100644
--- a/release/scripts/modules/rigify/delta.py
+++ b/release/scripts/modules/rigify/delta.py
@@ -79,7 +79,6 @@ def main(obj, bone_definition, base_names):
'''
Use this bone to define a delta thats applied to its child in pose mode.
'''
- return
mode_orig = obj.mode
bpy.ops.object.mode_set(mode='OBJECT')
diff --git a/release/scripts/modules/rigify/leg_biped_generic.py b/release/scripts/modules/rigify/leg_biped_generic.py
index af103a08265..65fde79da6e 100644
--- a/release/scripts/modules/rigify/leg_biped_generic.py
+++ b/release/scripts/modules/rigify/leg_biped_generic.py
@@ -146,8 +146,8 @@ def ik(obj, bone_definition, base_names):
# XXX - end dupe
- # Make a new chain, ORG are the original bones renamed.
- ik_chain = mt_chain.copy(to_fmt="MCH-%s")
+ # Make a new chain
+ ik_chain = mt_chain.copy(to_fmt="MCH-%s", base_names=base_names)
# simple rename
ik_chain.rename("thigh", ik_chain.thigh + "_ik")