From d265ae2a61fc3c8766a4ed801dc3fd72ab380d0a Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Fri, 26 Jan 2007 01:30:12 +0000 Subject: [PATCH] added notNone, put clampScalar in __builtin__ --- direct/src/showbase/PythonUtil.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index ba70ea5470..c0d4dbc6d7 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -2101,6 +2101,12 @@ def tagWithCaller(obj): def isDefaultValue(x): return x == type(x)() +def notNone(A, B): + # returns A if not None, B otherwise + if A is None: + return B + return A + def appendStr(obj, st): """adds a string onto the __str__ output of an instance""" def appendedStr(oldStr, st, self): @@ -2655,3 +2661,5 @@ __builtin__.exceptionLogged = exceptionLogged __builtin__.appendStr = appendStr __builtin__.bound = bound __builtin__.lerp = lerp +__builtin__.notNone = notNone +__builtin__.clampScalar = clampScalar