|
|
@@ -10,22 +10,16 @@ of the NodePath class
|
|
|
|
|
|
####################################################################
|
|
|
def id(self):
|
|
|
- """Returns a unique id identifying the NodePath instance"""
|
|
|
- print "Warning: NodePath.id() is deprecated. Use hash(NodePath) or NodePath.get_key() instead."
|
|
|
+ """Deprecated. Returns a unique id identifying the NodePath instance"""
|
|
|
+ print("Warning: NodePath.id() is deprecated. Use hash(NodePath) or NodePath.get_key() instead.")
|
|
|
return self.getKey()
|
|
|
|
|
|
Dtool_funcToMethod(id, NodePath)
|
|
|
del id
|
|
|
#####################################################################
|
|
|
-
|
|
|
-## def __hash__(self): // inside c code
|
|
|
-## return self.getKey()
|
|
|
-#####################################################################
|
|
|
-
|
|
|
- # For iterating over children
|
|
|
def getChildrenAsList(self):
|
|
|
- """Converts a node path's child NodePathCollection into a list"""
|
|
|
- print "Warning: NodePath.getChildrenAsList() is deprecated. Use get_children() instead."
|
|
|
+ """Deprecated. Converts a node path's child NodePathCollection into a list"""
|
|
|
+ print("Warning: NodePath.getChildrenAsList() is deprecated. Use get_children() instead.")
|
|
|
return list(self.getChildren())
|
|
|
|
|
|
Dtool_funcToMethod(getChildrenAsList, NodePath)
|
|
|
@@ -35,7 +29,7 @@ del getChildrenAsList
|
|
|
def printChildren(self):
|
|
|
"""Prints out the children of the bottom node of a node path"""
|
|
|
for child in self.getChildren():
|
|
|
- print child.getName()
|
|
|
+ print(child.getName())
|
|
|
Dtool_funcToMethod(printChildren, NodePath)
|
|
|
del printChildren
|
|
|
#####################################################################
|
|
|
@@ -95,8 +89,8 @@ del isolate
|
|
|
#####################################################################
|
|
|
|
|
|
def remove(self):
|
|
|
- """Remove a node path from the scene graph"""
|
|
|
- print "Warning: NodePath.remove() is deprecated. Use remove_node() instead."
|
|
|
+ """Deprecated. Remove a node path from the scene graph"""
|
|
|
+ print("Warning: NodePath.remove() is deprecated. Use remove_node() instead.")
|
|
|
# Send message in case anyone needs to do something
|
|
|
# before node is deleted
|
|
|
messenger.send('preRemoveNodePath', [self])
|
|
|
@@ -109,11 +103,11 @@ del remove
|
|
|
def lsNames(self):
|
|
|
"""Walk down a tree and print out the path"""
|
|
|
if self.isEmpty():
|
|
|
- print "(empty)"
|
|
|
+ print("(empty)")
|
|
|
else:
|
|
|
type = self.node().getType().getName()
|
|
|
name = self.getName()
|
|
|
- print type + " " + name
|
|
|
+ print(type + " " + name)
|
|
|
self.lsNamesRecurse()
|
|
|
|
|
|
Dtool_funcToMethod(lsNames, NodePath)
|
|
|
@@ -124,7 +118,7 @@ def lsNamesRecurse(self, indentString=' '):
|
|
|
for nodePath in self.getChildren():
|
|
|
type = nodePath.node().getType().getName()
|
|
|
name = nodePath.getName()
|
|
|
- print indentString + type + " " + name
|
|
|
+ print(indentString + type + " " + name)
|
|
|
nodePath.lsNamesRecurse(indentString + " ")
|
|
|
|
|
|
Dtool_funcToMethod(lsNamesRecurse, NodePath)
|
|
|
@@ -138,7 +132,7 @@ def reverseLsNames(self):
|
|
|
for nodePath in ancestry:
|
|
|
type = nodePath.node().getType().getName()
|
|
|
name = nodePath.getName()
|
|
|
- print indentString + type + " " + name
|
|
|
+ print(indentString + type + " " + name)
|
|
|
indentString = indentString + " "
|
|
|
|
|
|
Dtool_funcToMethod(reverseLsNames, NodePath)
|
|
|
@@ -146,7 +140,7 @@ del reverseLsNames
|
|
|
#####################################################################
|
|
|
def getAncestry(self):
|
|
|
"""Get a list of a node path's ancestors"""
|
|
|
- print "NodePath.getAncestry() is deprecated. Use get_ancestors() instead."""
|
|
|
+ print("NodePath.getAncestry() is deprecated. Use get_ancestors() instead.""")
|
|
|
ancestors = list(self.getAncestors())
|
|
|
ancestors.reverse()
|
|
|
return ancestors
|
|
|
@@ -197,11 +191,11 @@ def printPos(self, other = None, sd = 2):
|
|
|
else:
|
|
|
pos = self.getPos()
|
|
|
otherString = ''
|
|
|
- print (self.getName() + '.setPos(' + otherString +
|
|
|
+ print((self.getName() + '.setPos(' + otherString +
|
|
|
formatString % pos[0] + ', ' +
|
|
|
formatString % pos[1] + ', ' +
|
|
|
formatString % pos[2] +
|
|
|
- ')\n')
|
|
|
+ ')\n'))
|
|
|
Dtool_funcToMethod(printPos, NodePath)
|
|
|
del printPos
|
|
|
#####################################################################
|
|
|
@@ -215,11 +209,11 @@ def printHpr(self, other = None, sd = 2):
|
|
|
else:
|
|
|
hpr = self.getHpr()
|
|
|
otherString = ''
|
|
|
- print (self.getName() + '.setHpr(' + otherString +
|
|
|
+ print((self.getName() + '.setHpr(' + otherString +
|
|
|
formatString % hpr[0] + ', ' +
|
|
|
formatString % hpr[1] + ', ' +
|
|
|
formatString % hpr[2] +
|
|
|
- ')\n')
|
|
|
+ ')\n'))
|
|
|
Dtool_funcToMethod(printHpr, NodePath)
|
|
|
del printHpr
|
|
|
#####################################################################
|
|
|
@@ -233,11 +227,11 @@ def printScale(self, other = None, sd = 2):
|
|
|
else:
|
|
|
scale = self.getScale()
|
|
|
otherString = ''
|
|
|
- print (self.getName() + '.setScale(' + otherString +
|
|
|
+ print((self.getName() + '.setScale(' + otherString +
|
|
|
formatString % scale[0] + ', ' +
|
|
|
formatString % scale[1] + ', ' +
|
|
|
formatString % scale[2] +
|
|
|
- ')\n')
|
|
|
+ ')\n'))
|
|
|
|
|
|
Dtool_funcToMethod(printScale, NodePath)
|
|
|
del printScale
|
|
|
@@ -253,14 +247,14 @@ def printPosHpr(self, other = None, sd = 2):
|
|
|
pos = self.getPos()
|
|
|
hpr = self.getHpr()
|
|
|
otherString = ''
|
|
|
- print (self.getName() + '.setPosHpr(' + otherString +
|
|
|
+ print((self.getName() + '.setPosHpr(' + otherString +
|
|
|
formatString % pos[0] + ', ' +
|
|
|
formatString % pos[1] + ', ' +
|
|
|
formatString % pos[2] + ', ' +
|
|
|
formatString % hpr[0] + ', ' +
|
|
|
formatString % hpr[1] + ', ' +
|
|
|
formatString % hpr[2] +
|
|
|
- ')\n')
|
|
|
+ ')\n'))
|
|
|
|
|
|
Dtool_funcToMethod(printPosHpr, NodePath)
|
|
|
del printPosHpr
|
|
|
@@ -278,7 +272,7 @@ def printPosHprScale(self, other = None, sd = 2):
|
|
|
hpr = self.getHpr()
|
|
|
scale = self.getScale()
|
|
|
otherString = ''
|
|
|
- print (self.getName() + '.setPosHprScale(' + otherString +
|
|
|
+ print((self.getName() + '.setPosHprScale(' + otherString +
|
|
|
formatString % pos[0] + ', ' +
|
|
|
formatString % pos[1] + ', ' +
|
|
|
formatString % pos[2] + ', ' +
|
|
|
@@ -288,14 +282,14 @@ def printPosHprScale(self, other = None, sd = 2):
|
|
|
formatString % scale[0] + ', ' +
|
|
|
formatString % scale[1] + ', ' +
|
|
|
formatString % scale[2] +
|
|
|
- ')\n')
|
|
|
+ ')\n'))
|
|
|
|
|
|
Dtool_funcToMethod(printPosHprScale, NodePath)
|
|
|
del printPosHprScale
|
|
|
#####################################################################
|
|
|
|
|
|
def printTransform(self, other = None, sd = 2, fRecursive = 0):
|
|
|
- from pandac.PandaModules import Vec3
|
|
|
+ from panda3d.core import Vec3
|
|
|
fmtStr = '%%0.%df' % sd
|
|
|
name = self.getName()
|
|
|
if other == None:
|
|
|
@@ -306,23 +300,23 @@ def printTransform(self, other = None, sd = 2, fRecursive = 0):
|
|
|
pos = transform.getPos()
|
|
|
if not pos.almostEqual(Vec3(0)):
|
|
|
outputString = '%s.setPos(%s, %s, %s)' % (name, fmtStr, fmtStr, fmtStr)
|
|
|
- print outputString % (pos[0], pos[1], pos[2])
|
|
|
+ print(outputString % (pos[0], pos[1], pos[2]))
|
|
|
if transform.hasHpr():
|
|
|
hpr = transform.getHpr()
|
|
|
if not hpr.almostEqual(Vec3(0)):
|
|
|
outputString = '%s.setHpr(%s, %s, %s)' % (name, fmtStr, fmtStr, fmtStr)
|
|
|
- print outputString % (hpr[0], hpr[1], hpr[2])
|
|
|
+ print(outputString % (hpr[0], hpr[1], hpr[2]))
|
|
|
if transform.hasScale():
|
|
|
if transform.hasUniformScale():
|
|
|
scale = transform.getUniformScale()
|
|
|
if scale != 1.0:
|
|
|
outputString = '%s.setScale(%s)' % (name, fmtStr)
|
|
|
- print outputString % scale
|
|
|
+ print(outputString % scale)
|
|
|
else:
|
|
|
scale = transform.getScale()
|
|
|
if not scale.almostEqual(Vec3(1)):
|
|
|
outputString = '%s.setScale(%s, %s, %s)' % (name, fmtStr, fmtStr, fmtStr)
|
|
|
- print outputString % (scale[0], scale[1], scale[2])
|
|
|
+ print(outputString % (scale[0], scale[1], scale[2]))
|
|
|
if fRecursive:
|
|
|
for child in self.getChildren():
|
|
|
child.printTransform(other, sd, fRecursive)
|
|
|
@@ -383,700 +377,6 @@ def iPosHprScale(self, other = None):
|
|
|
Dtool_funcToMethod(iPosHprScale, NodePath)
|
|
|
del iPosHprScale
|
|
|
#####################################################################
|
|
|
-
|
|
|
-def __lerp(self, functorFunc, duration, blendType, taskName=None):
|
|
|
- """
|
|
|
- __lerp(self, functorFunc, float, string, string)
|
|
|
- Basic lerp functionality used by other lerps.
|
|
|
- Fire off a lerp. Make it a task if taskName given.
|
|
|
- """
|
|
|
- # functorFunc is a function which can be called to create a functor.
|
|
|
- # functor creation is defered so initial state (sampled in functorFunc)
|
|
|
- # will be appropriate for the time the lerp is spawned
|
|
|
- from direct.task import Task
|
|
|
- from direct.interval import LerpBlendHelpers
|
|
|
- from direct.task.TaskManagerGlobal import taskMgr
|
|
|
-
|
|
|
- # make the task function
|
|
|
- def lerpTaskFunc(task):
|
|
|
- from pandac.PandaModules import Lerp
|
|
|
- from pandac.PandaModules import ClockObject
|
|
|
- from direct.task.Task import Task, cont, done
|
|
|
- if task.init == 1:
|
|
|
- # make the lerp
|
|
|
- functor = task.functorFunc()
|
|
|
- task.lerp = Lerp(functor, task.duration, task.blendType)
|
|
|
- task.init = 0
|
|
|
- dt = globalClock.getDt()
|
|
|
- task.lerp.setStepSize(dt)
|
|
|
- task.lerp.step()
|
|
|
- if (task.lerp.isDone()):
|
|
|
- # Reset the init flag, in case the task gets re-used
|
|
|
- task.init = 1
|
|
|
- return(done)
|
|
|
- else:
|
|
|
- return(cont)
|
|
|
-
|
|
|
- # make the lerp task
|
|
|
- lerpTask = Task.Task(lerpTaskFunc)
|
|
|
- lerpTask.init = 1
|
|
|
- lerpTask.functorFunc = functorFunc
|
|
|
- lerpTask.duration = duration
|
|
|
- lerpTask.blendType = LerpBlendHelpers.getBlend(blendType)
|
|
|
-
|
|
|
- if (taskName == None):
|
|
|
- # don't spawn a task, return one instead
|
|
|
- return lerpTask
|
|
|
- else:
|
|
|
- # spawn the lerp task
|
|
|
- taskMgr.add(lerpTask, taskName)
|
|
|
- return lerpTask
|
|
|
-
|
|
|
-Dtool_funcToMethod(__lerp, NodePath)
|
|
|
-del __lerp
|
|
|
-#####################################################################
|
|
|
-def __autoLerp(self, functorFunc, time, blendType, taskName):
|
|
|
- """_autoLerp(self, functor, float, string, string)
|
|
|
- This lerp uses C++ to handle the stepping. Bonus is
|
|
|
- its more efficient, trade-off is there is less control"""
|
|
|
- from pandac.PandaModules import AutonomousLerp
|
|
|
- from direct.interval import LerpBlendHelpers
|
|
|
- # make a lerp that lives in C++ land
|
|
|
- functor = functorFunc()
|
|
|
- lerp = AutonomousLerp(functor, time,
|
|
|
- LerpBlendHelpers.getBlend(blendType),
|
|
|
- base.eventHandler)
|
|
|
- lerp.start()
|
|
|
- return lerp
|
|
|
-
|
|
|
-Dtool_funcToMethod(__autoLerp, NodePath)
|
|
|
-del __autoLerp
|
|
|
-#####################################################################
|
|
|
-
|
|
|
-# user callable lerp methods
|
|
|
-def lerpColor(self, *posArgs, **keyArgs):
|
|
|
- """lerpColor(self, *positionArgs, **keywordArgs)
|
|
|
- determine which lerpColor* to call based on arguments
|
|
|
- """
|
|
|
- if (len(posArgs) == 2):
|
|
|
- return apply(self.lerpColorVBase4, posArgs, keyArgs)
|
|
|
- elif (len(posArgs) == 3):
|
|
|
- return apply(self.lerpColorVBase4VBase4, posArgs, keyArgs)
|
|
|
- elif (len(posArgs) == 5):
|
|
|
- return apply(self.lerpColorRGBA, posArgs, keyArgs)
|
|
|
- elif (len(posArgs) == 9):
|
|
|
- return apply(self.lerpColorRGBARGBA, posArgs, keyArgs)
|
|
|
- else:
|
|
|
- # bad args
|
|
|
- raise Exception("Error: NodePath.lerpColor: bad number of args")
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpColor, NodePath)
|
|
|
-del lerpColor
|
|
|
-#####################################################################
|
|
|
-
|
|
|
-def lerpColorRGBA(self, r, g, b, a, time,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpColorRGBA(self, float, float, float, float, float,
|
|
|
- string="noBlend", string=none, string=none)
|
|
|
- """
|
|
|
- def functorFunc(self = self, r = r, g = g, b = b, a = a):
|
|
|
- from pandac.PandaModules import ColorLerpFunctor
|
|
|
- # just end rgba values, use current color rgba values for start
|
|
|
- startColor = self.getColor()
|
|
|
- functor = ColorLerpFunctor(
|
|
|
- self,
|
|
|
- startColor[0], startColor[1],
|
|
|
- startColor[2], startColor[3],
|
|
|
- r, g, b, a)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpColorRGBA, NodePath)
|
|
|
-del lerpColorRGBA
|
|
|
-#####################################################################
|
|
|
-def lerpColorRGBARGBA(self, sr, sg, sb, sa, er, eg, eb, ea, time,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpColorRGBARGBA(self, float, float, float, float, float,
|
|
|
- float, float, float, float, string="noBlend", string=none, string=none)
|
|
|
- """
|
|
|
- def functorFunc(self = self, sr = sr, sg = sg, sb = sb, sa = sa,
|
|
|
- er = er, eg = eg, eb = eb, ea = ea):
|
|
|
- from pandac.PandaModules import ColorLerpFunctor
|
|
|
- # start and end rgba values
|
|
|
- functor = ColorLerpFunctor(self, sr, sg, sb, sa,
|
|
|
- er, eg, eb, ea)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpColorRGBARGBA, NodePath)
|
|
|
-del lerpColorRGBARGBA
|
|
|
-#####################################################################
|
|
|
-def lerpColorVBase4(self, endColor, time,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpColorVBase4(self, VBase4, float, string="noBlend", string=none,
|
|
|
- string=none)
|
|
|
- """
|
|
|
- def functorFunc(self = self, endColor = endColor):
|
|
|
- from pandac.PandaModules import ColorLerpFunctor
|
|
|
- # just end vec4, use current color for start
|
|
|
- startColor = self.getColor()
|
|
|
- functor = ColorLerpFunctor(
|
|
|
- self, startColor, endColor)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpColorVBase4, NodePath)
|
|
|
-del lerpColorVBase4
|
|
|
-#####################################################################
|
|
|
-def lerpColorVBase4VBase4(self, startColor, endColor, time,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpColorVBase4VBase4(self, VBase4, VBase4, float, string="noBlend",
|
|
|
- string=none, string=none)
|
|
|
- """
|
|
|
- def functorFunc(self = self, startColor = startColor,
|
|
|
- endColor = endColor):
|
|
|
- from pandac.PandaModules import ColorLerpFunctor
|
|
|
- # start color and end vec
|
|
|
- functor = ColorLerpFunctor(
|
|
|
- self, startColor, endColor)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpColorVBase4VBase4, NodePath)
|
|
|
-del lerpColorVBase4VBase4
|
|
|
-#####################################################################
|
|
|
- # user callable lerp methods
|
|
|
-def lerpColorScale(self, *posArgs, **keyArgs):
|
|
|
- """lerpColorScale(self, *positionArgs, **keywordArgs)
|
|
|
- determine which lerpColorScale* to call based on arguments
|
|
|
- """
|
|
|
- if (len(posArgs) == 2):
|
|
|
- return apply(self.lerpColorScaleVBase4, posArgs, keyArgs)
|
|
|
- elif (len(posArgs) == 3):
|
|
|
- return apply(self.lerpColorScaleVBase4VBase4, posArgs, keyArgs)
|
|
|
- elif (len(posArgs) == 5):
|
|
|
- return apply(self.lerpColorScaleRGBA, posArgs, keyArgs)
|
|
|
- elif (len(posArgs) == 9):
|
|
|
- return apply(self.lerpColorScaleRGBARGBA, posArgs, keyArgs)
|
|
|
- else:
|
|
|
- # bad args
|
|
|
- raise Exception("Error: NodePath.lerpColorScale: bad number of args")
|
|
|
-
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpColorScale, NodePath)
|
|
|
-del lerpColorScale
|
|
|
-#####################################################################
|
|
|
-def lerpColorScaleRGBA(self, r, g, b, a, time,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpColorScaleRGBA(self, float, float, float, float, float,
|
|
|
- string="noBlend", string=none, string=none)
|
|
|
- """
|
|
|
- def functorFunc(self = self, r = r, g = g, b = b, a = a):
|
|
|
- from pandac.PandaModules import ColorScaleLerpFunctor
|
|
|
- # just end rgba values, use current color rgba values for start
|
|
|
- startColor = self.getColor()
|
|
|
- functor = ColorScaleLerpFunctor(
|
|
|
- self,
|
|
|
- startColor[0], startColor[1],
|
|
|
- startColor[2], startColor[3],
|
|
|
- r, g, b, a)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpColorScaleRGBA, NodePath)
|
|
|
-del lerpColorScaleRGBA
|
|
|
-#####################################################################
|
|
|
-def lerpColorScaleRGBARGBA(self, sr, sg, sb, sa, er, eg, eb, ea, time,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpColorScaleRGBARGBA(self, float, float, float, float, float,
|
|
|
- float, float, float, float, string="noBlend", string=none, string=none)
|
|
|
- """
|
|
|
- def functorFunc(self = self, sr = sr, sg = sg, sb = sb, sa = sa,
|
|
|
- er = er, eg = eg, eb = eb, ea = ea):
|
|
|
- from pandac.PandaModules import ColorScaleLerpFunctor
|
|
|
- # start and end rgba values
|
|
|
- functor = ColorScaleLerpFunctor(self, sr, sg, sb, sa,
|
|
|
- er, eg, eb, ea)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpColorScaleRGBARGBA, NodePath)
|
|
|
-del lerpColorScaleRGBARGBA
|
|
|
-#####################################################################
|
|
|
-def lerpColorScaleVBase4(self, endColor, time,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpColorScaleVBase4(self, VBase4, float, string="noBlend", string=none,
|
|
|
- string=none)
|
|
|
- """
|
|
|
- def functorFunc(self = self, endColor = endColor):
|
|
|
- from pandac.PandaModules import ColorScaleLerpFunctor
|
|
|
- # just end vec4, use current color for start
|
|
|
- startColor = self.getColor()
|
|
|
- functor = ColorScaleLerpFunctor(
|
|
|
- self, startColor, endColor)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpColorScaleVBase4, NodePath)
|
|
|
-del lerpColorScaleVBase4
|
|
|
-#####################################################################
|
|
|
-def lerpColorScaleVBase4VBase4(self, startColor, endColor, time,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpColorScaleVBase4VBase4(self, VBase4, VBase4, float, string="noBlend",
|
|
|
- string=none, string=none)
|
|
|
- """
|
|
|
- def functorFunc(self = self, startColor = startColor,
|
|
|
- endColor = endColor):
|
|
|
- from pandac.PandaModules import ColorScaleLerpFunctor
|
|
|
- # start color and end vec
|
|
|
- functor = ColorScaleLerpFunctor(
|
|
|
- self, startColor, endColor)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpColorScaleVBase4VBase4, NodePath)
|
|
|
-del lerpColorScaleVBase4VBase4
|
|
|
-#####################################################################
|
|
|
-def lerpHpr(self, *posArgs, **keyArgs):
|
|
|
- """lerpHpr(self, *positionArgs, **keywordArgs)
|
|
|
- Determine whether to call lerpHprHPR or lerpHprVBase3
|
|
|
- based on first argument
|
|
|
- """
|
|
|
- # check to see if lerping with
|
|
|
- # three floats or a VBase3
|
|
|
- if (len(posArgs) == 4):
|
|
|
- return apply(self.lerpHprHPR, posArgs, keyArgs)
|
|
|
- elif(len(posArgs) == 2):
|
|
|
- return apply(self.lerpHprVBase3, posArgs, keyArgs)
|
|
|
- else:
|
|
|
- # bad args
|
|
|
- raise Exception("Error: NodePath.lerpHpr: bad number of args")
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpHpr, NodePath)
|
|
|
-del lerpHpr
|
|
|
-#####################################################################
|
|
|
-def lerpHprHPR(self, h, p, r, time, other=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, shortest=shortest):
|
|
|
- from pandac.PandaModules import HprLerpFunctor
|
|
|
- # it's individual hpr components
|
|
|
- if (other != None):
|
|
|
- # lerp wrt other
|
|
|
- startHpr = self.getHpr(other)
|
|
|
- functor = HprLerpFunctor(
|
|
|
- self,
|
|
|
- startHpr[0], startHpr[1], startHpr[2],
|
|
|
- h, p, r, other)
|
|
|
- if shortest:
|
|
|
- functor.takeShortest()
|
|
|
- else:
|
|
|
- startHpr = self.getHpr()
|
|
|
- functor = HprLerpFunctor(
|
|
|
- self,
|
|
|
- startHpr[0], startHpr[1], startHpr[2],
|
|
|
- h, p, r)
|
|
|
- if shortest:
|
|
|
- functor.takeShortest()
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpHprHPR, NodePath)
|
|
|
-del lerpHprHPR
|
|
|
-#####################################################################
|
|
|
-def lerpHprVBase3(self, hpr, time, other=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, shortest=shortest):
|
|
|
- from pandac.PandaModules import HprLerpFunctor
|
|
|
- # it's a vbase3 hpr
|
|
|
- if (other != None):
|
|
|
- # lerp wrt other
|
|
|
- functor = HprLerpFunctor(
|
|
|
- self, (self.getHpr(other)), hpr, other)
|
|
|
- if shortest:
|
|
|
- functor.takeShortest()
|
|
|
- else:
|
|
|
- functor = HprLerpFunctor(
|
|
|
- self, (self.getHpr()), hpr)
|
|
|
- if shortest:
|
|
|
- functor.takeShortest()
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpHprVBase3, NodePath)
|
|
|
-del lerpHprVBase3
|
|
|
-#####################################################################
|
|
|
-def lerpPos(self, *posArgs, **keyArgs):
|
|
|
- """lerpPos(self, *positionArgs, **keywordArgs)
|
|
|
- Determine whether to call lerpPosXYZ or lerpPosPoint3
|
|
|
- based on the first argument
|
|
|
- """
|
|
|
- # check to see if lerping with three
|
|
|
- # floats or a Point3
|
|
|
- if (len(posArgs) == 4):
|
|
|
- return apply(self.lerpPosXYZ, posArgs, keyArgs)
|
|
|
- elif(len(posArgs) == 2):
|
|
|
- return apply(self.lerpPosPoint3, posArgs, keyArgs)
|
|
|
- else:
|
|
|
- # bad number off args
|
|
|
- raise Exception("Error: NodePath.lerpPos: bad number of args")
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpPos, NodePath)
|
|
|
-del lerpPos
|
|
|
-#####################################################################
|
|
|
-def lerpPosXYZ(self, x, y, z, time, other=None,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpPosXYZ(self, float, float, float, float, string="noBlend",
|
|
|
- string=None, NodePath=None)
|
|
|
- Perform a pos lerp with three floats as the end point
|
|
|
- """
|
|
|
- def functorFunc(self = self, x = x, y = y, z = z, other = other):
|
|
|
- from pandac.PandaModules import PosLerpFunctor
|
|
|
- if (other != None):
|
|
|
- # lerp wrt other
|
|
|
- startPos = self.getPos(other)
|
|
|
- functor = PosLerpFunctor(self,
|
|
|
- startPos[0], startPos[1], startPos[2],
|
|
|
- x, y, z, other)
|
|
|
- else:
|
|
|
- startPos = self.getPos()
|
|
|
- functor = PosLerpFunctor(self, startPos[0],
|
|
|
- startPos[1], startPos[2], x, y, z)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpPosXYZ, NodePath)
|
|
|
-del lerpPosXYZ
|
|
|
-#####################################################################
|
|
|
-def lerpPosPoint3(self, pos, time, other=None,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpPosPoint3(self, Point3, float, string="noBlend", string=None,
|
|
|
- string=None, NodePath=None)
|
|
|
- Perform a pos lerp with a Point3 as the end point
|
|
|
- """
|
|
|
- def functorFunc(self = self, pos = pos, other = other):
|
|
|
- from pandac.PandaModules import PosLerpFunctor
|
|
|
- if (other != None):
|
|
|
- #lerp wrt other
|
|
|
- functor = PosLerpFunctor(
|
|
|
- self, (self.getPos(other)), pos, other)
|
|
|
- else:
|
|
|
- functor = PosLerpFunctor(
|
|
|
- self, (self.getPos()), pos)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpPosPoint3, NodePath)
|
|
|
-del lerpPosPoint3
|
|
|
-#####################################################################
|
|
|
-def lerpPosHpr(self, *posArgs, **keyArgs):
|
|
|
- """lerpPosHpr(self, *positionArgs, **keywordArgs)
|
|
|
- Determine whether to call lerpPosHprXYZHPR or lerpHprPoint3VBase3
|
|
|
- based on first argument
|
|
|
- """
|
|
|
- # check to see if lerping with
|
|
|
- # six floats or a Point3 and a VBase3
|
|
|
- if (len(posArgs) == 7):
|
|
|
- return apply(self.lerpPosHprXYZHPR, posArgs, keyArgs)
|
|
|
- elif(len(posArgs) == 3):
|
|
|
- return apply(self.lerpPosHprPoint3VBase3, posArgs, keyArgs)
|
|
|
- else:
|
|
|
- # bad number off args
|
|
|
- raise Exception("Error: NodePath.lerpPosHpr: bad number of args")
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpPosHpr, NodePath)
|
|
|
-del lerpPosHpr
|
|
|
-#####################################################################
|
|
|
-def lerpPosHprPoint3VBase3(self, pos, hpr, time, other=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, shortest=shortest):
|
|
|
- from pandac.PandaModules import PosHprLerpFunctor
|
|
|
- if (other != None):
|
|
|
- # lerp wrt other
|
|
|
- startPos = self.getPos(other)
|
|
|
- startHpr = self.getHpr(other)
|
|
|
- functor = PosHprLerpFunctor(
|
|
|
- self, startPos, pos,
|
|
|
- startHpr, hpr, other)
|
|
|
- if shortest:
|
|
|
- functor.takeShortest()
|
|
|
- else:
|
|
|
- startPos = self.getPos()
|
|
|
- startHpr = self.getHpr()
|
|
|
- functor = PosHprLerpFunctor(
|
|
|
- self, startPos, pos,
|
|
|
- startHpr, hpr)
|
|
|
- if shortest:
|
|
|
- functor.takeShortest()
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpPosHprPoint3VBase3, NodePath)
|
|
|
-del lerpPosHprPoint3VBase3
|
|
|
-#####################################################################
|
|
|
-def lerpPosHprXYZHPR(self, x, y, z, h, p, r, time, other=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, shortest=shortest):
|
|
|
- from pandac.PandaModules import PosHprLerpFunctor
|
|
|
- if (other != None):
|
|
|
- # lerp wrt other
|
|
|
- startPos = self.getPos(other)
|
|
|
- startHpr = self.getHpr(other)
|
|
|
- functor = PosHprLerpFunctor(self,
|
|
|
- startPos[0], startPos[1],
|
|
|
- startPos[2], x, y, z,
|
|
|
- startHpr[0], startHpr[1],
|
|
|
- startHpr[2], h, p, r,
|
|
|
- other)
|
|
|
- if shortest:
|
|
|
- functor.takeShortest()
|
|
|
- else:
|
|
|
- startPos = self.getPos()
|
|
|
- startHpr = self.getHpr()
|
|
|
- functor = PosHprLerpFunctor(self,
|
|
|
- startPos[0], startPos[1],
|
|
|
- startPos[2], x, y, z,
|
|
|
- startHpr[0], startHpr[1],
|
|
|
- startHpr[2], h, p, r)
|
|
|
- if shortest:
|
|
|
- functor.takeShortest()
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpPosHprXYZHPR, NodePath)
|
|
|
-del lerpPosHprXYZHPR
|
|
|
-#####################################################################
|
|
|
-def lerpPosHprScale(self, pos, hpr, scale, time, other=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, shortest=shortest):
|
|
|
- from pandac.PandaModules import PosHprScaleLerpFunctor
|
|
|
- if (other != None):
|
|
|
- # lerp wrt other
|
|
|
- startPos = self.getPos(other)
|
|
|
- startHpr = self.getHpr(other)
|
|
|
- startScale = self.getScale(other)
|
|
|
- functor = PosHprScaleLerpFunctor(self,
|
|
|
- startPos, pos,
|
|
|
- startHpr, hpr,
|
|
|
- startScale, scale, other)
|
|
|
- if shortest:
|
|
|
- functor.takeShortest()
|
|
|
- else:
|
|
|
- startPos = self.getPos()
|
|
|
- startHpr = self.getHpr()
|
|
|
- startScale = self.getScale()
|
|
|
- functor = PosHprScaleLerpFunctor(self,
|
|
|
- startPos, pos,
|
|
|
- startHpr, hpr,
|
|
|
- startScale, scale)
|
|
|
- if shortest:
|
|
|
- functor.takeShortest()
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpPosHprScale, NodePath)
|
|
|
-del lerpPosHprScale
|
|
|
-#####################################################################
|
|
|
-def lerpScale(self, *posArgs, **keyArgs):
|
|
|
- """lerpSclae(self, *positionArgs, **keywordArgs)
|
|
|
- Determine whether to call lerpScaleXYZ or lerpScaleaseV3
|
|
|
- based on the first argument
|
|
|
- """
|
|
|
- # check to see if lerping with three
|
|
|
- # floats or a Point3
|
|
|
- if (len(posArgs) == 4):
|
|
|
- return apply(self.lerpScaleXYZ, posArgs, keyArgs)
|
|
|
- elif(len(posArgs) == 2):
|
|
|
- return apply(self.lerpScaleVBase3, posArgs, keyArgs)
|
|
|
- else:
|
|
|
- # bad number off args
|
|
|
- raise Exception("Error: NodePath.lerpScale: bad number of args")
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpScale, NodePath)
|
|
|
-del lerpScale
|
|
|
-#####################################################################
|
|
|
-def lerpScaleVBase3(self, scale, time, other=None,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpPos(self, VBase3, float, string="noBlend", string=none,
|
|
|
- string=none, NodePath=None)
|
|
|
- """
|
|
|
- def functorFunc(self = self, scale = scale, other = other):
|
|
|
- from pandac.PandaModules import ScaleLerpFunctor
|
|
|
- if (other != None):
|
|
|
- # lerp wrt other
|
|
|
- functor = ScaleLerpFunctor(self,
|
|
|
- (self.getScale(other)),
|
|
|
- scale, other)
|
|
|
- else:
|
|
|
- functor = ScaleLerpFunctor(self,
|
|
|
- (self.getScale()), scale)
|
|
|
-
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpScaleVBase3, NodePath)
|
|
|
-del lerpScaleVBase3
|
|
|
-#####################################################################
|
|
|
-def lerpScaleXYZ(self, sx, sy, sz, time, other=None,
|
|
|
- blendType="noBlend", auto=None, task=None):
|
|
|
- """lerpPos(self, float, float, float, float, string="noBlend",
|
|
|
- string=none, string=none, NodePath=None)
|
|
|
- """
|
|
|
- def functorFunc(self = self, sx = sx, sy = sy, sz = sz, other = other):
|
|
|
- from pandac.PandaModules import ScaleLerpFunctor
|
|
|
- if (other != None):
|
|
|
- # lerp wrt other
|
|
|
- startScale = self.getScale(other)
|
|
|
- functor = ScaleLerpFunctor(self,
|
|
|
- startScale[0], startScale[1],
|
|
|
- startScale[2], sx, sy, sz, other)
|
|
|
- else:
|
|
|
- startScale = self.getScale()
|
|
|
- functor = ScaleLerpFunctor(self,
|
|
|
- startScale[0], startScale[1],
|
|
|
- startScale[2], sx, sy, sz)
|
|
|
- return functor
|
|
|
- #determine whether to use auto, spawned, or blocking lerp
|
|
|
- if (auto != None):
|
|
|
- return self.__autoLerp(functorFunc, time, blendType, auto)
|
|
|
- elif (task != None):
|
|
|
- return self.__lerp(functorFunc, time, blendType, task)
|
|
|
- else:
|
|
|
- return self.__lerp(functorFunc, time, blendType)
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-Dtool_funcToMethod(lerpScaleXYZ, NodePath)
|
|
|
-del lerpScaleXYZ
|
|
|
-#####################################################################
|
|
|
def place(self):
|
|
|
base.startDirect(fWantTk = 1)
|
|
|
from direct.tkpanels import Placer
|
|
|
@@ -1253,8 +553,8 @@ Dtool_funcToMethod(colorScaleInterval, NodePath)
|
|
|
del colorScaleInterval
|
|
|
#####################################################################
|
|
|
def attachCollisionSphere(self, name, cx, cy, cz, r, fromCollide, intoCollide):
|
|
|
- from pandac.PandaModules import CollisionSphere
|
|
|
- from pandac.PandaModules import CollisionNode
|
|
|
+ from panda3d.core import CollisionSphere
|
|
|
+ from panda3d.core import CollisionNode
|
|
|
coll = CollisionSphere(cx, cy, cz, r)
|
|
|
collNode = CollisionNode(name)
|
|
|
collNode.addSolid(coll)
|
|
|
@@ -1267,8 +567,8 @@ Dtool_funcToMethod(attachCollisionSphere, NodePath)
|
|
|
del attachCollisionSphere
|
|
|
#####################################################################
|
|
|
def attachCollisionSegment(self, name, ax, ay, az, bx, by, bz, fromCollide, intoCollide):
|
|
|
- from pandac.PandaModules import CollisionSegment
|
|
|
- from pandac.PandaModules import CollisionNode
|
|
|
+ from panda3d.core import CollisionSegment
|
|
|
+ from panda3d.core import CollisionNode
|
|
|
coll = CollisionSegment(ax, ay, az, bx, by, bz)
|
|
|
collNode = CollisionNode(name)
|
|
|
collNode.addSolid(coll)
|
|
|
@@ -1281,8 +581,8 @@ Dtool_funcToMethod(attachCollisionSegment, NodePath)
|
|
|
del attachCollisionSegment
|
|
|
#####################################################################
|
|
|
def attachCollisionRay(self, name, ox, oy, oz, dx, dy, dz, fromCollide, intoCollide):
|
|
|
- from pandac.PandaModules import CollisionRay
|
|
|
- from pandac.PandaModules import CollisionNode
|
|
|
+ from panda3d.core import CollisionRay
|
|
|
+ from panda3d.core import CollisionNode
|
|
|
coll = CollisionRay(ox, oy, oz, dx, dy, dz)
|
|
|
collNode = CollisionNode(name)
|
|
|
collNode.addSolid(coll)
|
|
|
@@ -1296,7 +596,7 @@ del attachCollisionRay
|
|
|
#####################################################################
|
|
|
def flattenMultitex(self, stateFrom = None, target = None,
|
|
|
useGeom = 0, allowTexMat = 0, win = None):
|
|
|
- from pandac.PandaModules import MultitexReducer
|
|
|
+ from panda3d.core import MultitexReducer
|
|
|
mr = MultitexReducer()
|
|
|
if target != None:
|
|
|
mr.setTarget(target)
|
|
|
@@ -1466,26 +766,31 @@ del r_constructCollisionTree
|
|
|
|
|
|
#####################################################################
|
|
|
def analyze(self):
|
|
|
- from pandac.PandaModules import SceneGraphAnalyzer
|
|
|
+ """
|
|
|
+ Analyzes the geometry below this node and reports the
|
|
|
+ number of vertices, triangles, etc. This is the same
|
|
|
+ information reported by the bam-info program.
|
|
|
+ """
|
|
|
+ from panda3d.core import SceneGraphAnalyzer
|
|
|
sga = SceneGraphAnalyzer()
|
|
|
sga.addNode(self.node())
|
|
|
if sga.getNumLodNodes() == 0:
|
|
|
- print sga
|
|
|
+ print(sga)
|
|
|
else:
|
|
|
- print "At highest LOD:"
|
|
|
+ print("At highest LOD:")
|
|
|
sga2 = SceneGraphAnalyzer()
|
|
|
sga2.setLodMode(sga2.LMHighest)
|
|
|
sga2.addNode(self.node())
|
|
|
- print sga2
|
|
|
+ print(sga2)
|
|
|
|
|
|
- print "\nAt lowest LOD:"
|
|
|
+ print("\nAt lowest LOD:")
|
|
|
sga2.clear()
|
|
|
sga2.setLodMode(sga2.LMLowest)
|
|
|
sga2.addNode(self.node())
|
|
|
- print sga2
|
|
|
+ print(sga2)
|
|
|
|
|
|
- print "\nAll nodes:"
|
|
|
- print sga
|
|
|
+ print("\nAll nodes:")
|
|
|
+ print(sga)
|
|
|
|
|
|
Dtool_funcToMethod(analyze, NodePath)
|
|
|
del analyze
|