From 2ba9291bdff7bc691299dcbc38842c122652abe9 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 22 Feb 2001 18:59:34 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/actor/Actor.py | 2 +- direct/src/directdevices/DirectJoybox.py | 4 +- direct/src/directtools/DirectGeometry.py | 2 +- direct/src/directtools/DirectSelection.py | 2 +- direct/src/directutil/Mopath.py | 4 +- direct/src/extensions/NodePath-extensions.py | 2 +- direct/src/leveleditor/LevelEditor.py | 10 +- direct/src/showbase/ShowBase.py | 8 +- direct/src/task/Task.py | 6 +- direct/src/tkpanels/MopathRecorder.py | 8 +- panda/src/collide/collisionTraverser.cxx | 2 +- panda/src/express/clockObject.I | 24 --- panda/src/express/clockObject.h | 25 ++-- panda/src/sgmanip/nodePath.I | 28 +--- panda/src/sgmanip/nodePath.cxx | 148 +++++++++---------- panda/src/sgmanip/nodePath.h | 16 +- panda/src/testbed/demo.cxx | 6 +- 17 files changed, 123 insertions(+), 174 deletions(-) diff --git a/direct/src/actor/Actor.py b/direct/src/actor/Actor.py index 0bc5ba7414..4c1939508b 100644 --- a/direct/src/actor/Actor.py +++ b/direct/src/actor/Actor.py @@ -684,7 +684,7 @@ class Actor(PandaObject, NodePath): dt = DirectRenderTransition() # make the back part have the proper transition - backPart.getBottomArc().setTransition(dt) + backPart.arc().setTransition(dt) #reparent all the front parts to the back part frontParts.reparentTo(backPart) diff --git a/direct/src/directdevices/DirectJoybox.py b/direct/src/directdevices/DirectJoybox.py index 48ebd91296..47fbf11a61 100644 --- a/direct/src/directdevices/DirectJoybox.py +++ b/direct/src/directdevices/DirectJoybox.py @@ -48,7 +48,7 @@ class DirectJoybox(PandaObject): R_TWIST, L_TWIST, NULL_AXIS] self.modifier = [1,1,1,-1,-1,0] # Initialize time - self.lastTime = globalClock.getTime() + self.lastTime = globalClock.getFrameTime() # Record node path self.nodePath = nodePath # Ref CS for orbit mode @@ -121,7 +121,7 @@ class DirectJoybox(PandaObject): def updateVals(self): # Update delta time - cTime = globalClock.getTime() + cTime = globalClock.getFrameTime() self.deltaTime = cTime - self.lastTime self.lastTime = cTime # Update analogs diff --git a/direct/src/directtools/DirectGeometry.py b/direct/src/directtools/DirectGeometry.py index cc758a483a..8f53cdec8d 100644 --- a/direct/src/directtools/DirectGeometry.py +++ b/direct/src/directtools/DirectGeometry.py @@ -176,5 +176,5 @@ def relHpr(nodePath, base, h, p, r): # Set direct drawing style for an object # Never light object or draw in wireframe def useDirectRenderStyle(nodePath): - nodePath.getBottomArc().setTransition(LightTransition.allOff()) + nodePath.arc().setTransition(LightTransition.allOff()) nodePath.setRenderModeFilled() diff --git a/direct/src/directtools/DirectSelection.py b/direct/src/directtools/DirectSelection.py index 469d5b9664..aa21711ac0 100644 --- a/direct/src/directtools/DirectSelection.py +++ b/direct/src/directtools/DirectSelection.py @@ -345,7 +345,7 @@ class DirectBoundingBox: # Get a node path's bounds nodeBounds = self.nodePath.node().getBound() for child in self.nodePath.getChildrenAsList(): - nodeBounds.extendBy(child.getBottomArc().getBound()) + nodeBounds.extendBy(child.arc().getBound()) return nodeBounds.makeCopy() def show(self): diff --git a/direct/src/directutil/Mopath.py b/direct/src/directutil/Mopath.py index 553f681da0..dd752410a8 100644 --- a/direct/src/directutil/Mopath.py +++ b/direct/src/directutil/Mopath.py @@ -85,13 +85,13 @@ class Mopath(PandaObject): self.stop() t = taskMgr.spawnMethodNamed(self.__playTask, self.name + '-play') t.currentTime = time - t.lastTime = globalClock.getTime() + t.lastTime = globalClock.getFrameTime() def stop(self): taskMgr.removeTasksNamed(self.name + '-play') def __playTask(self, state): - time = globalClock.getTime() + time = globalClock.getFrameTime() dTime = time - state.lastTime state.lastTime = time if (self.loop): diff --git a/direct/src/extensions/NodePath-extensions.py b/direct/src/extensions/NodePath-extensions.py index 6f31d0206a..1f3f16baef 100644 --- a/direct/src/extensions/NodePath-extensions.py +++ b/direct/src/extensions/NodePath-extensions.py @@ -6,7 +6,7 @@ def id(self): """Returns the bottom node's this pointer as a unique id""" - return self.getBottomArc() + return self.arc() def getName(self): """Returns the name of the bottom node if it exists, or """ diff --git a/direct/src/leveleditor/LevelEditor.py b/direct/src/leveleditor/LevelEditor.py index 3a6c1d7a9d..8f1630d5cc 100644 --- a/direct/src/leveleditor/LevelEditor.py +++ b/direct/src/leveleditor/LevelEditor.py @@ -491,10 +491,10 @@ class LevelEditor(NodePath, PandaObject): hpr = direct.camera.getHpr() hpr.set(hpr[0], 0.0, 0.0) # Fine tune the drive mode - base.mouseInterface.getBottomNode().setPos(pos) - base.mouseInterface.getBottomNode().setHpr(hpr) - base.mouseInterface.getBottomNode().setForwardSpeed(20.0) - base.mouseInterface.getBottomNode().setReverseSpeed(20.0) + base.mouseInterface.node().setPos(pos) + base.mouseInterface.node().setHpr(hpr) + base.mouseInterface.node().setForwardSpeed(20.0) + base.mouseInterface.node().setReverseSpeed(20.0) def enableMouse(self): """ Enable Pie Menu interaction (and disable player camera control) """ @@ -1348,7 +1348,7 @@ class LevelEditor(NodePath, PandaObject): def createMap(self, neighborhood): map = loader.loadModel('models/level_editor/' + neighborhood + '_layout') - map.getBottomArc().setTransition(TransparencyTransition(1)) + map.arc().setTransition(TransparencyTransition(1)) map.setColor(Vec4(1,1,1,.4)) self.mapDictionary[neighborhood] = map # Make sure this item isn't pickable diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index c472402efd..743a56460d 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -118,7 +118,7 @@ class ShowBase: self.trackball = self.dataUnused.attachNewNode(Trackball('trackball')) self.drive = self.dataUnused.attachNewNode(DriveInterface('drive')) self.mouse2cam = self.dataUnused.attachNewNode(Transform2SG('mouse2cam')) - self.mouse2cam.node().setArc(self.camera.getBottomArc()) + self.mouse2cam.node().setArc(self.camera.arc()) self.useDrive() self.buttonThrower = self.mouseWatcher.attachNewNode(ButtonThrower()) @@ -283,7 +283,7 @@ class ShowBase: self.trackball.reparentTo(self.dataUnused) # Update the mouseInterface to point to the drive self.mouseInterface = self.drive - self.mouseInterfaceNode = self.mouseInterface.getBottomNode() + self.mouseInterfaceNode = self.mouseInterface.node() self.drive.node().reset() # Hookup the drive to the camera. Make sure it is first in # the list of children of the mouseValve. @@ -300,7 +300,7 @@ class ShowBase: self.drive.reparentTo(self.dataUnused) # Update the mouseInterface to point to the trackball self.mouseInterface = self.trackball - self.mouseInterfaceNode = self.mouseInterface.getBottomNode() + self.mouseInterfaceNode = self.mouseInterface.node() # Hookup the trackball to the camera. Make sure it is first # in the list of children of the mouseValve. self.trackball.reparentTo(self.mouseValve, 0) @@ -342,7 +342,7 @@ class ShowBase: self.mouseValve.node().setControl(1, self.oobeControl) self.oobeTrackball = self.mouseValve.attachNewNode(Trackball('oobeTrackball'), 1) self.oobe2cam = self.oobeTrackball.attachNewNode(Transform2SG('oobe2cam')) - self.oobe2cam.node().setArc(self.oobeCameraTrackball.getBottomArc()) + self.oobe2cam.node().setArc(self.oobeCameraTrackball.arc()) self.oobeButtonEventsType = TypeRegistry.ptr().findType('ButtonEvents_ButtonEventDataTransition') diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index 515d5d1936..449220a6e5 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -20,7 +20,7 @@ def getTimeFrame(): # you must manually tick the clock # Ask for the time last frame - t = globalClock.getTime() + t = globalClock.getFrameTime() # Get the new frame count f = globalClock.getFrameCount() @@ -381,8 +381,8 @@ class TaskManager: def run(self): # Set the clock to have last frame's time in case we were # Paused at the prompt for a long time - t = globalClock.getTime() - globalClock.setTime(t) + t = globalClock.getFrameTime() + globalClock.setRealTime(t) if self.stepping: self.step() else: diff --git a/direct/src/tkpanels/MopathRecorder.py b/direct/src/tkpanels/MopathRecorder.py index f7c7cbba54..e7293e3386 100644 --- a/direct/src/tkpanels/MopathRecorder.py +++ b/direct/src/tkpanels/MopathRecorder.py @@ -967,7 +967,7 @@ class MopathRecorder(AppShell, PandaObject): # Start new task t = taskMgr.spawnMethodNamed( self.recordTask, self.name + '-recordTask') - t.startTime = globalClock.getTime() + t.startTime = globalClock.getFrameTime() else: if self.samplingMode == 'Continuous': # Kill old task @@ -1002,7 +1002,7 @@ class MopathRecorder(AppShell, PandaObject): def recordTask(self, state): # Record raw data point - time = self.recordStart + (globalClock.getTime() - state.startTime) + time = self.recordStart + (globalClock.getFrameTime() - state.startTime) self.recordPoint(time) return Task.cont @@ -1311,7 +1311,7 @@ class MopathRecorder(AppShell, PandaObject): t = taskMgr.spawnMethodNamed( self.playbackTask, self.name + '-playbackTask') t.currentTime = self.playbackTime - t.lastTime = globalClock.getTime() + t.lastTime = globalClock.getFrameTime() def setSpeedScale(self, value): self.speedScale.set(value) @@ -1320,7 +1320,7 @@ class MopathRecorder(AppShell, PandaObject): self.playbackSF = pow(10.0, float(value)) def playbackTask(self, state): - time = globalClock.getTime() + time = globalClock.getFrameTime() dTime = self.playbackSF * (time - state.lastTime) state.lastTime = time if self.loopPlayback: diff --git a/panda/src/collide/collisionTraverser.cxx b/panda/src/collide/collisionTraverser.cxx index 3664cc9be1..1d3c50e3ca 100644 --- a/panda/src/collide/collisionTraverser.cxx +++ b/panda/src/collide/collisionTraverser.cxx @@ -240,7 +240,7 @@ traverse(const NodePath &root) { (*hi).first->begin_group(); } - df_traverse(root.get_bottom_node(), *this, NullAttributeWrapper(), + df_traverse(root.node(), *this, NullAttributeWrapper(), level_state, _graph_type); for (hi = _handlers.begin(); hi != _handlers.end(); ++hi) { diff --git a/panda/src/express/clockObject.I b/panda/src/express/clockObject.I index cd91471057..6fc818144d 100644 --- a/panda/src/express/clockObject.I +++ b/panda/src/express/clockObject.I @@ -210,30 +210,6 @@ get_global_clock() { return _global_clock; } -//////////////////////////////////////////////////////////////////// -// Function: ClockObject::get_time -// Access: Public -// Description: Returns get_frame_time(). The use of this function -// is deprecated and the function will soon disappear; -// use get_frame_time() instead. -//////////////////////////////////////////////////////////////////// -INLINE double ClockObject:: -get_time() const { - return get_frame_time(); -} - -//////////////////////////////////////////////////////////////////// -// Function: ClockObject::set_time -// Access: Public -// Description: Calls set_real_time(). The use of this function -// is deprecated and the function will soon disappear; -// use set_real_time() instead. -//////////////////////////////////////////////////////////////////// -INLINE void ClockObject:: -set_time(double time) { - set_real_time(time); -} - //////////////////////////////////////////////////////////////////// // Function: TimeVal::contructor // Access: Public diff --git a/panda/src/express/clockObject.h b/panda/src/express/clockObject.h index 8ad88a4114..8b6d3f3e6a 100644 --- a/panda/src/express/clockObject.h +++ b/panda/src/express/clockObject.h @@ -29,14 +29,15 @@ END_PUBLISH // Class : ClockObject // Description : A ClockObject keeps track of elapsed real time and // discrete time. It can run in two modes: In normal -// mode, get_time() returns the time as of the last time -// tick() was called. This is the "discrete" time, and -// is usually used to get the time as of, for instance, -// the beginning of the current frame. In non-real-time -// mode, get_time() returns a constant increment since -// the last time tick() was called; this is useful when -// it is desirable to fake the clock out, for instance -// for non-real-time animation rendering. +// mode, get_frame_time() returns the time as of the +// last time tick() was called. This is the "discrete" +// time, and is usually used to get the time as of, for +// instance, the beginning of the current frame. In +// non-real-time mode, get_frame_time() returns a +// constant increment since the last time tick() was +// called; this is useful when it is desirable to fake +// the clock out, for instance for non-real-time +// animation rendering. // // In both modes, get_real_time() always returns the // elapsed real time in seconds since the ClockObject @@ -46,8 +47,8 @@ END_PUBLISH // to have your own local timer. There is also a // default, global ClockObject intended to represent // global time for the application; this is normally set -// up to tick every frame so that its get_time() will -// return the time for the current frame. +// up to tick every frame so that its get_frame_time() +// will return the time for the current frame. //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEXPRESS ClockObject { PUBLISHED: @@ -81,10 +82,6 @@ PUBLISHED: INLINE static ClockObject *get_global_clock(); - // Deprecated functions. - INLINE double get_time() const; - INLINE void set_time(double time); - private: TrueClock *_true_clock; Mode _mode; diff --git a/panda/src/sgmanip/nodePath.I b/panda/src/sgmanip/nodePath.I index 45d7cf5480..0e62ce9d73 100644 --- a/panda/src/sgmanip/nodePath.I +++ b/panda/src/sgmanip/nodePath.I @@ -315,7 +315,7 @@ get_num_children() const { nassertr(verify_connectivity(), 0); nassertr(!is_empty(), 0); - return get_bottom_node()->get_num_children(_graph_type); + return node()->get_num_children(_graph_type); } //////////////////////////////////////////////////////////////////// @@ -332,7 +332,7 @@ get_child(int n) const { nassertr(n >= 0 && n < get_num_children(), NodePath()); NodePath result(*this); - result.extend_by(get_bottom_node()->get_child(_graph_type, n)); + result.extend_by(node()->get_child(_graph_type, n)); return result; } @@ -371,9 +371,9 @@ get_parent() const { // if there is no connection to the indicated node. //////////////////////////////////////////////////////////////////// INLINE NodePath NodePath:: -find_path_down_to(Node *node) const { +find_path_down_to(Node *dnode) const { NodePath result(*this); - if (result.extend_down_to(node)) { + if (result.extend_down_to(dnode)) { return result; } return NodePath(); @@ -1450,23 +1450,3 @@ INLINE void NodePath:: hide_collision_solids() { find_all_matches("**/+CollisionNode").hide(); } - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::get_bottom_node -// Access: Public -// Description: This function is deprecated. Use node() instead. -//////////////////////////////////////////////////////////////////// -INLINE Node *NodePath:: -get_bottom_node() const { - return node(); -} - -//////////////////////////////////////////////////////////////////// -// Function: NodePath::get_bottom_arc -// Access: Public -// Description: This function is deprecated. Use arc() instead. -//////////////////////////////////////////////////////////////////// -INLINE NodeRelation *NodePath:: -get_bottom_arc() const { - return arc(); -} diff --git a/panda/src/sgmanip/nodePath.cxx b/panda/src/sgmanip/nodePath.cxx index 0f80d5dae8..4eb62e127f 100644 --- a/panda/src/sgmanip/nodePath.cxx +++ b/panda/src/sgmanip/nodePath.cxx @@ -63,23 +63,23 @@ public: // unambiguous behavior is required. //////////////////////////////////////////////////////////////////// bool NodePath:: -extend_by(Node *node) { +extend_by(Node *dnode) { nassertr(verify_connectivity(), false); - nassertr(node != (Node *)NULL, false); + nassertr(dnode != (Node *)NULL, false); if (is_empty()) { nassertr(_head == (ArcComponent *)NULL, false); - _top_node = node; + _top_node = dnode; return true; } - Node *bottom_node = get_bottom_node(); - NodeRelation *arc = find_arc(bottom_node, node, _graph_type); + Node *bottom_node = node(); + NodeRelation *arc = find_arc(bottom_node, dnode, _graph_type); if (arc == (NodeRelation *)NULL) { if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() << "Cannot extend " << *this << " by " - << *node << "; no connection.\n"; + << *dnode << "; no connection.\n"; } return false; } @@ -109,7 +109,7 @@ extend_by(NodeRelation *arc) { _top_node = arc->get_parent(); } - if (arc->get_parent() != get_bottom_node()) { + if (arc->get_parent() != node()) { if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() << "Cannot extend " << *this << " by arc " << *arc << "\n"; @@ -182,8 +182,8 @@ extend_by(const string &path) { // if the node was not below this NodePath. //////////////////////////////////////////////////////////////////// bool NodePath:: -extend_down_to(Node *node) { - if (!is_empty() && get_bottom_node() == node) { +extend_down_to(Node *dnode) { + if (!is_empty() && node() == dnode) { // We're already there! return true; } @@ -192,14 +192,14 @@ extend_down_to(Node *node) { NodePathCollection col; FindApproxPath approx_path; approx_path.add_match_many(); - approx_path.add_match_pointer(node); + approx_path.add_match_pointer(dnode); find_matches(col, approx_path, -1); if (col.is_empty()) { if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() << "Could not extend " << *this << " down to " - << *node << "; no connection found.\n"; + << *dnode << "; no connection found.\n"; } return false; } @@ -263,10 +263,10 @@ get_children() const { nassertr(verify_connectivity(), result); nassertr(!is_empty(), result); - Node *node = get_bottom_node(); + Node *bottom_node = node(); DownRelations::const_iterator dri; - dri = node->_children.find(_graph_type); - if (dri != node->_children.end()) { + dri = bottom_node->_children.find(_graph_type); + if (dri != bottom_node->_children.end()) { const DownRelationPointers &drp = (*dri).second; DownRelationPointers::const_iterator drpi; @@ -298,10 +298,10 @@ get_siblings() const { NodePath parent = *this; parent.shorten(1); - Node *node = parent.get_bottom_node(); + Node *parent_node = parent.node(); DownRelations::const_iterator dri; - dri = node->_children.find(_graph_type); - if (dri != node->_children.end()) { + dri = parent_node->_children.find(_graph_type); + if (dri != parent_node->_children.end()) { const DownRelationPointers &drp = (*dri).second; DownRelationPointers::const_iterator drpi; @@ -326,13 +326,13 @@ get_siblings() const { // shortest paths will be listed first. //////////////////////////////////////////////////////////////////// NodePathCollection NodePath:: -find_all_paths_down_to(Node *node) const { +find_all_paths_down_to(Node *dnode) const { NodePathCollection col; nassertr(verify_connectivity(), col); - nassertr(node != (Node *)NULL, col); + nassertr(dnode != (Node *)NULL, col); FindApproxPath approx_path; approx_path.add_match_many(); - approx_path.add_match_pointer(node); + approx_path.add_match_pointer(dnode); find_matches(col, approx_path, -1); return col; } @@ -740,7 +740,7 @@ reparent_to(const NodePath &other, int sort) { NodeRelation *arc = _head->_arc; - arc->change_parent(other.get_bottom_node(), sort); + arc->change_parent(other.node(), sort); // Move our head pointer to the bottom of the new chain. This will // update our own path, as well as all paths that share the same @@ -796,21 +796,21 @@ instance_to(const NodePath &other, int sort) const { nassertr(!is_empty(), NodePath()); nassertr(!other.is_empty(), NodePath()); - Node *node = get_bottom_node(); - NodeRelation *arc = - NodeRelation::create_typed_arc(_graph_type, other.get_bottom_node(), - node, sort); - nassertr(arc != (NodeRelation *)NULL, NodePath()); - nassertr(arc->is_exact_type(_graph_type), NodePath()); + Node *bottom_node = node(); + NodeRelation *darc = + NodeRelation::create_typed_arc(_graph_type, other.node(), + bottom_node, sort); + nassertr(darc != (NodeRelation *)NULL, NodePath()); + nassertr(darc->is_exact_type(_graph_type), NodePath()); if (has_arcs()) { // Copy the transitions from this one's bottom arc, so the // instance will inherit the same local state by default. - arc->copy_transitions_from(get_bottom_arc()); + darc->copy_transitions_from(arc()); } NodePath instance(*this); - instance._head = new ArcComponent(arc, other._head); + instance._head = new ArcComponent(darc, other._head); return instance; } @@ -835,24 +835,24 @@ copy_to(const NodePath &other, int sort) const { nassertr(!is_empty(), NodePath()); nassertr(!other.is_empty(), NodePath()); - Node *source_node = get_bottom_node(); + Node *source_node = node(); PT_Node copy_node = source_node->copy_subgraph(_graph_type); nassertr(copy_node != (Node *)NULL, NodePath()); - NodeRelation *arc = - NodeRelation::create_typed_arc(_graph_type, other.get_bottom_node(), + NodeRelation *darc = + NodeRelation::create_typed_arc(_graph_type, other.node(), copy_node, sort); - nassertr(arc != (NodeRelation *)NULL, NodePath()); - nassertr(arc->is_exact_type(_graph_type), NodePath()); + nassertr(darc != (NodeRelation *)NULL, NodePath()); + nassertr(darc->is_exact_type(_graph_type), NodePath()); if (has_arcs()) { // Copy the transitions from this one's bottom arc, so the // duplicate will inherit the same local state by default. - arc->copy_transitions_from(get_bottom_arc()); + darc->copy_transitions_from(arc()); } NodePath instance(*this); - instance._head = new ArcComponent(arc, other._head); + instance._head = new ArcComponent(darc, other._head); return instance; } @@ -870,12 +870,12 @@ copy_to(const NodePath &other, int sort) const { // returned. //////////////////////////////////////////////////////////////////// NodePath NodePath:: -attach_new_node(Node *node, int sort) const { +attach_new_node(Node *dnode, int sort) const { nassertr(verify_connectivity(), NodePath()); nassertr(!is_empty(), NodePath(_graph_type)); - nassertr(node != (Node *)NULL, NodePath(_graph_type)); + nassertr(dnode != (Node *)NULL, NodePath(_graph_type)); - NodePath path(node, _graph_type); + NodePath path(dnode, _graph_type); return path.instance_to(*this, sort); } @@ -1003,7 +1003,7 @@ void NodePath:: analyze() const { nassertv(!is_empty()); SceneGraphAnalyzer sga(_graph_type); - sga.add_node(get_bottom_node()); + sga.add_node(node()); sga.write(nout); } @@ -1028,7 +1028,7 @@ int NodePath:: flatten_light() { nassertr(!is_empty(), 0); SceneGraphReducer gr(_graph_type); - int num_removed = gr.flatten(get_bottom_node(), false); + int num_removed = gr.flatten(node(), false); if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() @@ -1059,8 +1059,8 @@ int NodePath:: flatten_medium() { nassertr(!is_empty(), 0); SceneGraphReducer gr(_graph_type); - gr.apply_transitions(get_bottom_node()); - int num_removed = gr.flatten(get_bottom_node(), false); + gr.apply_transitions(node()); + int num_removed = gr.flatten(node(), false); if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() @@ -1091,8 +1091,8 @@ int NodePath:: flatten_strong() { nassertr(!is_empty(), 0); SceneGraphReducer gr(_graph_type); - gr.apply_transitions(get_bottom_node()); - int num_removed = gr.flatten(get_bottom_node(), true); + gr.apply_transitions(node()); + int num_removed = gr.flatten(node(), true); if (sgmanip_cat.is_debug()) { sgmanip_cat.debug() @@ -1119,7 +1119,7 @@ write_bam_file(const string &filename) const { bool okflag = false; if (bam_file.open_write(filename)) { - if (bam_file.write_object(get_bottom_node())) { + if (bam_file.write_object(node())) { okflag = true; } bam_file.close(); @@ -1727,7 +1727,7 @@ set_mat(const NodePath &other, const LMatrix4f &mat) { _head->_arc->get_parent(), ForwardIterator(_head->_next), ForwardIterator(), ntw, _graph_type); } else { - wrt(other.get_bottom_node(), ForwardIterator(other._head), ForwardIterator(), + wrt(other.node(), ForwardIterator(other._head), ForwardIterator(), _head->_arc->get_parent(), ForwardIterator(_head->_next), ForwardIterator(), ntw, _graph_type); } @@ -1755,11 +1755,11 @@ get_mat(const NodePath &other) const { NodeTransitionWrapper ntw(TransformTransition::get_class_type()); if (other.is_empty()) { - wrt(get_bottom_node(), ForwardIterator(_head), ForwardIterator(), + wrt(node(), ForwardIterator(_head), ForwardIterator(), (Node *)NULL, ntw, _graph_type); } else { - wrt(get_bottom_node(), ForwardIterator(_head), ForwardIterator(), - other.get_bottom_node(), ForwardIterator(other._head), ForwardIterator(), + wrt(node(), ForwardIterator(_head), ForwardIterator(), + other.node(), ForwardIterator(other._head), ForwardIterator(), ntw, _graph_type); } const TransformTransition *tt; @@ -2564,20 +2564,20 @@ r_get_net_transitions(const ArcComponent *comp, // node, either unnamed as a type, or as a name. //////////////////////////////////////////////////////////////////// string NodePath:: -format_node_name(Node *node) const { - nassertr(node != (Node *)NULL, string()); +format_node_name(Node *dnode) const { + nassertr(dnode != (Node *)NULL, string()); string name; - if (node->is_of_type(NamedNode::get_class_type())) { - name = DCAST(NamedNode, node)->get_name(); + if (dnode->is_of_type(NamedNode::get_class_type())) { + name = DCAST(NamedNode, dnode)->get_name(); } if (name.empty()) { // No name. If the type isn't one of the trivial types (Node or // NamedNode), use the type name instead, since it's likely to be // more unique. - if (!node->is_of_type(Node::get_class_type()) && - !node->is_of_type(NamedNode::get_class_type())) { - return "-" + node->get_type().get_name(); + if (!dnode->is_of_type(Node::get_class_type()) && + !dnode->is_of_type(NamedNode::get_class_type())) { + return "-" + dnode->get_type().get_name(); } } @@ -2663,12 +2663,12 @@ r_find_matches(NodePathCollection &result, } } else { - Node *node = entry._node_path.get_bottom_node(); - nassertv(node != (Node *)NULL); + Node *bottom_node = entry._node_path.node(); + nassertv(bottom_node != (Node *)NULL); DownRelations::const_iterator dri; - dri = node->_children.find(_graph_type); - if (dri != node->_children.end()) { + dri = bottom_node->_children.find(_graph_type); + if (dri != bottom_node->_children.end()) { const DownRelationPointers &drp = (*dri).second; DownRelationPointers::const_iterator drpi; @@ -2694,13 +2694,13 @@ r_find_matches(NodePathCollection &result, //////////////////////////////////////////////////////////////////// void NodePath:: r_list_descendants(ostream &out, int indent_level) const { - Node *node = get_bottom_node(); - nassertv(node != (Node *)NULL); - indent(out, indent_level) << *node << "\n"; + Node *bottom_node = node(); + nassertv(bottom_node != (Node *)NULL); + indent(out, indent_level) << *bottom_node << "\n"; DownRelations::const_iterator dri; - dri = node->_children.find(_graph_type); - if (dri != node->_children.end()) { + dri = bottom_node->_children.find(_graph_type); + if (dri != bottom_node->_children.end()) { const DownRelationPointers &drp = (*dri).second; DownRelationPointers::const_iterator drpi; @@ -2720,15 +2720,15 @@ r_list_descendants(ostream &out, int indent_level) const { //////////////////////////////////////////////////////////////////// void NodePath:: r_list_transitions(ostream &out, int indent_level) const { - Node *node = get_bottom_node(); - nassertv(node != (Node *)NULL); + Node *bottom_node = node(); + nassertv(bottom_node != (Node *)NULL); out << "\n+"; - indent(out, indent_level + 1) << *node << "\n\n"; + indent(out, indent_level + 1) << *bottom_node << "\n\n"; DownRelations::const_iterator dri; - dri = node->_children.find(_graph_type); - if (dri != node->_children.end()) { + dri = bottom_node->_children.find(_graph_type); + if (dri != bottom_node->_children.end()) { const DownRelationPointers &drp = (*dri).second; DownRelationPointers::const_iterator drpi; @@ -2755,10 +2755,10 @@ void NodePath:: r_adjust_all_priorities(NodeRelation *arc, int adjustment) { arc->adjust_all_priorities(adjustment); - Node *node = arc->get_child(); + Node *dnode = arc->get_child(); DownRelations::const_iterator dri; - dri = node->_children.find(_graph_type); - if (dri != node->_children.end()) { + dri = dnode->_children.find(_graph_type); + if (dri != dnode->_children.end()) { const DownRelationPointers &drp = (*dri).second; DownRelationPointers::const_iterator drpi; diff --git a/panda/src/sgmanip/nodePath.h b/panda/src/sgmanip/nodePath.h index fb8fca123b..6d747f3a68 100644 --- a/panda/src/sgmanip/nodePath.h +++ b/panda/src/sgmanip/nodePath.h @@ -132,11 +132,11 @@ PUBLISHED: // Methods to extend or shorten a NodePath. - bool extend_by(Node *node); + bool extend_by(Node *dnode); bool extend_by(NodeRelation *arc); bool extend_by(const NodePath &other); bool extend_by(const string &path); - bool extend_down_to(Node *node); + bool extend_down_to(Node *dnode); void shorten(int num_nodes = 1); void clear(); @@ -179,11 +179,11 @@ PUBLISHED: INLINE bool has_parent() const; INLINE NodePath get_parent() const; - INLINE NodePath find_path_down_to(Node *node) const; + INLINE NodePath find_path_down_to(Node *dnode) const; INLINE NodePath find(const string &path) const; NodePathCollection - find_all_paths_down_to(Node *node) const; + find_all_paths_down_to(Node *dnode) const; NodePathCollection find_all_matches(const string &path) const; @@ -200,7 +200,7 @@ PUBLISHED: void wrt_reparent_to(const NodePath &other, int sort = 0); NodePath instance_to(const NodePath &other, int sort = 0) const; NodePath copy_to(const NodePath &other, int sort = 0) const; - NodePath attach_new_node(Node *node, int sort = 0) const; + NodePath attach_new_node(Node *dnode, int sort = 0) const; INLINE NodePath attach_new_node(const string &name, int sort = 0) const; void remove_node(); @@ -451,10 +451,6 @@ PUBLISHED: PT(BoundingVolume) get_bounds() const; void write_bounds(ostream &out) const; - // Deprecated functions. These will go away soon. - INLINE Node *get_bottom_node() const; - INLINE NodeRelation *get_bottom_arc() const; - public: // This is a supporting class for passing the list of arcs to wrt(). @@ -477,7 +473,7 @@ private: ostream &out, int indent_level) const; void r_get_net_transitions(const ArcComponent *comp, AllTransitionsWrapper &trans) const; - string format_node_name(Node *node) const; + string format_node_name(Node *dnode) const; void find_matches(NodePathCollection &result, const string &approx_path_str, diff --git a/panda/src/testbed/demo.cxx b/panda/src/testbed/demo.cxx index ccddb87510..06eaaec77c 100644 --- a/panda/src/testbed/demo.cxx +++ b/panda/src/testbed/demo.cxx @@ -226,7 +226,7 @@ set_highlight() { nout << "Bounding volume of arc is " << *selected_node.get_bounds() << "\n"; nout << "Transitions on arc:\n"; - selected_node.get_bottom_arc()->write_transitions(nout, 2); + selected_node.arc()->write_transitions(nout, 2); selected_node.show_bounds(); } @@ -300,7 +300,7 @@ static void event_fkey(CPT_Event event) { if (selected_node.has_arcs()) { // Apply a color to the selected node. - NodeRelation *arc = selected_node.get_bottom_arc(); + NodeRelation *arc = selected_node.arc(); nassertv(arc != (NodeRelation *)NULL); if (event->get_name() == "f9") { @@ -519,7 +519,7 @@ event_L(CPT_Event) { NodePath search(sky); NodePath sky_search = search.find("**/sun"); - PT_Node light = sky_search.get_bottom_node(); + PT_Node light = sky_search.node(); flare->set_light_source(light); flare_arc = new RenderRelation(light, flare, 10);