diff options
Diffstat (limited to 'pie_menus_official')
-rw-r--r-- | pie_menus_official/__init__.py | 41 | ||||
-rw-r--r-- | pie_menus_official/pie_clip_marker_of.py | 34 | ||||
-rw-r--r-- | pie_menus_official/pie_manipulator_of.py | 12 | ||||
-rw-r--r-- | pie_menus_official/pie_object_modes_of.py | 22 | ||||
-rw-r--r-- | pie_menus_official/pie_pivot_of.py | 12 | ||||
-rw-r--r-- | pie_menus_official/pie_shade_of.py | 12 | ||||
-rw-r--r-- | pie_menus_official/pie_snap_of.py | 13 | ||||
-rw-r--r-- | pie_menus_official/pie_view_of.py | 14 |
8 files changed, 76 insertions, 84 deletions
diff --git a/pie_menus_official/__init__.py b/pie_menus_official/__init__.py index d65e3ba5..3bf000ec 100644 --- a/pie_menus_official/__init__.py +++ b/pie_menus_official/__init__.py @@ -30,7 +30,7 @@ from bpy.types import ( bl_info = { 'name': 'UI Pie Menu Official', 'author': 'Antony Riakiotakis, Sebastian Koenig', - 'version': (1, 1, 3), + 'version': (1, 1, 4), 'blender': (2, 7, 7), 'description': 'Individual Pie Menu Activation List', 'location': 'Addons Preferences', @@ -86,11 +86,8 @@ def get_addon_preferences(name=''): def register_submodule(mod): - if not hasattr(mod, '__addon_enabled__'): - mod.__addon_enabled__ = False - if not mod.__addon_enabled__: - mod.register() - mod.__addon_enabled__ = True + mod.register() + mod.__addon_enabled__ = True def unregister_submodule(mod): @@ -197,19 +194,21 @@ for mod in sub_modules: def gen_update(mod): def update(self, context): - if getattr(self, 'use_' + mod.__name__.split('.')[-1]): - if not mod.__addon_enabled__: - register_submodule(mod) + enabled = getattr(self, 'use_' + mod.__name__.split('.')[-1]) + if enabled: + register_submodule(mod) else: - if mod.__addon_enabled__: - unregister_submodule(mod) + unregister_submodule(mod) + mod.__addon_enabled__ = enabled return update prop = BoolProperty( name=info['name'], description=info.get('description', ''), update=gen_update(mod), + default=True, ) + setattr(UIToolsPreferences, 'use_' + mod_name, prop) prop = BoolProperty() setattr(UIToolsPreferences, 'show_expanded_' + mod_name, prop) @@ -218,18 +217,22 @@ classes = ( UIToolsPreferences, ) +def register_modules(dummy): + if dummy: + prefs = get_addon_preferences() + for mod in sub_modules: + name = mod.__name__.split('.')[-1] + if getattr(prefs, 'use_' + name, False): + register_submodule(mod) + else: + mod.__addon_enabled__ = False + return None def register(): for cls in classes: bpy.utils.register_class(cls) - prefs = get_addon_preferences() - for mod in sub_modules: - if not hasattr(mod, '__addon_enabled__'): - mod.__addon_enabled__ = False - name = mod.__name__.split('.')[-1] - if getattr(prefs, 'use_' + name): - register_submodule(mod) + register_modules(True) def unregister(): @@ -242,5 +245,3 @@ def unregister(): if __name__ == "__main__": register() - - diff --git a/pie_menus_official/pie_clip_marker_of.py b/pie_menus_official/pie_clip_marker_of.py index 1c303f29..924adc3d 100644 --- a/pie_menus_official/pie_clip_marker_of.py +++ b/pie_menus_official/pie_clip_marker_of.py @@ -22,7 +22,7 @@ bl_info = { "name": "Clip Editor Pies: Key: 'hotkey list Below'", "description": "Clip Editor Pies", # "author": "Antony Riakiotakis, Sebastian Koenig", - "version": (0, 1, 0), +# "version": (0, 1, 0), "blender": (2, 77, 0), "location": "Q, W, Shift W, E. Shift S, Shift A", "warning": "", @@ -259,32 +259,42 @@ classes = ( def register(): + addon_keymaps.clear() for cls in classes: bpy.utils.register_class(cls) wm = bpy.context.window_manager if wm.keyconfigs.addon: - km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal') - + #km = wm.keyconfigs.addon.keymaps.new(name='Object Non-modal') # WHY + km = wm.keyconfigs.addon.keymaps.new(name="Clip", space_type='CLIP_EDITOR') + kmi = km.keymap_items.new("wm.call_menu_pie", 'Q', 'PRESS') kmi.properties.name = "CLIP_PIE_marker_pie" + addon_keymaps.append((km, kmi)) + kmi = km.keymap_items.new("wm.call_menu_pie", 'W', 'PRESS') kmi.properties.name = "CLIP_PIE_clipsetup_pie" + addon_keymaps.append((km, kmi)) + kmi = km.keymap_items.new("wm.call_menu_pie", 'E', 'PRESS') kmi.properties.name = "CLIP_PIE_tracking_pie" + addon_keymaps.append((km, kmi)) + kmi = km.keymap_items.new("wm.call_menu_pie", 'S', 'PRESS', shift=True) kmi.properties.name = "CLIP_PIE_solver_pie" + addon_keymaps.append((km, kmi)) + kmi = km.keymap_items.new("wm.call_menu_pie", 'W', 'PRESS', shift=True) kmi.properties.name = "CLIP_PIE_reconstruction_pie" - addon_keymaps.append(km) + addon_keymaps.append((km, kmi)) km = wm.keyconfigs.addon.keymaps.new(name="Frames") + kmi = km.keymap_items.new("wm.call_menu_pie", 'A', 'PRESS', shift=True) kmi.properties.name = "CLIP_PIE_timecontrol_pie" - - addon_keymaps.append(km) + addon_keymaps.append((km, kmi)) def unregister(): @@ -293,14 +303,12 @@ def unregister(): wm = bpy.context.window_manager - if wm.keyconfigs.addon: - for km in addon_keymaps: - for kmi in km.keymap_items: - km.keymap_items.remove(kmi) - - wm.keyconfigs.addon.keymaps.remove(km) - + kc = wm.keyconfigs.addon + if kc: + for km, kmi in addon_keymaps: + km.keymap_items.remove(kmi) addon_keymaps.clear() + if __name__ == "__main__": register() diff --git a/pie_menus_official/pie_manipulator_of.py b/pie_menus_official/pie_manipulator_of.py index 43f65d65..46479b83 100644 --- a/pie_menus_official/pie_manipulator_of.py +++ b/pie_menus_official/pie_manipulator_of.py @@ -2,8 +2,8 @@ bl_info = { "name": "Manipulator Menu: Key: 'Ctrl Space'", "description": "Manipulator Modes", - "author": "Antony Riakiotakis, Sebastian Koenig", - "version": (0, 1, 0), +# "author": "Antony Riakiotakis, Sebastian Koenig", +# "version": (0, 1, 0), "blender": (2, 77, 0), "location": "Ctrl Space", "warning": "", @@ -80,11 +80,9 @@ def unregister(): kc = wm.keyconfigs.addon if kc: - km = kc.keymaps['Object Non-modal'] - for kmi in km.keymap_items: - if kmi.idname == 'wm.call_menu_pie': - if kmi.properties.name == "view3d.manipulator_of": - km.keymap_items.remove(kmi) + for km, kmi in addon_keymaps: + km.keymap_items.remove(kmi) + addon_keymaps.clear() if __name__ == "__main__": register() diff --git a/pie_menus_official/pie_object_modes_of.py b/pie_menus_official/pie_object_modes_of.py index 536bb7d0..87c14ef2 100644 --- a/pie_menus_official/pie_object_modes_of.py +++ b/pie_menus_official/pie_object_modes_of.py @@ -2,8 +2,8 @@ bl_info = { "name": "Mode Set: Key: 'Tab'", "description": "Object Modes", - "author": "Antony Riakiotakis, Sebastian Koenig", - "version": (0, 1, 0), +# "author": "Antony Riakiotakis, Sebastian Koenig", +# "version": (0, 1, 0), "blender": (2, 77, 0), "location": "Tab key", "warning": "", @@ -35,6 +35,7 @@ classes = [ addon_keymaps = [] def register(): + addon_keymaps.clear() for cls in classes: bpy.utils.register_class(cls) wm = bpy.context.window_manager @@ -46,7 +47,6 @@ def register(): kmi.properties.name = "pie.object_mode_of" addon_keymaps.append((km, kmi)) - if wm.keyconfigs.addon: # Grease Pencil Edit Modes km = wm.keyconfigs.addon.keymaps.new(name='Grease Pencil Stroke Edit Mode') kmi = km.keymap_items.new('wm.call_menu_pie', 'TAB', 'PRESS') @@ -55,25 +55,17 @@ def register(): def unregister(): + addon_keymaps.clear() for cls in classes: bpy.utils.unregister_class(cls) wm = bpy.context.window_manager kc = wm.keyconfigs.addon if kc: - km = kc.keymaps['Object Non-modal'] - for kmi in km.keymap_items: - if kmi.idname == 'wm.call_menu_pie': - if kmi.properties.name == "pie.object_mode_of": - km.keymap_items.remove(kmi) + for km, kmi in addon_keymaps: + km.keymap_items.remove(kmi) + addon_keymaps.clear() - kc = wm.keyconfigs.addon - if kc: - km = kc.keymaps['Grease Pencil Stroke Edit Mode'] - for kmi in km.keymap_items: - if kmi.idname == 'wm.call_menu_pie': - if kmi.properties.name == "pie.object_mode_of": - km.keymap_items.remove(kmi) if __name__ == "__main__": register() diff --git a/pie_menus_official/pie_pivot_of.py b/pie_menus_official/pie_pivot_of.py index d1cb2acc..43d6c860 100644 --- a/pie_menus_official/pie_pivot_of.py +++ b/pie_menus_official/pie_pivot_of.py @@ -2,8 +2,8 @@ bl_info = { "name": "Pivot Menu: Key: '. key'", "description": "Manipulator Modes", - "author": "Antony Riakiotakis, Sebastian Koenig", - "version": (0, 1, 0), +# "author": "Antony Riakiotakis, Sebastian Koenig", +# "version": (0, 1, 0), "blender": (2, 77, 0), "location": ". key", "warning": "", @@ -55,11 +55,9 @@ def unregister(): kc = wm.keyconfigs.addon if kc: - km = kc.keymaps['Object Non-modal'] - for kmi in km.keymap_items: - if kmi.idname == 'wm.call_menu_pie': - if kmi.properties.name == "view3d.pivot_of": - km.keymap_items.remove(kmi) + for km, kmi in addon_keymaps: + km.keymap_items.remove(kmi) + addon_keymaps.clear() if __name__ == "__main__": register() diff --git a/pie_menus_official/pie_shade_of.py b/pie_menus_official/pie_shade_of.py index 5ef189e6..ec60419b 100644 --- a/pie_menus_official/pie_shade_of.py +++ b/pie_menus_official/pie_shade_of.py @@ -2,8 +2,8 @@ bl_info = { "name": "Shade Menu: Key: 'Z key'", "description": "View Modes", - "author": "Antony Riakiotakis, Sebastian Koenig", - "version": (0, 1, 0), +# "author": "Antony Riakiotakis, Sebastian Koenig", +# "version": (0, 1, 0), "blender": (2, 77, 0), "location": "Z key", "warning": "", @@ -61,11 +61,9 @@ def unregister(): kc = wm.keyconfigs.addon if kc: - km = kc.keymaps['Object Non-modal'] - for kmi in km.keymap_items: - if kmi.idname == 'wm.call_menu_pie': - if kmi.properties.name == "pie.shade_of": - km.keymap_items.remove(kmi) + for km, kmi in addon_keymaps: + km.keymap_items.remove(kmi) + addon_keymaps.clear() if __name__ == "__main__": register() diff --git a/pie_menus_official/pie_snap_of.py b/pie_menus_official/pie_snap_of.py index ed427456..d262dfd9 100644 --- a/pie_menus_official/pie_snap_of.py +++ b/pie_menus_official/pie_snap_of.py @@ -2,8 +2,8 @@ bl_info = { "name": "Snap Menu: Key: 'Ctrl Shift Tab'", "description": "Snap Modes", - "author": "Antony Riakiotakis, Sebastian Koenig", - "version": (0, 1, 0), +# "author": "Antony Riakiotakis, Sebastian Koenig", +# "version": (0, 1, 0), "blender": (2, 77, 0), "location": "Ctrl Shift Tab", "warning": "", @@ -37,6 +37,7 @@ classes = [ addon_keymaps = [] def register(): + addon_keymaps.clear() for cls in classes: bpy.utils.register_class(cls) wm = bpy.context.window_manager @@ -55,11 +56,9 @@ def unregister(): kc = wm.keyconfigs.addon if kc: - km = kc.keymaps['Object Non-modal'] - for kmi in km.keymap_items: - if kmi.idname == 'wm.call_menu_pie': - if kmi.properties.name == "view3d.snap_of": - km.keymap_items.remove(kmi) + for km, kmi in addon_keymaps: + km.keymap_items.remove(kmi) + addon_keymaps.clear() if __name__ == "__main__": register() diff --git a/pie_menus_official/pie_view_of.py b/pie_menus_official/pie_view_of.py index 1dad87b2..f09376eb 100644 --- a/pie_menus_official/pie_view_of.py +++ b/pie_menus_official/pie_view_of.py @@ -1,9 +1,8 @@ - bl_info = { "name": "View Menu: Key: 'Q key'", "description": "View Modes", - "author": "Antony Riakiotakis, Sebastian Koenig", - "version": (0, 1, 0), +# "author": "Antony Riakiotakis, Sebastian Koenig", +# "version": (0, 1, 0), "blender": (2, 77, 0), "location": "Q key", "warning": "", @@ -53,6 +52,7 @@ classes = [ addon_keymaps = [] def register(): + addon_keymaps.clear() for cls in classes: bpy.utils.register_class(cls) wm = bpy.context.window_manager @@ -71,11 +71,9 @@ def unregister(): kc = wm.keyconfigs.addon if kc: - km = kc.keymaps['Object Non-modal'] - for kmi in km.keymap_items: - if kmi.idname == 'wm.call_menu_pie': - if kmi.properties.name == "pie.view_of": - km.keymap_items.remove(kmi) + for km, kmi in addon_keymaps: + km.keymap_items.remove(kmi) + addon_keymaps.clear() if __name__ == "__main__": register() |