[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25300] trunk/blender/release/scripts/ modules/rigify: * root bone override fixed
Campbell Barton
ideasman42 at gmail.com
Fri Dec 11 00:24:31 CET 2009
Revision: 25300
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25300
Author: campbellbarton
Date: 2009-12-11 00:24:31 +0100 (Fri, 11 Dec 2009)
Log Message:
-----------
* root bone override fixed
* delta was disabled
* simple copy metarig type
* proper exception when a type isnt found
Modified Paths:
--------------
trunk/blender/release/scripts/modules/rigify/__init__.py
trunk/blender/release/scripts/modules/rigify/delta.py
trunk/blender/release/scripts/modules/rigify/leg_biped_generic.py
Added Paths:
-----------
trunk/blender/release/scripts/modules/rigify/copy.py
Modified: trunk/blender/release/scripts/modules/rigify/__init__.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/__init__.py 2009-12-10 23:24:29 UTC (rev 25299)
+++ trunk/blender/release/scripts/modules/rigify/__init__.py 2009-12-10 23:24:31 UTC (rev 25300)
@@ -23,6 +23,7 @@
# 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 @@
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 @@
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 @@
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 @@
root_ebone_tmp = root_ebone
ebone.connected = False
- ebone.parent = root_ebone
+ ebone.parent = root_ebone_tmp
bpy.ops.object.mode_set(mode='OBJECT')
Added: trunk/blender/release/scripts/modules/rigify/copy.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/copy.py (rev 0)
+++ trunk/blender/release/scripts/modules/rigify/copy.py 2009-12-10 23:24:31 UTC (rev 25300)
@@ -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]
Property changes on: trunk/blender/release/scripts/modules/rigify/copy.py
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/blender/release/scripts/modules/rigify/delta.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/delta.py 2009-12-10 23:24:29 UTC (rev 25299)
+++ trunk/blender/release/scripts/modules/rigify/delta.py 2009-12-10 23:24:31 UTC (rev 25300)
@@ -79,7 +79,6 @@
'''
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')
Modified: trunk/blender/release/scripts/modules/rigify/leg_biped_generic.py
===================================================================
--- trunk/blender/release/scripts/modules/rigify/leg_biped_generic.py 2009-12-10 23:24:29 UTC (rev 25299)
+++ trunk/blender/release/scripts/modules/rigify/leg_biped_generic.py 2009-12-10 23:24:31 UTC (rev 25300)
@@ -146,8 +146,8 @@
# 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")
More information about the Bf-blender-cvs
mailing list