Browse Source

*** empty log message ***

Joe Shochet 25 years ago
parent
commit
543c5432f9

+ 13 - 11
direct/src/directnotify/Notifier.py

@@ -2,6 +2,7 @@
    for the programmer/user"""
    for the programmer/user"""
 
 
 from LoggerGlobal import *
 from LoggerGlobal import *
+import time
 
 
 class Notifier:
 class Notifier:
 
 
@@ -23,28 +24,34 @@ class Notifier:
         self.__debug = 0
         self.__debug = 0
         self.__logging = 0
         self.__logging = 0
 
 
+    def getTime(self):
+        """
+        Return the time as a string suitable for printing at the
+        head of any notify message
+        """
+        return time.strftime(":%m-%d-%Y %H:%M:%S: ", time.localtime(time.time()))
+
     def __str__(self):
     def __str__(self):
         """__str__(self)
         """__str__(self)
         Print handling routine"""
         Print handling routine"""
         return "%s: info = %d, warning = %d, debug = %d, logging = %d" % \
         return "%s: info = %d, warning = %d, debug = %d, logging = %d" % \
                (self.__name, self.__info, self.__warning, self.__debug, self.__logging)
                (self.__name, self.__info, self.__warning, self.__debug, self.__logging)
     
     
-        
     # error funcs
     # error funcs
     def error(self, errorString, exception=StandardError):
     def error(self, errorString, exception=StandardError):
         """error(self, string, Exception=StandardError)
         """error(self, string, Exception=StandardError)
         Raise an exception with given string and optional type:
         Raise an exception with given string and optional type:
         Exception: error"""
         Exception: error"""
-        self.__log(str(exception) + ": " + self.__name + ": " + errorString)
+        str = (self.getTime() + str(exception) + ": " + self.__name + ": " + errorString)
+        self.__log(str)
         raise exception(errorString)
         raise exception(errorString)
 
 
-
     # warning funcs
     # warning funcs
     def warning(self, warningString):
     def warning(self, warningString):
         """warning(self, string)
         """warning(self, string)
         Issue the warning message if warn flag is on"""
         Issue the warning message if warn flag is on"""
         if (self.__warning):
         if (self.__warning):
-            str = ':' + self.__name + '(warning): ' + warningString
+            str = (self.getTime() + self.__name + '(warning): ' + warningString)
             self.__log(str)
             self.__log(str)
             print(str)
             print(str)
 
 
@@ -58,14 +65,12 @@ class Notifier:
         Return whether the printing of warning messages is on or off"""
         Return whether the printing of warning messages is on or off"""
         return(self.__warning)
         return(self.__warning)
 
 
-
-
     # debug funcs
     # debug funcs
     def debug(self, debugString):
     def debug(self, debugString):
         """debug(self, string)
         """debug(self, string)
         Issue the debug message if debug flag is on"""
         Issue the debug message if debug flag is on"""
         if (self.__debug):
         if (self.__debug):
-            str = ':' + self.__name + '(debug): ' + debugString
+            str = (self.getTime() + self.__name + '(debug): ' + debugString)
             self.__log(str)
             self.__log(str)
             print(str)
             print(str)
 
 
@@ -79,14 +84,12 @@ class Notifier:
         Return whether the printing of debug messages is on or off"""
         Return whether the printing of debug messages is on or off"""
         return(self.__debug)
         return(self.__debug)
 
 
-
-
     # info funcs
     # info funcs
     def info(self, infoString):
     def info(self, infoString):
         """info(self, string)
         """info(self, string)
         Print the given informational string, if info flag is on"""
         Print the given informational string, if info flag is on"""
         if (self.__info):
         if (self.__info):
-            str = ':' + self.__name + '(info): ' + infoString
+            str = (self.getTime() + self.__name + '(info): ' + infoString)
             self.__log(str)
             self.__log(str)
             print(str)
             print(str)
 
 
