소스 검색

*** empty log message ***

David Rose 24 년 전
부모
커밋
e5deed7dfd

+ 2 - 1
panda/src/char/characterJoint.h

@@ -12,6 +12,7 @@
 #include <namedNode.h>
 #include <nodeRelation.h>
 #include <pt_NamedNode.h>
+#include <pt_NodeRelation.h>
 
 ////////////////////////////////////////////////////////////////////
 //       Class : CharacterJoint
@@ -44,7 +45,7 @@ PUBLISHED:
   void clear_local_transforms();
 
 private:
-  typedef set< PT(NodeRelation) > ArcList;
+  typedef set< PT_NodeRelation > ArcList;
   ArcList _net_transform_arcs;
   ArcList _local_transform_arcs;
 

+ 2 - 1
panda/src/collide/collisionHandlerPhysical.h

@@ -13,6 +13,7 @@
 
 #include <driveInterface.h>
 #include <pointerTo.h>
+#include <pt_NodeRelation.h>
 
 ///////////////////////////////////////////////////////////////////
 // 	 Class : CollisionHandlerPhysical
@@ -54,7 +55,7 @@ protected:
     void set_mat(const LMatrix4f &mat) const;
 
     PT(DriveInterface) _drive_interface;
-    PT(NodeRelation) _arc;
+    PT_NodeRelation _arc;
   };
 
   typedef map<PT(CollisionNode), ColliderDef> Colliders;

+ 3 - 1
panda/src/collide/collisionSolid.h

@@ -13,6 +13,8 @@
 #include <luse.h>
 #include <nodeRelation.h>
 #include <pointerTo.h>
+#include <node.h>
+#include <vector_PT_NodeRelation.h>
 
 class CollisionHandler;
 class CollisionEntry;
@@ -85,7 +87,7 @@ protected:
 
   virtual void recompute_viz(Node *parent)=0;
   
-  typedef vector< PT(NodeRelation) > VizArcs;
+  typedef vector_PT_NodeRelation VizArcs;
   VizArcs _solid_viz_arcs;
   VizArcs _wireframe_viz_arcs;
   VizArcs _other_viz_arcs;

+ 1 - 1
panda/src/cull/cullStateLookup.cxx

