diff --git a/include/obj/NiControllerSequence.h b/include/obj/NiControllerSequence.h index 95763e1813487dbc011e40052bc794d51457526a..c1aac068791368f131ba5a74eeecfc2da5ded0a4 100644 --- a/include/obj/NiControllerSequence.h +++ b/include/obj/NiControllerSequence.h @@ -98,6 +98,13 @@ public: */ NIFLIB_API void AddController( NiTimeController * obj ); + /*! + * Attaches a controler to this KF file for a KF file of version 10.2.0.0 or below. Versions above this use interpolators. + * \param[in] obj A reference to the new NiTimeController to attach. + * \sa NiControllerSequence::ClearChildren, NiControllersequence::AddInterpolator + */ + NIFLIB_API void AddController( string const & targetName, NiTimeController * obj ); + /*! * Attatches an interpolator to this KF file for a KF file of version greater than 10.2.0.0. Versions below this use controllers. * \param[in] obj A reference to the new controller which has an interpolator to attach. diff --git a/src/obj/NiControllerSequence.cpp b/src/obj/NiControllerSequence.cpp index 6feaabeebee4930f49869b216afa47d7d4db0601..72ba41ed68d0e63fbfb170c3ebd2eb83caec5e95 100644 --- a/src/obj/NiControllerSequence.cpp +++ b/src/obj/NiControllerSequence.cpp @@ -222,7 +222,6 @@ void NiControllerSequence::AddController( NiTimeController * obj ) { if ( target == NULL ) { throw runtime_error("Controller must have a target to be added to a NiControllerSequence."); } - //Make a new ControllerLink and fill out necessary data ControllerLink cl; cl.controller = obj; @@ -240,6 +239,24 @@ void NiControllerSequence::AddController( NiTimeController * obj ) { controlledBlocks.push_back( cl ); } +void NiControllerSequence::AddController( string const & targetName, NiTimeController * obj ) { + //Make sure the link isn't null + if ( obj == NULL ) { + throw runtime_error("Attempted to add a null controller to NiControllerSequence."); + } + + //Make a new ControllerLink and fill out necessary data + ControllerLink cl; + cl.controller = obj; + cl.targetName = targetName; + cl.nodeName = targetName; + + cl.controllerType = obj->GetType().GetTypeName(); + + //Add finished ControllerLink to list + controlledBlocks.push_back( cl ); +} + void NiControllerSequence::AddInterpolator( NiSingleInterpController * obj, byte priority ) { //Make sure the link isn't null if ( obj == NULL ) {