diff --git a/NifImport/BaseImporter.h b/NifImport/BaseImporter.h index cec3fd50a9e6b098a266b6200344848bba3cb13b..abedf9fe8571dd63e0554319e5237a6f15120319 100644 --- a/NifImport/BaseImporter.h +++ b/NifImport/BaseImporter.h @@ -14,6 +14,7 @@ HISTORY: #ifndef __BASEIMPORTER_H__ #define __BASEIMPORTER_H__ +class IBipMaster; extern IBipMaster * (_cdecl * Max8CreateNewBiped)(float,float,class Point3 const &,int,int,int,int,int,int,int,int,int,int,int,int,float,int,int,int,int,int,int,int,int); // Importer Base diff --git a/NifImport/ImportAnimation.cpp b/NifImport/ImportAnimation.cpp index 1afe253feb89cee7eaccb191ac76d9f00630d882..80cf8403c826221ad1c45e89fae45a4ba3760cf2 100644 --- a/NifImport/ImportAnimation.cpp +++ b/NifImport/ImportAnimation.cpp @@ -369,11 +369,13 @@ Control *AnimationImport::GetTMController(const string& name) if (NULL == c) return NULL; +#ifdef USE_BIPED // ignore bipeds for now. if ( (c->ClassID() == BIPSLAVE_CONTROL_CLASS_ID) ||(c->ClassID() == BIPBODY_CONTROL_CLASS_ID) ||(c->ClassID() == FOOTPRINT_CLASS_ID)) return NULL; +#endif return c; } diff --git a/NifImport/ImportSkeleton.cpp b/NifImport/ImportSkeleton.cpp index b2d0110c423f50630ea483728d13d9bbab1a01ef..9cc6b8cd13b30fdbb5db3c32de9024c31a18862f 100644 --- a/NifImport/ImportSkeleton.cpp +++ b/NifImport/ImportSkeleton.cpp @@ -105,6 +105,7 @@ bool NifImporter::IsBiped() void NifImporter::ImportBipeds(vector<NiNodeRef>& nodes) { +#ifdef USE_BIPED IBipMaster* master = NULL; try { @@ -195,6 +196,7 @@ void NifImporter::ImportBipeds(vector<NiNodeRef>& nodes) } if (master) master->EndModes(BMODE_FIGURE, TRUE); +#endif } static float CalcLength(NiNodeRef node, vector<NiAVObjectRef>& children) @@ -297,6 +299,7 @@ static float CalcScale(INode *bone, NiNodeRef node, vector<NiNodeRef>& children) return 1.0f; } +#ifdef USE_BIPED void PosRotScaleBiped(IBipMaster* master, INode *n, Point3 p, Quat& q, float s, PosRotScale prs, TimeValue t = 0) { if (prs & prsScale) @@ -306,6 +309,7 @@ void PosRotScaleBiped(IBipMaster* master, INode *n, Point3 p, Quat& q, float s, if (prs & prsPos) master->SetBipedPos(p, t, n, FALSE); } + AngAxis CalcAngAxis(Point3 vs, Point3 vf) { Point3 cross = CrossProd(vs, vf); @@ -315,6 +319,7 @@ AngAxis CalcAngAxis(Point3 vs, Point3 vf) float dot = DotProd(vs, vf); return AngAxis( cross, acos( dot ) ); } + Matrix3 GenerateRotMatrix(AngAxis a) { Matrix3 m(TRUE); @@ -334,6 +339,7 @@ Matrix3 GenerateRotMatrix(AngAxis a) m[2][2] = rcos + w*w*(1-rcos); return m; } + static AngAxis CalcTransform(INode *bone, NiNodeRef node, vector<NiNodeRef>& children) { Matrix3 mr(TRUE); @@ -370,11 +376,13 @@ static AngAxis CalcTransform(INode *bone, NiNodeRef node, vector<NiNodeRef>& chi } return mr; } +#endif void NifImporter::AlignBiped(IBipMaster* master, NiNodeRef node) { +#ifdef USE_BIPED NiNodeRef parent = node->GetParent(); string name = node->GetName(); vector<NiAVObjectRef> children = node->GetChildren(); @@ -446,6 +454,7 @@ void NifImporter::AlignBiped(IBipMaster* master, NiNodeRef node) for (vector<NiNodeRef>::iterator itr = childNodes.begin(), end = childNodes.end(); itr != end; ++itr){ AlignBiped(master, *itr); } +#endif } INode *NifImporter::CreateBone(const string& name, Point3 startPos, Point3 endPos, Point3 zAxis) diff --git a/NifImport/MaxNifImport.h b/NifImport/MaxNifImport.h index 2106fa8139ef87b7c1192d05a4f72b84755cf89f..19ff556f03aa7a703a51f1b2556ba88ebc817b16 100644 --- a/NifImport/MaxNifImport.h +++ b/NifImport/MaxNifImport.h @@ -23,7 +23,9 @@ #include <istdplug.h> #include <iparamb2.h> #include <iparamm2.h> -#include <cs/Biped8Api.h> +#ifdef USE_BIPED +# include <cs/Biped8Api.h> +#endif #include <scenetraversal.h> #include <plugapi.h> #include <triobj.h> diff --git a/NifImport/MaxNifImport.vcproj b/NifImport/MaxNifImport.vcproj index ace67d6816f242f8451a04aa2fdd6f5ab3723cf0..3c93bcd53bca8871a9559cf64701542e05ee285f 100644 --- a/NifImport/MaxNifImport.vcproj +++ b/NifImport/MaxNifImport.vcproj @@ -15,9 +15,9 @@ </ToolFiles> <Configurations> <Configuration - Name="Release|Win32" - OutputDirectory=".\Release" - IntermediateDirectory=".\Release" + Name="Release - Max 7|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" UseOfMFC="0" @@ -49,7 +49,7 @@ Name="VCCLCompilerTool" AdditionalOptions="/LD " InlineFunctionExpansion="1" - AdditionalIncludeDirectories="" + AdditionalIncludeDirectories="C:\3dsmax7\maxsdk\include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;USE_NIFLIB_TEMPLATE_HELPERS;_USE_MATH_DEFINES" StringPooling="true" ExceptionHandling="2" @@ -81,10 +81,10 @@ Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib shlwapi.lib core.lib geom.lib gfx.lib mesh.lib maxutil.lib maxscrpt.lib paramblk2.lib bmm.lib niflib.lib" - OutputFile="C:\3dsmax8\plugins\MaxNifImport.dli" + OutputFile="C:\3dsmax7\plugins\MaxNifImport.dli" LinkIncremental="1" SuppressStartupBanner="true" - AdditionalLibraryDirectories="C:\3dsmax8\maxsdk\lib" + AdditionalLibraryDirectories="C:\3dsmax7\maxsdk\lib" ModuleDefinitionFile=".\MaxNifImport.def" ProgramDatabaseFile=".\Release\MaxNifImport.pdb" SubSystem="2" @@ -117,13 +117,13 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="if exist "C:\3dsmax8\plugcfg" (
if not exist "C:\3dsmax8\plugcfg\MaxNifTools.ini" (
copy "$(ProjectDir)MaxNifTools.ini" "C:\3dsmax8\plugcfg\MaxNifTools.ini"
)
)
if exist "C:\3dsmax8" (
xcopy /D /Y /I "$(ProjectDir)..\MaxNifPlugins_Readme.txt" "$(ProjectDir)Staging\"
)
xcopy /D /Y /I "$(TargetPath)" "$(ProjectDir)Staging\plugins\"
xcopy /D /Y /I "$(ProjectDir)MaxNifTools.ini" "$(ProjectDir)Staging\plugcfg"
" + CommandLine="if exist "C:\3dsmax7\plugcfg" (
if not exist "C:\3dsmax7\plugcfg\MaxNifTools.ini" (
copy "$(ProjectDir)MaxNifTools.ini" "C:\3dsmax7\plugcfg\MaxNifTools.ini"
)
)
if exist "C:\3dsmax7" (
xcopy /D /Y /I "$(ProjectDir)..\MaxNifPlugins_Readme.txt" "$(ProjectDir)Staging\"
)
mkdir "$(ProjectDir)Staging\max7\plugcfg\" > nul 2<&1
mkdir "$(ProjectDir)Staging\max7\plugins\" > nul 2<&1
xcopy /D /Y /I "$(TargetPath)" "$(ProjectDir)Staging\max7\plugins\"
xcopy /D /Y /I "$(ProjectDir)MaxNifTools.ini" "$(ProjectDir)Staging\max7\plugcfg\"
" /> </Configuration> <Configuration - Name="Debug|Win32" - OutputDirectory=".\Debug" - IntermediateDirectory=".\Debug" + Name="Debug - Max 7|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" UseOfMFC="0" @@ -153,7 +153,7 @@ Name="VCCLCompilerTool" AdditionalOptions="/LD " Optimization="0" - AdditionalIncludeDirectories="" + AdditionalIncludeDirectories="C:\3dsmax7\maxsdk\include" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;USE_NIFLIB_TEMPLATE_HELPERS;_USE_MATH_DEFINES;USE_UNSUPPORTED_CODE" GeneratePreprocessedFile="0" ExceptionHandling="2" @@ -180,6 +180,108 @@ <Tool Name="VCPreLinkEventTool" /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/MACHINE:I386" + AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib shlwapi.lib core.lib geom.lib gfx.lib mesh.lib maxutil.lib maxscrpt.lib paramblk2.lib bmm.lib niflibd.lib" + OutputFile="C:\3dsmax7\plugins\MaxNifImport.dli" + LinkIncremental="2" + SuppressStartupBanner="true" + AdditionalLibraryDirectories="C:\3dsmax7\maxsdk\lib" + IgnoreDefaultLibraryNames="msvcrtd.lib" + ModuleDefinitionFile=".\MaxNifImport.def" + GenerateDebugInformation="true" + ProgramDatabaseFile=".\Debug\MaxNifImport.pdb" + SubSystem="2" + BaseAddress="0x16860000" + ImportLibrary=".\Debug\MaxNifImport.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="if exist "C:\3dsmax7\plugcfg" (
if not exist "C:\3dsmax7\plugcfg\MaxNifTools.ini" (
copy "$(ProjectDir)MaxNifTools.ini" "C:\3dsmax7\plugcfg\MaxNifTools.ini"
)
)
" + /> + </Configuration> + <Configuration + Name="Debug - Max 8|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="_DEBUG" + MkTypLibCompatible="true" + SuppressStartupBanner="true" + TargetEnvironment="1" + TypeLibraryName=".\Debug\MaxNifImport.tlb" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/LD " + Optimization="0" + AdditionalIncludeDirectories="C:\3dsmax8\maxsdk\include" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;USE_NIFLIB_TEMPLATE_HELPERS;_USE_MATH_DEFINES;USE_UNSUPPORTED_CODE;USE_BIPED" + GeneratePreprocessedFile="0" + ExceptionHandling="2" + RuntimeLibrary="1" + ForceConformanceInForLoopScope="false" + UsePrecompiledHeader="2" + PrecompiledHeaderFile=".\Debug\MaxNifImport.pch" + AssemblerListingLocation=".\Debug\" + ObjectFile=".\Debug\" + ProgramDataBaseFileName=".\Debug\" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + CompileAs="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="_DEBUG" + Culture="1033" + /> + <Tool + Name="VCPreLinkEventTool" + /> <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" @@ -222,6 +324,112 @@ CommandLine="if exist "C:\3dsmax8\plugcfg" (
if not exist "C:\3dsmax8\plugcfg\MaxNifTools.ini" (
copy "$(ProjectDir)MaxNifTools.ini" "C:\3dsmax8\plugcfg\MaxNifTools.ini"
)
)
" /> </Configuration> + <Configuration + Name="Release - Max 8|Win32" + OutputDirectory="$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="false" + WholeProgramOptimization="0" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + CommandLine="" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + PreprocessorDefinitions="NDEBUG" + MkTypLibCompatible="true" + SuppressStartupBanner="true" + TargetEnvironment="1" + TypeLibraryName=".\Release\MaxNifImport.tlb" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/LD " + InlineFunctionExpansion="1" + AdditionalIncludeDirectories="C:\3dsmax8\maxsdk\include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;USE_NIFLIB_TEMPLATE_HELPERS;_USE_MATH_DEFINES;USE_BIPED" + StringPooling="true" + ExceptionHandling="2" + RuntimeLibrary="0" + EnableFunctionLevelLinking="true" + ForceConformanceInForLoopScope="false" + UsePrecompiledHeader="2" + PrecompiledHeaderFile=".\Release\MaxNifImport.pch" + AssemblerListingLocation=".\Release\" + ObjectFile=".\Release\" + ProgramDataBaseFileName=".\Release\" + WarningLevel="3" + SuppressStartupBanner="true" + DebugInformationFormat="3" + CompileAs="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + PreprocessorDefinitions="NDEBUG" + Culture="1033" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/MACHINE:I386" + AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib shlwapi.lib core.lib geom.lib gfx.lib mesh.lib maxutil.lib maxscrpt.lib paramblk2.lib bmm.lib niflib.lib" + OutputFile="C:\3dsmax8\plugins\MaxNifImport.dli" + LinkIncremental="1" + SuppressStartupBanner="true" + AdditionalLibraryDirectories="C:\3dsmax8\maxsdk\lib" + ModuleDefinitionFile=".\MaxNifImport.def" + ProgramDatabaseFile=".\Release\MaxNifImport.pdb" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + SetChecksum="true" + BaseAddress="0x16860000" + ImportLibrary=".\Release\MaxNifImport.lib" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="if exist "C:\3dsmax8\plugcfg" (
if not exist "C:\3dsmax8\plugcfg\MaxNifTools.ini" (
copy "$(ProjectDir)MaxNifTools.ini" "C:\3dsmax8\plugcfg\MaxNifTools.ini"
)
)
if exist "C:\3dsmax8" (
xcopy /D /Y /I "$(ProjectDir)..\MaxNifPlugins_Readme.txt" "$(ProjectDir)Staging\"
)
mkdir "$(ProjectDir)Staging\max8\plugcfg\" > nul
mkdir "$(ProjectDir)Staging\max8\plugins\" > nul
xcopy /D /Y /I "$(TargetPath)" "$(ProjectDir)Staging\max8\plugins\"
xcopy /D /Y /I "$(ProjectDir)MaxNifTools.ini" "$(ProjectDir)Staging\max8\plugins\"
" + /> + </Configuration> </Configurations> <References> </References> @@ -246,7 +454,15 @@ RelativePath=".\stdafx.cpp" > <FileConfiguration - Name="Release|Win32" + Name="Release - Max 7|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug - Max 7|Win32" > <Tool Name="VCCLCompilerTool" @@ -254,7 +470,15 @@ /> </FileConfiguration> <FileConfiguration - Name="Debug|Win32" + Name="Debug - Max 8|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Release - Max 8|Win32" > <Tool Name="VCCLCompilerTool" @@ -340,7 +564,15 @@ RelativePath=".\MaxNifImport.cpp" > <FileConfiguration - Name="Debug|Win32" + Name="Debug - Max 7|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="2" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug - Max 8|Win32" > <Tool Name="VCCLCompilerTool" diff --git a/NifImport/niutils.cpp b/NifImport/niutils.cpp index cd680d361f3182080807116bc41be96f61f62222..b49bc0c3b0d7a3d147d32afc6dead286c88fd282 100644 --- a/NifImport/niutils.cpp +++ b/NifImport/niutils.cpp @@ -19,8 +19,10 @@ HISTORY: #include <sstream> #include <modstack.h> #include <iskin.h> -#include <cs/Biped8Api.h> -#include <cs/OurExp.h> +#ifdef USE_BIPED +# include <cs/Biped8Api.h> +# include <cs/OurExp.h> +#endif using namespace std; using namespace Niflib; @@ -332,8 +334,8 @@ void PosRotScaleNode(INode *n, Matrix3& m3, PosRotScale prs, TimeValue t) void PosRotScaleNode(INode *n, Point3 p, Quat& q, float s, PosRotScale prs, TimeValue t) { if (Control *c = n->GetTMController()) { - ScaleValue sv(Point3(s,s,s)); +#ifdef USE_BIPED // Bipeds are special. And will crash if you dont treat them with care if ( (c->ClassID() == BIPSLAVE_CONTROL_CLASS_ID) ||(c->ClassID() == BIPBODY_CONTROL_CLASS_ID) @@ -350,6 +352,7 @@ void PosRotScaleNode(INode *n, Point3 p, Quat& q, float s, PosRotScale prs, Time BipIface->SetBipedPosition(p, t, n); } else +#endif { if (prs & prsScale) if (Control *sclCtrl = c->GetScaleController()) diff --git a/NifImport/objectParams.h b/NifImport/objectParams.h index faa7c15cb4b77adac8948ae010edf6153e84f1e8..23a45f424dc7db9d93716af5ca3aeacb2c484102 100644 --- a/NifImport/objectParams.h +++ b/NifImport/objectParams.h @@ -32,6 +32,10 @@ inline Value* make_maxscript_value(const Color& rgb); inline Value* make_maxscript_value(LPCTSTR str); inline Value* make_maxscript_value(ReferenceTarget* rtarg); +#if VERSION_3DSMAX <= ((MAX_RELEASE_R7<<16)+(15<<8)+0) +inline void clear_error_source_data() {} +#endif + // Not all of the paramters for materials and shaders // are published in the interfaces. ObjectParams class // is used to access the properties of objects the same @@ -245,7 +249,6 @@ inline bool setMAXScriptController(ReferenceTarget* obj, LPTSTR name, Control* c return rval; } - // These helpers are used to convert C++ values to // their MAXScript value. Maxscript uses different // methods to handle the conversion, and these helpers