Jump to content

[SOLVED] deleting nodes...


photo

Recommended Posts

Posted

I have a node that is added via

Node node = load_node([path to node]);

making a vector of those objects via

forloop (int i=0; max) { markers.append(node_clone(node)); }

I want to remove some nodes from the world in that list.

for (int i=markers.size()-1; i>=new_max; i--) { markers.remove(i); }

does not remove the node from the world.

for (int i=markers.size()-1;i>=new_max;i--) { Node n = markers[i]; markers.remove(i); node_delete(n); }

or any variation there of gives me the following issue.

 ExternClass::destructor(): object is not constructed in "P10ObjectMesh" class
Posted

in answer to my own question

 

 

 for (int i=markers.size()-1;i>=new_max;i--) { Node n = markers[i]; markers.remove(i); node_delete(node_append(n)); }

 

actually works

Posted

Hey Danni,

 

That's just because cloned node doesn't belong to any script (editor/world/system) so you need to use node_append in order to destroy it properly.

×
×
  • Create New...