Jump to content

[SOLVED] Unable to remove Node from the editor


photo

Recommended Posts

Hi,

 

I am trying to remove an Node from the Editor using script & I am getting following error on the command prompt.

 

Editor::removeNode(): can't find 04002CC0 node

 

The scenrio is mentioned below in steps

- In Editor, add grass mesh from the Editor menu option & name it as "Grass"

- In Script, using engine.editor.findNode("Grass"); I get the index

- Using index, retrive the Node object (grassNode)

- Call engine.editor.releaseNode( grassNode );

- Append it using node_append( grassNode );

- Now in TriggerEnter callback use engine.editor.removeNode( grassnode ); to remove the Grass mesh

 

The problem is that, I am getting above error at TriggerEnter callback & the Grass mesh is not removed from the Editor.

 

From the documentation I see that my step to remove an node is correct, but am I going wrong some where?

 

Can some one point the issue.

 

Thanks

Link to comment

engine.editor.removeNode will remove nodes owned by the editor. You have just released ownership of the node from the editor and appened ownship to the script using node_append. A node owned by the script cannot be removed using engine.editor.removeNode. Try using engine.editor.removeNode without releasing and appending to script OR use node_delete if you want to delete a node owned by script.

Link to comment

Thanks for the pointer. I removed the script ownership & used engine.editor.removeNode() function, even now I am getting the same error

 

Editor::removeNode(): can't find 04002CC0 node

Link to comment

If engine.editor.findNode returns you anything, then it is already owned by the editor, not the script. So you should not be removing ownship of anything to successfully call engine.editor.removeNode. Nodes that are not owned by either the editor or the script (i.e. ownerless) is bad. You do not want that to happen. It's all written here https://developer.unigine.com/en/docs/1.0/code/memory_management. Based on that, if you can still not get this to work, you will need to provide some sample code so we can see what your doing wrong.

Link to comment

Hey thanks for the link, I will check them in detail.

 

I might be going wrong because I am passing the Node to the external C++ module & trying to delete the node in it. So I think this might be the issue. I will check the documentation further on passing node to external module.

 

Between if some one knows about the right page in doc, than point it out which would save some time for me.

 

Thanks

Link to comment
×
×
  • Create New...