Refactor debug names, this time using C++ strings

This commit is contained in:
enn0x 2010-06-30 21:44:12 +00:00
parent bf4a5aface
commit 955b03dff9
108 changed files with 168 additions and 171 deletions

View File

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

View File

@ -33,6 +33,8 @@ link(NxActor *actorPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(actorPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_actors.add(this);
@ -136,9 +138,8 @@ set_name(const char *name) {
nassertv(_error_type == ET_ok);
free(_name);
_name = strdup(name);
_ptr->setName(_name);
_name = name ? name : "";
_ptr->setName(_name.c_str());
}
////////////////////////////////////////////////////////////////////
@ -401,7 +402,6 @@ create_shape(PhysxShapeDesc &desc) {
nassertr(shapePtr, NULL);
shape->link(shapePtr);
shape->set_name(desc.ptr()->name);
return shape;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,6 +30,8 @@ link(NxForceFieldShape *shapePtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData;
group->_shapes.add(this);
}

View File

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

View File

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

View File

@ -30,6 +30,8 @@ link(NxShape *shapePtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
actor->_shapes.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxForceFieldShape *shapePtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData;
group->_shapes.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxShape *shapePtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
actor->_shapes.add(this);
}

View File

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

View File

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

View File

@ -29,13 +29,15 @@ TypeHandle PhysxCloth::_type_handle;
// Description:
////////////////////////////////////////////////////////////////////
void PhysxCloth::
link(NxCloth *ptr) {
link(NxCloth *clothPtr) {
// Link self
_ptr = ptr;
_ptr = clothPtr;
_error_type = ET_ok;
_ptr->userData = this;
set_name(clothPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_cloths.add(this);
}
@ -146,9 +148,8 @@ set_name(const char *name) {
nassertv(_error_type == ET_ok);
free(_name);
_name = strdup(name);
_ptr->setName(_name);
_name = name ? name : "";
_ptr->setName(_name.c_str());
}
////////////////////////////////////////////////////////////////////

View File

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

View File

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

View File

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

View File

@ -70,7 +70,9 @@ PUBLISHED:
public:
NxClothDesc _desc;
char *_name;
private:
string _name;
};
#include "physxClothDesc.I"

View File

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

View File

@ -29,6 +29,8 @@ link(NxForceFieldShape *shapePtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData;
group->_shapes.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxShape *shapePtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
actor->_shapes.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxJoint *jointPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(jointPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_joints.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxJoint *jointPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(jointPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_joints.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxJoint *jointPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(jointPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_joints.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxJoint *jointPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(jointPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_joints.add(this);
}

View File

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

View File

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

View File

@ -25,13 +25,15 @@ TypeHandle PhysxForceField::_type_handle;
// Description:
////////////////////////////////////////////////////////////////////
void PhysxForceField::
link(NxForceField *materialPtr) {
link(NxForceField *fieldPtr) {
// Link self
_ptr = materialPtr;
_ptr = fieldPtr;
_ptr->userData = this;
_error_type = ET_ok;
set_name(fieldPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_forcefields.add(this);
@ -85,9 +87,8 @@ set_name(const char *name) {
nassertv(_error_type == ET_ok);
free(_name);
_name = strdup(name);
_ptr->setName(_name);
_name = name ? name : "";
_ptr->setName(_name.c_str());
}
////////////////////////////////////////////////////////////////////

View File

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

View File

@ -22,7 +22,6 @@
INLINE PhysxForceFieldDesc::
PhysxForceFieldDesc() {
_desc.name = NULL;
}
////////////////////////////////////////////////////////////////////
@ -33,7 +32,6 @@ PhysxForceFieldDesc() {
INLINE PhysxForceFieldDesc::
~PhysxForceFieldDesc() {
free(_name);
}
////////////////////////////////////////////////////////////////////
@ -45,6 +43,7 @@ INLINE void PhysxForceFieldDesc::
set_to_default() {
_desc.setToDefault();
set_name("");
}
////////////////////////////////////////////////////////////////////

View File

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

View File

@ -66,7 +66,8 @@ public:
NxForceFieldDesc _desc;
NxForceFieldLinearKernelDesc _kernel;
char *_name;
private:
string _name;
};
#include "physxForceFieldDesc.I"

View File

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

View File

@ -105,9 +105,8 @@ set_name(const char *name) {
nassertv(_error_type == ET_ok);
free(_name);
_name = strdup(name);
ptr()->setName(_name);
_name = name ? name : "";
ptr()->setName(_name.c_str());
}
////////////////////////////////////////////////////////////////////

View File

@ -62,7 +62,8 @@ public:
protected:
INLINE PhysxForceFieldShape();
char *_name;
private:
string _name;
////////////////////////////////////////////////////////////////////
public:

View File

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

View File

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

View File

@ -43,7 +43,9 @@ PUBLISHED:
public:
virtual NxForceFieldShapeDesc *ptr() const = 0;
char *_name;
private:
string _name;
protected:
INLINE PhysxForceFieldShapeDesc();

View File

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

View File

@ -32,6 +32,8 @@ link(NxForceFieldShapeGroup *groupPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(groupPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_ffgroups.add(this);
@ -143,9 +145,8 @@ set_name(const char *name) {
nassertv(_error_type == ET_ok);
free(_name);
_name = strdup(name);
_ptr->setName(_name);
_name = name ? name : "";
_ptr->setName(_name.c_str());
}
////////////////////////////////////////////////////////////////////
@ -193,7 +194,6 @@ create_shape(PhysxForceFieldShapeDesc &desc) {
nassertr(shapePtr, NULL);
shape->link(shapePtr);
shape->set_name(desc.ptr()->name);
return shape;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxShape *shapePtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
actor->_shapes.add(this);
}

View File

@ -24,8 +24,7 @@ void PhysxHeightFieldShapeDesc::
set_to_default() {
_desc.setToDefault();
_desc.name = _name;
set_name("");
_desc.shapeFlags = NX_SF_FEATURE_INDICES | NX_SF_VISUALIZATION;
_desc.meshFlags = NX_MESH_SMOOTH_SPHERE_COLLISIONS;

View File

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

View File

@ -101,9 +101,8 @@ set_name(const char *name) {
nassertv(_error_type == ET_ok);
free(_name);
_name = strdup(name);
ptr()->setName(_name);
_name = name ? name : "";
ptr()->setName(_name.c_str());
}
////////////////////////////////////////////////////////////////////

View File

@ -72,7 +72,8 @@ public:
protected:
INLINE PhysxJoint();
char *_name;
private:
string _name;
////////////////////////////////////////////////////////////////////
public:

View File

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

View File

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

View File

@ -58,7 +58,9 @@ PUBLISHED:
public:
virtual NxJointDesc *ptr() const = 0;
char *_name;
private:
string _name;
protected:
INLINE PhysxJointDesc();

View File

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

View File

@ -30,6 +30,8 @@ link(NxShape *shapePtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
actor->_shapes.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxJoint *jointPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(jointPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_joints.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxJoint *jointPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(jointPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_joints.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxJoint *jointPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(jointPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_joints.add(this);
}

View File

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

View File

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

View File

@ -30,6 +30,8 @@ link(NxJoint *jointPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(jointPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_joints.add(this);
}

View File

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

View File

@ -32,6 +32,8 @@ link(NxJoint *jointPtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(jointPtr->getName());
PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData;
scene->_joints.add(this);
}

View File

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

View File

@ -395,11 +395,6 @@ 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;
}
@ -710,7 +705,7 @@ create_controller(PhysxControllerDesc &desc) {
nassertr(controllerPtr, NULL);
controller->link(controllerPtr);
controllerPtr->getActor()->setName("");
controller->get_actor()->set_name("");
return controller;
}
@ -764,7 +759,6 @@ create_joint(PhysxJointDesc &desc) {
nassertr(jointPtr, NULL);
joint->link(jointPtr);
joint->set_name(desc.ptr()->name);
return joint;
}
@ -826,11 +820,6 @@ 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;
}
@ -884,7 +873,6 @@ create_force_field_shape_group(PhysxForceFieldShapeGroupDesc &desc) {
nassertr(groupPtr, NULL);
group->link(groupPtr);
group->set_name(strdup(desc._desc.name));
return group;
}
@ -940,7 +928,6 @@ create_cloth(PhysxClothDesc &desc) {
nassertr(clothPtr, NULL);
cloth->link(clothPtr);
cloth->set_name(desc._desc.name);
return cloth;
}

View File

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

View File

@ -112,9 +112,8 @@ set_name(const char *name) {
nassertv(_error_type == ET_ok);
free(_name);
_name = strdup(name);
ptr()->setName(_name);
_name = name ? name : "";
ptr()->setName(_name.c_str());
}
////////////////////////////////////////////////////////////////////

View File

@ -86,7 +86,8 @@ public:
protected:
INLINE PhysxShape();
char *_name;
private:
string _name;
////////////////////////////////////////////////////////////////////
public:

View File

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

View File

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

View File

@ -61,7 +61,9 @@ PUBLISHED:
public:
virtual NxShapeDesc *ptr() const = 0;
char *_name;
private:
string _name;
protected:
INLINE PhysxShapeDesc();

View File

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

View File

@ -29,6 +29,8 @@ link(NxForceFieldShape *shapePtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData;
group->_shapes.add(this);
}

View File

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

View File

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

View File

@ -29,6 +29,8 @@ link(NxShape *shapePtr) {
_ptr->userData = this;
_error_type = ET_ok;
set_name(shapePtr->getName());
PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData;
actor->_shapes.add(this);
}

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More