diff --git a/CHANGELOG.md b/CHANGELOG.md index b3c6492..a56f561 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +1.8.1 + +- added: bone propertie search and active bone picker + 1.8.0 - added: `wrap animation` tool. On selected pose bones on each location keyframe, apply offset from a reference bone to a root bone. diff --git a/__init__.py b/__init__.py index 2b40e90..17034bd 100644 --- a/__init__.py +++ b/__init__.py @@ -4,7 +4,7 @@ bl_info = { "name": "Auto Walk", "description": "Develop a walk/run cycles along a curve and pin feets", "author": "Samuel Bernou", - "version": (1, 8, 0), + "version": (1, 8, 1), "blender": (3, 0, 0), "location": "View3D", "warning": "", diff --git a/panels.py b/panels.py index 8ef7c68..e03e1b2 100644 --- a/panels.py +++ b/panels.py @@ -160,11 +160,24 @@ class AW_MT_wrap_animation_help(bpy.types.Menu): col.label(text='Root is the bone to return to. Often root/walk/world bone') col.label(text='In most cases, Ref bone will be the bottom spine bone') col.label(text='Applying with spine selected will align spine with root on X-Y axis') + # col.separator() + # col.label(text='Note: If resulted animation is broken', icon='ERROR') + # col.label(text='try applying with only one selected bone at a time') - col.separator() - col.label(text='Note: If resulted animation is broken', icon='ERROR') - col.label(text='try applying with only one selected bone at a time') +class AW_OT_bone_eye_dropper(bpy.types.Operator): + bl_idname = "auto_walk.bone_eye_dropper" + bl_label = "Bone Eye Dropper" + bl_description = "Fill the field with active pose bone" + bl_options = {'INTERNAL'} + field : bpy.props.StringProperty() + prop : bpy.props.StringProperty() + + def execute(self, context): + prop = self.prop + field = eval(self.field) + setattr(field, prop, context.active_pose_bone.name) + return {'FINISHED'} class AW_PT_wrap_animation_panel(bpy.types.Panel): bl_space_type = "VIEW_3D" @@ -180,22 +193,19 @@ class AW_PT_wrap_animation_panel(bpy.types.Panel): if not context.object or context.object.type != 'ARMATURE': col.label(text='Active object must be of Armature type') return - - settings = context.scene.anim_cycle_settings - - ## As pose bone search picker - # col.prop_search(context.object, "pose_bone", context.object.pose, "bones") - # col.prop_search(settings, "wrap_root_bone", context.object.pose, "bones") - # col.prop_search(settings, "wrap_ref_bone", context.object.pose, "bones") - - ## As strings - # col.label(text='offset selection from reference bone to Root') + row = col.row() - row.label(text='Enter bones names') + row.label(text='Offset Reference to Root') row.operator("wm.call_menu", text="", icon='QUESTION').name = "AW_MT_wrap_animation_help" - col.prop(settings, "wrap_root_bone", text='Root') - col.prop(settings, "wrap_ref_bone", text='Ref') + settings = context.scene.anim_cycle_settings + for prop_name in ("wrap_root_bone", "wrap_ref_bone"): + row = col.row() + row.prop_search(settings, prop_name, context.object.pose, "bones") + eyedrop = row.operator('auto_walk.bone_eye_dropper', text='', icon='EYEDROPPER') + eyedrop.field = repr(settings) + eyedrop.prop = prop_name + col.operator('autowalk.wrap_animation', text='Wrap Animation') # , icon='' class AW_PT_anim_tools_panel(bpy.types.Panel): @@ -252,6 +262,7 @@ AW_PT_walk_cycle_anim_panel, AW_PT_anim_tools_panel, AW_PT_nla_tools_panel, AW_MT_wrap_animation_help, +AW_OT_bone_eye_dropper, AW_PT_wrap_animation_panel, ) diff --git a/properties.py b/properties.py index f2c772f..33c3a0a 100644 --- a/properties.py +++ b/properties.py @@ -76,21 +76,7 @@ class AW_PG_settings(bpy.types.PropertyGroup) : pin_rot_z : bpy.props.BoolProperty( name="Pin Rot Z", description="Pin bones rotation Z", default=True, options={'HIDDEN'}) - ## Wrap properties - - # wrap_ref_bone : bpy.props.PointerProperty( - # name="Reference Bone", - # type=bpy.types.PoseBone, - # description="Reference bone to replace aligned with root bone" - # ) - - # wrap_root_bone : bpy.props.PointerProperty( - # name="Root Bone", - # type=bpy.types.PoseBone, - # description="Root bone, on each keyframe\ - # \nthe offset between ref bon eand root bone will be applied to selected pose bones" - # ) - + ## Wrap properties wrap_ref_bone : bpy.props.StringProperty( name="Reference Bone", description="Reference bone to calculate offset towards Root bone" @@ -98,9 +84,9 @@ class AW_PG_settings(bpy.types.PropertyGroup) : wrap_root_bone : bpy.props.StringProperty( name="Root Bone", - default="world", # should be root or walk + # default="root", # should be root or walk description="Root bone, on each keyframe\ - \nthe offset between ref bon eand root bone will be applied to selected pose bones" + \nthe offset between ref bon and root bone will be applied to selected pose bones" ) """