Using a compositing setup from a .blend file #781
-
Hello! Thanks for a great project! If I have a nice compositing setup in a Node Graph in a .blend file, is there any way to make use of that compositing flow in blenderproc? e.g. can I somehow pull in the compositing setup via bproc.loader.load_blend()? cheers |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Unfortunately, blender does not allow importing a whole node graph from a blend file. However, it allows importing node groups. Then in blenderproc, you can import node groups from a blend file via: bproc.loader.load_blend("my_file.blend", data_blocks=["node_groups"]) Then you can create a new instance of that node group via: import bpy
bpy.context.scene.use_nodes = True
nodes = bpy.context.scene.node_tree.nodes
links = bpy.context.scene.node_tree.links
node = nodes.new("CompositorNodeGroup")
node.node_tree = bpy.data.node_groups["MyNodeGroupName"] You of course then have to link the new node group with render layers and composite nodes. Usually we create the compositing node graphs, programmatically, but if your node graph is really complex, it might make more sense to import them as a node group. |
Beta Was this translation helpful? Give feedback.
Unfortunately, blender does not allow importing a whole node graph from a blend file. However, it allows importing node groups.
So in your blend file, you first have to group all the nodes you want to export via
ctrl + g
(see https://docs.blender.org/manual/en/latest/interface/controls/nodes/groups.html#make-group).Then in blenderproc, you can import node groups from a blend file via:
Then you can create a new instance of that node group via: