Browse Source

Fix Deletion of Nodes in the SceneComposer (Invoke destroy() on children so they are removed from the Composer and not only the openGL Window)

MeFisto94 9 years ago
parent
commit
295727939d
1 changed files with 14 additions and 0 deletions
  1. 14 0
      jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeNode.java

+ 14 - 0
jme3-core/src/com/jme3/gde/core/sceneexplorer/nodes/JmeNode.java

@@ -175,6 +175,20 @@ public class JmeNode extends JmeSpatial {
         }
     }
 
+    @Override
+    public void destroy() throws IOException {
+        super.destroy(); /* super has to be the first call, since it calls spatial.removeFromParent(); */
+        
+        for (org.openide.nodes.Node n : getChildren().getNodes()) {
+            n.destroy(); // Call destroy on children
+        }
+        
+        if (getParentNode() == null) {
+            setName("Scene"); /* You can't delete the rootNode but fake clearing it */
+        }
+        refresh(false);
+    }
+
     @Override
     public Class<?> getExplorerObjectClass() {
         return Node.class;