Skip to content
Snippets Groups Projects
Commit 8fb0a900 authored by Alecu100's avatar Alecu100
Browse files

added overloads for the controller sequence to add generic interpolators

parent d43b7317
No related branches found
No related tags found
No related merge requests found
......@@ -107,7 +107,7 @@ public:
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.
* Attaches 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.
* \param[in] priority Used only in Oblivion to set the priority of one controller over another when the two are merged.
* \sa NiControllerSequence::ClearChildren, NiControllerSequence::AddController
......@@ -115,7 +115,7 @@ public:
NIFLIB_API void AddInterpolator( NiSingleInterpController * obj, byte priority = 0 );
/*!
* Attatches an interpolator to this KF file for a KF file of version greater than 10.2.0.0. Versions below this use controllers.
* Attaches 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.
* \param[in] priority Used only in Oblivion to set the priority of one controller over another when the two are merged.
* \param[in] include_string_pallete Indicates if the resulting ControllerLinks will hold reference to the NiStringPallete in the NiControllerSequence
......@@ -123,6 +123,17 @@ public:
*/
NIFLIB_API void AddInterpolator( NiSingleInterpController * obj, byte priority , bool include_string_pallete );
/*!
* Attaches a generic interpolator to this KF file for a KF file of version greater than 10.2.0.0. Versions below this use controllers.
* \param[in] interpolator A reference to the new interpolator to insert into the controllersequence
* \param[in] target The target object that the controller which held the interpolator would act on
* \param[in] controller_type_name The name of the type of the controller that held the interpolator
* \param[in] priority Used only in Oblivion to set the priority of one controller over another when the two are merged.
* \param[in] include_string_pallete Indicates if the resulting ControllerLinks will hold reference to the NiStringPallete in the NiControllerSequence
* \sa NiControllerSequence::ClearChildren, NiControllerSequence::AddController
*/
NIFLIB_API void AddGenericInterpolator( NiInterpolator * interpolator, NiObjectNET* target, string controller_type_name, byte priority = 0, bool include_string_pallete = true);
/*!
* Removes all controllers and interpolators from this Kf file root object.
* \sa NiControllerSequence::AddController, NiControllerSequence::AddInterpolator
......
......@@ -433,6 +433,53 @@ void NiControllerSequence::AddInterpolator( NiSingleInterpController * obj, byte
}
void NiControllerSequence::AddGenericInterpolator( NiInterpolator * interpolator, NiObjectNET* target, string controller_type_name, byte priority /*= 0*/, bool include_string_pallete /*= true*/ ) {
//Make sure the parameters aren't null
if(interpolator == NULL) {
throw runtime_error("Attempted to add a null interpolator to the controller sequence");
}
if(target == NULL) {
throw runtime_error("Attempted to add a null target to the controller sequence");
}
//Make a new ControllerLink and fill out necessary data
ControllerLink cl;
NiPropertyRef prop = DynamicCast<NiProperty>(target);
cl.interpolator = interpolator;
cl.priority = priority;
if(include_string_pallete == true) {
//If there are existing ControllerLinks, use the same StringPalette they're using
if ( stringPalette == NULL ) {
stringPalette = new NiStringPalette;
}
cl.stringPalette = stringPalette;
cl.nodeNameOffset = stringPalette->AddSubStr( target->GetName() );
if ( prop != NULL ) {
cl.propertyTypeOffset = stringPalette->AddSubStr( prop->GetType().GetTypeName() );
}
cl.controllerTypeOffset = stringPalette->AddSubStr( controller_type_name );
} else {
cl.stringPalette = NULL;
cl.nodeName = target->GetName();
if(prop != NULL) {
cl.propertyType = prop->GetType().GetTypeName();
}
cl.controllerType = controller_type_name;
}
//Add finished ControllerLink to list
controlledBlocks.push_back( cl );
}
void NiControllerSequence::ClearControllerData() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment