Browse Source

ls and reverseLs

Dave Schuyler 22 years ago
parent
commit
47fd8335df
3 changed files with 31 additions and 3 deletions
  1. 1 2
      dtool/src/dconfig/config_dconfig.h
  2. 28 1
      panda/src/pgraph/nodePath.I
  3. 2 0
      panda/src/pgraph/nodePath.h

+ 1 - 2
dtool/src/dconfig/config_dconfig.h

@@ -25,8 +25,7 @@
 #pragma warning (disable : 4231)
 #endif
 
-#include <dtoolbase.h>
-
+#include "dtoolbase.h"
 #include "notifyCategoryProxy.h"
 
 NotifyCategoryDecl(dconfig, EXPCL_DTOOLCONFIG, EXPTP_DTOOLCONFIG);

+ 28 - 1
panda/src/pgraph/nodePath.I

@@ -373,6 +373,33 @@ ls(ostream &out, int indent_level) const {
   }
 }
 
+////////////////////////////////////////////////////////////////////
+//     Function: NodePath::reverse_ls
+//       Access: Published
+//  Description: Lists the hierarchy at and above the referenced node.
+////////////////////////////////////////////////////////////////////
+INLINE void NodePath::
+reverse_ls() const {
+  reverse_ls(nout);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: NodePath::reverse_ls
+//       Access: Published
+//  Description: Lists the hierarchy at and above the referenced node.
+////////////////////////////////////////////////////////////////////
+INLINE int NodePath::
+reverse_ls(ostream &out, int indent_level) const {
+  if (is_empty()) {
+    out << "(empty)\n";
+    return 0;
+  } else if (has_parent()) {
+    indent_level = get_parent().reverse_ls(out, indent_level);
+  }
+  node()->write(out, indent_level);
+  return indent_level + 2;
+}
+
 ////////////////////////////////////////////////////////////////////
 //     Function: NodePath::get_state
 //       Access: Published
@@ -786,7 +813,7 @@ set_pos_hpr(const NodePath &other,
 ////////////////////////////////////////////////////////////////////
 INLINE void NodePath::
 set_hpr_scale(const NodePath &other,
-	      float h, float p, float r, float sx, float sy, float sz) {
+        float h, float p, float r, float sx, float sy, float sz) {
   set_hpr_scale(other, LVecBase3f(h, p, r), LVecBase3f(sx, sy, sz));
 }
 

+ 2 - 0
panda/src/pgraph/nodePath.h

@@ -216,6 +216,8 @@ PUBLISHED:
 
   INLINE void ls() const;
   INLINE void ls(ostream &out, int indent_level = 0) const;
+  INLINE void reverse_ls() const;
+  INLINE int reverse_ls(ostream &out, int indent_level = 0) const;
 
 
   // Aggregate transform and state information.