diff --git a/gen/obj_impl.cpp b/gen/obj_impl.cpp index de340f72caa0cd4fd564ccb4c296e80bd09585a3..20275d9247292d6183a6a4afc73c95b2a1ef391c 100644 --- a/gen/obj_impl.cpp +++ b/gen/obj_impl.cpp @@ -6261,11 +6261,6 @@ void NiKeyframeData::InternalRead( istream& in, list<uint> & link_stack, unsigne void NiKeyframeData::InternalWrite( ostream& out, map<NiObjectRef,uint> link_map, unsigned int version, unsigned int user_version ) const { AKeyedData::Write( out, link_map, version, user_version ); - if ( rotationType == XYZ_ROTATION_KEY ) { - numRotationKeys = 1; - } else { - numRotationKeys = uint(quaternionKeys.size()); - } NifStream( numRotationKeys, out, version ); if ( (numRotationKeys != 0) ) { NifStream( rotationType, out, version ); @@ -6313,11 +6308,6 @@ void NiKeyframeData::InternalWrite( ostream& out, map<NiObjectRef,uint> link_map std::string NiKeyframeData::InternalAsString( bool verbose ) const { stringstream out; out << AKeyedData::asString(); - if ( rotationType == XYZ_ROTATION_KEY ) { - numRotationKeys = 1; - } else { - numRotationKeys = uint(quaternionKeys.size()); - } out << " Num Rotation Keys: " << numRotationKeys << endl; if ( (numRotationKeys != 0) ) { out << " Rotation Type: " << rotationType << endl; diff --git a/obj/NiKeyframeData.cpp b/obj/NiKeyframeData.cpp index c042799e0f5b0686e2867f1680491e57b4da954f..c99f8edcbda960c19fe35fab40627a14a072b96f 100644 --- a/obj/NiKeyframeData.cpp +++ b/obj/NiKeyframeData.cpp @@ -44,14 +44,24 @@ KeyType NiKeyframeData::GetRotateType() const { void NiKeyframeData::SetRotateType( KeyType t ) { rotationType = t; + UpdateRotationKeyCount(); } vector< Key<Quaternion> > NiKeyframeData::GetQuatRotateKeys() const { return quaternionKeys; } +void NiKeyframeData::UpdateRotationKeyCount() { + if ( rotationType == XYZ_ROTATION_KEY ) { + numRotationKeys = 1; + } else { + numRotationKeys = uint(quaternionKeys.size()); + } +}; + void NiKeyframeData::SetQuatRotateKeys( const vector< Key<Quaternion> > & keys ) { quaternionKeys = keys; + UpdateRotationKeyCount(); } KeyType NiKeyframeData::GetXRotateType() const { diff --git a/obj/NiKeyframeData.h b/obj/NiKeyframeData.h index 403b785ba67e885eebf86f966c4b262a132ddaaf..fb08de34a39182e675eb1b31a5a19f8ad6476ee1 100644 --- a/obj/NiKeyframeData.h +++ b/obj/NiKeyframeData.h @@ -185,6 +185,7 @@ public: void SetScaleKeys( vector< Key<float> > const & keys ); protected: + void UpdateRotationKeyCount(); NI_KEYFRAME_DATA_MEMBERS STANDARD_INTERNAL_METHODS };