Post Retarget fixes - added an Update Constraints button, that recalculates all fixes...
authorBenjy Cook <benjycook@hotmail.com>
Fri, 5 Aug 2011 08:44:16 +0000 (08:44 +0000)
committerBenjy Cook <benjycook@hotmail.com>
Fri, 5 Aug 2011 08:44:16 +0000 (08:44 +0000)
release/scripts/modules/mocap_constraints.py
release/scripts/startup/ui_mocap.py

index 8fd42d173926801de05ef92dd260468eef15aff5..75afbe622312319387240805350243ecb921d5d8 100644 (file)
@@ -419,3 +419,10 @@ def unbakeConstraints(context):
             if ik_con:
                 ik_con.mute = False
         m_constraint.active = True
+
+
+def updateConstraints(obj, context):
+    fixes = obj.data.mocap_constraints
+    for fix in fixes:
+        fix.active = False
+        fix.active = True
index 03d173df7a6b1b54e6d7b94ca84f1fa4af2ff799..8ef4c1e7591ef20ae4ac70ad7dce73d52d2aab69 100644 (file)
@@ -264,9 +264,10 @@ class MocapConstraintsPanel(bpy.types.Panel):
                     enduser_obj = context.active_object
                     enduser_arm = enduser_obj.data
                     layout.operator_menu_enum("mocap.addmocapfix", "type")
+                    layout.operator("mocap.updateconstraints", text='Update Fixes')
                     bakeRow = layout.row()
-                    bakeRow.operator("mocap.bakeconstraints")
-                    bakeRow.operator("mocap.unbakeconstraints")
+                    bakeRow.operator("mocap.bakeconstraints", text='Bake Fixes')
+                    bakeRow.operator("mocap.unbakeconstraints", text='Unbake Fixes')
                     layout.separator()
                     for i, m_constraint in enumerate(enduser_arm.mocap_constraints):
                         box = layout.box()
@@ -588,6 +589,21 @@ class OBJECT_OT_UnbakeMocapConstraints(bpy.types.Operator):
             return isinstance(context.active_object.data, bpy.types.Armature)
 
 
+class OBJECT_OT_UpdateMocapConstraints(bpy.types.Operator):
+    '''Updates all post-retarget fixes - needed after changes to armature object or pose'''
+    bl_idname = "mocap.updateconstraints"
+    bl_label = "Updates all fixes to target armature - neccesary to take under consideration changes to armature object or pose"
+
+    def execute(self, context):
+        updateConstraints(context.active_object, context)
+        return {"FINISHED"}
+
+    @classmethod
+    def poll(cls, context):
+        if context.active_object:
+            return isinstance(context.active_object.data, bpy.types.Armature)
+
+
 class OBJECT_OT_GuessHierachyMapping(bpy.types.Operator):
     '''Attemps to auto figure out hierarchy mapping'''
     bl_idname = "mocap.guessmapping"
@@ -623,7 +639,7 @@ class OBJECT_OT_PathEditing(bpy.types.Operator):
     @classmethod
     def poll(cls, context):
         if context.active_object:
-            selected_objs = [obj for obj in context.selected_objects if obj != context.active_object]
+            selected_objs = [obj for obj in context.selected_objects if obj != context.active_object and isinstance(obj.data, bpy.types.Curve)]
             return selected_objs
         else:
             return False