From 15aec65b19137e3433c8c482d7204a750ac65f36 Mon Sep 17 00:00:00 2001 From: Pullusb Date: Thu, 24 Jun 2021 16:40:22 +0200 Subject: [PATCH] Select tool prop to dix prop group and UI change --- OP_file_checker.py | 15 +++++++-------- __init__.py | 28 ++++------------------------ properties.py | 22 +++++++++++++++++----- 3 files changed, 28 insertions(+), 37 deletions(-) diff --git a/OP_file_checker.py b/OP_file_checker.py index 1db0ab2..ef03d14 100755 --- a/OP_file_checker.py +++ b/OP_file_checker.py @@ -78,14 +78,13 @@ class GPTB_OT_file_checker(bpy.types.Operator): if hasattr(area.spaces[0], 'show_locked_time'): setattr(area.spaces[0], 'show_locked_time', True) - ## set cursor type (according to prefs ?) - if fix.set_cursor_type: - if context.mode in ("EDIT_GPENCIL", "SCULPT_GPENCIL"): - tool = prefs.select_active_tool - if tool != 'none': - if bpy.context.workspace.tools.from_space_view3d_mode(bpy.context.mode, create=False).idname != tool: - bpy.ops.wm.tool_set_by_id(name=tool)# Tweaktoolcode - problems.append(f'tool changed to {tool.split(".")[1]}') + ## set cursor type + if context.mode in ("EDIT_GPENCIL", "SCULPT_GPENCIL"): + tool = fix.select_active_tool + if tool != 'none': + if bpy.context.workspace.tools.from_space_view3d_mode(bpy.context.mode, create=False).idname != tool: + bpy.ops.wm.tool_set_by_id(name=tool)# Tweaktoolcode + problems.append(f'tool changed to {tool.split(".")[1]}') # ## GP use additive drawing (else creating a frame in dopesheet makes it blank...) # if not context.scene.tool_settings.use_gpencil_draw_additive: diff --git a/__init__.py b/__init__.py index 8bea5e0..fba1bf9 100755 --- a/__init__.py +++ b/__init__.py @@ -247,19 +247,6 @@ class GPTB_prefs(bpy.types.AddonPreferences): default=False, ) - ## default active tool to use - select_active_tool : EnumProperty( - name="Default selection tool", description="Active tool to set when launching check fix scene", - default='builtin.select_lasso', - items=( - ('none', 'Dont change', 'Let the current active tool without change', 0),#'MOUSE_RMB' - ('builtin.select', 'Select tweak', 'Use active select tweak active tool', 1),#'MOUSE_RMB' - ('builtin.select_box', 'Select box', 'Use active select box active tool', 2),#'MOUSE_LMB' - ('builtin.select_circle', 'Select circle', 'Use active select circle active tool', 3),#'MOUSE_MMB' - ('builtin.select_lasso', 'Select lasso', 'Use active select lasso active tool', 4),#'MOUSE_MMB' - )) - - ## render settings render_obj_exclusion : StringProperty( name="GP obj exclude filter", @@ -356,6 +343,9 @@ class GPTB_prefs(bpy.types.AddonPreferences): row.prop(self, 'render_res_x', text='Width') row.prop(self, 'render_res_y', text='Height') + box.prop(self, 'use_relative_remap_on_save') + box.prop(self, "render_obj_exclusion", icon='FILTER')# + subbox = box.box() subbox.label(text='Project folders:') @@ -376,8 +366,6 @@ class GPTB_prefs(bpy.types.AddonPreferences): subbox.prop(self, 'separator') subbox.prop(self, 'prefixes') - box.prop(self, 'use_relative_remap_on_save') - ### TODO add render settings # layout.separator()## Playblast @@ -421,15 +409,6 @@ class GPTB_prefs(bpy.types.AddonPreferences): box.label(text="No Jump hotkey auto set. Following operators needs to be set manually", icon="ERROR") box.label(text="screen.gp_keyframe_jump - preferably in 'screen' category to jump from any editor") - ## Active tool - box = layout.box() - box.label(text='Autofix check button options:') - box.prop(self, "select_active_tool", icon='RESTRICT_SELECT_OFF') - - - box.prop(self, "render_obj_exclusion", icon='FILTER')# - - box = layout.box() box.label(text='Tools options:') box.prop(self, 'use_precise_eraser') @@ -486,6 +465,7 @@ class GPTB_prefs(bpy.types.AddonPreferences): col.prop(self.fixprops, 'disable_guide') col.prop(self.fixprops, 'list_disabled_anim') col.prop(self.fixprops, 'autokey_add_n_replace') + col.prop(self.fixprops, "select_active_tool", icon='RESTRICT_SELECT_OFF') # row.label(text='lock the active camera if not a draw cam (and if not "layout" in blendfile name)') if self.pref_tabs == 'UPDATE': diff --git a/properties.py b/properties.py index 4897d86..fbd12a0 100755 --- a/properties.py +++ b/properties.py @@ -41,11 +41,6 @@ class GP_PG_FixSettings(bpy.types.PropertyGroup): name="Dopesheets Show Slider And Sync Range", description="Toggle on the use of show slider and sync range", default=True, options={'HIDDEN'}) - - set_cursor_type : BoolProperty( - name="Set Select Cursor Mode", - description="Set the type of the selection cursor (according to addon prefs)", - default=True, options={'HIDDEN'}) check_front_axis : BoolProperty( name="Check If Draw Axis is Front (X-Z)", @@ -77,6 +72,23 @@ class GP_PG_FixSettings(bpy.types.PropertyGroup): description="Change autokey mode back to 'Add & Replace'", default=True, options={'HIDDEN'}) + # set_cursor_type : BoolProperty( + # name="Set Select Cursor Mode", + # description="Set the type of the selection cursor (according to addon prefs)", + # default=True, options={'HIDDEN'}) + + ## default active tool to use + select_active_tool : EnumProperty( + name="Default selection tool", description="Active tool to set when launching check fix scene", + default='builtin.select_lasso', + items=( + ('none', 'Dont change', 'Let the current active tool without change', 0),#'MOUSE_RMB' + ('builtin.select', 'Select tweak', 'Use active select tweak active tool', 1),#'MOUSE_RMB' + ('builtin.select_box', 'Select box', 'Use active select box active tool', 2),#'MOUSE_LMB' + ('builtin.select_circle', 'Select circle', 'Use active select circle active tool', 3),#'MOUSE_MMB' + ('builtin.select_lasso', 'Select lasso', 'Use active select lasso active tool', 4),#'MOUSE_MMB' + )) + class GP_PG_ToolsSettings(bpy.types.PropertyGroup): eraser_radius : IntProperty( name="Eraser Radius", description="Radius of eraser brush",