diff --git a/NIF_Blocks.cpp b/NIF_Blocks.cpp index 7abef842c9959b2211e1cb211c2c50f9d58c1e49..0d0755aad49aea001791791c613747631d334cfd 100644 --- a/NIF_Blocks.cpp +++ b/NIF_Blocks.cpp @@ -928,7 +928,7 @@ void NiSkinData::Read( ifstream& in ) { void NiSkinData::Write( ofstream& out ) { //Calculate offset matrices prior to writing data - CalculateBoneOffsets(); + //CalculateBoneOffsets(); WriteString( "NiSkinData", out ); @@ -1011,7 +1011,7 @@ string NiSkinData::asString() { out << setprecision(1); //Calculate bone offsets pior to printing readout - CalculateBoneOffsets(); + //CalculateBoneOffsets(); out << "Rotate:" << endl << " |" << setw(6) << rotation[0][0] << "," << setw(6) << rotation[0][1] << "," << setw(6) << rotation[0][2] << " |" << endl @@ -1024,6 +1024,7 @@ string NiSkinData::asString() { << "Bones:" << endl; map<IBlock*, Bone>::iterator it; + //vector<Bone>::iterator it; int num = 0; for( it = bone_map.begin(); it != bone_map.end(); ++it ) { //Friendlier name diff --git a/nif_attrs.h b/nif_attrs.h index f84f464b1c666de629546cbb0d5f776ad1434a17..6c7174200db6d04f68eeb9df26b8c5eba5b3867c 100644 --- a/nif_attrs.h +++ b/nif_attrs.h @@ -460,7 +460,7 @@ public: } } void Write( ofstream& out ) { - //See if there is a data block + ISkinInstInternal * data = (ISkinInstInternal*)_owner->QueryInterface( SkinInstInternal ); blk_ref data_blk = _owner->GetAttr("Data")->asLink(); if ( data_blk.is_null() == false ) { //Get Bone data from data block @@ -631,7 +631,7 @@ public: ~BBoxAttr() {} string GetType() const { return "bbox"; } void Read( ifstream& in ) { - data.isUsed = (ReadUInt( in ) != 0); + data.isUsed = (ReadUInt( in ) != 0); if ( data.isUsed ){ data.unknownInt = ReadUInt( in ); ReadFVector3( data.translation, in ); @@ -1256,7 +1256,7 @@ public: ~RootAttr() {} string GetType() const { return "root"; } void Read( ifstream& in ) { - ReadUInt( in ); //Read data but do nothing with it + original_root = ReadUInt( in ); //Read data but do nothing with it } void Write( ofstream& out ) { WriteUInt( FindRoot().get_index(), out ); @@ -1272,15 +1272,18 @@ public: //If parent is null, we're done - every node is an influence or there are no nodes //Probably shouldn't happen - if (par.is_null() == true) + if (par.is_null() == true) { return block; + } + //If parent is a node and its 'not a skin influence' flag is set, it is the root for this skeleton - if ( QueryNode(par) != NULL ) { + if ( par->QueryInterface(Node) != NULL ) { flags = par->GetAttr("Flags")->asInt(); - if ( (flags & 8) == 1 ) + if ( (flags & 8) != 0 ) { return par; + } } //We didn't find the root this time, set block to par and try again @@ -1299,6 +1302,8 @@ public: return out.str(); } blk_ref asLink() const { return FindRoot(); } +private: + int original_root; }; #endif \ No newline at end of file