diff --git a/include/obj/bhkConstraint.h b/include/obj/bhkConstraint.h index eb9e701e8f663783a64c1fa7ab7d2cc94c2f3389..8fdf8f2ab74c114fd7a3807d30a1b31a9b53f318 100644 --- a/include/obj/bhkConstraint.h +++ b/include/obj/bhkConstraint.h @@ -55,6 +55,27 @@ public: NIFLIB_API virtual const Type & GetType() const; //--BEGIN MISC CUSTOM CODE--// + + /*! + * Adds an entity to this bhkConstraint. + */ + NIFLIB_API void AddEntity( bhkEntity * obj ); + + /*! + * Removes an entity from this bhkConstraint. + */ + NIFLIB_API void RemoveEntity( bhkEntity * obj ); + + /*! + * Removes all entities from this bhkConstraint. + */ + NIFLIB_API void ClearEntities(); + + /*! + * Retrieves all the entities attached to this bhkConstraint. + */ + NIFLIB_API vector< bhkEntity * > GetEntities() const; + //--END CUSTOM CODE--// protected: /*! Number of bodies affected by this constraint. */ diff --git a/src/obj/bhkConstraint.cpp b/src/obj/bhkConstraint.cpp index 0409924d747beec0ecf859a409cd484cbc5535b6..31cf7299075734146fcf85acdbb62182e47c31ec 100644 --- a/src/obj/bhkConstraint.cpp +++ b/src/obj/bhkConstraint.cpp @@ -145,4 +145,28 @@ std::list<NiObject *> bhkConstraint::GetPtrs() const { } //--BEGIN MISC CUSTOM CODE--// + +void bhkConstraint::AddEntity( bhkEntity * obj ) { + entities.push_back( obj ); +} + +void bhkConstraint::RemoveEntity( bhkEntity * obj ) { + //Search Effect list for the one to remove + for ( vector< bhkEntity * >::iterator it = entities.begin(); it != entities.end(); ) { + if ( *it == obj ) { + it = entities.erase( it ); + } else { + ++it; + } + } +} + +void bhkConstraint::ClearEntities() { + entities.clear(); +} + +vector< bhkEntity * > bhkConstraint::GetEntities() const { + return entities; +} + //--END CUSTOM CODE--//