Ver código fonte

generalize enableBlend()

David Rose 23 anos atrás
pai
commit
e229adcd80
1 arquivos alterados com 4 adições e 13 exclusões
  1. 4 13
      direct/src/actor/Actor.py

+ 4 - 13
direct/src/actor/Actor.py

@@ -934,7 +934,7 @@ class Actor(PandaObject, NodePath):
         for control in self.getAnimControls(animName, partName, lodName):
         for control in self.getAnimControls(animName, partName, lodName):
             control.pose(frame)
             control.pose(frame)
 
 
-    def enableBlend(self, partName = None):
+    def enableBlend(self, blendType = PartBundle.BTNormalizedLinear, partName = None):
         """Enables blending of multiple animations simultaneously.
         """Enables blending of multiple animations simultaneously.
         After this is called, you may call play(), loop(), or pose()
         After this is called, you may call play(), loop(), or pose()
         on multiple animations and have all of them contribute to the
         on multiple animations and have all of them contribute to the
@@ -949,11 +949,11 @@ class Actor(PandaObject, NodePath):
         for lodName, bundleDict in self.__partBundleDict.items():
         for lodName, bundleDict in self.__partBundleDict.items():
             if partName == None:
             if partName == None:
                 for partBundle in bundleDict.values():
                 for partBundle in bundleDict.values():
-                    partBundle.node().getBundle().setBlendType(PartBundle.BTNormalizedLinear)
+                    partBundle.node().getBundle().setBlendType(blendType)
             else:
             else:
                 partBundle = bundleDict.get(partName)
                 partBundle = bundleDict.get(partName)
                 if partBundle != None:
                 if partBundle != None:
-                    partBundle.node().getBundle().setBlendType(PartBundle.BTNormalizedLinear)
+                    partBundle.node().getBundle().setBlendType(blendType)
                 else:
                 else:
                     Actor.notify.warning("Couldn't find part: %s" % (partName))
                     Actor.notify.warning("Couldn't find part: %s" % (partName))
 
 
@@ -961,16 +961,7 @@ class Actor(PandaObject, NodePath):
         """ Restores normal one-animation-at-a-time operation after a
         """ Restores normal one-animation-at-a-time operation after a
         previous call to enableBlend().
         previous call to enableBlend().
         """
         """
-        for lodName, bundleDict in self.__partBundleDict.items():
-            if partName == None:
-                for partBundle in bundleDict.values():
-                    partBundle.node().getBundle().setBlendType(PartBundle.BTSingle)
-            else:
-                partBundle = bundleDict.get(partName)
-                if partBundle != None:
-                    partBundle.node().getBundle().setBlendType(PartBundle.BTSingle)
-                else:
-                    Actor.notify.warning("Couldn't find part: %s" % (partName))
+        self.enableBlend(PartBundle.BTSingle, partName)
 
 
     def setControlEffect(self, animName, effect,
     def setControlEffect(self, animName, effect,
                          partName = None, lodName = None):
                          partName = None, lodName = None):