bl_info = { "name": "Unfold Anim Cycle", "description": "Anim utility to develop walk/run cycles along a curve", "author": "Samuel Bernou", "version": (0, 1, 1), "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 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_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 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") # 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=( 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() 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_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()