0

I want add to compositing an existing group, but I don’t know what to write to import a existing group (where can I see the available commands for compositing, not bpy..., I mean comp_node... ?). Is it possible to at least switch empty group to existing NodeGroup? I looked through all the answers, nowhere is a working code.

my variant:

import bpy

bpy.context.scene.use_nodes = True tree = bpy.context.scene.node_tree

comp_node = tree.nodes.new('CompositorNodeGroup') comp_node = ???????

enter image description here

quellenform
  • 35,177
  • 10
  • 50
  • 133
M. Gordon
  • 29
  • 5

1 Answers1

2

If you already have a node group then this code will help you and if you want to know how to create node groups this link will help you. How to handle creating a node group in a script?

import bpy
scene = bpy.context.scene
use_nodes = scene.use_nodes
if not use_nodes:
    scene.use_nodes = True
tree = scene.node_tree
nodes = tree.nodes
nodes.clear()

#check if there is already group new_group = nodes.get('Group') if not new_group: new_group= nodes.new('CompositorNodeGroup')

new_group.node_tree = bpy.data.node_groups['NodeGroup']

Gorgious
  • 30,723
  • 2
  • 44
  • 101
Muzammil
  • 828
  • 2
  • 14