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

added a new overload for the AddInterpolatorMethod in the NiControllerSequence...

added a new overload for the AddInterpolatorMethod in the NiControllerSequence class to fix a bug when it would export the string pallete for fallout 3 nif versions.
parent a181fa70
No related branches found
No related tags found
No related merge requests found
...@@ -114,6 +114,15 @@ public: ...@@ -114,6 +114,15 @@ public:
*/ */
NIFLIB_API void AddInterpolator( NiSingleInterpController * obj, byte priority = 0 ); 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.
* \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
* \sa NiControllerSequence::ClearChildren, NiControllerSequence::AddController
*/
NIFLIB_API void AddInterpolator( NiSingleInterpController * obj, byte priority , bool include_string_pallete );
/*! /*!
* Removes all controllers and interpolators from this Kf file root object. * Removes all controllers and interpolators from this Kf file root object.
* \sa NiControllerSequence::AddController, NiControllerSequence::AddInterpolator * \sa NiControllerSequence::AddController, NiControllerSequence::AddInterpolator
......
...@@ -377,6 +377,63 @@ void NiControllerSequence::AddInterpolator( NiSingleInterpController * obj, byte ...@@ -377,6 +377,63 @@ void NiControllerSequence::AddInterpolator( NiSingleInterpController * obj, byte
controlledBlocks.push_back( cl ); controlledBlocks.push_back( cl );
} }
void NiControllerSequence::AddInterpolator( NiSingleInterpController * obj, byte priority , bool include_string_pallete ) {
//Make sure the link isn't null
if ( obj == NULL ) {
throw runtime_error("Attempted to add a null controller to NiControllerSequence block.");
}
NiInterpolatorRef interp = obj->GetInterpolator();
if ( interp == NULL ) {
throw runtime_error("Controller must have an interpolator attached to be added to a NiControllerSequence with the AddInterpolator function.");
}
NiObjectNETRef target = obj->GetTarget();
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;
NiPropertyRef prop = DynamicCast<NiProperty>(target);
cl.interpolator = interp;
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( obj->GetType().GetTypeName() );
} else {
cl.stringPalette = NULL;
cl.nodeName = target->GetName();
if(prop != NULL) {
cl.propertyType = prop->GetType().GetTypeName();
}
cl.controllerType = obj->GetType().GetTypeName();
}
//Add finished ControllerLink to list
controlledBlocks.push_back( cl );
}
void NiControllerSequence::ClearControllerData() { void NiControllerSequence::ClearControllerData() {
throw runtime_error("The AddInterpolator function cannot be implemented until problems in the XML are solved."); throw runtime_error("The AddInterpolator function cannot be implemented until problems in the XML are solved.");
......
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