Bläddra i källkod

return None for getDuration() if __animControlDict is empty

Josh Wilson 17 år sedan
förälder
incheckning
9191f85b85
1 ändrade filer med 7 tillägg och 7 borttagningar
  1. 7 7
      direct/src/actor/Actor.py

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

@@ -756,13 +756,13 @@ class Actor(DirectObject, NodePath):
         If no anim is given, find the current anim for the part.
         NOTE: Returns info only for an arbitrary LOD
         """
-        # use the first lod
-        lodName = self.__animControlDict.keys()[0]
-        controls = self.getAnimControls(animName, partName)
-        if len(controls) == 0:
-            return None
-
-        return controls[0].getPlayRate()
+        if self.__animControlDict:
+            # use the first lod
+            lodName = self.__animControlDict.keys()[0]
+            controls = self.getAnimControls(animName, partName)
+            if controls:
+                return controls[0].getPlayRate()
+        return None
 
     def setPlayRate(self, rate, animName, partName=None):
         """setPlayRate(self, float, string, string=None)