From 543c5432f9a4a47cd55a2e875d6749c971f9ca6b Mon Sep 17 00:00:00 2001 From: Joe Shochet Date: Tue, 24 Apr 2001 07:04:08 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/directnotify/Notifier.py | 24 +++++---- direct/src/extensions/NodePath-extensions.py | 54 ++++++++++++-------- direct/src/task/Task.py | 3 ++ 3 files changed, 49 insertions(+), 32 deletions(-) diff --git a/direct/src/directnotify/Notifier.py b/direct/src/directnotify/Notifier.py index 58b37167f0..5a024c818d 100644 --- a/direct/src/directnotify/Notifier.py +++ b/direct/src/directnotify/Notifier.py @@ -2,6 +2,7 @@ for the programmer/user""" from LoggerGlobal import * +import time class Notifier: @@ -23,28 +24,34 @@ class Notifier: self.__debug = 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): """__str__(self) Print handling routine""" return "%s: info = %d, warning = %d, debug = %d, logging = %d" % \ (self.__name, self.__info, self.__warning, self.__debug, self.__logging) - # error funcs def error(self, errorString, exception=StandardError): """error(self, string, Exception=StandardError) Raise an exception with given string and optional type: Exception: error""" - self.__log(str(exception) + ": " + self.__name + ": " + errorString) + str = (self.getTime() + str(exception) + ": " + self.__name + ": " + errorString) + self.__log(str) raise exception(errorString) - # warning funcs def warning(self, warningString): """warning(self, string) Issue the warning message if warn flag is on""" if (self.__warning): - str = ':' + self.__name + '(warning): ' + warningString + str = (self.getTime() + self.__name + '(warning): ' + warningString) self.__log(str) print(str) @@ -58,14 +65,12 @@ class Notifier: Return whether the printing of warning messages is on or off""" return(self.__warning) - - # debug funcs def debug(self, debugString): """debug(self, string) Issue the debug message if debug flag is on""" if (self.__debug): - str = ':' + self.__name + '(debug): ' + debugString + str = (self.getTime() + self.__name + '(debug): ' + debugString) self.__log(str) print(str) @@ -79,14 +84,12 @@ class Notifier: Return whether the printing of debug messages is on or off""" return(self.__debug) - - # info funcs def info(self, infoString): """info(self, string) Print the given informational string, if info flag is on""" if (self.__info): - str = ':' + self.__name + '(info): ' + infoString + str = (self.getTime() + self.__name + '(info): ' + infoString) self.__log(str) print(str) @@ -100,7 +103,6 @@ class Notifier: Enable/Disable informational message printing""" self.__info = bool - # log funcs def __log(self, logEntry): """__log(self, string) diff --git a/direct/src/extensions/NodePath-extensions.py b/direct/src/extensions/NodePath-extensions.py index 93289ab9ee..5a58d9bbc2 100644 --- a/direct/src/extensions/NodePath-extensions.py +++ b/direct/src/extensions/NodePath-extensions.py @@ -443,12 +443,13 @@ raise Exception("Error: NodePath.lerpHpr: bad number of args") 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", string=none, string=none, NodePath=none) 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 # it's individual hpr components if (other != None): @@ -458,14 +459,16 @@ self, startHpr[0], startHpr[1], startHpr[2], h, p, r, other) - functor.takeShortest() + if shortest: + functor.takeShortest() else: startHpr = self.getHpr() functor = HprLerpFunctor.HprLerpFunctor( self, startHpr[0], startHpr[1], startHpr[2], h, p, r) - functor.takeShortest() + if shortest: + functor.takeShortest() return functor #determine whether to use auto, spawned, or blocking lerp if (auto != None): @@ -476,23 +479,26 @@ return self.__lerp(functorFunc, time, blendType) 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, string=none, NodePath=None) 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 # it's a vbase3 hpr if (other != None): # lerp wrt other functor = HprLerpFunctor.HprLerpFunctor( self, (self.getHpr(other)), hpr, other) - functor.takeShortest() + if shortest: + functor.takeShortest() else: functor = HprLerpFunctor.HprLerpFunctor( self, (self.getHpr()), hpr) - functor.takeShortest() + if shortest: + functor.takeShortest() return functor #determine whether to use auto, spawned, or blocking lerp if (auto != None): @@ -586,11 +592,12 @@ raise Exception("Error: NodePath.lerpPosHpr: bad number of args") 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", 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 if (other != None): # lerp wrt other @@ -599,14 +606,16 @@ functor = PosHprLerpFunctor.PosHprLerpFunctor( self, startPos, pos, startHpr, hpr, other) - functor.takeShortest() + if shortest: + functor.takeShortest() else: startPos = self.getPos() startHpr = self.getHpr() functor = PosHprLerpFunctor.PosHprLerpFunctor( self, startPos, pos, startHpr, hpr) - functor.takeShortest() + if shortest: + functor.takeShortest() return functor #determine whether to use auto, spawned, or blocking lerp if (auto != None): @@ -617,12 +626,12 @@ return self.__lerp(functorFunc, time, blendType) 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, string=none, NodePath=None) """ 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 if (other != None): # lerp wrt other @@ -634,7 +643,8 @@ startHpr[0], startHpr[1], startHpr[2], h, p, r, other) - functor.takeShortest() + if shortest: + functor.takeShortest() else: startPos = self.getPos() startHpr = self.getHpr() @@ -643,7 +653,8 @@ startPos[2], x, y, z, startHpr[0], startHpr[1], startHpr[2], h, p, r) - functor.takeShortest() + if shortest: + functor.takeShortest() return functor #determine whether to use auto, spawned, or blocking lerp if (auto != None): @@ -655,14 +666,14 @@ 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", string=none, string=none, NodePath=None) 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 """ def functorFunc(self = self, pos = pos, hpr = hpr, - scale = scale, other = other): + scale = scale, other = other, shortest=shortest): import PosHprScaleLerpFunctor if (other != None): # lerp wrt other @@ -673,7 +684,8 @@ startPos, pos, startHpr, hpr, startScale, scale, other) - functor.takeShortest() + if shortest: + functor.takeShortest() else: startPos = self.getPos() startHpr = self.getHpr() @@ -682,8 +694,8 @@ startPos, pos, startHpr, hpr, startScale, scale) - - functor.takeShortest() + if shortest: + functor.takeShortest() return functor #determine whether to use auto, spawned, or blocking lerp if (auto != None): diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index 17f4d7c48c..e5fd95a897 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -41,6 +41,9 @@ class Task: def getPriority(self): return self._priority + def setPriority(self, pri): + self._priority = pri + def setStartTimeFrame(self, startTime, startFrame): self.starttime = startTime self.startframe = startFrame