Gp modifier to unified modifier
parent
0160b4eae4
commit
94fc926f7a
|
@ -181,20 +181,12 @@ class GPTB_OT_file_checker(bpy.types.Operator):
|
|||
if fix.list_gp_mod_vis_conflict:
|
||||
mod_viz_ct = 0
|
||||
for o in context.scene.objects:
|
||||
if o.type == 'GREASEPENCIL':
|
||||
for m in o.grease_pencil_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} - GP 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}')
|
||||
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:
|
||||
problems.append(['gp.list_modifier_visibility', f'{mod_viz_ct} modifiers visibility conflicts (details in console)', 'MODIFIER_DATA'])
|
||||
|
@ -203,11 +195,11 @@ class GPTB_OT_file_checker(bpy.types.Operator):
|
|||
if fix.list_broken_mod_targets:
|
||||
for o in [o for o in bpy.context.scene.objects if o.type == 'GREASEPENCIL']:
|
||||
lay_name_list = [l.name for l in o.data.layers]
|
||||
for m in o.grease_pencil_modifiers:
|
||||
if not hasattr(m, 'layer'):
|
||||
for m in o.modifiers:
|
||||
if not hasattr(m, 'layer_filter'):
|
||||
continue
|
||||
if m.layer != '' and not m.layer in lay_name_list:
|
||||
mess = f'Broken modifier layer target: {o.name} > {m.name} > {m.layer}'
|
||||
if m.layer_filter != '' and not m.layer_filter in lay_name_list:
|
||||
mess = f'Broken modifier layer target: {o.name} > {m.name} > {m.layer_filter}'
|
||||
print(mess)
|
||||
problems.append(mess)
|
||||
|
||||
|
@ -562,46 +554,6 @@ class GPTB_OT_list_object_visibility(bpy.types.Operator):
|
|||
# self.report({'INFO'}, f"No Object visibility conflict on current scene")
|
||||
# return {'FINISHED'}
|
||||
|
||||
|
||||
## Only GP modifier
|
||||
'''
|
||||
class GPTB_OT_list_modifier_visibility(bpy.types.Operator):
|
||||
bl_idname = "gp.list_modifier_visibility"
|
||||
bl_label = "List GP 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 != 'GREASEPENCIL':
|
||||
continue
|
||||
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])
|
||||
mods.append(m)
|
||||
return context.window_manager.invoke_props_dialog(self, width=250)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
for o in self.ob_list:
|
||||
layout.label(text=o[0].name, icon='OUTLINER_OB_GREASEPENCIL')
|
||||
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'}
|
||||
'''
|
||||
|
||||
## 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"
|
||||
|
@ -612,24 +564,14 @@ class GPTB_OT_list_modifier_visibility(bpy.types.Operator):
|
|||
def invoke(self, context, event):
|
||||
self.ob_list = []
|
||||
for o in context.scene.objects:
|
||||
if o.type == 'GREASEPENCIL':
|
||||
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)
|
||||
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)
|
||||
|
||||
|
|
|
@ -475,7 +475,7 @@ class GPTB_OT_toggle_hide_gp_modifier(Operator):
|
|||
for o in pool:
|
||||
if o.type != 'GREASEPENCIL':
|
||||
continue
|
||||
for m in o.grease_pencil_modifiers:
|
||||
for m in o.modifier:
|
||||
# skip modifier that are not visible in render
|
||||
if not m.show_render:
|
||||
continue
|
||||
|
|
|
@ -78,11 +78,11 @@ def layer_name_build(layer, prefix='', desc='', suffix=''):
|
|||
# maybe a more elegant way exists to find all objects users ?
|
||||
|
||||
# update Gpencil modifier targets
|
||||
for mod in ob_user.grease_pencil_modifiers:
|
||||
if not hasattr(mod, 'layer'):
|
||||
for mod in ob_user.modifier:
|
||||
if not hasattr(mod, 'layer_filter'):
|
||||
continue
|
||||
if mod.layer == old:
|
||||
mod.layer = new
|
||||
if mod.layer_filter == old:
|
||||
mod.layer_filter = new
|
||||
|
||||
"""
|
||||
def layer_name_build(layer, prefix='', prefix2='', desc='', suffix=''):
|
||||
|
|
4
utils.py
4
utils.py
|
@ -1221,7 +1221,7 @@ def all_object_modifier_enabled(objects) -> bool:
|
|||
for o in objects:
|
||||
if o.type != 'GREASEPENCIL':
|
||||
continue
|
||||
for m in o.grease_pencil_modifiers:
|
||||
for m in o.modifier:
|
||||
if m.show_render and not m.show_viewport:
|
||||
return False
|
||||
|
||||
|
@ -1325,7 +1325,7 @@ def gp_modifier_status(objects) -> tuple((str, str)):
|
|||
## Skip hided object
|
||||
if o.hide_get() and o.hide_render:
|
||||
continue
|
||||
for m in o.grease_pencil_modifiers:
|
||||
for m in o.modifier:
|
||||
if m.show_render and not m.show_viewport:
|
||||
off_count += 1
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue