140 lines
4.2 KiB
Python
140 lines
4.2 KiB
Python
bl_info = {
|
|
"name": "Walk cycle anim",
|
|
"description": "Walk cycle utility",
|
|
"author": "Samuel Bernou",
|
|
"version": (0, 1, 0),
|
|
"blender": (2, 92, 0),
|
|
"location": "View3D",
|
|
"warning": "",
|
|
"doc_url": "https://github.com/Pullusb/PROJ_name",
|
|
"category": "Object" }
|
|
|
|
# from . import other_file
|
|
|
|
import bpy
|
|
|
|
from . import OP_setup_curve_path
|
|
from . import OP_animate_path
|
|
from . import panels
|
|
|
|
class WCA_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_boned : bpy.props.BoolProperty(
|
|
name="On selected", description="Expand on selected bones",
|
|
default=True, options={'HIDDEN'})
|
|
|
|
# IntProperty : bpy.props.IntProperty(
|
|
# name="int prop", description="", default=25, min=1, max=2**31-1, soft_min=1, soft_max=2**31-1, step=1, options={'HIDDEN'})#, subtype='PIXEL'
|
|
|
|
|
|
class WCA_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")
|
|
|
|
# display the bool prop
|
|
layout.prop(self, "debug")
|
|
|
|
# draw something only if a prop evaluate True
|
|
# if self.super_special_option:
|
|
# layout.label(text="/!\ Carefull, the super special option is especially powerfull")
|
|
# layout.label(text=" and with great power... well you know !")
|
|
|
|
|
|
|
|
'''
|
|
addon_keymaps = []
|
|
def register_keymaps():
|
|
addon = bpy.context.window_manager.keyconfigs.addon
|
|
km = addon.keymaps.new(name = "3D View", space_type = "VIEW_3D")
|
|
# km = addon.keymaps.new(name = "Grease Pencil", space_type = "EMPTY", region_type='WINDOW')
|
|
|
|
# kmi = km.keymap_items.new(
|
|
# name="name",
|
|
# idname="anim.snap_curve_to_ground",
|
|
# type="F",
|
|
# value="PRESS",
|
|
# shift=True,
|
|
# ctrl=True,
|
|
# alt = False,
|
|
# oskey=False
|
|
# )
|
|
|
|
kmi = km.keymap_items.new('anim.snap_curve_to_ground', type='F5', value='PRESS')
|
|
|
|
|
|
addon_keymaps.append((km, kmi))
|
|
|
|
def unregister_keymaps():
|
|
for km, kmi in addon_keymaps:
|
|
km.keymap_items.remove(kmi)
|
|
addon_keymaps.clear()
|
|
'''
|
|
|
|
### --- REGISTER ---
|
|
|
|
classes=(
|
|
WCA_PGT_settings,
|
|
WCA_addon_prefs,
|
|
)
|
|
|
|
def register():
|
|
for cls in classes:
|
|
bpy.utils.register_class(cls)
|
|
OP_setup_curve_path.register()
|
|
OP_animate_path.register()
|
|
panels.register()
|
|
|
|
# if not bpy.app.background:
|
|
#register_keymaps()
|
|
bpy.types.Scene.anim_cycle_settings = bpy.props.PointerProperty(type = WCA_PGT_settings)
|
|
|
|
def unregister():
|
|
# if not bpy.app.background:
|
|
#unregister_keymaps()
|
|
panels.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()
|