فهرست منبع

Fixed bug with internal debug names getting lost.

enn0x 15 سال پیش
والد
کامیت
76c3f1268b
72فایلهای تغییر یافته به همراه197 افزوده شده و 45 حذف شده
  1. 5 1
      panda/src/physx/physxActor.I
  2. 5 3
      panda/src/physx/physxActor.cxx
  3. 1 0
      panda/src/physx/physxActor.h
  4. 3 1
      panda/src/physx/physxActorDesc.I
  5. 3 1
      panda/src/physx/physxActorDesc.cxx
  6. 1 0
      panda/src/physx/physxActorDesc.h
  7. 1 0
      panda/src/physx/physxBoxForceFieldShape.I
  8. 1 0
      panda/src/physx/physxBoxShape.I
  9. 2 1
      panda/src/physx/physxBoxShapeDesc.I
  10. 1 0
      panda/src/physx/physxCapsuleForceFieldShape.I
  11. 1 0
      panda/src/physx/physxCapsuleShape.I
  12. 2 1
      panda/src/physx/physxCapsuleShapeDesc.I
  13. 10 1
      panda/src/physx/physxCloth.I
  14. 4 1
      panda/src/physx/physxCloth.cxx
  15. 1 0
      panda/src/physx/physxCloth.h
  16. 3 1
      panda/src/physx/physxClothDesc.I
  17. 3 1
      panda/src/physx/physxClothDesc.cxx
  18. 1 3
      panda/src/physx/physxClothDesc.h
  19. 1 0
      panda/src/physx/physxConvexForceFieldShape.I
  20. 1 0
      panda/src/physx/physxConvexShape.I
  21. 2 1
      panda/src/physx/physxConvexShapeDesc.I
  22. 1 0
      panda/src/physx/physxCylindricalJoint.I
  23. 1 0
      panda/src/physx/physxD6Joint.I
  24. 1 0
      panda/src/physx/physxDistanceJoint.I
  25. 1 0
      panda/src/physx/physxFixedJoint.I
  26. 2 0
      panda/src/physx/physxForceField.I
  27. 4 2
      panda/src/physx/physxForceField.cxx
  28. 1 0
      panda/src/physx/physxForceField.h
  29. 2 1
      panda/src/physx/physxForceFieldDesc.I
  30. 3 1
      panda/src/physx/physxForceFieldDesc.cxx
  31. 2 0
      panda/src/physx/physxForceFieldDesc.h
  32. 4 1
      panda/src/physx/physxForceFieldShape.I
  33. 4 1
      panda/src/physx/physxForceFieldShape.cxx
  34. 2 0
      panda/src/physx/physxForceFieldShape.h
  35. 12 0
      panda/src/physx/physxForceFieldShapeDesc.I
  36. 3 1
      panda/src/physx/physxForceFieldShapeDesc.cxx
  37. 2 0
      panda/src/physx/physxForceFieldShapeDesc.h
  38. 2 0
      panda/src/physx/physxForceFieldShapeGroup.I
  39. 5 1
      panda/src/physx/physxForceFieldShapeGroup.cxx
  40. 1 0
      panda/src/physx/physxForceFieldShapeGroup.h
  41. 2 1
      panda/src/physx/physxForceFieldShapeGroupDesc.I
  42. 3 1
      panda/src/physx/physxForceFieldShapeGroupDesc.cxx
  43. 1 0
      panda/src/physx/physxForceFieldShapeGroupDesc.h
  44. 1 0
      panda/src/physx/physxHeightFieldShape.I
  45. 1 1
      panda/src/physx/physxHeightFieldShapeDesc.cxx
  46. 4 1
      panda/src/physx/physxJoint.I
  47. 4 1
      panda/src/physx/physxJoint.cxx
  48. 2 0
      panda/src/physx/physxJoint.h
  49. 12 0
      panda/src/physx/physxJointDesc.I
  50. 3 1
      panda/src/physx/physxJointDesc.cxx
  51. 2 0
      panda/src/physx/physxJointDesc.h
  52. 1 0
      panda/src/physx/physxPlaneShape.I
  53. 2 1
      panda/src/physx/physxPlaneShapeDesc.I
  54. 1 0
      panda/src/physx/physxPointInPlaneJoint.I
  55. 1 0
      panda/src/physx/physxPointOnLineJoint.I
  56. 1 0
      panda/src/physx/physxPrismaticJoint.I
  57. 1 0
      panda/src/physx/physxPulleyJoint.I
  58. 13 8
      panda/src/physx/physxScene.cxx
  59. 4 1
      panda/src/physx/physxShape.I
  60. 4 1
      panda/src/physx/physxShape.cxx
  61. 2 0
      panda/src/physx/physxShape.h
  62. 12 0
      panda/src/physx/physxShapeDesc.I
  63. 3 1
      panda/src/physx/physxShapeDesc.cxx
  64. 2 0
      panda/src/physx/physxShapeDesc.h
  65. 1 0
      panda/src/physx/physxSphereForceFieldShape.I
  66. 1 0
      panda/src/physx/physxSphereShape.I
  67. 2 1
      panda/src/physx/physxSphereShapeDesc.I
  68. 1 0
      panda/src/physx/physxSphericalJoint.I
  69. 1 0
      panda/src/physx/physxTriangleMeshShape.I
  70. 2 1
      panda/src/physx/physxTriangleMeshShapeDesc.I
  71. 1 0
      panda/src/physx/physxWheelShape.I
  72. 1 1
      panda/src/physx/physxWheelShapeDesc.cxx

