📋 Metadata
- Author: whinton
- Date: 2019-03-28 18:49:10
- Type:
question - Replies (1): post_02134
💬 Content
Hello,
I’m trying to call a script that will automatically add connected nodes to the current node tree. It looks like this
import bpy
for i in range(1):
#specifcy node tree
myTree = bpy.data.node_groups['Pop ups']
#location offset
offsetX = i *400
#add Time Info Node
mytime = bpy.data.node_groups['Pop ups'].nodes.new("an_TimeInfoNode")
mytime.location=offsetX, 0
#add Delay Time Node
mydelay = bpy.data.node_groups['Pop ups'].nodes.new("an_DelayTimeNode")
mydelay.location=offsetX+200,0
#Connect Frame, Time
nodetree=bpy.data.node_groups['Pop ups']
nodetree.links.new(mytime.outputs['Frame'],mydelay.inputs['Time'])
I’m wondering how set the nodetree contextually. That is, when I call the external script, the active node tree is passed into the script, and the nodes are added/connected to the current node tree.