rdb 17 лет назад
Родитель
Сommit
7c9592f520

+ 18 - 0
panda/src/ode/odeBody.I

@@ -12,6 +12,24 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+////////////////////////////////////////////////////////////////////
+//     Function: OdeBody::is_empty
+//       Access: Published
+//  Description: Returns true if the ID is 0, meaning the OdeBody
+//               does not point to a valid body. It is an error to
+//               call a method on an empty body.
+//               Note that an empty OdeBody also evaluates to False.
+////////////////////////////////////////////////////////////////////
+INLINE bool OdeBody::
+is_empty() const {
+  return (_id == 0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: OdeBody::get_id
+//       Access: Published
+//  Description: Returns the underlying dBodyID.
+////////////////////////////////////////////////////////////////////
 INLINE dBodyID OdeBody::
 get_id() const {
   return _id;

+ 1 - 0
panda/src/ode/odeBody.h

@@ -43,6 +43,7 @@ PUBLISHED:
   OdeBody(OdeWorld &world);
   virtual ~OdeBody();
   void destroy();
+  INLINE bool is_empty() const;
 
   INLINE void set_auto_disable_linear_threshold(dReal linear_threshold);
   INLINE void set_auto_disable_angular_threshold(dReal angular_threshold);

+ 18 - 0
panda/src/ode/odeGeom.I

@@ -12,6 +12,24 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+////////////////////////////////////////////////////////////////////
+//     Function: OdeGeom::is_empty
+//       Access: Published
+//  Description: Returns true if the ID is 0, meaning the OdeGeom
+//               does not point to a valid geom. It is an error to
+//               call a method on an empty geom.
+//               Note that an empty OdeGeom also evaluates to False.
+////////////////////////////////////////////////////////////////////
+INLINE bool OdeGeom::
+is_empty() const {
+  return (_id == 0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: OdeGeom::get_id
+//       Access: Published
+//  Description: Returns the underlying dGeomID.
+////////////////////////////////////////////////////////////////////
 INLINE dGeomID OdeGeom::
 get_id() const {
   return _id;

+ 1 - 0
panda/src/ode/odeGeom.h

@@ -70,6 +70,7 @@ PUBLISHED:
 
   virtual ~OdeGeom();
   void destroy();
+  INLINE bool is_empty() const;
 
   //INLINE void set_data(void* data);
   INLINE void set_body(OdeBody &body);

+ 18 - 0
panda/src/ode/odeJoint.I

@@ -12,6 +12,24 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+////////////////////////////////////////////////////////////////////
+//     Function: OdeJoint::is_empty
+//       Access: Published
+//  Description: Returns true if the ID is 0, meaning the OdeJoint
+//               does not point to a valid joint. It is an error to
+//               call a method on an empty joint.
+//               Note that an empty OdeJoint also evaluates to False.
+////////////////////////////////////////////////////////////////////
+INLINE bool OdeJoint::
+is_empty() const {
+  return (_id == 0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: OdeJoint::get_id
+//       Access: Published
+//  Description: Returns the underlying dJointID.
+////////////////////////////////////////////////////////////////////
 INLINE dJointID OdeJoint::
 get_id() const {
   return _id;

+ 1 - 0
panda/src/ode/odeJoint.h

@@ -68,6 +68,7 @@ PUBLISHED:
 
   virtual ~OdeJoint();
   void destroy();
+  INLINE bool is_empty() const;
   
   /* INLINE void set_data(void *data); */
   /* INLINE void *get_data(); */

+ 17 - 0
panda/src/ode/odeSpace.I

@@ -12,7 +12,24 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+////////////////////////////////////////////////////////////////////
+//     Function: OdeSpace::is_empty
+//       Access: Published
+//  Description: Returns true if the ID is 0, meaning the OdeSpace
+//               does not point to a valid space. It is an error to
+//               call a method on an empty space.
+//               Note that an empty OdeSpace also evaluates to False.
+////////////////////////////////////////////////////////////////////
+INLINE bool OdeSpace::
+is_empty() const {
+  return (_id == 0);
+}
 
+////////////////////////////////////////////////////////////////////
+//     Function: OdeSpace::get_id
+//       Access: Published
+//  Description: Returns the underlying dSpaceID.
+////////////////////////////////////////////////////////////////////
 INLINE dSpaceID OdeSpace::
 get_id() const {
   return _id;

+ 1 - 0
panda/src/ode/odeSpace.h

@@ -51,6 +51,7 @@ protected:
 PUBLISHED:
   virtual ~OdeSpace();
   void destroy();
+  INLINE bool is_empty() const;
 
   INLINE void set_cleanup(int mode);
   INLINE int get_cleanup() const;

+ 18 - 0
panda/src/ode/odeWorld.I

@@ -12,6 +12,24 @@
 //
 ////////////////////////////////////////////////////////////////////
 
+////////////////////////////////////////////////////////////////////
+//     Function: OdeWorld::is_empty
+//       Access: Published
+//  Description: Returns true if the ID is 0, meaning the OdeWorld
+//               does not point to a valid world. It is an error to
+//               call a method on an empty world.
+//               Note that an empty OdeWorld also evaluates to False.
+////////////////////////////////////////////////////////////////////
+INLINE bool OdeWorld::
+is_empty() const {
+  return (_id == 0);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: OdeWorld::get_id
+//       Access: Published
+//  Description: Returns the underlying dWorldID.
+////////////////////////////////////////////////////////////////////
 INLINE dWorldID OdeWorld::
 get_id() const {
   return _id;

+ 1 - 0
panda/src/ode/odeWorld.h

@@ -42,6 +42,7 @@ PUBLISHED:
   OdeWorld(const OdeWorld &copy);
   virtual ~OdeWorld();
   void destroy();
+  INLINE bool is_empty() const;
 
   INLINE void set_gravity(dReal x, dReal y, dReal z);
   INLINE void set_gravity(const LVecBase3f &vec);