upgraded modifier visibility conflict checker
1.9.7 - changed: `list modifiers visibility conflict` (used in `check file` or through search menu) now not limited to GP objects type.gpv2
parent
8c49c1efcb
commit
8404e16633
|
@ -1,5 +1,9 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
1.9.7
|
||||||
|
|
||||||
|
- changed: `list modifiers visibility conflict` (used in `check file` or through search menu) now not limited to GP objects type.
|
||||||
|
|
||||||
1.9.6
|
1.9.6
|
||||||
|
|
||||||
- fix: icon removed in 3.0
|
- fix: icon removed in 3.0
|
||||||
|
|
|
@ -19,8 +19,8 @@ class GPTB_OT_file_checker(bpy.types.Operator):
|
||||||
# GP use additive drawing (else creating a frame in dopesheet makes it blank...)
|
# GP use additive drawing (else creating a frame in dopesheet makes it blank...)
|
||||||
# GP stroke placement/projection check
|
# GP stroke placement/projection check
|
||||||
# Disabled animation
|
# Disabled animation
|
||||||
# Object visibility conflict
|
# Objects visibility conflict
|
||||||
# GP modifiers visibility conflict
|
# Objects modifiers visibility conflict
|
||||||
# GP modifiers broken target check
|
# GP modifiers broken target check
|
||||||
# Set onion skin filter to 'All type'
|
# Set onion skin filter to 'All type'
|
||||||
# Set filepath type
|
# Set filepath type
|
||||||
|
@ -149,24 +149,29 @@ class GPTB_OT_file_checker(bpy.types.Operator):
|
||||||
viz_ct += 1
|
viz_ct += 1
|
||||||
print(f'{o.name} : viewport {vp} != render {rd}')
|
print(f'{o.name} : viewport {vp} != render {rd}')
|
||||||
if viz_ct:
|
if viz_ct:
|
||||||
## warn only : problems.append(f'{viz_ct} objects visibility conflicts (details in console)')
|
|
||||||
problems.append(['gp.list_object_visibility', f'{viz_ct} objects visibility conflicts (details in console)', 'OBJECT_DATAMODE'])
|
problems.append(['gp.list_object_visibility', f'{viz_ct} objects visibility conflicts (details in console)', 'OBJECT_DATAMODE'])
|
||||||
|
|
||||||
## GP modifiers visibility conflict
|
## GP modifiers visibility conflict
|
||||||
if fix.list_gp_mod_vis_conflict:
|
if fix.list_gp_mod_vis_conflict:
|
||||||
mod_viz_ct = 0
|
mod_viz_ct = 0
|
||||||
for o in context.scene.objects:
|
for o in context.scene.objects:
|
||||||
if o.type != 'GPENCIL':
|
if o.type == 'GPENCIL':
|
||||||
continue
|
for m in o.grease_pencil_modifiers:
|
||||||
for m in o.grease_pencil_modifiers:
|
if m.show_viewport != m.show_render:
|
||||||
if m.show_viewport != m.show_render:
|
vp = 'Yes' if m.show_viewport else 'No'
|
||||||
vp = 'Yes' if m.show_viewport else 'No'
|
rd = 'Yes' if m.show_render else 'No'
|
||||||
rd = 'Yes' if m.show_render else 'No'
|
mod_viz_ct += 1
|
||||||
mod_viz_ct += 1
|
print(f'{o.name} - GP modifier {m.name}: viewport {vp} != render {rd}')
|
||||||
print(f'{o.name} - modifier {m.name}: viewport {vp} != render {rd}')
|
else:
|
||||||
|
for m in o.modifiers:
|
||||||
|
if m.show_viewport != m.show_render:
|
||||||
|
vp = 'Yes' if m.show_viewport else 'No'
|
||||||
|
rd = 'Yes' if m.show_render else 'No'
|
||||||
|
mod_viz_ct += 1
|
||||||
|
print(f'{o.name} - modifier {m.name}: viewport {vp} != render {rd}')
|
||||||
|
|
||||||
if mod_viz_ct:
|
if mod_viz_ct:
|
||||||
## 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} modifiers visibility conflicts (details in console)', 'MODIFIER_DATA'])
|
||||||
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
|
## check if GP modifier have broken layer targets
|
||||||
if fix.list_broken_mod_targets:
|
if fix.list_broken_mod_targets:
|
||||||
|
@ -525,7 +530,8 @@ class GPTB_OT_list_object_visibility(bpy.types.Operator):
|
||||||
# return {'FINISHED'}
|
# return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
## not exposed in UI, Check is performed in Check file (can be called in popped menu)
|
## Only GP modifier
|
||||||
|
'''
|
||||||
class GPTB_OT_list_modifier_visibility(bpy.types.Operator):
|
class GPTB_OT_list_modifier_visibility(bpy.types.Operator):
|
||||||
bl_idname = "gp.list_modifier_visibility"
|
bl_idname = "gp.list_modifier_visibility"
|
||||||
bl_label = "List GP Modifiers Visibility Conflicts"
|
bl_label = "List GP Modifiers Visibility Conflicts"
|
||||||
|
@ -561,71 +567,58 @@ class GPTB_OT_list_modifier_visibility(bpy.types.Operator):
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
## basic listing as message box # all in invoke now
|
|
||||||
# li = []
|
|
||||||
# oblist = []
|
|
||||||
# if self.selection:
|
|
||||||
# pool = context.selected_objects
|
|
||||||
# else:
|
|
||||||
# pool = context.scene.objects
|
|
||||||
|
|
||||||
# for o in pool:
|
|
||||||
# if o.type != 'GPENCIL':
|
|
||||||
# continue
|
|
||||||
# for m in o.grease_pencil_modifiers:
|
|
||||||
# if m.show_viewport != m.show_render:
|
|
||||||
# if o not in oblist:
|
|
||||||
# oblist.append(o)
|
|
||||||
# li.append(o.name) # just name first time to list mods after
|
|
||||||
|
|
||||||
# vp = 1 if m.show_viewport else 0
|
|
||||||
# rd = 1 if m.show_render else 0
|
|
||||||
|
|
||||||
# mess = f' - modifier {m.name}: viewport {vp} != render {rd}'
|
|
||||||
# # mess = f'{o.name} - modifier {m.name}: viewport {vp} != render {rd}'
|
|
||||||
# li.append(mess)
|
|
||||||
# if li:
|
|
||||||
# utils.show_message_box(li)
|
|
||||||
# else:
|
|
||||||
# self.report({'INFO'}, f"No Gp modifier visibility conflict on {'selection' if self.selection else 'scene'}")
|
|
||||||
# return {'FINISHED'}
|
|
||||||
|
|
||||||
|
|
||||||
'''### OLD
|
|
||||||
class GPTB_OT_check_scene(bpy.types.Operator):
|
|
||||||
bl_idname = "gp.scene_check"
|
|
||||||
bl_label = "Check GP scene"
|
|
||||||
bl_description = "Check and fix scene settings"
|
|
||||||
bl_options = {"REGISTER"}
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def poll(cls, context):
|
|
||||||
return True
|
|
||||||
|
|
||||||
def execute(self, context):
|
|
||||||
## check scene resolution / 100% / framerate
|
|
||||||
context.scene.render.resolution_percentage = 100
|
|
||||||
context.scene.render.resolution_x = 3072# define addon properties to make generic ?
|
|
||||||
context.scene.render.resolution_y = 1620# define addon properties to make generic ?
|
|
||||||
context.scene.render.fps = 24# define addon properties to make generic ?
|
|
||||||
|
|
||||||
## check GP datas name
|
|
||||||
gp_os = [o for o in context.scene.objects if o.type == 'GPENCIL' if o.data.users == 1]#no multiple users
|
|
||||||
|
|
||||||
for gpo in gp_os:
|
|
||||||
if gpo.data.name.startswith('Stroke'):# dont touch already renamed group
|
|
||||||
if gpo.data.name != gpo.name:
|
|
||||||
print('renaming GP data:', gpo.data.name, '-->', gpo.name)
|
|
||||||
gpo.data.name = gpo.name
|
|
||||||
|
|
||||||
## disable autolock
|
|
||||||
context.scene.tool_settings.lock_object_mode = False
|
|
||||||
|
|
||||||
return {"FINISHED"}
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
## not exposed in UI, Check is performed in Check file (can be called in popped menu)
|
||||||
|
class GPTB_OT_list_modifier_visibility(bpy.types.Operator):
|
||||||
|
bl_idname = "gp.list_modifier_visibility"
|
||||||
|
bl_label = "List Objects Modifiers Visibility Conflicts"
|
||||||
|
bl_description = "List Modifier visibility conflicts, when viewport and render have different values"
|
||||||
|
bl_options = {"REGISTER"}
|
||||||
|
|
||||||
|
def invoke(self, context, event):
|
||||||
|
self.ob_list = []
|
||||||
|
for o in context.scene.objects:
|
||||||
|
if o.type == 'GPENCIL':
|
||||||
|
if not len(o.grease_pencil_modifiers):
|
||||||
|
continue
|
||||||
|
mods = []
|
||||||
|
for m in o.grease_pencil_modifiers:
|
||||||
|
if m.show_viewport != m.show_render:
|
||||||
|
if not mods:
|
||||||
|
self.ob_list.append([o, mods, 'OUTLINER_OB_GREASEPENCIL'])
|
||||||
|
mods.append(m)
|
||||||
|
else:
|
||||||
|
if not len(o.modifiers):
|
||||||
|
continue
|
||||||
|
mods = []
|
||||||
|
for m in o.modifiers:
|
||||||
|
if m.show_viewport != m.show_render:
|
||||||
|
if not mods:
|
||||||
|
self.ob_list.append([o, mods, "OUTLINER_OB_" + o.type])
|
||||||
|
mods.append(m)
|
||||||
|
self.ob_list.sort(key=lambda x: x[2]) # regroup by objects type (this or x[0] for object name)
|
||||||
|
return context.window_manager.invoke_props_dialog(self, width=250)
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
if not self.ob_list:
|
||||||
|
layout.label(text='No modifier visibility conflict found', icon='CHECKMARK')
|
||||||
|
return
|
||||||
|
|
||||||
|
for o in self.ob_list:
|
||||||
|
layout.label(text=o[0].name, icon=o[2])
|
||||||
|
for m in o[1]:
|
||||||
|
row = layout.row()
|
||||||
|
row.label(text='')
|
||||||
|
row.label(text=m.name, icon='MODIFIER_ON')
|
||||||
|
row.prop(m, 'show_viewport', text='', emboss=False) # invert_checkbox=True
|
||||||
|
row.prop(m, 'show_render', text='', emboss=False) # invert_checkbox=True
|
||||||
|
|
||||||
|
def execute(self, context):
|
||||||
|
return {'FINISHED'}
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
# GPTB_OT_check_scene,
|
|
||||||
GPTB_OT_list_object_visibility,
|
GPTB_OT_list_object_visibility,
|
||||||
GPTB_OT_list_modifier_visibility,
|
GPTB_OT_list_modifier_visibility,
|
||||||
GPTB_OT_copy_string_to_clipboard,
|
GPTB_OT_copy_string_to_clipboard,
|
||||||
|
|
|
@ -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, 6),
|
"version": (1, 9, 7),
|
||||||
"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": "",
|
||||||
|
|
Loading…
Reference in New Issue