cehck broken modifier layer targets

1.9.5

- added: `Check file` also check if GP modifiers have broken layer target
- changed: `Check file` disable drawing guide is now On by default
gpv2
Pullusb 2022-02-02 17:08:41 +01:00
parent 651f9e7747
commit eccb450081
4 changed files with 27 additions and 5 deletions

View File

@ -1,5 +1,10 @@
# Changelog
1.9.5
- added: `Check file` also check if GP modifiers have broken layer target
- changed: `Check file` disable drawing guide is now On by default
1.9.4
- feat: renaming using the name_manager take care of changing layer target values in GP modifiers

View File

@ -9,8 +9,8 @@ class GPTB_OT_file_checker(bpy.types.Operator):
bl_description = "Check / correct some aspect of the file, properties and such and report"
bl_options = {"REGISTER"}
## list of action :
# Lock main cam:
## list of actions :
# Lock main cam
# set scene res
# set scene percentage at 100:
# set show slider and sync range
@ -21,6 +21,7 @@ class GPTB_OT_file_checker(bpy.types.Operator):
# Disabled animation
# Object visibility conflict
# GP modifiers visibility conflict
# GP modifiers broken target check
# Set onion skin filter to 'All type'
# Set filepath type
# Set Lock object mode state
@ -167,6 +168,17 @@ class GPTB_OT_file_checker(bpy.types.Operator):
## warn only : problems.append(f'{mod_viz_ct} visibility conflicts in Gp object modifiers (details in console)')
problems.append(['gp.list_modifier_visibility', f'{mod_viz_ct} visibility conflicts in Gp object modifiers (details in console)', 'MODIFIER_DATA'])
## check if GP modifier have broken layer targets
if fix.list_broken_mod_targets:
for o in [o for o in bpy.context.scene.objects if o.type == 'GPENCIL']:
lay_name_list = [l.info for l in o.data.layers]
for m in o.grease_pencil_modifiers:
if not hasattr(m, 'layer'):
continue
if not m.layer in lay_name_list:
mess = f'Broken modifier target: {o.name} > {m.name} > {m.layer}'
print(mess)
problems.append(mess)
## Use median point
if fix.set_pivot_median_point:
@ -217,7 +229,6 @@ class GPTB_OT_file_checker(bpy.types.Operator):
if apply:
bpy.context.scene.tool_settings.lock_object_mode = False
# ## Set onion skin filter to 'All type'
# fix_kf_type = 0
# for gp in bpy.data.grease_pencils:#from data

View File

@ -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, 4),
"version": (1, 9, 5),
"blender": (2, 91, 0),
"location": "Sidebar (N menu) > Gpencil > Toolbox / Gpencil properties",
"warning": "",
@ -606,6 +606,7 @@ class GPTB_prefs(bpy.types.AddonPreferences):
col.prop(self.fixprops, 'list_disabled_anim')
col.prop(self.fixprops, 'list_obj_vis_conflict')
col.prop(self.fixprops, 'list_gp_mod_vis_conflict')
col.prop(self.fixprops, 'list_broken_mod_targets')
col.prop(self.fixprops, 'autokey_add_n_replace')
#-# col.prop(self.fixprops, 'set_cursor_type')
col.prop(self.fixprops, "select_active_tool", icon='RESTRICT_SELECT_OFF')

View File

@ -83,7 +83,7 @@ class GP_PG_FixSettings(bpy.types.PropertyGroup):
disable_guide : BoolProperty(
name="Disable Drawing Guide",
description="Disable constrained guide in draw mode",
default=False, options={'HIDDEN'})
default=True, options={'HIDDEN'})
list_disabled_anim : BoolProperty(
name="List Disabled Animation",
@ -100,6 +100,11 @@ class GP_PG_FixSettings(bpy.types.PropertyGroup):
description="Alert if some GP modifier have different show viewport and show render values",
default=True, options={'HIDDEN'})
list_broken_mod_targets : BoolProperty(
name="List GP Object modifiers broken target",
description="Alert if some GP modifier have a target layer not existing in layer stack",
default=True, options={'HIDDEN'})
autokey_add_n_replace : BoolProperty(
name="Autokey Mode Add and Replace",
description="Change autokey mode back to 'Add & Replace'",