scene context for view layer exlude management
0.5.3 - fix: manage output : activate only some viewlayer take context.scene instead of render.scenemain
parent
79e2e058f3
commit
014df3c996
|
@ -14,6 +14,10 @@ Activate / deactivate layer opaticty according to prefix
|
||||||
Activate / deactivate all masks using MA layers
|
Activate / deactivate all masks using MA layers
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
0.5.3
|
||||||
|
|
||||||
|
- fix: manage output : activate only some viewlayer take context.scene instead of render.scene
|
||||||
|
|
||||||
0.5.2
|
0.5.2
|
||||||
|
|
||||||
- fix: `rename lowercase` also change modifier layer target names (else target was broken)
|
- fix: `rename lowercase` also change modifier layer target names (else target was broken)
|
||||||
|
|
|
@ -174,12 +174,13 @@ class GPEXP_OT_enable_all_viewlayers(bpy.types.Operator):
|
||||||
bl_options = {"REGISTER"}
|
bl_options = {"REGISTER"}
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
rd_scn = bpy.data.scenes.get('Render')
|
# scn = bpy.data.scenes.get('Render')
|
||||||
if not rd_scn:
|
# if not scn:
|
||||||
print('SKIP, no Render scene')
|
# print('SKIP, no Render scene')
|
||||||
return {"CANCELLED"}
|
# return {"CANCELLED"}
|
||||||
|
scn = context.scene
|
||||||
|
|
||||||
vl_list = [vl for vl in rd_scn.view_layers if not vl.use and vl.name not in {'View Layer', 'exclude'}]
|
vl_list = [vl for vl in scn.view_layers if not vl.use and vl.name not in {'View Layer', 'exclude'}]
|
||||||
for v in vl_list:
|
for v in vl_list:
|
||||||
v.use = True
|
v.use = True
|
||||||
|
|
||||||
|
@ -193,19 +194,20 @@ class GPEXP_OT_activate_only_selected_layers(bpy.types.Operator):
|
||||||
bl_options = {"REGISTER"}
|
bl_options = {"REGISTER"}
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
rd_scn = bpy.data.scenes.get('Render')
|
# scn = bpy.data.scenes.get('Render')
|
||||||
if not rd_scn:
|
# if not scn:
|
||||||
print('SKIP, no Render scene')
|
# print('SKIP, no Render scene')
|
||||||
return {"CANCELLED"}
|
# return {"CANCELLED"}
|
||||||
|
scn = context.scene
|
||||||
|
|
||||||
nodes = rd_scn.node_tree.nodes
|
nodes = scn.node_tree.nodes
|
||||||
|
|
||||||
rlayers_nodes = [n for n in nodes if n.select and n.type == 'R_LAYERS']
|
rlayers_nodes = [n for n in nodes if n.select and n.type == 'R_LAYERS']
|
||||||
vls = [rd_scn.view_layers.get(n.layer) for n in rlayers_nodes if rd_scn.view_layers.get(n.layer)]
|
vls = [scn.view_layers.get(n.layer) for n in rlayers_nodes if scn.view_layers.get(n.layer)]
|
||||||
for v in rd_scn.view_layers:
|
for v in scn.view_layers:
|
||||||
v.use = v in vls
|
v.use = v in vls
|
||||||
|
|
||||||
self.report({"INFO"}, f'Now only {len(vls)} viewlayer active (/{len(rd_scn.view_layers)})')
|
self.report({"INFO"}, f'Now only {len(vls)} viewlayer active (/{len(scn.view_layers)})')
|
||||||
return {"FINISHED"}
|
return {"FINISHED"}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ bl_info = {
|
||||||
"name": "GP Render",
|
"name": "GP Render",
|
||||||
"description": "Organise export of gp layers through compositor output",
|
"description": "Organise export of gp layers through compositor output",
|
||||||
"author": "Samuel Bernou",
|
"author": "Samuel Bernou",
|
||||||
"version": (0, 5, 2),
|
"version": (0, 5, 3),
|
||||||
"blender": (2, 93, 0),
|
"blender": (2, 93, 0),
|
||||||
"location": "View3D",
|
"location": "View3D",
|
||||||
"warning": "",
|
"warning": "",
|
||||||
|
|
Loading…
Reference in New Issue