@@ -106,7 +106,7 @@ find_node(Node *node,
 //               CullStateSubtree is always returned.
 ////////////////////////////////////////////////////////////////////
 CullStateSubtree *CullStateLookup::
-get_subtree(const PT(NodeRelation) &arc, 
+get_subtree(const PT_NodeRelation &arc, 
 	    const AllTransitionsWrapper &trans,
 	    Node *top_subtree,
 	    UpdateSeq now) {

+ 3 - 2
panda/src/cull/cullStateLookup.h

@@ -11,6 +11,7 @@
 #include <geomNode.h>
 #include <pointerTo.h>
 #include <pt_Node.h>
+#include <pt_NodeRelation.h>
 
 #include <map>
 
@@ -42,7 +43,7 @@ public:
   CullState *find_node(Node *node, 
 		       const AllTransitionsWrapper &trans,
 		       UpdateSeq now);
-  CullStateSubtree *get_subtree(const PT(NodeRelation) &arc,
+  CullStateSubtree *get_subtree(const PT_NodeRelation &arc,
 				const AllTransitionsWrapper &trans,
 				Node *top_subtree,
 				UpdateSeq now);
@@ -63,7 +64,7 @@ private:
   typedef map<PT_Node,  PT(CullState) > CullStates;
   CullStates _cull_states;
 
-  typedef map<PT(NodeRelation), CullStateSubtree *> Subtrees;
+  typedef map<PT_NodeRelation, CullStateSubtree *> Subtrees;
   Subtrees _subtrees;
 };
 

+ 12 - 4
panda/src/graph/Sources.pp

@@ -47,9 +47,15 @@
     onOffTransition.I onOffTransition.cxx onOffTransition.h \
     onTransition.I onTransition.cxx onTransition.h pointerNameClass.h \
     pt_NamedNode.N pt_NamedNode.cxx pt_NamedNode.h pt_Node.N \
-    pt_Node.cxx pt_Node.h setTransitionHelpers.T \
+    pt_Node.cxx pt_Node.h \
+    pt_NodeRelation.cxx pt_NodeRelation.h \
+    setTransitionHelpers.T \
     setTransitionHelpers.h transitionDirection.h traverserVisitor.T \
-    traverserVisitor.h vector_PT_Node.cxx vector_PT_Node.h wrt.I \
+    traverserVisitor.h \
+    vector_PT_Node.cxx vector_PT_Node.h \
+    vector_PT_NodeRelation.cxx vector_PT_NodeRelation.h \
+    vector_NodeRelation_star.cxx vector_NodeRelation_star.h \
+    wrt.I \
     wrt.cxx wrt.h
 
   #define INSTALL_HEADERS \
@@ -79,9 +85,11 @@
     nullTransitionWrapper.h onAttribute.h onOffAttribute.I \
     onOffAttribute.h onOffTransition.I onOffTransition.h \
     onTransition.I onTransition.h pointerNameClass.h pt_NamedNode.h \
-    pt_Node.h setTransitionHelpers.T setTransitionHelpers.h \
+    pt_Node.h pt_NodeRelation.h \
+    setTransitionHelpers.T setTransitionHelpers.h \
     transitionDirection.h traverserVisitor.T traverserVisitor.h \
-    vector_PT_Node.h wrt.I wrt.h
+    vector_PT_Node.h vector_PT_NodeRelation.h vector_NodeRelation_star.h \
+    wrt.I wrt.h
 
   #define IGATESCAN all
 

+ 4 - 6
panda/src/graph/node.h

@@ -83,13 +83,11 @@ PUBLISHED:
   virtual void write(ostream &out, int indent_level = 0) const;
 
 public:
-  // We reference-count the child pointer, but not the parent pointer,
-  // to avoid circular reference counting.
+  // These members define the actual connection of arcs to the nodes.
+  // Generally, you should not monkey with them, unless you know what
+  // you're doing; the get_parent()/get_child() interface above is
+  // simpler to use.
 
-  // The following members are public to allow low-overhead traversal
-  // through the scene graph when necessary, but beware!  It is not
-  // safe to access these members directly outside of PANDA.DLL.
-  // Instead, use the get_parent()/get_child() interface, above.
   INLINE_GRAPH const NodeConnection &find_connection(TypeHandle graph_type) const;
   INLINE_GRAPH NodeConnection *update_connection(TypeHandle graph_type);
 

+ 6 - 5
panda/src/graph/nodeConnection.h

@@ -10,6 +10,11 @@
 
 #include "nodeRelation.h"
 #include "config_graph.h"
+#include "vector_PT_NodeRelation.h"
+#include "vector_NodeRelation_star.h"
+
+typedef vector_PT_NodeRelation DownRelationPointers;
+typedef vector_NodeRelation_star UpRelationPointers;
 
 
 ///////////////////////////////////////////////////////////////////
@@ -17,12 +22,8 @@
 // Description : This class represents the table, stored within each
 //               Node, of all the connected NodeRelations (arcs) of a
 //               particular graph type.
-//
-//               Node that this class is not exported from PANDA.DLL.
-//               You should use the get_parent()/get_child() interface
-//               to Node for code outside of PANDA.DLL.
 ////////////////////////////////////////////////////////////////////
-class NodeConnection {
+class EXPCL_PANDA NodeConnection {
 public:
   INLINE_GRAPH NodeConnection(TypeHandle graph_type = TypeHandle::none());
   INLINE_GRAPH ~NodeConnection();

+ 7 - 7
panda/src/graph/nodeRelation.I

@@ -11,7 +11,7 @@
 ////////////////////////////////////////////////////////////////////
 EXPCL_PANDA INLINE_GRAPH void
 remove_arc(NodeRelation *arc) {
-  PT(NodeRelation) hold_arc = arc->detach();
+  PT(TypedWriteableReferenceCount) hold_ptr = arc->detach();
   arc->_parent = NULL;
   arc->_child = NULL;
 }
@@ -88,7 +88,7 @@ get_graph_type() const {
 ////////////////////////////////////////////////////////////////////
 INLINE_GRAPH void NodeRelation::
 change_parent(Node *parent) {
-  PT(NodeRelation) hold_arc = detach();
+  PT(TypedWriteableReferenceCount) hold_ptr = detach();
   _parent = parent;
   attach();
 }
@@ -101,7 +101,7 @@ change_parent(Node *parent) {
 ////////////////////////////////////////////////////////////////////
 INLINE_GRAPH void NodeRelation::
 change_parent(Node *parent, int sort) {
-  PT(NodeRelation) hold_arc = detach();
+  PT(TypedWriteableReferenceCount) hold_ptr = detach();
   _parent = parent;
   _sort = sort;
   attach();
@@ -114,7 +114,7 @@ change_parent(Node *parent, int sort) {
 ////////////////////////////////////////////////////////////////////
 INLINE_GRAPH void NodeRelation::
 change_child(Node *child) {
-  PT(NodeRelation) hold_arc = detach();
+  PT(TypedWriteableReferenceCount) hold_ptr = detach();
   _child = child;
   attach();
 }
@@ -127,7 +127,7 @@ change_child(Node *child) {
 ////////////////////////////////////////////////////////////////////
 INLINE_GRAPH void NodeRelation::
 change_parent_and_child(Node *parent, Node *child) {
-  PT(NodeRelation) hold_arc = detach();
+  PT(TypedWriteableReferenceCount) hold_ptr = detach();
   _parent = parent;
   _child = child;
   attach();
@@ -141,7 +141,7 @@ change_parent_and_child(Node *parent, Node *child) {
 ////////////////////////////////////////////////////////////////////
 INLINE_GRAPH void NodeRelation::
 set_sort(int sort) {
-  PT(NodeRelation) hold_arc = detach();
+  PT(TypedWriteableReferenceCount) hold_ptr = detach();
   _sort = sort;
   attach();
 }
@@ -155,7 +155,7 @@ set_sort(int sort) {
 ////////////////////////////////////////////////////////////////////
 INLINE_GRAPH void NodeRelation::
 set_graph_type(TypeHandle graph_type) {
-  PT(NodeRelation) hold_arc = detach();
+  PT(TypedWriteableReferenceCount) hold_ptr = detach();
   _graph_type = graph_type;
   attach();
 }

+ 8 - 4
panda/src/graph/nodeRelation.cxx

@@ -670,10 +670,14 @@ attach() {
 //               when its last reference count is removed, and it is
 //               generally a bad idea to destruct a class within its
 //               own method.
+
+//               It must be a PT(TypedWriteableReferenceCount), and
+//               not PT_NodeRelation, because of circularity problems
+//               trying to export the template class PT_NodeRelation.
 ////////////////////////////////////////////////////////////////////
-PT(NodeRelation) NodeRelation::
+PT(TypedWriteableReferenceCount) NodeRelation::
 detach() {
-  PT(NodeRelation) result = this;
+  PT(TypedWriteableReferenceCount) result = this;
 
   nassertr(_parent != (Node*)NULL, result);
   nassertr(_child != (Node*)NULL, result);
@@ -726,9 +730,9 @@ detach() {
 //               remove it from its parent's arc list, which is
 //               presumably about to be destroyed anyway.
 ////////////////////////////////////////////////////////////////////
-PT(NodeRelation) NodeRelation::
+PT(TypedWriteableReferenceCount) NodeRelation::
 detach_below() {
-  PT(NodeRelation) result = this;
+  PT(TypedWriteableReferenceCount) result = this;
 
   nassertr(_parent != (Node*)NULL, result);
   nassertr(_child != (Node*)NULL, result);

+ 2 - 5
panda/src/graph/nodeRelation.h

@@ -134,8 +134,8 @@ private:
 
 protected:
   void attach();
-  PT(NodeRelation) detach();
-  PT(NodeRelation) detach_below();
+  PT(TypedWriteableReferenceCount) detach();
+  PT(TypedWriteableReferenceCount) detach_below();
 
 private:
   // We reference-count the child pointer, but not the parent pointer,
@@ -222,9 +222,6 @@ private:
 EXPCL_PANDA INLINE_GRAPH ostream &
 operator << (ostream &out, const NodeRelation &arc);
 
-typedef vector< PT(NodeRelation) > DownRelationPointers;
-typedef vector<NodeRelation *> UpRelationPointers;
-
 #include "nodeRelation.T"
 
 #ifndef DONT_INLINE_GRAPH

+ 12 - 0
panda/src/graph/pt_NodeRelation.cxx

@@ -0,0 +1,12 @@
+// Filename: pt_NodeRelation.cxx
+// Created by:  drose (07May01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "nodeRelation.h"
+#include "pt_NodeRelation.h"
+
+// Tell GCC that we'll take care of the instantiation explicitly here.
+#ifdef __GNUC__
+#pragma implementation
+#endif

+ 33 - 0
panda/src/graph/pt_NodeRelation.h

@@ -0,0 +1,33 @@
+// Filename: pt_NodeRelation.h
+// Created by:  drose (07May01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef PT_NODERELATION_H
+#define PT_NODERELATION_H
+
+#include <pandabase.h>
+
+#include "nodeRelation.h"
+#include <pointerTo.h>
+
+////////////////////////////////////////////////////////////////////
+//       Class : PT_NodeRelation
+// Description : PT(NodeRelation).  This is defined here solely we can
+//               explicitly export the template class.  It's not
+//               strictly necessary, but it doesn't hurt.
+////////////////////////////////////////////////////////////////////
+
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, PointerToBase<NodeRelation>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, PointerTo<NodeRelation>)
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, ConstPointerTo<NodeRelation>)
+
+typedef PointerTo<NodeRelation> PT_NodeRelation;
+typedef ConstPointerTo<NodeRelation> CPT_NodeRelation;
+
+// Tell GCC that we'll take care of the instantiation explicitly here.
+#ifdef __GNUC__
+#pragma interface
+#endif
+
+#endif

+ 11 - 0
panda/src/graph/vector_NodeRelation_star.cxx

@@ -0,0 +1,11 @@
+// Filename: vector_NodeRelation_star.cxx
+// Created by:  drose (07May01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "vector_NodeRelation_star.h"
+
+// Tell GCC that we'll take care of the instantiation explicitly here.
+#ifdef __GNUC__
+#pragma implementation
+#endif

+ 32 - 0
panda/src/graph/vector_NodeRelation_star.h

@@ -0,0 +1,32 @@
+// Filename: vector_NodeRelation_star.h
+// Created by:  drose (07May01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef VECTOR_NODERELATION_STAR_H
+#define VECTOR_NODERELATION_STAR_H
+
+#include <pandabase.h>
+
+#include <vector>
+
+class NodeRelation;
+
+////////////////////////////////////////////////////////////////////
+//       Class : vector_NodeRelation_star
+// Description : A vector of NodeRelation*'s.  This class is defined
+//               once here, and exported to PANDA.DLL; other packages
+//               that want to use a vector of this type (whether they
+//               need to export it or not) should include this header
+//               file, rather than defining the vector again.
+////////////////////////////////////////////////////////////////////
+
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, std::vector<NodeRelation *>)
+typedef vector<NodeRelation *> vector_NodeRelation_star;
+
+// Tell GCC that we'll take care of the instantiation explicitly here.
+#ifdef __GNUC__
+#pragma interface
+#endif
+
+#endif

+ 12 - 0
panda/src/graph/vector_PT_NodeRelation.cxx

@@ -0,0 +1,12 @@
+// Filename: vector_PT_NodeRelation.cxx
+// Created by:  drose (07May01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#include "node.h"
+#include "vector_PT_NodeRelation.h"
+
+// Tell GCC that we'll take care of the instantiation explicitly here.
+#ifdef __GNUC__
+#pragma implementation
+#endif

+ 33 - 0
panda/src/graph/vector_PT_NodeRelation.h

@@ -0,0 +1,33 @@
+// Filename: vector_PT_NodeRelation.h
+// Created by:  drose (07May01)
+// 
+////////////////////////////////////////////////////////////////////
+
+#ifndef VECTOR_PT_NODERELATION_H
+#define VECTOR_PT_NODERELATION_H
+
+#include <pandabase.h>
+
+#include "nodeRelation.h"
+#include "pt_NodeRelation.h"
+
+#include <vector>
+
+////////////////////////////////////////////////////////////////////
+//       Class : vector_PT_NodeRelation
+// Description : A vector of PT(NodeRelation)'s.  This class is defined once
+//               here, and exported to PANDA.DLL; other packages that
+//               want to use a vector of this type (whether they need
+//               to export it or not) should include this header file,
+//               rather than defining the vector again.
+////////////////////////////////////////////////////////////////////
+
+EXPORT_TEMPLATE_CLASS(EXPCL_PANDA, EXPTP_PANDA, std::vector<PT_NodeRelation>)
+typedef vector<PT_NodeRelation> vector_PT_NodeRelation;
+
+// Tell GCC that we'll take care of the instantiation explicitly here.
+#ifdef __GNUC__
+#pragma interface
+#endif
+
+#endif

+ 8 - 1
panda/src/graph/wrt.I

@@ -858,7 +858,8 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now,
       top_subtree = top_subtree_3;
     }
 
-    if (check_trans.compare_to(result) != 0) {
+    int compare = check_trans.compare_to(result);
+    if (compare != 0) {
       wrt_cat.warning()
 	<< "WRT subtree cache from " << *arc->get_child() << " to ";
       if (to == (Node *)NULL) {
@@ -874,6 +875,12 @@ cached_wrt_subtree(NodeRelation *arc, Node *to, UpdateSeq as_of, UpdateSeq now,
 	<< "  should be:\n";
       check_trans.write(wrt_cat.warning(false), 4);
       result = check_trans;
+
+      /*
+      cerr << "Begin recheck.\n";
+      int num = check_trans.compare_to(result);
+      cerr << "Done recheck, result = " << num << "\n";
+      */
     }
   }
 #endif

+ 2 - 1
panda/src/parametrics/parametricCurve.h

@@ -9,6 +9,7 @@
 #include <pandabase.h>
 
 #include <namedNode.h>
+#include <pt_NodeRelation.h>
 #include <luse.h>
 
 #include <typedef.h>
@@ -129,7 +130,7 @@ private:
   typedef list<ParametricCurveDrawer *> DrawerList;
   DrawerList _drawers;
   ParametricCurveDrawer *_implicit_drawer;
-  PT(NodeRelation) _viz_arc;
+  PT_NodeRelation _viz_arc;
 
 // TypedWriteable stuff
 protected:

+ 2 - 1
panda/src/parametrics/parametricCurveDrawer.h

@@ -10,6 +10,7 @@
 
 #include <lineSegs.h>
 #include <node.h>
+#include <vector_PT_NodeRelation.h>
 
 #include <typeHandle.h>
 
@@ -71,7 +72,7 @@ private:
   float _num_ticks;
   float _tick_scale;
 
-  typedef vector< PT(NodeRelation) > TickArcs;
+  typedef vector_PT_NodeRelation TickArcs;
   TickArcs _tick_arcs;
 
 public:

+ 2 - 1
panda/src/sgmanip/nodePath.cxx

@@ -26,6 +26,7 @@
 #include <dftraverser.h>
 #include <bamFile.h>
 #include <materialPool.h>
+#include <pt_NodeRelation.h>
 
 #include <list>
 
@@ -884,7 +885,7 @@ remove_node() {
   nassertv(verify_connectivity());
   nassertv(has_arcs());
 
-  PT(NodeRelation) darc = arc();
+  PT_NodeRelation darc = arc();
 
   // Set the chain to stop here, so that any NodePaths sharing this
   // one will now begin at this "deleted" node.

+ 2 - 1
panda/src/tform/mouseWatcher.h

@@ -17,6 +17,7 @@
 #include <nodeRelation.h>
 #include <pointerTo.h>
 #include <eventHandler.h>
+#include <pt_NodeRelation.h>
 
 #include <set>
 
@@ -106,7 +107,7 @@ private:
   string _enter_pattern;
   string _leave_pattern;
 
-  PT(NodeRelation) _geometry;
+  PT_NodeRelation _geometry;
 
   EventHandler* _eh;