gp_render/OP_manage_outputs.py

35 lines
932 B
Python

import bpy
class GPEXP_OT_mute_toggle_output_nodes(bpy.types.Operator):
bl_idname = "gp.mute_toggle_output_nodes"
bl_label = "Mute Toggle output nodes"
bl_description = "Mute / Unmute all output nodes"
bl_options = {"REGISTER"}
mute : bpy.props.BoolProperty(default=True, options={'SKIP_SAVE'})
def execute(self, context):
# scene = bpy.data.scenes.get('Render')
ct = 0
for n in context.scene.node_tree.nodes:
if n.type != 'OUTPUT_FILE':
continue
n.mute = self.mute
ct += 1
state = 'muted' if self.mute else 'unmuted'
self.report({"INFO"}, f'{ct} nodes {state}')
return {"FINISHED"}
classes=(
GPEXP_OT_mute_toggle_output_nodes,
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in reversed(classes):
bpy.utils.unregister_class(cls)