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