initial code for layer check
parent
3576630352
commit
160a957007
|
@ -0,0 +1,85 @@
|
|||
import bpy
|
||||
from . import fn
|
||||
|
||||
## direct use (Pop up menu version below)
|
||||
|
||||
|
||||
class GPEXP_OT_check_layers_state(bpy.types.Operator):
|
||||
bl_idname = "gp.check_layers_state"
|
||||
bl_label = "Check Layers State"
|
||||
bl_description = "Display state of layer that migh need adjustement"
|
||||
bl_options = {"REGISTER"} # , "UNDO"
|
||||
|
||||
# clear_unused_view_layers : bpy.props.BoolProperty(name="Clear unused view layers",
|
||||
# description="Delete view layer that aren't used in the nodetree anymore",
|
||||
# default=True)
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return context.object and context.object.type == 'GPENCIL'
|
||||
|
||||
def invoke(self, context, event):
|
||||
self.ctrl=event.ctrl
|
||||
self.alt=event.alt
|
||||
return context.window_manager.invoke_props_dialog(self)
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
# layout.prop(self, 'clear_unused_view_layers')
|
||||
|
||||
def execute(self, context):
|
||||
if self.alt:
|
||||
pool = [o for o in context.selected_objects if o.type == 'GPENCIL']
|
||||
else:
|
||||
pool = [context.object]
|
||||
|
||||
# TODO create a list to disaply everything in a message box ?
|
||||
|
||||
for ob in pool:
|
||||
layers = ob.data.layers
|
||||
for l in layers:
|
||||
used = False
|
||||
if l.mask_layers:
|
||||
print(f'-> masks')
|
||||
state = '' if l.use_mask_layer else ' (disabled)'
|
||||
print(f'{ob.name} > {l.info}{state}:')
|
||||
used = True
|
||||
for ml in l.mask_layers:
|
||||
mlstate = ' (disabled)' if ml.hide else ''
|
||||
mlinvert = ' <>' if ml.invert else ''
|
||||
print(f' - {ml.info}{mlstate}{mlinvert}')
|
||||
|
||||
if l.opacity != 1:
|
||||
print(f'-> opacity {l.opacity}')
|
||||
used = True
|
||||
|
||||
if l.use_light:
|
||||
print(f'-> use light !')
|
||||
used = True
|
||||
if l.blend_mode != 'REGULAR':
|
||||
print(f'-> blend mode "{l.blend_mode}" !')
|
||||
used = True
|
||||
|
||||
if used:
|
||||
print()
|
||||
|
||||
# render = bpy.data.scenes.get('Render')
|
||||
# if not render:
|
||||
# print('SKIP, no Render scene')
|
||||
# return {"CANCELLED"}
|
||||
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
|
||||
classes=(
|
||||
GPEXP_OT_check_layers_state,
|
||||
)
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
|
||||
def unregister():
|
||||
for cls in reversed(classes):
|
||||
bpy.utils.unregister_class(cls)
|
Loading…
Reference in New Issue