auto_walk/__init__.py

109 lines
3.4 KiB
Python

bl_info = {
"name": "Unfold Anim Cycle",
"description": "Anim utility to develop walk/run cycles along a curve",
"author": "Samuel Bernou",
"version": (0, 2, 0),
"blender": (2, 92, 0),
"location": "View3D",
"warning": "WIP",
"doc_url": "https://gitlab.com/autour-de-minuit/blender/unfold_anim_cycle",
"category": "Object" }
# from . import other_file
import bpy
from . import OP_setup_curve_path
from . import OP_animate_path
from . import OP_expand_cycle_step
from . import OP_snap_contact
from . import panels
class UAC_PGT_settings(bpy.types.PropertyGroup) :
## HIDDEN to hide the animatable dot thing
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")
## As strings
# path_to_follow : bpy.props.StringProperty(
# name="Path to follow", description="Curve object used")
# gnd : bpy.props.StringProperty(
# name="Ground object", description="Choose the ground object to use")
expand_on_selected_bones : bpy.props.BoolProperty(
name="On selected", description="Expand on selected bones",
default=True, options={'HIDDEN'})
start_frame : bpy.props.IntProperty(
name="Start Frame", description="Starting frame for animation path",
default=100,
min=0, max=2**31-1, soft_min=0, soft_max=2**31-1, step=1, options={'HIDDEN'})#, subtype='PIXEL'
class UAC_addon_prefs(bpy.types.AddonPreferences):
## can be just __name__ if prefs are in the __init__ mainfile
# Else need the splitext '__name__ = addonname.subfile' (or use a static name)
bl_idname = __name__.split('.')[0] # or with: os.path.splitext(__name__)[0]
# some_bool_prop to display in the addon pref
debug : bpy.props.BoolProperty(
name='Debug',
description="Enable Debug prints",
default=False)
tgt_bone : bpy.props.StringProperty(
name="Constrained Pose bone name", default='root',
description="name of the bone that suppose to hold the constraint")
def draw(self, context):
layout = self.layout
## some 2.80 UI options
# layout.use_property_split = True
# flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False)
# layout = flow.column()
layout.label(text='Create')
layout.prop(self, "tgt_bone")
layout.prop(self, "debug")
### --- REGISTER ---
classes=(
UAC_PGT_settings,
UAC_addon_prefs,
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
OP_setup_curve_path.register()
OP_animate_path.register()
OP_expand_cycle_step.register()
OP_snap_contact.register()
panels.register()
# if not bpy.app.background:
#register_keymaps()
bpy.types.Scene.anim_cycle_settings = bpy.props.PointerProperty(type = UAC_PGT_settings)
def unregister():
# if not bpy.app.background:
#unregister_keymaps()
panels.unregister()
OP_snap_contact.unregister()
OP_expand_cycle_step.unregister()
OP_animate_path.unregister()
OP_setup_curve_path.unregister()
for cls in reversed(classes):
bpy.utils.unregister_class(cls)
del bpy.types.Scene.anim_cycle_settings
if __name__ == "__main__":
register()