Browse Source

Add assert before notify.

aignacio_sf 19 years ago
parent
commit
19eebe69c1
2 changed files with 16 additions and 14 deletions
  1. 6 4
      direct/src/interval/LerpInterval.py
  2. 10 10
      direct/src/showbase/Messenger.py

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

@@ -39,7 +39,7 @@ class LerpNodePathInterval(CLerpNodePathInterval):
         # functor, false if none of them are.  This is used by derived
         # functor, false if none of them are.  This is used by derived
         # classes to determine if a functor was passed in for a
         # classes to determine if a functor was passed in for a
         # parameter.
         # parameter.
-        
+
         for param in params:
         for param in params:
             if callable(param):
             if callable(param):
                 return 1
                 return 1
@@ -107,7 +107,7 @@ class LerpPosInterval(LerpNodePathInterval):
             self.setupParam(self.setEndPos, self.endPos)
             self.setupParam(self.setEndPos, self.endPos)
             self.setupParam(self.setStartPos, self.startPos)
             self.setupParam(self.setStartPos, self.startPos)
         LerpNodePathInterval.privDoEvent(self, t, event)
         LerpNodePathInterval.privDoEvent(self, t, event)
-                
+
 
 
 class LerpHprInterval(LerpNodePathInterval):
 class LerpHprInterval(LerpNodePathInterval):
     def __init__(self, nodePath, duration, hpr,
     def __init__(self, nodePath, duration, hpr,
@@ -630,7 +630,7 @@ class LerpFunctionInterval(Interval.Interval):
             if "%d" in name:
             if "%d" in name:
                 name = name % LerpFunctionInterval.lerpFunctionIntervalNum
                 name = name % LerpFunctionInterval.lerpFunctionIntervalNum
                 LerpFunctionInterval.lerpFunctionIntervalNum += 1
                 LerpFunctionInterval.lerpFunctionIntervalNum += 1
-            
+
         # Initialize superclass
         # Initialize superclass
         Interval.Interval.__init__(self, name, duration)
         Interval.Interval.__init__(self, name, duration)
 
 
@@ -648,8 +648,10 @@ class LerpFunctionInterval(Interval.Interval):
             data = (self.fromData * (1 - bt)) + (self.toData * bt)
             data = (self.fromData * (1 - bt)) + (self.toData * bt)
             # Evaluate function
             # Evaluate function
             apply(self.function, [data] + self.extraArgs)
             apply(self.function, [data] + self.extraArgs)
+
         # Print debug information
         # Print debug information
-        self.notify.debug('updateFunc() - %s: t = %f' % (self.name, t))
+        assert self.notify.debug('updateFunc() - %s: t = %f' % (self.name, t))
+
         self.state = CInterval.SStarted
         self.state = CInterval.SStarted
         self.currT = t
         self.currT = t
 
 

+ 10 - 10
direct/src/showbase/Messenger.py

@@ -72,7 +72,7 @@ class Messenger:
             self.notify.warning(
             self.notify.warning(
                 "object: %s already accepting: %s" %
                 "object: %s already accepting: %s" %
                 (object.__class__.__name__, event))
                 (object.__class__.__name__, event))
-        
+
         acceptorDict[object] = [method, extraArgs, persistent]
         acceptorDict[object] = [method, extraArgs, persistent]
 
 
         # Remember that this object is listening for this event
         # Remember that this object is listening for this event
@@ -159,7 +159,7 @@ class Messenger:
         Send this event, optionally passing in arguments
         Send this event, optionally passing in arguments
         """
         """
         if Messenger.notify.getDebug() and not self.quieting.get(event):
         if Messenger.notify.getDebug() and not self.quieting.get(event):
-            Messenger.notify.debug(
+            assert Messenger.notify.debug(
                 'sent event: ' + event + ' sentArgs: ' + `sentArgs`)
                 'sent event: ' + event + ' sentArgs: ' + `sentArgs`)
         if __debug__:
         if __debug__:
             foundWatch=0
             foundWatch=0
@@ -276,10 +276,10 @@ class Messenger:
             """
             """
             return a matching event (needle) if found (in haystack).
             return a matching event (needle) if found (in haystack).
             This is primarily a debugging tool.
             This is primarily a debugging tool.
-            
+
             This is intended for debugging use only.
             This is intended for debugging use only.
             This function is not defined if python is ran with -O (optimize).
             This function is not defined if python is ran with -O (optimize).
-            
+
             See Also: unwatch
             See Also: unwatch
             """
             """
             if not self.__watching.get(needle):
             if not self.__watching.get(needle):
@@ -290,10 +290,10 @@ class Messenger:
             """
             """
             return a matching event (needle) if found (in haystack).
             return a matching event (needle) if found (in haystack).
             This is primarily a debugging tool.
             This is primarily a debugging tool.
-            
+
             This is intended for debugging use only.
             This is intended for debugging use only.
             This function is not defined if python is ran with -O (optimize).
             This function is not defined if python is ran with -O (optimize).
-            
+
             See Also: watch
             See Also: watch
             """
             """
             if self.__watching.get(needle):
             if self.__watching.get(needle):
@@ -305,10 +305,10 @@ class Messenger:
             When verbose mode is on, don't spam the output with messages
             When verbose mode is on, don't spam the output with messages
             marked as quiet.
             marked as quiet.
             This is primarily a debugging tool.
             This is primarily a debugging tool.
-            
+
             This is intended for debugging use only.
             This is intended for debugging use only.
             This function is not defined if python is ran with -O (optimize).
             This function is not defined if python is ran with -O (optimize).
-            
+
             See Also: unquiet
             See Also: unquiet
             """
             """
             if not self.quieting.get(message):
             if not self.quieting.get(message):
@@ -319,10 +319,10 @@ class Messenger:
             Remove a message from the list of messages that are not reported
             Remove a message from the list of messages that are not reported
             in verbose mode.
             in verbose mode.
             This is primarily a debugging tool.
             This is primarily a debugging tool.
-            
+
             This is intended for debugging use only.
             This is intended for debugging use only.
             This function is not defined if python is ran with -O (optimize).
             This function is not defined if python is ran with -O (optimize).
-            
+
             See Also: quiet
             See Also: quiet
             """
             """
             if self.quieting.get(message):
             if self.quieting.get(message):