瀏覽代碼

fix lod watersquirt bug

cxgeorge 23 年之前
父節點
當前提交
f3ecd1b3be
共有 1 個文件被更改,包括 12 次插入7 次删除
  1. 12 7
      direct/src/actor/Actor.py

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

@@ -275,9 +275,12 @@ class Actor(PandaObject, NodePath):
                 for animName, file, animControl in animInfo:
                     print '    Anim:', animName
                     print '      File:', file
-                    print ('      NumFrames: %d PlayRate: %0.2f' %
-                           (animControl.getNumFrames(),
-                            animControl.getPlayRate()))
+                    if animControl == None:
+                        print ' (not loaded)'
+                    else:
+                        print ('      NumFrames: %d PlayRate: %0.2f' %
+                               (animControl.getNumFrames(),
+                                animControl.getPlayRate()))
 
     def cleanup(self):
         """cleanup(self)
@@ -317,7 +320,7 @@ class Actor(PandaObject, NodePath):
     def getPartNames(self):
         """getPartNames(self):
         Return list of Actor part names. If not an multipart actor,
-        returns 'modelRoot' NOTE: returns parts of first LOD"""
+        returns 'modelRoot' NOTE: returns parts of arbitrary LOD"""
         return self.__partBundleDict.values()[0].keys()
     
     def getGeomNode(self):
@@ -428,10 +431,12 @@ class Actor(PandaObject, NodePath):
     def update(self, lod=0):
         """ update(lod)
         """
-        if (lod < len(self.__partBundleDict.values())):
-            partBundles = self.__partBundleDict.values()[lod].values()
+        lodnames = self.getLODNames()
+        if (lod < len(lodnames)):
+            partBundles = self.__partBundleDict[lodnames[lod]].values()
             for partBundle in partBundles:
-                partBundle.node().update()
+                # print "updating: %s" % (partBundle.node())
+                partBundle.node().updateToNow()
         else:
             self.notify.warning('update() - no lod: %d' % lod)