auto_walk/properties.py

113 lines
4.5 KiB
Python
Raw Normal View History

2022-03-29 18:46:33 +02:00
import bpy
from bpy.props import (
IntProperty,
BoolProperty,
StringProperty,
FloatProperty,
EnumProperty,
)
class AW_PG_settings(bpy.types.PropertyGroup) :
2022-03-29 18:46:33 +02:00
## HIDDEN to hide the animatable dot thing
tweak : bpy.props.BoolProperty(
name="Tweak", description="Show Tweaking options",
default=False, options={'HIDDEN'})
tgt_bone : bpy.props.StringProperty(
name="Bone to constrain", default='',
description="Name of the bone to constrain with follow path (usually the root bone)")
2022-03-29 18:46:33 +02:00
path_to_follow : bpy.props.PointerProperty(type=bpy.types.Object,
name="Path", description="Curve object used")
gnd : bpy.props.PointerProperty(type=bpy.types.Object,
name="Ground", description="Choose the ground object to use")
expand_on_selected_bones : bpy.props.BoolProperty(
name="On selected", description="Expand on selected bones",
2022-03-30 17:40:52 +02:00
default=False, options={'HIDDEN'})
2022-03-29 18:46:33 +02:00
linear : bpy.props.BoolProperty(
2022-03-30 17:40:52 +02:00
name="Linear", description="keep the animation path linear\
\nElse step the path usings follow path cycle keys)",
default=True, options={'HIDDEN'})
2022-03-29 18:46:33 +02:00
start_frame : bpy.props.IntProperty(
name="Start Frame", description="Starting frame for animation path",
default=100,
2022-03-29 18:46:33 +02:00
min=0, max=2**31-1, soft_min=0, soft_max=2**31-1, step=1, options={'HIDDEN'})#, subtype='PIXEL'
end_frame : bpy.props.IntProperty(
name="End Frame", description="End frame, to calculate when character should reach the end of the path",
default=101,
min=0, max=2**31-1, soft_min=0, soft_max=2**31-1, step=1, options={'HIDDEN'})#, subtype='PIXEL'
2022-03-29 18:46:33 +02:00
forward_axis : bpy.props.EnumProperty(
name='Forward Axis',
default='FORWARD_Z', # Modifier default is FORWARD_X (should be TRACK_NEGATIVE_Y for a good rig)
description='Local axis of the "root" bone that point forward in rest pose',
2022-03-29 18:46:33 +02:00
items=(
('FORWARD_X', 'X', ''),
('FORWARD_Y', 'Y', ''),
('FORWARD_Z', 'Z', ''),
('TRACK_NEGATIVE_X', '-X', ''),
('TRACK_NEGATIVE_Y', '-Y', ''),
('TRACK_NEGATIVE_Z', '-Z', ''),
),
)
custom_pin : bpy.props.BoolProperty(
name="Custom Pinning", description="Pin only specific axis\
\nElse pin all location and rotation",
default=False, options={'HIDDEN'})
pin_loc_x : bpy.props.BoolProperty(
name="Pin Loc X", description="Pin bones location X", default=True, options={'HIDDEN'})
pin_loc_y : bpy.props.BoolProperty(
name="Pin Loc Y", description="Pin bones location Y", default=True, options={'HIDDEN'})
pin_loc_z : bpy.props.BoolProperty(
name="Pin Loc Z", description="Pin bones location Z", default=True, options={'HIDDEN'})
pin_rot_x : bpy.props.BoolProperty(
name="Pin Rot X", description="Pin bones rotation X", default=True, options={'HIDDEN'})
pin_rot_y : bpy.props.BoolProperty(
name="Pin Rot Y", description="Pin bones rotation Y", default=True, options={'HIDDEN'})
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.StringProperty(
name="Reference Bone",
description="Reference bone to calculate offset towards Root bone"
)
wrap_root_bone : bpy.props.StringProperty(
name="Root Bone",
# default="root", # should be root or walk
description="Root bone, on each keyframe\
\nthe offset between ref bon and root bone will be applied to selected pose bones"
)
2022-03-29 18:46:33 +02:00
"""
## foot axis not needed (not always aligned with character direction)
foot_axis : EnumProperty(
name="Foot Axis", description="Foot forward axis",
default='Y', options={'HIDDEN', 'SKIP_SAVE'},
items=(
('X', 'X', '', 0),
('Y', 'Y', '', '', 1),
('Z', 'Z', '', '', 2),
# ('-X', '-X', '', 3),
# ('-Y', '-Y', '', '', 4),
# ('-Z', '-Z', '', '', 5),
))
"""
def register():
bpy.utils.register_class(AW_PG_settings)
bpy.types.Scene.anim_cycle_settings = bpy.props.PointerProperty(type = AW_PG_settings)
2022-03-29 18:46:33 +02:00
def unregister():
bpy.utils.unregister_class(AW_PG_settings)
2022-03-29 18:46:33 +02:00
del bpy.types.Scene.anim_cycle_settings