diff --git a/direct/src/actor/Actor.py b/direct/src/actor/Actor.py index 00b845797f..5c025e2431 100644 --- a/direct/src/actor/Actor.py +++ b/direct/src/actor/Actor.py @@ -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) diff --git a/direct/src/extensions/NodePath-extensions.py b/direct/src/extensions/NodePath-extensions.py index 78f4973b77..efdbb17167 100644 --- a/direct/src/extensions/NodePath-extensions.py +++ b/direct/src/extensions/NodePath-extensions.py @@ -15,26 +15,16 @@ def getName(self): """Returns the name of the bottom node if it exists, or """ - import NamedNode - # Initialize to a default value - name = '' - # 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 '' def setName(self, name = ''): - """Returns the name of the bottom node if it exists, or """ - 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 diff --git a/direct/src/ffi/FFIRename.py b/direct/src/ffi/FFIRename.py index 73f6ca9c91..133382cef9 100644 --- a/direct/src/ffi/FFIRename.py +++ b/direct/src/ffi/FFIRename.py @@ -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', diff --git a/direct/src/gui/OnscreenText.py b/direct/src/gui/OnscreenText.py index 77a56a7a34..f13dcbfccc 100644 --- a/direct/src/gui/OnscreenText.py +++ b/direct/src/gui/OnscreenText.py @@ -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() diff --git a/direct/src/showbase/qpShowBase.py b/direct/src/showbase/qpShowBase.py index fd53a63859..f2603daddd 100644 --- a/direct/src/showbase/qpShowBase.py +++ b/direct/src/showbase/qpShowBase.py @@ -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): """