After all those traversing and editing, it is very easy to delete nodes. Simply make a list of nodes or a single node, and pass it to the appropriate method of the scene object. The script below deletes all the selected nodes:


Another script, deletes a first top level node in the scene:


You can’t delete the root node, so you’ll get an error if you try the following code:


That’s all you need to know about the deletion.