From 94c9fa441f48c716f5702d3b20e0cd77e8ff9781 Mon Sep 17 00:00:00 2001 From: Shon Ferguson <shonferg@users.sourceforge.net> Date: Sat, 24 Jun 2006 05:00:30 +0000 Subject: [PATCH] Temporary fix for NiKeyframeData. --- gen/obj_impl.cpp | 12 ++++++++++-- nif_math.h | 3 +-- niflib.cpp | 16 ++++++++++++++-- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/gen/obj_impl.cpp b/gen/obj_impl.cpp index 892272e3..9c8ead89 100644 --- a/gen/obj_impl.cpp +++ b/gen/obj_impl.cpp @@ -6251,7 +6251,11 @@ 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 ); - numRotationKeys = uint(quaternionKeys.size()); + if ( rotationType == XYZ_ROTATION_KEY ) { + numRotationKeys = uint(xyzRotations.size()); + } else { + numRotationKeys = uint(quaternionKeys.size()); + } NifStream( numRotationKeys, out, version ); if ( (numRotationKeys != 0) ) { NifStream( rotationType, out, version ); @@ -6299,7 +6303,11 @@ void NiKeyframeData::InternalWrite( ostream& out, map<NiObjectRef,uint> link_map std::string NiKeyframeData::InternalAsString( bool verbose ) const { stringstream out; out << AKeyedData::asString(); - numRotationKeys = uint(quaternionKeys.size()); + if ( rotationType == XYZ_ROTATION_KEY ) { + numRotationKeys = uint(xyzRotations.size()); + } else { + numRotationKeys = uint(quaternionKeys.size()); + } out << " Num Rotation Keys: " << numRotationKeys << endl; if ( (numRotationKeys != 0) ) { out << " Rotation Type: " << rotationType << endl; diff --git a/nif_math.h b/nif_math.h index 49224082..86a8a6a3 100644 --- a/nif_math.h +++ b/nif_math.h @@ -237,8 +237,6 @@ struct NIFLIB_API Vector3 { // * \return This vector is returned. // */ //Vector3 & operator*=( const Matrix44 & rh ); - - friend ostream & operator<<( ostream & out, const Vector3 & rh ); }; /* Stores two floating point numbers. Used as a row of a Matrix22 */ @@ -878,6 +876,7 @@ struct NIFLIB_API Quaternion { ostream & operator<<( ostream & out, TexCoord const & val ); ostream & operator<<( ostream & out, Triangle const & val ); +ostream & operator<<( ostream & out, Vector3 const & val ); ostream & operator<<( ostream & out, Float2 const & val ); ostream & operator<<( ostream & out, Matrix22 const & val ); ostream & operator<<( ostream & out, Float3 const & val ); diff --git a/niflib.cpp b/niflib.cpp index c64a44ff..bea78575 100644 --- a/niflib.cpp +++ b/niflib.cpp @@ -153,8 +153,12 @@ vector<NiObjectRef> ReadNifList( istream & in ) { cout << header.asString(); #endif - //--Read Blocks--// - size_t numBlocks = header.numBlocks; +#ifdef PRINT_OBJECT_NAMES + cout << endl << "Reading Objects:"; +#endif + + //--Read Objects--// + size_t numBlocks = header.numBlocks; vector<NiObjectRef> blocks( numBlocks ); //List to hold the blocks list<uint> link_stack; //List to add link values to as they're read in from the file string objectType; @@ -335,9 +339,17 @@ void WriteNifTree( ostream & out, NiObjectRef const & root, unsigned int version //Write header to file header.Write( out ); +#ifdef PRINT_OBJECT_NAMES + cout << endl << "Writing Objects:"; +#endif + //--Write Objects--// for (uint i = 0; i < objects.size(); ++i) { +#ifdef PRINT_OBJECT_NAMES + cout << endl << i << ": " << objects[i]->GetType().GetTypeName(); +#endif + if (version < 0x05000001) { //cout << i << ": " << objects[i]->GetType().GetTypeName() << endl; //Write Block Type -- GitLab