wrap anim easier bone set

1.8.1

- added: bone propertie search and active bone picker
master
pullusb 2023-03-09 11:18:44 +01:00
parent f75d785370
commit 9a139a2025
4 changed files with 35 additions and 34 deletions

View File

@ -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.

View File

@ -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": "",

View File

@ -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"
@ -181,21 +194,18 @@ class AW_PT_wrap_animation_panel(bpy.types.Panel):
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,
)

View File

@ -77,20 +77,6 @@ class AW_PG_settings(bpy.types.PropertyGroup) :
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_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"
)
"""