Browse Source

fix for actor setLOD

Zachary Pavlov 16 years ago
parent
commit
3fcd2a764e
1 changed files with 7 additions and 3 deletions
  1. 7 3
      direct/src/actor/Actor.py

+ 7 - 3
direct/src/actor/Actor.py

@@ -700,10 +700,14 @@ class Actor(DirectObject, NodePath):
         # add the switch distance info
 ##         sortedKeys = self.switches.keys()
 ##         sortedKeys.sort()
-        sortedKeys = self.__sortedLODNames
-        index = sortedKeys.index(str(lodName))
-        self.__LODNode.node().setSwitch(index, inDist, outDist)
+        self.__LODNode.node().setSwitch(self.getLODIndex(lodName), inDist, outDist)
 
+    def getLODIndex(self, lodName):
+        """getLODIndex(self)
+        safe method (but expensive) for retrieving the child index
+        """
+        return list(self.__LODNode.getChildren()).index(self.getLOD(lodName))
+        
     def getLOD(self, lodName):
         """getLOD(self, string)
         Get the named node under the LOD to which we parent all LOD