fix delete view layer error in merge

main
pullusb 2023-06-08 15:28:52 +02:00
parent 352027ad8c
commit 4e2ea0e122
2 changed files with 6 additions and 1 deletions

View File

@ -17,6 +17,7 @@ Activate / deactivate all masks using MA layers
1.3.5
- added: button to exclude viewlayers and nodes by selection or by hided layers
- fixed: `delete view layer` error in merge, when fusing multiple view layer
1.3.4

6
fn.py
View File

@ -476,9 +476,11 @@ def merge_gplayer_viewlayers(ob=None, act=None, layers=None):
if not act.viewlayer_render:
return ({'ERROR'}, f'Active layer {act.info} has no viewlayer assigned')
# list layers and viewlayers
# List layers and viewlayers
vls = [rd_scn.view_layers.get(l.viewlayer_render) for l in layers
if l.viewlayer_render and l.viewlayer_render != act.viewlayer_render and rd_scn.view_layers.get(l.viewlayer_render)]
# Remove duplication
vls = list(set(vls))
# Remove viewlayer related nodes
remove_nodes_by_viewlayer(vls, rd_scn)
@ -490,6 +492,8 @@ def merge_gplayer_viewlayers(ob=None, act=None, layers=None):
## Delete unused viewlayers ()
used_vl_name = [n.layer for n in rd_scn.node_tree.nodes if n.type == 'R_LAYERS' and n.layer]
used_vl_name = list(set(used_vl_name))
for vl in vls:
# rd_scn.view_layers.remove(vl)
if vl.name == 'exclude':