Migrate Fileoutput and viewlayer management ops from gp_render
Better overall UI. Split file output in a separate panel
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import bpy
|
||||
|
||||
from bpy.types import Operator
|
||||
from bpy.props import (StringProperty,
|
||||
BoolProperty,
|
||||
)
|
||||
|
||||
class RT_OT_enable_all_viewlayers(Operator):
|
||||
bl_idname = "rt.enable_all_viewlayers"
|
||||
bl_label = "Enable All Viewlayers"
|
||||
bl_description = "Enable all View layers except those named 'exclude'" # 'View Layer'
|
||||
bl_options = {"REGISTER"}
|
||||
|
||||
def execute(self, context):
|
||||
scn = context.scene
|
||||
|
||||
vl_list = [vl for vl in scn.view_layers if not vl.use and vl.name not in {'exclude',}] # 'View Layer',
|
||||
for v in vl_list:
|
||||
v.use = True
|
||||
|
||||
self.report({"INFO"}, f'{len(vl_list)} ViewLayers Reactivated')
|
||||
return {"FINISHED"}
|
||||
|
||||
class RT_OT_activate_only_selected_layers(Operator):
|
||||
bl_idname = "rt.activate_only_selected_layers"
|
||||
bl_label = "Activate Only Selected Layers"
|
||||
bl_description = "Activate only selected node view layer , excluding all others"
|
||||
bl_options = {"REGISTER"}
|
||||
|
||||
def execute(self, context):
|
||||
scn = context.scene
|
||||
|
||||
nodes = scn.node_tree.nodes
|
||||
|
||||
rlayers_nodes = [n for n in nodes if n.select and n.type == 'R_LAYERS']
|
||||
vls = [scn.view_layers.get(n.layer) for n in rlayers_nodes if scn.view_layers.get(n.layer)]
|
||||
for v in scn.view_layers:
|
||||
v.use = v in vls
|
||||
|
||||
self.report({"INFO"}, f'Now only {len(vls)} viewlayer active (/{len(scn.view_layers)})')
|
||||
return {"FINISHED"}
|
||||
|
||||
classes = (
|
||||
RT_OT_enable_all_viewlayers,
|
||||
RT_OT_activate_only_selected_layers
|
||||
)
|
||||
|
||||
def register():
|
||||
for cls in classes:
|
||||
bpy.utils.register_class(cls)
|
||||
|
||||
def unregister():
|
||||
for cls in reversed(classes):
|
||||
bpy.utils.unregister_class(cls)
|
||||
Reference in New Issue
Block a user