info = { 'icon': 'X', 'description': 'Full Clear : nodes, render_layers, nodegroups', } import bpy C = bpy.context def clear(): render = bpy.data.scenes.get('Render') if not render: print('SKIP, no Render scene') return {"CANCELLED"} # # clear passes # for i in range(len(render.view_layers))[::-1]: # vl = render.view_layers[i] # if not ' / ' in vl.name: # render.view_layers.remove(vl) # clear all nodes if render.use_nodes: for i in range(len(render.node_tree.nodes))[::-1]: if not render.node_tree.nodes[i].parent: continue render.node_tree.nodes.remove(render.node_tree.nodes[i]) # clear all view_layers for vl in reversed(render.view_layers): if ' / ' in vl.name: render.view_layers.remove(vl) # clear all "NG_" nodegroups for ng in reversed(bpy.data.node_groups): if ng.name.startswith('NG_'): bpy.data.node_groups.remove(ng) clear()