diff options
author | Benjy Cook <benjycook@hotmail.com> | 2011-08-13 15:09:42 +0400 |
---|---|---|
committer | Benjy Cook <benjycook@hotmail.com> | 2011-08-13 15:09:42 +0400 |
commit | aaeb498c26bf1241ab6f0b50976afdecd7636288 (patch) | |
tree | 02d099dab01191774e9a699d4d8aaa1b2a9d1251 /release | |
parent | c5ef9b62c1f7f407c42bb48fe3362fa6cf3cf101 (diff) |
Added a small operator to ease mapping. When used, the hierarchy mapping field is filled with the currently selected (pose) bone.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/ui_mocap.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/release/scripts/startup/ui_mocap.py b/release/scripts/startup/ui_mocap.py index 82f76d66d1b..0820b6183f4 100644 --- a/release/scripts/startup/ui_mocap.py +++ b/release/scripts/startup/ui_mocap.py @@ -283,6 +283,7 @@ class MocapPanel(bpy.types.Panel): row.prop(data=bone, property='foot', text='', icon='POSE_DATA') row.label(bone.name) row.prop_search(bone, "map", enduser_arm, "bones") + row.operator("mocap.selectmap", text='', icon='CURSOR').perf_bone = bone.name label_mod = "FK" if bone.map: pose_bone = perf_pose_bones[bone.map] @@ -493,6 +494,37 @@ class OBJECT_OT_LoadMappingButton(bpy.types.Operator): return activeIsArmature and isinstance(performer_obj[0].data, bpy.types.Armature) else: return False + + +class OBJECT_OT_SelectMapBoneButton(bpy.types.Operator): + '''Select a bone for faster mapping''' + bl_idname = "mocap.selectmap" + bl_label = "Select a bone for faster mapping" + perf_bone = bpy.props.StringProperty() + + def execute(self, context): + enduser_obj = bpy.context.active_object + performer_obj = [obj for obj in bpy.context.selected_objects if obj != enduser_obj][0] + selectedBone = "" + for bone in enduser_obj.data.bones: + boneVis = bone.layers + for i in range(32): + if boneVis[i] and enduser_obj.data.layers[i]: + if bone.select: + selectedBone = bone.name + break + performer_obj.data.bones[self.perf_bone].map = selectedBone + return {"FINISHED"} + + @classmethod + def poll(cls, context): + if context.active_object: + activeIsArmature = isinstance(context.active_object.data, bpy.types.Armature) + performer_obj = [obj for obj in context.selected_objects if obj != context.active_object] + if performer_obj: + return activeIsArmature and isinstance(performer_obj[0].data, bpy.types.Armature) + else: + return False class OBJECT_OT_ConvertSamplesButton(bpy.types.Operator): |