@@ -100,7 +103,6 @@ class Notifier:
         Enable/Disable informational message  printing"""
         Enable/Disable informational message  printing"""
         self.__info = bool
         self.__info = bool
 
 
-
     # log funcs
     # log funcs
     def __log(self, logEntry):
     def __log(self, logEntry):
         """__log(self, string)
         """__log(self, string)

+ 33 - 21
direct/src/extensions/NodePath-extensions.py

@@ -443,12 +443,13 @@
             raise Exception("Error: NodePath.lerpHpr: bad number of args")
             raise Exception("Error: NodePath.lerpHpr: bad number of args")
     
     
     def lerpHprHPR(self, h, p, r, time, other=None,
     def lerpHprHPR(self, h, p, r, time, other=None,
-                   blendType="noBlend", auto=None, task=None):
+                   blendType="noBlend", auto=None, task=None, shortest=1):
         """lerpHprHPR(self, float, float, float, float, string="noBlend",
         """lerpHprHPR(self, float, float, float, float, string="noBlend",
         string=none, string=none, NodePath=none)
         string=none, string=none, NodePath=none)
         Perform a hpr lerp with three floats as the end point
         Perform a hpr lerp with three floats as the end point
         """
         """
-        def functorFunc(self = self, h = h, p = p, r = r, other = other):
+        def functorFunc(self = self, h = h, p = p, r = r,
+                        other = other, shortest=shortest):
             import HprLerpFunctor
             import HprLerpFunctor
             # it's individual hpr components
             # it's individual hpr components
             if (other != None):
             if (other != None):
@@ -458,14 +459,16 @@
                     self,
                     self,
                     startHpr[0], startHpr[1], startHpr[2],
                     startHpr[0], startHpr[1], startHpr[2],
                     h, p, r, other)
                     h, p, r, other)
-                functor.takeShortest()
+                if shortest:
+                    functor.takeShortest()
             else:
             else:
                 startHpr = self.getHpr()
                 startHpr = self.getHpr()
                 functor = HprLerpFunctor.HprLerpFunctor(
                 functor = HprLerpFunctor.HprLerpFunctor(
                     self,
                     self,
                     startHpr[0], startHpr[1], startHpr[2],
                     startHpr[0], startHpr[1], startHpr[2],
                     h, p, r)
                     h, p, r)
-                functor.takeShortest()
+                if shortest:
+                    functor.takeShortest()
             return functor
             return functor
         #determine whether to use auto, spawned, or blocking lerp
         #determine whether to use auto, spawned, or blocking lerp
         if (auto != None):
         if (auto != None):
@@ -476,23 +479,26 @@
             return self.__lerp(functorFunc, time, blendType)
             return self.__lerp(functorFunc, time, blendType)
     
     
     def lerpHprVBase3(self, hpr, time, other=None,
     def lerpHprVBase3(self, hpr, time, other=None,
-                      blendType="noBlend", auto=None, task=None):
+                      blendType="noBlend", auto=None, task=None, shortest=1):
         """lerpHprVBase3(self, VBase3, float, string="noBlend", string=none,
         """lerpHprVBase3(self, VBase3, float, string="noBlend", string=none,
         string=none, NodePath=None)
         string=none, NodePath=None)
         Perform a hpr lerp with a VBase3 as the end point
         Perform a hpr lerp with a VBase3 as the end point
         """
         """
-        def functorFunc(self = self, hpr = hpr, other = other):
+        def functorFunc(self = self, hpr = hpr,
+                        other = other, shortest=shortest):
             import HprLerpFunctor
             import HprLerpFunctor
             # it's a vbase3 hpr
             # it's a vbase3 hpr
             if (other != None):
             if (other != None):
                 # lerp wrt other
                 # lerp wrt other
                 functor = HprLerpFunctor.HprLerpFunctor(
                 functor = HprLerpFunctor.HprLerpFunctor(
                     self, (self.getHpr(other)), hpr, other)
                     self, (self.getHpr(other)), hpr, other)
