From 64104d402bb1ea66a53cc0a6283e70bed12d7938 Mon Sep 17 00:00:00 2001 From: Amorilia <amorilia@users.sourceforge.net> Date: Wed, 18 Jan 2006 20:06:46 +0000 Subject: [PATCH] niftexture workaround --- NIF_Blocks.cpp | 18 +++++++++++++++--- NIF_IO.cpp | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/NIF_Blocks.cpp b/NIF_Blocks.cpp index dfeb37c8..7d7c1e16 100644 --- a/NIF_Blocks.cpp +++ b/NIF_Blocks.cpp @@ -1062,7 +1062,14 @@ void AShapeData::Write( ofstream& out, unsigned int version ) const { GetAttr("Center")->Write( out, version ); GetAttr("Radius")->Write( out, version ); - WriteBool( colors.size() > 0, out, version ); + if ( version <= VER_4_0_0_2 ) { + // NifTexture bug workaround: + if ( colors.size() > 0 ) + WriteUInt( 0xffffffff, out ); + else + WriteUInt( 0, out ); + } else + WriteBool( colors.size() > 0, out, version ); for ( uint i = 0; i < colors.size(); ++i ){ NifStream( colors[i], out ); @@ -1075,7 +1082,12 @@ void AShapeData::Write( ofstream& out, unsigned int version ) const { // hasUVs does not exist after version 4.0.0.2 bool hasUVs = true; if ( version <= VER_4_0_0_2 ) { - WriteBool( uv_sets.size() > 0, out, version ); + //WriteBool( uv_sets.size() > 0, out, version ); + // NifTexture bug workaround: + if (uv_sets.size() > 0) + WriteUInt( 0xffffffff, out ); + else + WriteUInt( 0, out ); } for ( uint i = 0; i < uv_sets.size(); ++i ){ @@ -1086,7 +1098,7 @@ void AShapeData::Write( ofstream& out, unsigned int version ) const { } //Unknown Short here from version 10.0.1.0 on - //Just read it and throw it away for now + //Just write a zero if ( version >= VER_10_0_1_0) { WriteUShort( 0, out ); } diff --git a/NIF_IO.cpp b/NIF_IO.cpp index cae6a84d..bbe0eb56 100644 --- a/NIF_IO.cpp +++ b/NIF_IO.cpp @@ -301,7 +301,7 @@ void WriteBool( bool val, ofstream& out, unsigned int version ) { if ( version < 0x04010001 ) { //Bools are stored as integers before version 4.1.0.1 if (val) - WriteUInt( 0xFFFFFFFF, out ); // NifTexture workaround + WriteUInt( 1, out ); else WriteUInt( 0, out ); } else { -- GitLab