Can you please provide the code in one section. i dont understand what you mean by the above quote.
With the last snippet i mean, you could use your way to find the node you want to remove, then call the
removeNode(node scene) function i posted in my first reply. I hope this deconfused it.
does the function delete check if the geometryid is used somewhere else in scene?
Yes, removeNode(node, root) will remove "node" from "root" (scene) and ensure to only dispose the geometries from "node" and it's children if it isn't used anywhere in the "root". I didn't tested it but it should work.
where in the function does it dispose only if it is not used somewhere else?
After step 1 all relevant geometries from "node" and it's children are remembered in the geometries lookup object. Then it goes through the desired root object (scene) and checks if any other mesh uses one of the remembered geometries, if so it increments
used on the geometry. At step 3, it then loops the remembered geometries and if
used is still zero it gets disposed.