瀏覽代碼

*** empty log message ***

Mark Mine 24 年之前
父節點
當前提交
bec411d2c3
共有 1 個文件被更改,包括 5 次插入4 次删除
  1. 5 4
      direct/src/interval/LerpInterval.py

+ 5 - 4
direct/src/interval/LerpInterval.py

@@ -242,7 +242,7 @@ class LerpFunctionInterval(Interval):
     lerpFunctionIntervalNum = 1
     lerpFunctionIntervalNum = 1
     # Class methods
     # Class methods
     def __init__(self, function, fromData = 0, toData = 1, duration = 0.0,
     def __init__(self, function, fromData = 0, toData = 1, duration = 0.0,
-                 blendType = 'noBlend', name = None):
+                 blendType = 'noBlend', extraArgs = [], name = None):
         """__init__(function, duration, fromData, toData, name)
         """__init__(function, duration, fromData, toData, name)
         """
         """
         # Record instance variables
         # Record instance variables
@@ -250,6 +250,7 @@ class LerpFunctionInterval(Interval):
         self.fromData = fromData
         self.fromData = fromData
         self.toData = toData
         self.toData = toData
 	self.blendType = self.getBlend(blendType)
 	self.blendType = self.getBlend(blendType)
+        self.extraArgs = extraArgs
         # Generate unique name if necessary
         # Generate unique name if necessary
 	if (name == None):
 	if (name == None):
 	    name = ('LerpFunctionInterval-%d' %
 	    name = ('LerpFunctionInterval-%d' %
@@ -263,17 +264,17 @@ class LerpFunctionInterval(Interval):
         # Evaluate the function
         # Evaluate the function
         if (t >= self.duration):
         if (t >= self.duration):
             # Set to end value
             # Set to end value
-	    self.function(self.toData)            
+	    apply(self.function, [self.toData] + self.extraArgs)
         else:
         else:
             # In the middle of the lerp, compute appropriate blended value
             # In the middle of the lerp, compute appropriate blended value
             try:
             try:
                 bt = self.blendType(t/self.duration)
                 bt = self.blendType(t/self.duration)
                 data = (self.fromData * (1 - bt)) + (self.toData * bt)
                 data = (self.fromData * (1 - bt)) + (self.toData * bt)
                 # Evaluate function
                 # Evaluate function
-                self.function(data)
+                apply(self.function, [data] + self.extraArgs)
             except ZeroDivisionError:
             except ZeroDivisionError:
                 # Zero duration, just use endpoint
                 # Zero duration, just use endpoint
-                self.function(self.toData)
+                apply(self.function, [self.toData] + self.extraArgs)
     def getBlend(self, blendType):
     def getBlend(self, blendType):
         """__getBlend(self, string)
         """__getBlend(self, string)
         Return the C++ blend class corresponding to blendType string
         Return the C++ blend class corresponding to blendType string