mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
more pgraph refinements
This commit is contained in:
parent
29e70407b5
commit
9c355f52b6
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
from PandaObject import *
|
from PandaObject import *
|
||||||
import LODNode
|
import LODNode
|
||||||
|
import UsePgraph
|
||||||
|
|
||||||
class Actor(PandaObject, NodePath):
|
class Actor(PandaObject, NodePath):
|
||||||
"""Actor class: Contains methods for creating, manipulating
|
"""Actor class: Contains methods for creating, manipulating
|
||||||
@ -205,7 +206,10 @@ class Actor(PandaObject, NodePath):
|
|||||||
# bounding volume for pieces that animate away from their
|
# bounding volume for pieces that animate away from their
|
||||||
# original position. It's disturbing to see someone's hands
|
# original position. It's disturbing to see someone's hands
|
||||||
# disappear; better to cull the whole object or none of it.
|
# disappear; better to cull the whole object or none of it.
|
||||||
self.__geomNode.arc().setFinal(1)
|
if UsePgraph.use:
|
||||||
|
self.__geomNode.node().setFinal(1)
|
||||||
|
else:
|
||||||
|
self.__geomNode.arc().setFinal(1)
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
try:
|
try:
|
||||||
@ -707,7 +711,10 @@ class Actor(PandaObject, NodePath):
|
|||||||
joint = bundle.findChild(jointName)
|
joint = bundle.findChild(jointName)
|
||||||
|
|
||||||
if (joint):
|
if (joint):
|
||||||
joint.addNetTransform(node.arc())
|
if UsePgraph.use:
|
||||||
|
joint.addNetTransform(node.node())
|
||||||
|
else:
|
||||||
|
joint.addNetTransform(node.arc())
|
||||||
else:
|
else:
|
||||||
Actor.notify.warning("no joint named %s!" % (jointName))
|
Actor.notify.warning("no joint named %s!" % (jointName))
|
||||||
|
|
||||||
@ -832,13 +839,19 @@ class Actor(PandaObject, NodePath):
|
|||||||
|
|
||||||
if mode == -2:
|
if mode == -2:
|
||||||
# Turn off depth test/write on the frontParts.
|
# Turn off depth test/write on the frontParts.
|
||||||
dw = DepthWriteTransition.off()
|
if UsePgraph.use:
|
||||||
dt = DepthTestTransition(DepthTestProperty.MNone)
|
numFrontParts = frontParts.getNumPaths()
|
||||||
numFrontParts = frontParts.getNumPaths()
|
for partNum in range(0, numFrontParts):
|
||||||
for partNum in range(0, numFrontParts):
|
frontParts[partNum].setDepthWrite(0, 1)
|
||||||
frontParts[partNum].arc().setTransition(dw, 1)
|
frontParts[partNum].setDepthTest(0, 1)
|
||||||
frontParts[partNum].arc().setTransition(dt, 1)
|
else:
|
||||||
|
dw = DepthWriteTransition.off()
|
||||||
|
dt = DepthTestTransition(DepthTestProperty.MNone)
|
||||||
|
numFrontParts = frontParts.getNumPaths()
|
||||||
|
for partNum in range(0, numFrontParts):
|
||||||
|
frontParts[partNum].arc().setTransition(dw, 1)
|
||||||
|
frontParts[partNum].arc().setTransition(dt, 1)
|
||||||
|
|
||||||
# Find the back part.
|
# Find the back part.
|
||||||
backPart = root.find("**/" + backPartName)
|
backPart = root.find("**/" + backPartName)
|
||||||
if (backPart.isEmpty()):
|
if (backPart.isEmpty()):
|
||||||
@ -847,8 +860,11 @@ class Actor(PandaObject, NodePath):
|
|||||||
|
|
||||||
if mode == -3:
|
if mode == -3:
|
||||||
# Draw as a decal.
|
# Draw as a decal.
|
||||||
dt = DecalTransition()
|
if UsePgraph.use:
|
||||||
backPart.arc().setTransition(dt)
|
backPart.node().setEffect(DecalEffect.make())
|
||||||
|
else:
|
||||||
|
dt = DecalTransition()
|
||||||
|
backPart.arc().setTransition(dt)
|
||||||
else:
|
else:
|
||||||
# Reorder the backPart to be the first of its siblings.
|
# Reorder the backPart to be the first of its siblings.
|
||||||
backPart.reparentTo(backPart.getParent(), -1)
|
backPart.reparentTo(backPart.getParent(), -1)
|
||||||
|
@ -15,26 +15,16 @@
|
|||||||
|
|
||||||
def getName(self):
|
def getName(self):
|
||||||
"""Returns the name of the bottom node if it exists, or <noname>"""
|
"""Returns the name of the bottom node if it exists, or <noname>"""
|
||||||
import NamedNode
|
|
||||||
# Initialize to a default value
|
|
||||||
name = '<noname>'
|
|
||||||
# Get the bottom node
|
|
||||||
node = self.node()
|
node = self.node()
|
||||||
# Is it a named node?, If so, see if it has a name
|
if hasattr(node, "getName"):
|
||||||
if issubclass(node.__class__, NamedNode.NamedNode):
|
return node.getName()
|
||||||
namedNodeName = node.getName()
|
|
||||||
# Is it not zero length?
|
return '<noname>'
|
||||||
if len(namedNodeName) != 0:
|
|
||||||
name = namedNodeName
|
|
||||||
return name
|
|
||||||
|
|
||||||
def setName(self, name = '<noname>'):
|
def setName(self, name = '<noname>'):
|
||||||
"""Returns the name of the bottom node if it exists, or <noname>"""
|
"""Sets the name of the bottom node if it can be set."""
|
||||||
import NamedNode
|
|
||||||
# Get the bottom node
|
|
||||||
node = self.node()
|
node = self.node()
|
||||||
# Is it a named node?, If so, see if it has a name
|
if hasattr(node, "setName"):
|
||||||
if issubclass(node.__class__, NamedNode.NamedNode):
|
|
||||||
node.setName(name)
|
node.setName(name)
|
||||||
|
|
||||||
# For iterating over children
|
# For iterating over children
|
||||||
|
@ -116,6 +116,7 @@ pgraphClassRenameDictionary = {
|
|||||||
'DataNode' : 'SpDataNode',
|
'DataNode' : 'SpDataNode',
|
||||||
'DialNode' : 'SpDialNode',
|
'DialNode' : 'SpDialNode',
|
||||||
'DriveInterface' : 'SpDriveInterface',
|
'DriveInterface' : 'SpDriveInterface',
|
||||||
|
'Fog' : 'SpFog',
|
||||||
'GeomNode' : 'SpGeomNode',
|
'GeomNode' : 'SpGeomNode',
|
||||||
'HprLerpFunctor' : 'SpHprLerpFunctor',
|
'HprLerpFunctor' : 'SpHprLerpFunctor',
|
||||||
'HprScaleLerpFunctor' : 'SpHprScaleLerpFunctor',
|
'HprScaleLerpFunctor' : 'SpHprScaleLerpFunctor',
|
||||||
@ -170,6 +171,7 @@ pgraphClassRenameDictionary = {
|
|||||||
'QpDataNode' : 'DataNode',
|
'QpDataNode' : 'DataNode',
|
||||||
'QpDialNode' : 'DialNode',
|
'QpDialNode' : 'DialNode',
|
||||||
'QpDriveInterface' : 'DriveInterface',
|
'QpDriveInterface' : 'DriveInterface',
|
||||||
|
'QpFog' : 'Fog',
|
||||||
'QpGeomNode' : 'GeomNode',
|
'QpGeomNode' : 'GeomNode',
|
||||||
'QpHprLerpFunctor' : 'HprLerpFunctor',
|
'QpHprLerpFunctor' : 'HprLerpFunctor',
|
||||||
'QpHprScaleLerpFunctor' : 'HprScaleLerpFunctor',
|
'QpHprScaleLerpFunctor' : 'HprScaleLerpFunctor',
|
||||||
|
@ -105,7 +105,8 @@ class OnscreenText(PandaObject, NodePath):
|
|||||||
bg = bg or (0, 0, 0, 0)
|
bg = bg or (0, 0, 0, 0)
|
||||||
shadow = shadow or (0, 0, 0, 0)
|
shadow = shadow or (0, 0, 0, 0)
|
||||||
frame = frame or (0, 0, 0, 0)
|
frame = frame or (0, 0, 0, 0)
|
||||||
align = align or TextNode.ACenter
|
if align == None:
|
||||||
|
align = TextNode.ACenter
|
||||||
|
|
||||||
elif style == ScreenTitle:
|
elif style == ScreenTitle:
|
||||||
scale = scale or 0.15
|
scale = scale or 0.15
|
||||||
@ -113,7 +114,8 @@ class OnscreenText(PandaObject, NodePath):
|
|||||||
bg = bg or (0, 0, 0, 0)
|
bg = bg or (0, 0, 0, 0)
|
||||||
shadow = shadow or (0, 0, 0, 1)
|
shadow = shadow or (0, 0, 0, 1)
|
||||||
frame = frame or (0, 0, 0, 0)
|
frame = frame or (0, 0, 0, 0)
|
||||||
align = align or TextNode.ACenter
|
if align == None:
|
||||||
|
align = TextNode.ACenter
|
||||||
|
|
||||||
elif style == ScreenPrompt:
|
elif style == ScreenPrompt:
|
||||||
scale = scale or 0.1
|
scale = scale or 0.1
|
||||||
@ -121,7 +123,8 @@ class OnscreenText(PandaObject, NodePath):
|
|||||||
bg = bg or (0, 0, 0, 0)
|
bg = bg or (0, 0, 0, 0)
|
||||||
shadow = shadow or (0, 0, 0, 1)
|
shadow = shadow or (0, 0, 0, 1)
|
||||||
frame = frame or (0, 0, 0, 0)
|
frame = frame or (0, 0, 0, 0)
|
||||||
align = align or TextNode.ACenter
|
if align == None:
|
||||||
|
align = TextNode.ACenter
|
||||||
|
|
||||||
elif style == NameConfirm:
|
elif style == NameConfirm:
|
||||||
scale = scale or 0.1
|
scale = scale or 0.1
|
||||||
@ -129,7 +132,8 @@ class OnscreenText(PandaObject, NodePath):
|
|||||||
bg = bg or (0, 0, 0, 0)
|
bg = bg or (0, 0, 0, 0)
|
||||||
shadow = shadow or (0, 0, 0, 0)
|
shadow = shadow or (0, 0, 0, 0)
|
||||||
frame = frame or (0, 0, 0, 0)
|
frame = frame or (0, 0, 0, 0)
|
||||||
align = align or TextNode.ACenter
|
if align == None:
|
||||||
|
align = TextNode.ACenter
|
||||||
|
|
||||||
elif style == BlackOnWhite:
|
elif style == BlackOnWhite:
|
||||||
scale = scale or 0.1
|
scale = scale or 0.1
|
||||||
@ -137,7 +141,8 @@ class OnscreenText(PandaObject, NodePath):
|
|||||||
bg = bg or (1, 1, 1, 1)
|
bg = bg or (1, 1, 1, 1)
|
||||||
shadow = shadow or (0, 0, 0, 0)
|
shadow = shadow or (0, 0, 0, 0)
|
||||||
frame = frame or (0, 0, 0, 0)
|
frame = frame or (0, 0, 0, 0)
|
||||||
align = align or TextNode.ACenter
|
if align == None:
|
||||||
|
align = TextNode.ACenter
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
@ -220,8 +225,7 @@ class OnscreenText(PandaObject, NodePath):
|
|||||||
self.textNode = None
|
self.textNode = None
|
||||||
if self.isClean == 0:
|
if self.isClean == 0:
|
||||||
self.isClean = 1
|
self.isClean = 1
|
||||||
if self.hasArcs():
|
self.removeNode()
|
||||||
self.removeNode()
|
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
@ -618,8 +618,8 @@ class ShowBase:
|
|||||||
"""
|
"""
|
||||||
self.mouse2cam.reparentTo(self.mouseInterface)
|
self.mouse2cam.reparentTo(self.mouseInterface)
|
||||||
|
|
||||||
def setMouseOnArc(self, newArc):
|
def setMouseOnNode(self, newNode):
|
||||||
self.mouse2cam.node().setArc(newArc)
|
self.mouse2cam.node().setNode(newNode)
|
||||||
|
|
||||||
def useDrive(self):
|
def useDrive(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user