diff --git a/NifImport/DllEntry.cpp b/NifImport/DllEntry.cpp index 97160e9db168ef437b052836c17edb50dedbf6d3..436e5afcd8c994c68a7df75ce9743d574eb2d14d 100644 --- a/NifImport/DllEntry.cpp +++ b/NifImport/DllEntry.cpp @@ -10,6 +10,7 @@ *> Copyright (c) 2006, All Rights Reserved. **********************************************************************/ +#include "stdafx.h" #include "MaxNifImport.h" extern ClassDesc2* GetMaxNifImportDesc(); diff --git a/NifImport/MaxNifImport.cpp b/NifImport/MaxNifImport.cpp index 9c7022fb287d3669c4c24bb4e0af9ce2f81db9e2..5486090765e32ab8c95894984052e3ff5fbd9891 100644 --- a/NifImport/MaxNifImport.cpp +++ b/NifImport/MaxNifImport.cpp @@ -93,6 +93,7 @@ public: bool enableAutoSmooth; float autoSmoothAngle; bool flipUVTextures; + bool enableSkinSupport; // Biped/Bones related settings string skeleton; @@ -465,6 +466,7 @@ void NifImporter::LoadIniSettings() enableAutoSmooth = GetIniValue<bool>(NifImportSection, "EnableAutoSmooth", true); autoSmoothAngle = GetIniValue<float>(NifImportSection, "AutoSmoothAngle", 30.0f); flipUVTextures = GetIniValue<bool>(NifImportSection, "FlipUVTextures", true); + enableSkinSupport = GetIniValue<bool>(NifImportSection, "EnableSkinSupport", true); skeleton = (appSettings != NULL) ? appSettings->Skeleton : ""; @@ -611,7 +613,7 @@ void NifImporter::AlignBiped(IBipMaster* master, NiNodeRef block) Matrix3 m3 = node->GetNodeTM(TimeValue(), NULL); // local translation m master->SetBipedPos(Point3(pos.x, pos.y, pos.z), 0, node, TRUE); - Matrix3 m(rot.rows[0].data, rot.rows[1].data, rot.rows[2].data, Point3()); + Matrix3 m(rot.rows[0].data, rot.rows[1].data, rot.rows[2].data, Point3(0,0,0)); Matrix3 im = Inverse(m); Point3 p; Quat q; Point3 s; @@ -644,7 +646,7 @@ void NifImporter::PositionBiped(IBipMaster* master, NiNodeRef block, bool Recurs Matrix3 m3 = node->GetNodeTM(TimeValue(), NULL); // local translation m master->SetBipedPos(Point3(pos.x, pos.y, pos.z), 0, node, TRUE); - Matrix3 m(rot.rows[0].data, rot.rows[1].data, rot.rows[2].data, Point3()); + Matrix3 m(rot.rows[0].data, rot.rows[1].data, rot.rows[2].data, Point3(0,0,0)); Matrix3 im = Inverse(m); Point3 p; Quat q; Point3 s; DecomposeMatrix(im, p, q, s); @@ -679,7 +681,7 @@ void NifImporter::RotateBiped(IBipMaster* master, NiNodeRef block, bool Recurse) Matrix3 m3 = node->GetNodeTM(TimeValue(), NULL); // local translation m master->SetBipedPos(Point3(pos.x, pos.y, pos.z), 0, node, TRUE); - Matrix3 m(rot.rows[0].data, rot.rows[1].data, rot.rows[2].data, Point3()); + Matrix3 m(rot.rows[0].data, rot.rows[1].data, rot.rows[2].data, Point3(0,0,0)); Matrix3 im = Inverse(m); Point3 p; Quat q; Point3 s; @@ -715,7 +717,7 @@ void NifImporter::ScaleBiped(IBipMaster* master, NiNodeRef block, bool Recurse) Matrix3 m3 = node->GetNodeTM(TimeValue(), NULL); // local translation m master->SetBipedPos(Point3(pos.x, pos.y, pos.z), 0, node, TRUE); - Matrix3 m(rot.rows[0].data, rot.rows[1].data, rot.rows[2].data, Point3()); + Matrix3 m(rot.rows[0].data, rot.rows[1].data, rot.rows[2].data, Point3(0,0,0)); Matrix3 im = Inverse(m); Point3 p; Quat q; Point3 s; @@ -956,7 +958,8 @@ bool NifImporter::ImportTransform(ImpNode *node, NiAVObjectRef avObject) wt.Decompose(pos, rot, scale); Point3 p(pos.x, pos.y, pos.z); - Matrix3 m(rot.rows[0].data, rot.rows[1].data, rot.rows[2].data, Point3()); + Matrix3 m(rot.rows[0].data, rot.rows[1].data, rot.rows[2].data, Point3(0,0,0)); + m.Invert(); m.SetTrans(p); node->SetTransform(0,m); return true; @@ -1067,7 +1070,9 @@ bool NifImporter::ImportMesh(NiTriShapeRef triShape) vector<Triangle> v = triShapeData->GetTriangles(); SetTrangles(mesh, v, hasTexture); } - ImportSkin(node, triShape); + if (enableSkinSupport) + ImportSkin(node, triShape); + i->AddNodeToScene(node); if (enableAutoSmooth){ @@ -1107,7 +1112,9 @@ bool NifImporter::ImportMesh(NiTriStripsRef triStrips) vector<Triangle> v = triStripsData->GetTriangles(); SetTrangles(mesh, v, hasTexture); } - ImportSkin(node, triStrips); + if (enableSkinSupport) + ImportSkin(node, triStrips); + i->AddNodeToScene(node); // apply autosmooth after object creation for it to take hold diff --git a/NifImport/MaxNifImport.vcproj b/NifImport/MaxNifImport.vcproj index 02ae21c7e41ccf5ff6664c8df7c4a2ae35c89f61..c118c76f3f8dec98d9f32a0c47754c77a75465fb 100644 --- a/NifImport/MaxNifImport.vcproj +++ b/NifImport/MaxNifImport.vcproj @@ -54,7 +54,7 @@ RuntimeLibrary="0" EnableFunctionLevelLinking="true" ForceConformanceInForLoopScope="false" - UsePrecompiledHeader="0" + UsePrecompiledHeader="2" PrecompiledHeaderFile=".\Release\MaxNifImport.pch" AssemblerListingLocation=".\Release\" ObjectFile=".\Release\" @@ -154,7 +154,7 @@ ExceptionHandling="2" RuntimeLibrary="1" ForceConformanceInForLoopScope="false" - UsePrecompiledHeader="0" + UsePrecompiledHeader="2" PrecompiledHeaderFile=".\Debug\MaxNifImport.pch" AssemblerListingLocation=".\Debug\" ObjectFile=".\Debug\" @@ -236,6 +236,14 @@ <File RelativePath=".\stdafx.cpp" > + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> <FileConfiguration Name="Debug|Win32" > diff --git a/NifImport/MaxNifTools.ini b/NifImport/MaxNifTools.ini index 71bd9d897f7b5fddebe8b5d96edbc393844a3b9b..f45238053250f6765da915d2ddb91f5282403f5f 100644 --- a/NifImport/MaxNifTools.ini +++ b/NifImport/MaxNifTools.ini @@ -30,6 +30,8 @@ AutoSmoothAngle=30.0 ; Remove Double/Illegal faces on meshes on import RemoveDoubleFaces=1 RemoveIllegalFaces=1 +; EnableSkinSupport attempt to skin the mesh if bones are available +EnableSkinSupport=1 [BipedImport] ; Biped Height. Default: 131.90