auto_walk/__init__.py

117 lines
3.7 KiB
Python
Raw Normal View History

2021-04-05 01:35:12 +02:00
bl_info = {
2021-04-05 01:39:27 +02:00
"name": "Unfold Anim Cycle",
"description": "Anim utility to develop walk/run cycles along a curve",
2021-04-05 01:35:12 +02:00
"author": "Samuel Bernou",
"version": (0, 3, 2),
2021-04-05 01:35:12 +02:00
"blender": (2, 92, 0),
"location": "View3D",
2021-04-05 01:39:27 +02:00
"warning": "WIP",
"doc_url": "https://gitlab.com/autour-de-minuit/blender/unfold_anim_cycle",
2021-04-05 01:35:12 +02:00
"category": "Object" }
# from . import other_file
2021-04-08 19:25:05 +02:00
if 'bpy' in locals():
import importlib as imp
2021-04-08 19:25:05 +02:00
imp.reload(OP_setup_curve_path)
imp.reload(OP_animate_path)
imp.reload(OP_expand_cycle_step)
imp.reload(OP_snap_contact)
imp.reload(OP_world_copy_paste)
imp.reload(panels)
else:
from . import OP_setup_curve_path
from . import OP_animate_path
from . import OP_expand_cycle_step
from . import OP_snap_contact
from . import OP_world_copy_paste
from . import panels
2021-04-08 19:25:05 +02:00
import bpy
2021-04-05 01:39:27 +02:00
class UAC_PGT_settings(bpy.types.PropertyGroup) :
2021-04-05 01:35:12 +02:00
## 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")
2021-04-06 18:30:25 +02:00
expand_on_selected_bones : bpy.props.BoolProperty(
2021-04-05 01:35:12 +02:00
name="On selected", description="Expand on selected bones",
default=True, options={'HIDDEN'})
2021-04-08 19:25:05 +02:00
linear : bpy.props.BoolProperty(
name="Linear", description="keep the animation path linear (Else step the path usings cycle keys)",
default=False, options={'HIDDEN'})
2021-04-05 01:35:12 +02:00
2021-04-06 18:30:25 +02:00
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'
2021-04-05 01:35:12 +02:00
2021-04-05 01:39:27 +02:00
class UAC_addon_prefs(bpy.types.AddonPreferences):
2021-04-05 01:35:12 +02:00
## 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=(
2021-04-05 01:39:27 +02:00
UAC_PGT_settings,
UAC_addon_prefs,
2021-04-05 01:35:12 +02:00
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
OP_setup_curve_path.register()
OP_animate_path.register()
2021-04-06 18:30:25 +02:00
OP_expand_cycle_step.register()
OP_snap_contact.register()
2021-04-08 19:25:05 +02:00
OP_world_copy_paste.register()
2021-04-05 01:35:12 +02:00
panels.register()
# if not bpy.app.background:
#register_keymaps()
2021-04-05 01:39:27 +02:00
bpy.types.Scene.anim_cycle_settings = bpy.props.PointerProperty(type = UAC_PGT_settings)
2021-04-05 01:35:12 +02:00
def unregister():
# if not bpy.app.background:
#unregister_keymaps()
panels.unregister()
2021-04-08 19:25:05 +02:00
OP_world_copy_paste.unregister()
2021-04-06 18:30:25 +02:00
OP_snap_contact.unregister()
OP_expand_cycle_step.unregister()
2021-04-05 01:35:12 +02:00
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()