fix delete view layer error in merge
parent
352027ad8c
commit
4e2ea0e122
|
@ -17,6 +17,7 @@ Activate / deactivate all masks using MA layers
|
||||||
1.3.5
|
1.3.5
|
||||||
|
|
||||||
- added: button to exclude viewlayers and nodes by selection or by hided layers
|
- 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
|
1.3.4
|
||||||
|
|
||||||
|
|
6
fn.py
6
fn.py
|
@ -476,9 +476,11 @@ def merge_gplayer_viewlayers(ob=None, act=None, layers=None):
|
||||||
if not act.viewlayer_render:
|
if not act.viewlayer_render:
|
||||||
return ({'ERROR'}, f'Active layer {act.info} has no viewlayer assigned')
|
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
|
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)]
|
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 viewlayer related nodes
|
||||||
remove_nodes_by_viewlayer(vls, rd_scn)
|
remove_nodes_by_viewlayer(vls, rd_scn)
|
||||||
|
@ -490,6 +492,8 @@ def merge_gplayer_viewlayers(ob=None, act=None, layers=None):
|
||||||
## Delete unused viewlayers ()
|
## 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 = [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:
|
for vl in vls:
|
||||||
# rd_scn.view_layers.remove(vl)
|
# rd_scn.view_layers.remove(vl)
|
||||||
if vl.name == 'exclude':
|
if vl.name == 'exclude':
|
||||||
|
|
Loading…
Reference in New Issue