I have a geom node tree (converted to a function - createTree() - via NodeToPython). It just draws a curve between a source and target object. Both objects are meshes. The Geometry node modifier is added to the source object, and the target object is passed via a Group Input. Works great during the first run.
On the second run of my addon, even though I delete all the objects (meshes and the nodegroup) before recreating things, the object passed to the Group Input is still some how alive probably because its still being referenced somewhere. It doesn't show up in the outliner viewlayer, but I do see it when changing to outliner-blend file view. It shows up greyed out. So now I get 2 objects. The TargetObject and Targetobject.001.
Code looks like this -
join_obj=createTree()
mod = sourceobj.modifiers.new(name = "Join Objs", type = 'NODES')
mod.node_group = join_objs
mod['Input_2']=bpy.data.objects['Targetobject'] # Is this the right way to pass the Target??
This is the cleanup code maybe I am making a mistake here
if "Join Objs" in bpy.data.node_groups:
bpy,data.node_groups.remove(bpy.data.node_groups['Join Objs'])
bpy.ops.object.select_all(action='DESELECT')
bpy.ops.object.select_by_type(type='MESH')
Cleanup needed input node pointing at target object to be reset to None, for the target object to be removed properly.
So adding this to cleanup seems to work
mod['Input_2']=None
I have a geom node tree (converted to a function - createTree() - via NodeToPython). It just draws a curve between a source and target object. Both objects are meshes. The Geometry node modifier is added to the source object, and the target object is passed via a Group Input. Works great during the first run.
On the second run of my addon, even though I delete all the objects (meshes and the nodegroup) before recreating things, the object passed to the Group Input is still some how alive probably because its still being referenced somewhere. It doesn't show up in the outliner viewlayer, but I do see it when changing to outliner-blend file view. It shows up greyed out. So now I get 2 objects. The TargetObject and Targetobject.001. Code looks like this -
This is the cleanup code maybe I am making a mistake here
And this is the create_tree code
Any idea whats happening? Thank!
(Not too familiar with blender terms and cleanup process between 2 runs of an addon so apologies if I am missing something basic)