fix icon issue and cleaned init-register

1.9.6

- fix: icon removed in 3.0
gpv2
Pullusb 2022-02-22 11:29:31 +01:00
parent eccb450081
commit 8c49c1efcb
5 changed files with 54 additions and 73 deletions

View File

@ -1,5 +1,9 @@
# Changelog # Changelog
1.9.6
- fix: icon removed in 3.0
1.9.5 1.9.5
- added: `Check file` also check if GP modifiers have broken layer target - added: `Check file` also check if GP modifiers have broken layer target

View File

@ -53,7 +53,7 @@ class GPTB_OT_load_brushes(bpy.types.Operator, ImportHelper):
def load_brush_ui(self, context): def load_brush_ui(self, context):
prefs = get_addon_prefs() prefs = get_addon_prefs()
if context.mode == 'PAINT_GPENCIL': 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): def load_brush_top_bar_ui(self, context):
prefs = get_addon_prefs() prefs = get_addon_prefs()

View File

@ -134,12 +134,12 @@ class GPTB_OT_batch_flat_reproject(bpy.types.Operator):
def flat_reproject_clean_menu(self, context): def flat_reproject_clean_menu(self, context):
if context.mode == 'EDIT_GPENCIL': if context.mode == 'EDIT_GPENCIL':
self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup (also works with 'INVOKE_DEFAULT') 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): def flat_reproject_context_menu(self, context):
if context.mode == 'EDIT_GPENCIL' and context.scene.tool_settings.gpencil_selectmode_edit == 'STROKE': 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_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 = ( classes = (
GPTB_OT_batch_flat_reproject, GPTB_OT_batch_flat_reproject,

View File

@ -392,12 +392,12 @@ class GPTB_OT_batch_reproject_all_frames(bpy.types.Operator):
def reproject_clean_menu(self, context): def reproject_clean_menu(self, context):
if context.mode == 'EDIT_GPENCIL': if context.mode == 'EDIT_GPENCIL':
self.layout.operator_context = 'INVOKE_REGION_WIN' # needed for popup (also works with 'INVOKE_DEFAULT') 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): def reproject_context_menu(self, context):
if context.mode == 'EDIT_GPENCIL' and context.scene.tool_settings.gpencil_selectmode_edit == 'STROKE': 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_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 = ( classes = (
GPTB_OT_realign, GPTB_OT_realign,

View File

@ -15,7 +15,7 @@ bl_info = {
"name": "GP toolbox", "name": "GP toolbox",
"description": "Tool set for Grease Pencil in animation production", "description": "Tool set for Grease Pencil in animation production",
"author": "Samuel Bernou, Christophe Seux", "author": "Samuel Bernou, Christophe Seux",
"version": (1, 9, 5), "version": (1, 9, 6),
"blender": (2, 91, 0), "blender": (2, 91, 0),
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties", "location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
"warning": "", "warning": "",
@ -29,6 +29,7 @@ bl_info = {
# from .utils import * # from .utils import *
from pathlib import Path from pathlib import Path
from shutil import which from shutil import which
from sys import modules
from .utils import get_addon_prefs, draw_kmi from .utils import get_addon_prefs, draw_kmi
# from .functions import * # from .functions import *
@ -693,41 +694,43 @@ GPTB_prefs,
GPT_OT_auto_tint_gp_layers, 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(): 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: for cls in classes:
bpy.utils.register_class(cls) bpy.utils.register_class(cls)
OP_helpers.register()
OP_keyframe_jump.register() for mod in addon_modules:
OP_file_checker.register() mod.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()
bpy.types.Scene.gptoolprops = bpy.props.PointerProperty(type = GP_PG_ToolsSettings) bpy.types.Scene.gptoolprops = bpy.props.PointerProperty(type = GP_PG_ToolsSettings)
set_env_properties() set_env_properties()
@ -738,48 +741,22 @@ def register():
if not 'remap_relative' in [hand.__name__ for hand in bpy.app.handlers.save_pre]: if not 'remap_relative' in [hand.__name__ for hand in bpy.app.handlers.save_pre]:
bpy.app.handlers.save_pre.append(remap_relative) 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.is_git_repo = (Path(__file__).parent / '.git').exists()
prefs.has_git = bool(which('git')) prefs.has_git = bool(which('git'))
## change a variable in prefs if a '.git is detected'
def unregister(): def unregister():
# remove handler
if 'remap_relative' in [hand.__name__ for hand in bpy.app.handlers.save_pre]: if 'remap_relative' in [hand.__name__ for hand in bpy.app.handlers.save_pre]:
bpy.app.handlers.save_pre.remove(remap_relative) bpy.app.handlers.save_pre.remove(remap_relative)
keymaps.unregister() for mod in reversed(addon_modules):
# addon_updater_ops.unregister() mod.unregister()
for cls in reversed(classes): for cls in reversed(classes):
bpy.utils.unregister_class(cls) 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 del bpy.types.Scene.gptoolprops