-                functor.takeShortest()
+                if shortest:
+                    functor.takeShortest()
             else:
             else:
                 functor = HprLerpFunctor.HprLerpFunctor(
                 functor = HprLerpFunctor.HprLerpFunctor(
                     self, (self.getHpr()), hpr)
                     self, (self.getHpr()), hpr)
-                functor.takeShortest()
+                if shortest:
+                    functor.takeShortest()
             return functor
             return functor
         #determine whether to use auto, spawned, or blocking lerp
         #determine whether to use auto, spawned, or blocking lerp
         if (auto != None):
         if (auto != None):
@@ -586,11 +592,12 @@
             raise Exception("Error: NodePath.lerpPosHpr: bad number of args")
             raise Exception("Error: NodePath.lerpPosHpr: bad number of args")
 
 
     def lerpPosHprPoint3VBase3(self, pos, hpr, time, other=None,
     def lerpPosHprPoint3VBase3(self, pos, hpr, time, other=None,
-                               blendType="noBlend", auto=None, task=None):
+                               blendType="noBlend", auto=None, task=None, shortest=1):
         """lerpPosHprPoint3VBase3(self, Point3, VBase3, string="noBlend",
         """lerpPosHprPoint3VBase3(self, Point3, VBase3, string="noBlend",
         string=none, string=none, NodePath=None)
         string=none, string=none, NodePath=None)
         """
         """
-        def functorFunc(self = self, pos = pos, hpr = hpr, other = other):
+        def functorFunc(self = self, pos = pos, hpr = hpr,
+                        other = other, shortest=shortest):
             import PosHprLerpFunctor
             import PosHprLerpFunctor
             if (other != None):
             if (other != None):
                 # lerp wrt other
                 # lerp wrt other
@@ -599,14 +606,16 @@
                 functor = PosHprLerpFunctor.PosHprLerpFunctor(
                 functor = PosHprLerpFunctor.PosHprLerpFunctor(
                     self, startPos, pos,
                     self, startPos, pos,
                     startHpr, hpr, other)
                     startHpr, hpr, other)
-                functor.takeShortest()
+                if shortest:
+                    functor.takeShortest()
             else:
             else:
                 startPos = self.getPos()
                 startPos = self.getPos()
                 startHpr = self.getHpr()
                 startHpr = self.getHpr()
                 functor = PosHprLerpFunctor.PosHprLerpFunctor(
                 functor = PosHprLerpFunctor.PosHprLerpFunctor(
                     self, startPos, pos,
                     self, startPos, pos,
                     startHpr, hpr)
                     startHpr, hpr)
-                functor.takeShortest()
+                if shortest:
+                    functor.takeShortest()
             return functor
             return functor
         #determine whether to use auto, spawned, or blocking lerp
         #determine whether to use auto, spawned, or blocking lerp
         if (auto != None):
         if (auto != None):
@@ -617,12 +626,12 @@
             return self.__lerp(functorFunc, time, blendType)
             return self.__lerp(functorFunc, time, blendType)
 
 
     def lerpPosHprXYZHPR(self, x, y, z, h, p, r, time, other=None,
     def lerpPosHprXYZHPR(self, x, y, z, h, p, r, time, other=None,
-                         blendType="noBlend", auto=None, task=None):
+                         blendType="noBlend", auto=None, task=None, shortest=1):
         """lerpPosHpr(self, float, string="noBlend", string=none,
         """lerpPosHpr(self, float, string="noBlend", string=none,
         string=none, NodePath=None)
         string=none, NodePath=None)
         """
         """
         def functorFunc(self = self, x = x, y = y, z = z,
         def functorFunc(self = self, x = x, y = y, z = z,
-                        h = h, p = p, r = r, other = other):
+                        h = h, p = p, r = r, other = other, shortest=shortest):
             import PosHprLerpFunctor
             import PosHprLerpFunctor
             if (other != None):
             if (other != None):
                 # lerp wrt other
                 # lerp wrt other
