From 8c49c1efcb697c070e2ff431df2515223edf7975 Mon Sep 17 00:00:00 2001 From: Pullusb Date: Tue, 22 Feb 2022 11:29:31 +0100 Subject: [PATCH] fix icon issue and cleaned init-register 1.9.6 - fix: icon removed in 3.0 --- CHANGELOG.md | 4 ++ OP_brushes.py | 2 +- OP_flat_reproject.py | 4 +- OP_realign.py | 4 +- __init__.py | 113 +++++++++++++++++-------------------------- 5 files changed, 54 insertions(+), 73 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdc4237..4e9c7a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +1.9.6 + +- fix: icon removed in 3.0 + 1.9.5 - added: `Check file` also check if GP modifiers have broken layer target diff --git a/OP_brushes.py b/OP_brushes.py index 1bfc6b7..82b2d3e 100644 --- a/OP_brushes.py +++ b/OP_brushes.py @@ -53,7 +53,7 @@ class GPTB_OT_load_brushes(bpy.types.Operator, ImportHelper): def load_brush_ui(self, context): prefs = get_addon_prefs() if context.mode == 'PAINT_GPENCIL': - self.layout.operator('gp.load_brushes', icon='SMALL_TRI_RIGHT_VEC').filepath = prefs.brush_path # KEYTYPE_JITTER_VEC + self.layout.operator('gp.load_brushes', icon='KEYTYPE_JITTER_VEC').filepath = prefs.brush_path def load_brush_top_bar_ui(self, context): prefs = get_addon_prefs() diff --git a/OP_flat_reproject.py b/OP_flat_reproject.py index 55ec1ce..c8eb260 100644 --- a/OP_flat_reproject.py +++ b/OP_flat_reproject.py @@ -134,12 +134,12 @@ class GPTB_OT_batch_flat_reproject(bpy.types.Operator): def flat_reproject_clean_menu(self, context): if context.mode == 'EDIT_GPENCIL': self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup (also works with 'INVOKE_DEFAULT') - self.layout.operator('gp.batch_flat_reproject', icon='SMALL_TRI_RIGHT_VEC') # KEYTYPE_JITTER_VEC + self.layout.operator('gp.batch_flat_reproject', icon='KEYTYPE_JITTER_VEC') def flat_reproject_context_menu(self, context): if context.mode == 'EDIT_GPENCIL' and context.scene.tool_settings.gpencil_selectmode_edit == 'STROKE': self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup - self.layout.operator('gp.batch_flat_reproject', icon='SMALL_TRI_RIGHT_VEC') # KEYTYPE_JITTER_VEC + self.layout.operator('gp.batch_flat_reproject', icon='KEYTYPE_JITTER_VEC') classes = ( GPTB_OT_batch_flat_reproject, diff --git a/OP_realign.py b/OP_realign.py index 460ee18..2c6a273 100644 --- a/OP_realign.py +++ b/OP_realign.py @@ -392,12 +392,12 @@ class GPTB_OT_batch_reproject_all_frames(bpy.types.Operator): def reproject_clean_menu(self, context): if context.mode == 'EDIT_GPENCIL': self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup (also works with 'INVOKE_DEFAULT') - self.layout.operator('gp.batch_reproject_all_frames', icon='SMALL_TRI_RIGHT_VEC') # KEYTYPE_JITTER_VEC + self.layout.operator('gp.batch_reproject_all_frames', icon='KEYTYPE_JITTER_VEC') def reproject_context_menu(self, context): if context.mode == 'EDIT_GPENCIL' and context.scene.tool_settings.gpencil_selectmode_edit == 'STROKE': self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup - self.layout.operator('gp.batch_reproject_all_frames', icon='SMALL_TRI_RIGHT_VEC') # KEYTYPE_JITTER_VEC + self.layout.operator('gp.batch_reproject_all_frames', icon='KEYTYPE_JITTER_VEC') classes = ( GPTB_OT_realign, diff --git a/__init__.py b/__init__.py index b34d8d5..9c18b99 100755 --- a/__init__.py +++ b/__init__.py @@ -15,7 +15,7 @@ bl_info = { "name": "GP toolbox", "description": "Tool set for Grease Pencil in animation production", "author": "Samuel Bernou, Christophe Seux", -"version": (1, 9, 5), +"version": (1, 9, 6), "blender": (2, 91, 0), "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "warning": "", @@ -29,6 +29,7 @@ bl_info = { # from .utils import * from pathlib import Path from shutil import which +from sys import modules from .utils import get_addon_prefs, draw_kmi # from .functions import * @@ -686,48 +687,50 @@ class GPTB_set_env_settings(bpy.types.Operator): classes = ( -GP_PG_FixSettings, -GP_PG_ToolsSettings, -GPTB_set_env_settings, -GPTB_prefs, -GPT_OT_auto_tint_gp_layers, + GP_PG_FixSettings, + GP_PG_ToolsSettings, + GPTB_set_env_settings, + GPTB_prefs, + GPT_OT_auto_tint_gp_layers, ) -# register, unregister = bpy.utils.register_classes_factory(classes) - +addon_modules = ( + OP_helpers, + OP_keyframe_jump, + OP_file_checker, + OP_breakdowner, + OP_temp_cutter, + GP_colorize, + OP_playblast_bg, + OP_playblast, + OP_palettes, + OP_palettes_linker, + OP_brushes, + OP_cursor_snap_canvas, + OP_copy_paste, + OP_flat_reproject, + OP_realign, + OP_depth_move, + OP_key_duplicate_send, + OP_layer_manager, + OP_eraser_brush, + OP_material_picker, + OP_git_update, + OP_layer_picker, + OP_layer_nav, + TOOL_eraser_brush, + handler_draw_cam, + UI_tools, + keymaps, +) def register(): - # addon_updater_ops.register(bl_info) - # bpy.types.Scene.gpfixprops = bpy.props.PointerProperty(type = GP_PG_FixSettings) # used in prefs for cls in classes: bpy.utils.register_class(cls) - OP_helpers.register() - OP_keyframe_jump.register() - OP_file_checker.register() - OP_breakdowner.register() - OP_temp_cutter.register() - GP_colorize.register()## GP_guided_colorize. - OP_playblast_bg.register() - OP_playblast.register() - OP_palettes.register() - OP_palettes_linker.register() - OP_brushes.register() - OP_cursor_snap_canvas.register() - OP_copy_paste.register() - OP_flat_reproject.register() - OP_realign.register() - OP_depth_move.register() - OP_key_duplicate_send.register() - OP_layer_manager.register() - OP_eraser_brush.register() - OP_material_picker.register() - OP_git_update.register() - OP_layer_picker.register() - OP_layer_nav.register() - TOOL_eraser_brush.register() - handler_draw_cam.register() - UI_tools.register() - keymaps.register() + + for mod in addon_modules: + mod.register() + bpy.types.Scene.gptoolprops = bpy.props.PointerProperty(type = GP_PG_ToolsSettings) set_env_properties() @@ -738,48 +741,22 @@ def register(): if not 'remap_relative' in [hand.__name__ for hand in bpy.app.handlers.save_pre]: bpy.app.handlers.save_pre.append(remap_relative) + ## change a variable in prefs if a '.git is detected' prefs.is_git_repo = (Path(__file__).parent / '.git').exists() prefs.has_git = bool(which('git')) - ## change a variable in prefs if a '.git is detected' def unregister(): - # remove handler if 'remap_relative' in [hand.__name__ for hand in bpy.app.handlers.save_pre]: bpy.app.handlers.save_pre.remove(remap_relative) - keymaps.unregister() - # addon_updater_ops.unregister() + for mod in reversed(addon_modules): + mod.unregister() + for cls in reversed(classes): bpy.utils.unregister_class(cls) - UI_tools.unregister() - handler_draw_cam.unregister() - TOOL_eraser_brush.unregister() - OP_layer_nav.unregister() - OP_layer_picker.unregister() - OP_git_update.unregister() - OP_material_picker.unregister() - OP_eraser_brush.unregister() - OP_layer_manager.unregister() - OP_key_duplicate_send.unregister() - OP_depth_move.unregister() - OP_realign.unregister() - OP_flat_reproject.unregister() - OP_copy_paste.unregister() - OP_cursor_snap_canvas.unregister() - OP_brushes.unregister() - OP_palettes_linker.unregister() - OP_palettes.unregister() - OP_file_checker.unregister() - OP_helpers.unregister() - OP_keyframe_jump.unregister() - OP_breakdowner.unregister() - OP_temp_cutter.unregister() - GP_colorize.unregister()## GP_guided_colorize. - OP_playblast_bg.unregister() - OP_playblast.unregister() - # del bpy.types.Scene.gpfixprops + del bpy.types.Scene.gptoolprops