+ 5 - 1
panda/src/physx/physxActor.I

@@ -22,6 +22,7 @@
 INLINE PhysxActor::
 PhysxActor() : PhysxObject() {
 
+  _name = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -32,6 +33,7 @@ PhysxActor() : PhysxObject() {
 INLINE PhysxActor::
 ~PhysxActor() {
 
+  free(_name);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -53,8 +55,10 @@ ls() const {
 INLINE void PhysxActor::
 ls(ostream &out, int indent_level) const {
 
+  char *name = _name ? _name : "";
+
   indent(out, indent_level) << get_type().get_name()
-                            << " " << get_name( )
+                            << " " << name
                             << " (at 0x" << this << ")";
 
   if (!_np.is_empty()) {

+ 5 - 3
panda/src/physx/physxActor.cxx

@@ -41,8 +41,6 @@ link(NxActor *actorPtr) {
   NxU32 nShapes = _ptr->getNbShapes();
 
   for (NxU32 i=0; i < nShapes; i++) {
-    if (shapes[i]->getName() == NULL) shapes[i]->setName("");
-
     PhysxShape *shape = PhysxShape::factory(shapes[i]->getType());
     shape->link(shapes[i]);
   }
@@ -137,7 +135,10 @@ void PhysxActor::
 set_name(const char *name) {
 
   nassertv(_error_type == ET_ok);
-  _ptr->setName(name);
+
+  free(_name);
+  _name = strdup(name);
+  _ptr->setName(_name);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -400,6 +401,7 @@ create_shape(PhysxShapeDesc &desc) {
   nassertr(shapePtr, NULL);
 
   shape->link(shapePtr);
+  shape->set_name(desc.ptr()->name);
 
   return shape;
 }

+ 1 - 0
panda/src/physx/physxActor.h

@@ -197,6 +197,7 @@ private:
   NxActor *_ptr;
   NodePath _np;
   PT(PhysxController) _controller;
+  char *_name;
 
 ////////////////////////////////////////////////////////////////////
 public:

+ 3 - 1
panda/src/physx/physxActorDesc.I

@@ -22,7 +22,8 @@
 INLINE PhysxActorDesc::
 PhysxActorDesc() {
 
-  _desc.name = "";
+  _name = NULL;
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -33,6 +34,7 @@ PhysxActorDesc() {
 INLINE PhysxActorDesc::
 ~PhysxActorDesc() {
 
+  free(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 3 - 1
panda/src/physx/physxActorDesc.cxx

@@ -36,7 +36,9 @@ add_shape(PhysxShapeDesc &desc) {
 void PhysxActorDesc::
 set_name(const char *name) {
 
-  _desc.name = name;
+  free(_name);
+  _name = strdup(name);
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/physx/physxActorDesc.h

@@ -54,6 +54,7 @@ PUBLISHED:
 
 public:
   NxActorDesc _desc;
+  char *_name;
 };
 
 #include "physxActorDesc.I"

+ 1 - 0
panda/src/physx/physxBoxForceFieldShape.I

@@ -32,5 +32,6 @@ PhysxBoxForceFieldShape() : PhysxForceFieldShape() {
 INLINE PhysxBoxForceFieldShape::
 ~PhysxBoxForceFieldShape() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxBoxShape.I

@@ -32,5 +32,6 @@ PhysxBoxShape() : PhysxShape() {
 INLINE PhysxBoxShape::
 ~PhysxBoxShape() {
 
+  free(_name);
 }
 

+ 2 - 1
panda/src/physx/physxBoxShapeDesc.I

@@ -22,7 +22,7 @@
 INLINE PhysxBoxShapeDesc::
 PhysxBoxShapeDesc() : PhysxShapeDesc() {
 
-  _desc.name = "";
+  set_to_default();
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -44,6 +44,7 @@ INLINE void PhysxBoxShapeDesc::
 set_to_default() {
 
   _desc.setToDefault();
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/physx/physxCapsuleForceFieldShape.I

@@ -32,5 +32,6 @@ PhysxCapsuleForceFieldShape() : PhysxForceFieldShape() {
 INLINE PhysxCapsuleForceFieldShape::
 ~PhysxCapsuleForceFieldShape() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxCapsuleShape.I

@@ -32,5 +32,6 @@ PhysxCapsuleShape() : PhysxShape() {
 INLINE PhysxCapsuleShape::
 ~PhysxCapsuleShape() {
 
+  free(_name);
 }
 

+ 2 - 1
panda/src/physx/physxCapsuleShapeDesc.I

@@ -22,7 +22,7 @@
 INLINE PhysxCapsuleShapeDesc::
 PhysxCapsuleShapeDesc() : PhysxShapeDesc() {
 
-  _desc.name = "";
+  set_to_default();
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -44,6 +44,7 @@ INLINE void PhysxCapsuleShapeDesc::
 set_to_default() {
 
   _desc.setToDefault();
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 10 - 1
panda/src/physx/physxCloth.I

@@ -22,6 +22,7 @@
 INLINE PhysxCloth::
 PhysxCloth() : PhysxObject() {
 
+  _name = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -32,6 +33,7 @@ PhysxCloth() : PhysxObject() {
 INLINE PhysxCloth::
 ~PhysxCloth() {
 
+  free(_name);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -53,9 +55,16 @@ ls() const {
 INLINE void PhysxCloth::
 ls(ostream &out, int indent_level) const {
 
+  char *name = _name ? _name : "";
+
   indent(out, indent_level) << get_type().get_name()
+                            << " " << name
                             << " (at 0x" << this << ")";
-  //out << " N:0x" << _node;
+
+  //if (_node) {
+  //  " N:0x" << _node;
+  //}
+
   out << "\n";
 }
 

+ 4 - 1
panda/src/physx/physxCloth.cxx

@@ -145,7 +145,10 @@ void PhysxCloth::
 set_name(const char *name) {
 
   nassertv(_error_type == ET_ok);
-  _ptr->setName(name);
+
+  free(_name);
+  _name = strdup(name);
+  _ptr->setName(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/physx/physxCloth.h

@@ -108,6 +108,7 @@ public:
 private:
   NxCloth *_ptr;
   PT(PhysxClothNode) _node;
+  char *_name;
 
 ////////////////////////////////////////////////////////////////////
 public:

+ 3 - 1
panda/src/physx/physxClothDesc.I

@@ -22,7 +22,8 @@
 INLINE PhysxClothDesc::
 PhysxClothDesc() {
 
-  _desc.name = "";
+  _name = NULL;
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -33,6 +34,7 @@ PhysxClothDesc() {
 INLINE PhysxClothDesc::
 ~PhysxClothDesc() {
 
+  free(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 3 - 1
panda/src/physx/physxClothDesc.cxx

@@ -24,7 +24,9 @@
 void PhysxClothDesc::
 set_name(const char *name) {
 
-  _desc.name = name;
+  free(_name);
+  _name = strdup(name);
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 3
panda/src/physx/physxClothDesc.h

@@ -68,11 +68,9 @@ PUBLISHED:
   unsigned int get_solver_iterations() const;
   bool get_flag(PhysxClothFlag flag) const;
 
-public:
-  //void get_mesh_numbers(NxU32 &numVertices, NxU32 &numTriangles);
-
 public:
   NxClothDesc _desc;
+  char *_name;  
 };
 
 #include "physxClothDesc.I"

+ 1 - 0
panda/src/physx/physxConvexForceFieldShape.I

@@ -32,5 +32,6 @@ PhysxConvexForceFieldShape() : PhysxForceFieldShape() {
 INLINE PhysxConvexForceFieldShape::
 ~PhysxConvexForceFieldShape() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxConvexShape.I

@@ -32,5 +32,6 @@ PhysxConvexShape() : PhysxShape() {
 INLINE PhysxConvexShape::
 ~PhysxConvexShape() {
 
+  free(_name);
 }
 

+ 2 - 1
panda/src/physx/physxConvexShapeDesc.I

@@ -22,7 +22,7 @@
 INLINE PhysxConvexShapeDesc::
 PhysxConvexShapeDesc() : PhysxShapeDesc() {
 
-  _desc.name = "";
+  set_to_default();
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -44,6 +44,7 @@ INLINE void PhysxConvexShapeDesc::
 set_to_default() {
 
   _desc.setToDefault();
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/physx/physxCylindricalJoint.I

@@ -32,5 +32,6 @@ PhysxCylindricalJoint() : PhysxJoint() {
 INLINE PhysxCylindricalJoint::
 ~PhysxCylindricalJoint() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxD6Joint.I

@@ -32,5 +32,6 @@ PhysxD6Joint() : PhysxJoint() {
 INLINE PhysxD6Joint::
 ~PhysxD6Joint() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxDistanceJoint.I

@@ -32,5 +32,6 @@ PhysxDistanceJoint() : PhysxJoint() {
 INLINE PhysxDistanceJoint::
 ~PhysxDistanceJoint() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxFixedJoint.I

@@ -32,5 +32,6 @@ PhysxFixedJoint() : PhysxJoint() {
 INLINE PhysxFixedJoint::
 ~PhysxFixedJoint() {
 
+  free(_name);
 }
 

+ 2 - 0
panda/src/physx/physxForceField.I

@@ -22,6 +22,7 @@
 INLINE PhysxForceField::
 PhysxForceField() : PhysxObject() {
 
+  _name = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -32,6 +33,7 @@ PhysxForceField() : PhysxObject() {
 INLINE PhysxForceField::
 ~PhysxForceField() {
 
+  free(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 4 - 2
panda/src/physx/physxForceField.cxx

@@ -38,7 +38,6 @@ link(NxForceField *materialPtr) {
   // Link include shape group
   PhysxForceFieldShapeGroup *group = new PhysxForceFieldShapeGroup();
   group->link(&(_ptr->getIncludeShapeGroup()));
-  _ptr->getIncludeShapeGroup().setName("");
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -85,7 +84,10 @@ void PhysxForceField::
 set_name(const char *name) {
 
   nassertv(_error_type == ET_ok);
-  _ptr->setName(name);
+
+  free(_name);
+  _name = strdup(name);
+  _ptr->setName(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/physx/physxForceField.h

@@ -68,6 +68,7 @@ public:
 
 private:
   NxForceField *_ptr;
+  char *_name;
 
 ////////////////////////////////////////////////////////////////////
 public:

+ 2 - 1
panda/src/physx/physxForceFieldDesc.I

@@ -22,7 +22,7 @@
 INLINE PhysxForceFieldDesc::
 PhysxForceFieldDesc() {
 
-  _desc.name = "";
+  _desc.name = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -33,6 +33,7 @@ PhysxForceFieldDesc() {
 INLINE PhysxForceFieldDesc::
 ~PhysxForceFieldDesc() {
 
+  free(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 3 - 1
panda/src/physx/physxForceFieldDesc.cxx

@@ -26,7 +26,9 @@
 void PhysxForceFieldDesc::
 set_name(const char *name) {
 
-  _desc.name = name;
+  free(_name);
+  _name = strdup(name);
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 0
panda/src/physx/physxForceFieldDesc.h

@@ -65,6 +65,8 @@ public:
 
   NxForceFieldDesc _desc;
   NxForceFieldLinearKernelDesc _kernel;
+
+  char *_name;
 };
 
 #include "physxForceFieldDesc.I"

+ 4 - 1
panda/src/physx/physxForceFieldShape.I

@@ -22,6 +22,7 @@
 INLINE PhysxForceFieldShape::
 PhysxForceFieldShape() : PhysxObject() {
 
+  _name = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -43,8 +44,10 @@ ls() const {
 INLINE void PhysxForceFieldShape::
 ls(ostream &out, int indent_level) const {
 
+  char *name = _name ? _name : "";
+
   indent(out, indent_level) << get_type().get_name()
-                            << " " << get_name()
+                            << " " << name
                             << " (at 0x" << this << ")\n";
 }
 

+ 4 - 1
panda/src/physx/physxForceFieldShape.cxx

@@ -104,7 +104,10 @@ void PhysxForceFieldShape::
 set_name(const char *name) {
 
   nassertv(_error_type == ET_ok);
-  ptr()->setName(name);
+
+  free(_name);
+  _name = strdup(name);
+  ptr()->setName(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 0
panda/src/physx/physxForceFieldShape.h

@@ -62,6 +62,8 @@ public:
 protected:
   INLINE PhysxForceFieldShape();
 
+  char *_name;
+
 ////////////////////////////////////////////////////////////////////
 public:
   static TypeHandle get_class_type() {

+ 12 - 0
panda/src/physx/physxForceFieldShapeDesc.I

@@ -22,5 +22,17 @@
 INLINE PhysxForceFieldShapeDesc::
 PhysxForceFieldShapeDesc() {
 
+  _name = NULL;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysxForceFieldShapeDesc::Destructor
+//       Access: Protected
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE PhysxForceFieldShapeDesc::
+~PhysxForceFieldShapeDesc() {
+
+  free(_name);
 }
 

+ 3 - 1
panda/src/physx/physxForceFieldShapeDesc.cxx

@@ -23,7 +23,9 @@
 void PhysxForceFieldShapeDesc::
 set_name(const char *name) {
 
-  ptr()->name = name;
+  free(_name);
+  _name = strdup(name);
+  ptr()->name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 0
panda/src/physx/physxForceFieldShapeDesc.h

@@ -43,9 +43,11 @@ PUBLISHED:
 
 public:
   virtual NxForceFieldShapeDesc *ptr() const = 0;
+  char *_name;
 
 protected:
   INLINE PhysxForceFieldShapeDesc();
+  INLINE ~PhysxForceFieldShapeDesc();
 };
 
 #include "physxForceFieldShapeDesc.I"

+ 2 - 0
panda/src/physx/physxForceFieldShapeGroup.I

@@ -22,6 +22,7 @@
 INLINE PhysxForceFieldShapeGroup::
 PhysxForceFieldShapeGroup() : PhysxObject() {
 
+  _name = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -32,6 +33,7 @@ PhysxForceFieldShapeGroup() : PhysxObject() {
 INLINE PhysxForceFieldShapeGroup::
 ~PhysxForceFieldShapeGroup() {
 
+  free(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 5 - 1
panda/src/physx/physxForceFieldShapeGroup.cxx

@@ -142,7 +142,10 @@ void PhysxForceFieldShapeGroup::
 set_name(const char *name) {
 
   nassertv(_error_type == ET_ok);
-  _ptr->setName(name);
+
+  free(_name);
+  _name = strdup(name);
+  _ptr->setName(_name);
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -190,6 +193,7 @@ create_shape(PhysxForceFieldShapeDesc &desc) {
   nassertr(shapePtr, NULL);
 
   shape->link(shapePtr);
+  shape->set_name(desc.ptr()->name);
 
   return shape;
 }

+ 1 - 0
panda/src/physx/physxForceFieldShapeGroup.h

@@ -69,6 +69,7 @@ public:
 
 private:
   NxForceFieldShapeGroup *_ptr;
+  char *_name;
 
 ////////////////////////////////////////////////////////////////////
 public:

+ 2 - 1
panda/src/physx/physxForceFieldShapeGroupDesc.I

@@ -22,7 +22,7 @@
 INLINE PhysxForceFieldShapeGroupDesc::
 PhysxForceFieldShapeGroupDesc() {
 
-  _desc.name = "";
+  _desc.name = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -33,6 +33,7 @@ PhysxForceFieldShapeGroupDesc() {
 INLINE PhysxForceFieldShapeGroupDesc::
 ~PhysxForceFieldShapeGroupDesc() {
 
+  free(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 3 - 1
panda/src/physx/physxForceFieldShapeGroupDesc.cxx

@@ -35,7 +35,9 @@ add_shape(PhysxForceFieldShapeDesc &desc) {
 void PhysxForceFieldShapeGroupDesc::
 set_name(const char *name) {
 
-  _desc.name = name;
+  free(_name);
+  _name = strdup(name);
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/physx/physxForceFieldShapeGroupDesc.h

@@ -45,6 +45,7 @@ PUBLISHED:
 
 public:
   NxForceFieldShapeGroupDesc _desc;
+  char *_name;
 };
 
 #include "physxForceFieldShapeGroupDesc.I"

+ 1 - 0
panda/src/physx/physxHeightFieldShape.I

@@ -32,5 +32,6 @@ PhysxHeightFieldShape() : PhysxShape() {
 INLINE PhysxHeightFieldShape::
 ~PhysxHeightFieldShape() {
 
+  free(_name);
 }
 

+ 1 - 1
panda/src/physx/physxHeightFieldShapeDesc.cxx

@@ -25,7 +25,7 @@ set_to_default() {
 
   _desc.setToDefault();
 
-  _desc.name = "";
+  _desc.name = _name;
 
   _desc.shapeFlags = NX_SF_FEATURE_INDICES | NX_SF_VISUALIZATION;
   _desc.meshFlags = NX_MESH_SMOOTH_SPHERE_COLLISIONS;

+ 4 - 1
panda/src/physx/physxJoint.I

@@ -22,6 +22,7 @@
 INLINE PhysxJoint::
 PhysxJoint() : PhysxObject() {
 
+  _name = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -43,8 +44,10 @@ ls() const {
 INLINE void PhysxJoint::
 ls(ostream &out, int indent_level) const {
 
+  char *name = _name ? _name : "";
+
   indent(out, indent_level) << get_type().get_name()
-                            << " " << get_name( )
+                            << " " << name
                             << " (at 0x" << this << ")";
 
   NxActor *actorPtr[2];

+ 4 - 1
panda/src/physx/physxJoint.cxx

@@ -100,7 +100,10 @@ void PhysxJoint::
 set_name(const char *name) {
 
   nassertv(_error_type == ET_ok);
-  ptr()->setName(name);
+
+  free(_name);
+  _name = strdup(name);
+  ptr()->setName(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 0
panda/src/physx/physxJoint.h

@@ -72,6 +72,8 @@ public:
 protected:
   INLINE PhysxJoint();
 
+  char *_name;
+
 ////////////////////////////////////////////////////////////////////
 public:
   static TypeHandle get_class_type() {

+ 12 - 0
panda/src/physx/physxJointDesc.I

@@ -22,5 +22,17 @@
 INLINE PhysxJointDesc::
 PhysxJointDesc() {
 
+  _name = NULL;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysxJointDesc::Destructor
+//       Access: Protected
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE PhysxJointDesc::
+~PhysxJointDesc() {
+
+  free(_name);
 }
 

+ 3 - 1
panda/src/physx/physxJointDesc.cxx

@@ -23,7 +23,9 @@
 void PhysxJointDesc::
 set_name(const char *name) {
 
-  ptr()->name = name;
+  free(_name);
+  _name = strdup(name);
+  ptr()->name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 0
panda/src/physx/physxJointDesc.h

@@ -58,9 +58,11 @@ PUBLISHED:
 
 public:
   virtual NxJointDesc *ptr() const = 0;
+  char *_name;
 
 protected:
   INLINE PhysxJointDesc();
+  INLINE ~PhysxJointDesc();
 };
 
 #include "physxJointDesc.I"

+ 1 - 0
panda/src/physx/physxPlaneShape.I

@@ -32,5 +32,6 @@ PhysxPlaneShape() : PhysxShape() {
 INLINE PhysxPlaneShape::
 ~PhysxPlaneShape() {
 
+  free(_name);
 }
 

+ 2 - 1
panda/src/physx/physxPlaneShapeDesc.I

@@ -22,7 +22,7 @@
 INLINE PhysxPlaneShapeDesc::
 PhysxPlaneShapeDesc() : PhysxShapeDesc() {
 
-  _desc.name = "";
+  set_to_default();
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -44,6 +44,7 @@ INLINE void PhysxPlaneShapeDesc::
 set_to_default() {
 
   _desc.setToDefault();
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/physx/physxPointInPlaneJoint.I

@@ -32,5 +32,6 @@ PhysxPointInPlaneJoint() : PhysxJoint() {
 INLINE PhysxPointInPlaneJoint::
 ~PhysxPointInPlaneJoint() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxPointOnLineJoint.I

@@ -32,5 +32,6 @@ PhysxPointOnLineJoint() : PhysxJoint() {
 INLINE PhysxPointOnLineJoint::
 ~PhysxPointOnLineJoint() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxPrismaticJoint.I

@@ -32,5 +32,6 @@ PhysxPrismaticJoint() : PhysxJoint() {
 INLINE PhysxPrismaticJoint::
 ~PhysxPrismaticJoint() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxPulleyJoint.I

@@ -32,5 +32,6 @@ PhysxPulleyJoint() : PhysxJoint() {
 INLINE PhysxPulleyJoint::
 ~PhysxPulleyJoint() {
 
+  free(_name);
 }
 

+ 13 - 8
panda/src/physx/physxScene.cxx

@@ -395,6 +395,11 @@ create_actor(PhysxActorDesc &desc) {
   nassertr(actorPtr, NULL);
 
   actor->link(actorPtr);
+  actor->set_name(desc._desc.name);
+
+  for (unsigned int i=0; i < actor->get_num_shapes(); i++) {
+    actor->get_shape(i)->set_name(desc._desc.shapes[i]->name);
+  }
 
   return actor;
 }
@@ -759,6 +764,7 @@ create_joint(PhysxJointDesc &desc) {
   nassertr(jointPtr, NULL);
 
   joint->link(jointPtr);
+  joint->set_name(desc.ptr()->name);
 
   return joint;
 }
@@ -820,6 +826,11 @@ create_force_field(PhysxForceFieldDesc &desc) {
   nassertr(fieldPtr, NULL);
 
   field->link(fieldPtr);
+  field->set_name(desc._desc.name);
+
+  for (unsigned int i=0; i < field->get_num_shape_groups(); i++) {
+    field->get_shape_group(i)->set_name(desc._desc.shapeGroups[i]->getName());
+  }
 
   return field;
 }
@@ -873,6 +884,7 @@ create_force_field_shape_group(PhysxForceFieldShapeGroupDesc &desc) {
   nassertr(groupPtr, NULL);
 
   group->link(groupPtr);
+  group->set_name(strdup(desc._desc.name));
 
   return group;
 }
@@ -928,14 +940,7 @@ create_cloth(PhysxClothDesc &desc) {
   nassertr(clothPtr, NULL);
 
   cloth->link(clothPtr);
-
-  // TODO:
-
-  // Allocate buffers in the cloth's geom node (PhysxMeshNode)
-  //NxU32 numVertices = 0;
-  //NxU32 numTriangles = 0;
-  //desc.get_mesh_numbers(numVertices, numTriangles);
-  //cloth->get_cloth_node()->allocate(numVertices, numTriangles, cloth);
+  cloth->set_name(desc._desc.name);
 
   return cloth;
 }

+ 4 - 1
panda/src/physx/physxShape.I

@@ -22,6 +22,7 @@
 INLINE PhysxShape::
 PhysxShape() : PhysxObject() {
 
+  _name = NULL;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -43,8 +44,10 @@ ls() const {
 INLINE void PhysxShape::
 ls(ostream &out, int indent_level) const {
 
+  char *name = _name ? _name : "";
+
   indent(out, indent_level) << get_type().get_name()
-                            << " " << get_name()
+                            << " " << name
                             << " (at 0x" << this << ")\n";
 }
 

+ 4 - 1
panda/src/physx/physxShape.cxx

@@ -111,7 +111,10 @@ void PhysxShape::
 set_name(const char *name) {
 
   nassertv(_error_type == ET_ok);
-  ptr()->setName(name);
+
+  free(_name);
+  _name = strdup(name);
+  ptr()->setName(_name);
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 0
panda/src/physx/physxShape.h

@@ -86,6 +86,8 @@ public:
 protected:
   INLINE PhysxShape();
 
+  char *_name;
+
 ////////////////////////////////////////////////////////////////////
 public:
   static TypeHandle get_class_type() {

+ 12 - 0
panda/src/physx/physxShapeDesc.I

@@ -22,5 +22,17 @@
 INLINE PhysxShapeDesc::
 PhysxShapeDesc() {
 
+  _name = NULL;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: PhysxShapeDesc::Destructor
+//       Access: Protected
+//  Description:
+////////////////////////////////////////////////////////////////////
+INLINE PhysxShapeDesc::
+~PhysxShapeDesc() {
+
+  free(_name);
 }
 

+ 3 - 1
panda/src/physx/physxShapeDesc.cxx

@@ -24,7 +24,9 @@
 void PhysxShapeDesc::
 set_name(const char *name) {
 
-  ptr()->name = name;
+  free(_name);
+  _name = strdup(name);
+  ptr()->name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 2 - 0
panda/src/physx/physxShapeDesc.h

@@ -61,9 +61,11 @@ PUBLISHED:
 
 public:
   virtual NxShapeDesc *ptr() const = 0;
+  char *_name;
 
 protected:
   INLINE PhysxShapeDesc();
+  INLINE ~PhysxShapeDesc();
 };
 
 #include "physxShapeDesc.I"

+ 1 - 0
panda/src/physx/physxSphereForceFieldShape.I

@@ -32,5 +32,6 @@ PhysxSphereForceFieldShape() : PhysxForceFieldShape() {
 INLINE PhysxSphereForceFieldShape::
 ~PhysxSphereForceFieldShape() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxSphereShape.I

@@ -32,5 +32,6 @@ PhysxSphereShape() : PhysxShape() {
 INLINE PhysxSphereShape::
 ~PhysxSphereShape() {
 
+  free(_name);
 }
 

+ 2 - 1
panda/src/physx/physxSphereShapeDesc.I

@@ -22,7 +22,7 @@
 INLINE PhysxSphereShapeDesc::
 PhysxSphereShapeDesc() : PhysxShapeDesc() {
 
-  _desc.name = "";
+  set_to_default();
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -44,6 +44,7 @@ INLINE void PhysxSphereShapeDesc::
 set_to_default() {
 
   _desc.setToDefault();
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/physx/physxSphericalJoint.I

@@ -32,5 +32,6 @@ PhysxSphericalJoint() : PhysxJoint() {
 INLINE PhysxSphericalJoint::
 ~PhysxSphericalJoint() {
 
+  free(_name);
 }
 

+ 1 - 0
panda/src/physx/physxTriangleMeshShape.I

@@ -32,5 +32,6 @@ PhysxTriangleMeshShape() : PhysxShape() {
 INLINE PhysxTriangleMeshShape::
 ~PhysxTriangleMeshShape() {
 
+  free(_name);
 }
 

+ 2 - 1
panda/src/physx/physxTriangleMeshShapeDesc.I

@@ -22,7 +22,7 @@
 INLINE PhysxTriangleMeshShapeDesc::
 PhysxTriangleMeshShapeDesc() : PhysxShapeDesc() {
 
-  _desc.name = "";
+  set_to_default();
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -44,6 +44,7 @@ INLINE void PhysxTriangleMeshShapeDesc::
 set_to_default() {
 
   _desc.setToDefault();
+  _desc.name = _name;
 }
 
 ////////////////////////////////////////////////////////////////////

+ 1 - 0
panda/src/physx/physxWheelShape.I

@@ -32,5 +32,6 @@ PhysxWheelShape() : PhysxShape() {
 INLINE PhysxWheelShape::
 ~PhysxWheelShape() {
 
+  free(_name);
 }
 

+ 1 - 1
panda/src/physx/physxWheelShapeDesc.cxx

@@ -24,7 +24,7 @@ set_to_default() {
 
   _desc.setToDefault();
 
-  _desc.name = "";
+  _desc.name = _name;
   _desc.localPose = PhysxManager::mat4_to_nxMat34(LMatrix4f::y_to_z_up_mat());
 }