Browse Source

fixed a crash with new loadAnims function

Asad M. Zaman 18 years ago
parent
commit
b4f7896e0c
1 changed files with 8 additions and 2 deletions
  1. 8 2
      direct/src/actor/Actor.py

+ 8 - 2
direct/src/actor/Actor.py

@@ -1728,7 +1728,9 @@ class Actor(DirectObject, NodePath):
         to 'lodRoot' for non-LOD actors) and dict of corresponding
         anims in the form animName:animPath{}
         """
+        reload = True
         if (lodName == 'all'):
+            reload = False
             lodNames = self.switches.keys()
             lodNames.sort()
             for i in range(0,len(lodNames)):
@@ -1740,13 +1742,17 @@ class Actor(DirectObject, NodePath):
                                   (anims, partName, lodNames[0]))
 
         firstLoad = True
-        for lName in lodNames:
+        if not reload:
             try:
-                self.__animControlDict[lName][partName]
+                self.__animControlDict[lodNames[0]][partName]
                 firstLoad = False
             except:
+                pass
+        for lName in lodNames:
+            if firstLoad:
                 self.__animControlDict.setdefault(lName, {})
                 self.__animControlDict[lName].setdefault(partName, {})
+
         for animName, filename in anims.items():
             # make sure this lod is in anim control dict
             for lName in lodNames: