瀏覽代碼

Merge pull request #201 from Bebul/invalidateUpdateListOptimization

Fix invalidateUpdateList not to use both cycle and recursion traverse
Paul Speed 10 年之前
父節點
當前提交
44c860e2d2
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      jme3-core/src/main/java/com/jme3/scene/Node.java

+ 3 - 3
jme3-core/src/main/java/com/jme3/scene/Node.java

@@ -199,15 +199,15 @@ public class Node extends Spatial implements Savable {
     }
 
     /**
-     *  Called to invalide the root node's update list.  This is
+     *  Called to invalidate the root node's update list.  This is
      *  called whenever a spatial is attached/detached as well as
      *  when a control is added/removed from a Spatial in a way
      *  that would change state.
      */
     void invalidateUpdateList() {
         updateListValid = false;
-        for( Node n = parent; n != null; n = n.getParent() ) {
-            n.invalidateUpdateList();
+        if ( parent != null ) {
+          parent.invalidateUpdateList();
         }
     }