@@ -634,7 +643,8 @@
                                             startHpr[0], startHpr[1],
                                             startHpr[0], startHpr[1],
                                             startHpr[2], h, p, r,
                                             startHpr[2], h, p, r,
                                             other)
                                             other)
-                functor.takeShortest()
+                if shortest:
+                    functor.takeShortest()
             else:
             else:
                 startPos = self.getPos()
                 startPos = self.getPos()
                 startHpr = self.getHpr()
                 startHpr = self.getHpr()
@@ -643,7 +653,8 @@
                                             startPos[2], x, y, z,
                                             startPos[2], x, y, z,
                                             startHpr[0], startHpr[1],
                                             startHpr[0], startHpr[1],
                                             startHpr[2], h, p, r)
                                             startHpr[2], h, p, r)
-                functor.takeShortest()
+                if shortest:
+                    functor.takeShortest()
             return functor
             return functor
         #determine whether to use auto, spawned, or blocking lerp
         #determine whether to use auto, spawned, or blocking lerp
         if (auto != None):
         if (auto != None):
@@ -655,14 +666,14 @@
 
 
 
 
     def lerpPosHprScale(self, pos, hpr, scale, time, other=None,
     def lerpPosHprScale(self, pos, hpr, scale, time, other=None,
-                        blendType="noBlend", auto=None, task=None):
+                        blendType="noBlend", auto=None, task=None, shortest=1):
         """lerpPosHpr(self, Point3, VBase3, float, float, string="noBlend",
         """lerpPosHpr(self, Point3, VBase3, float, float, string="noBlend",
         string=none, string=none, NodePath=None)
         string=none, string=none, NodePath=None)
         Only one case, no need for extra args. Call the appropriate lerp
         Only one case, no need for extra args. Call the appropriate lerp
         (auto, spawned, or blocking) based on how(if) a task name is given
         (auto, spawned, or blocking) based on how(if) a task name is given
         """
         """
         def functorFunc(self = self, pos = pos, hpr = hpr,
         def functorFunc(self = self, pos = pos, hpr = hpr,
-                        scale = scale, other = other):
+                        scale = scale, other = other, shortest=shortest):
             import PosHprScaleLerpFunctor
             import PosHprScaleLerpFunctor
             if (other != None):
             if (other != None):
                 # lerp wrt other
                 # lerp wrt other
@@ -673,7 +684,8 @@
                                                  startPos, pos,
                                                  startPos, pos,
                                                  startHpr, hpr,
                                                  startHpr, hpr,
                                                  startScale, scale, other)
                                                  startScale, scale, other)
-                functor.takeShortest()
+                if shortest:
+                    functor.takeShortest()
             else:
             else:
                 startPos = self.getPos()
                 startPos = self.getPos()
                 startHpr = self.getHpr()
                 startHpr = self.getHpr()
@@ -682,8 +694,8 @@
                                                  startPos, pos,
                                                  startPos, pos,
                                                  startHpr, hpr,
                                                  startHpr, hpr,
                                                  startScale, scale)
                                                  startScale, scale)
-
-                functor.takeShortest()
+                if shortest:
+                    functor.takeShortest()
             return functor
             return functor
         #determine whether to use auto, spawned, or blocking lerp
         #determine whether to use auto, spawned, or blocking lerp
         if (auto != None):
         if (auto != None):

+ 3 - 0
direct/src/task/Task.py

@@ -41,6 +41,9 @@ class Task:
     def getPriority(self):
     def getPriority(self):
         return self._priority
         return self._priority
 
 
+    def setPriority(self, pri):
+        self._priority = pri
+
     def setStartTimeFrame(self, startTime, startFrame):
     def setStartTimeFrame(self, startTime, startFrame):
         self.starttime = startTime
         self.starttime = startTime
         self.startframe = startFrame
         self.startframe = startFrame