├── .gitattributes ├── .gitignore ├── .gitmodules ├── AUTHORS.TXT ├── Build └── Sheets │ ├── Debug_Settings.props │ ├── Debug_Settings.vsprops │ ├── Max_System_Default.props │ ├── Max_System_Default.vsprops │ ├── Max_System_Win32.props │ ├── Max_System_Win32.vsprops │ ├── Max_System_x64.props │ ├── Max_System_x64.vsprops │ ├── Max_Version_2008.props │ ├── Max_Version_2008.vsprops │ ├── Max_Version_2009.props │ ├── Max_Version_2009.vsprops │ ├── Max_Version_2010.props │ ├── Max_Version_2010.vsprops │ ├── Max_Version_2011.props │ ├── Max_Version_2011.vsprops │ ├── Max_Version_2012.props │ ├── Max_Version_2012.vsprops │ ├── Max_Version_4.vsprops │ ├── Max_Version_42.vsprops │ ├── Max_Version_5.vsprops │ ├── Max_Version_6.vsprops │ ├── Max_Version_7.vsprops │ ├── Max_Version_8.vsprops │ ├── Max_Version_9.props │ ├── Max_Version_9.vsprops │ ├── Niflib_Settings.props │ ├── Niflib_Settings.vsprops │ ├── Release_Settings.props │ ├── Release_Settings.vsprops │ └── gmax_Version_12.vsprops ├── CHANGELOG.TXT ├── LICENSE.TXT ├── MaxNifTools.ini ├── MaxNifTools.iss ├── NifCommon ├── 3dsmaxport.h ├── AnimKey.cpp ├── AnimKey.h ├── AppSettings.cpp ├── AppSettings.h ├── Hyperlinks.cpp ├── Hyperlinks.h ├── IniSection.h ├── MAX_Mem.h ├── MAX_MemDirect.h ├── NifCommon_VC80.vcproj ├── NifGui.cpp ├── NifGui.h ├── NifPlugins.cpp ├── NifPlugins.h ├── NifQHull.cpp ├── NifVersion.h ├── build.isi ├── config.h ├── config.h.in ├── nifversion.rc ├── nimorph.cpp ├── niutils.cpp ├── niutils.h ├── objectParams.h ├── pch.cpp └── pch.h ├── NifExport ├── Animation.cpp ├── Coll.cpp ├── Config.cpp ├── DllEntry.cpp ├── Exporter.cpp ├── Exporter.h ├── KfExport.cpp ├── Mesh.cpp ├── MtlTex.cpp ├── NifExport.cpp ├── NifExport.def ├── NifExport.h ├── NifExport.rc ├── NifExport.sln ├── NifExport.vcproj ├── NifExport_VC80.vcproj ├── NvTriStrip │ ├── NvTriStrip.cpp │ ├── NvTriStrip.h │ ├── NvTriStripObjects.cpp │ ├── NvTriStripObjects.h │ ├── VertexCache.cpp │ └── VertexCache.h ├── Strips.cpp ├── Util.cpp ├── pch.cpp ├── pch.h └── resource.h ├── NifFurniture ├── DllEntry.cpp ├── FurnitureMarkers.h ├── NifFurniture.cpp ├── NifFurniture.def ├── NifFurniture.h ├── NifFurniture.rc ├── NifFurniture.vcproj ├── NifFurniture_VC80.vcproj └── resource.h ├── NifImport ├── BaseImporter.h ├── DllEntry.cpp ├── ImportAnimation.cpp ├── ImportCollision.cpp ├── ImportLights.cpp ├── ImportMeshAndSkin.cpp ├── ImportMtlAndTex.cpp ├── ImportSkeleton.cpp ├── KFImporter.cpp ├── KFImporter.h ├── KFMImporter.cpp ├── KFMImporter.h ├── KfDialog.cpp ├── MaxNifImport.cpp ├── MaxNifImport.def ├── MaxNifImport.h ├── MaxNifImport.rc ├── MaxNifImport.vcproj ├── MaxNifImport_VC80.vcproj ├── NIFImport.cpp ├── NIFImporter.h ├── NifDialog.cpp ├── resource.h ├── stdafx.cpp └── stdafx.h ├── NifPlugins ├── DllEntry.cpp ├── NifPlugins.def ├── NifPlugins.rc ├── pch.cpp ├── pch.h └── resource.h ├── NifPlugins_Development_Readme.txt ├── NifPlugins_VC2010.sln ├── NifProps ├── DllEntry.cpp ├── Modifier │ ├── AddDel16.bmp │ ├── AddDelMask16.bmp │ ├── BSDismemberSkin.cpp │ ├── bmp00003.bmp │ └── selmask.bmp ├── NifProps.cpp ├── NifProps.def ├── NifProps.h ├── NifProps.rc ├── NifProps.vcproj ├── NifProps_VC80.vcproj ├── NifStrings.h ├── Shader │ ├── NifShader.cpp │ ├── shaderutil.cpp │ └── shaderutil.h ├── bhkBoxObj.cpp ├── bhkCapsuleObj.cpp ├── bhkHelperFuncs.cpp ├── bhkHelperFuncs.h ├── bhkHelperInterface.cpp ├── bhkHelperInterface.h ├── bhkListObj.cpp ├── bhkProxyObj.cpp ├── bhkRigidBodyInterface.cpp ├── bhkRigidBodyInterface.h ├── bhkRigidBodyModifer.cpp ├── bhkSphereObj.cpp ├── dds │ ├── ConvertColor.h │ ├── dds.cpp │ ├── dds.dep │ ├── dds.h │ ├── dds.rc │ ├── ddsTypes.h │ ├── ddsres.h │ ├── dxtlib.h │ ├── nvDXTlib.lib │ ├── nvErrorCodes.h │ ├── nvdxt_options.h │ ├── tPixel.h │ ├── tVector.h │ └── veroverrides.h ├── iNifProps.h └── resource.h ├── README.TXT ├── TODO.txt ├── User_Settings.props ├── User_Settings.vsprops ├── build.bat ├── makeconfig.bat ├── makeconfig.sh ├── makezip.sh ├── nif_maxsdk.zip ├── stagenif.bat └── start_devenv.bat /.gitattributes: -------------------------------------------------------------------------------- 1 | *.bat eol=crlf 2 | *.vcproj eol=crlf 3 | *.vsprops eol=crlf 4 | *.sln eol=crlf 5 | *.ini eol=crlf 6 | *.iss eol=crlf 7 | *.sh eol=lf 8 | *.zip binary 9 | *.cpp text 10 | *.h text 11 | .gitattributes text 12 | .gitignore text 13 | 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.suo 2 | *.ncb 3 | *.obj 4 | *.dlu 5 | *.user 6 | *.opensdf 7 | *.tlog 8 | *.log 9 | *.lib 10 | *.pch 11 | *.pdb 12 | *.res 13 | *.lastbuildstate 14 | *.dll 15 | *.exp 16 | *.cache 17 | UpgradeLog* 18 | Staging 19 | Temp 20 | Build/x64 21 | Build/Debug 22 | _UpgradeReport_Files 23 | x64 24 | Debug 25 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "niflib"] 2 | path = niflib 3 | url = git://niftools.git.sourceforge.net/gitroot/niftools/niflib 4 | -------------------------------------------------------------------------------- /AUTHORS.TXT: -------------------------------------------------------------------------------- 1 | gundalf 2 | tazpn 3 | sacarrow 4 | 5 | -------------------------------------------------------------------------------- /Build/Sheets/Debug_Settings.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | 6 | 7 | <_ProjectFileVersion>10.0.30319.1 8 | true 9 | 10 | 11 | 12 | Disabled 13 | _DEBUG;%(PreprocessorDefinitions) 14 | true 15 | EnableFastChecks 16 | MultiThreadedDebug 17 | ProgramDatabase 18 | 19 | 20 | true 21 | $(IntDir)$(TargetName).pdb 22 | 23 | 24 | _DEBUG;%(PreprocessorDefinitions) 25 | 26 | 27 | _DEBUG;%(PreprocessorDefinitions) 28 | 29 | 30 | pushd $(SolutionDir) 31 | call "$(SolutionDir)makeconfig.bat" 32 | popd 33 | 34 | 35 | 36 | 37 | 38 | $(NifBuildType) 39 | 40 | 41 | -------------------------------------------------------------------------------- /Build/Sheets/Debug_Settings.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 17 | 23 | 27 | 31 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /Build/Sheets/Max_System_Default.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MaxInstallDir)plugins\ 5 | $(MaxInstallDir)plugcfg\ 6 | $(MaxInstallDir)maxsdk\ 7 | 8 | 9 | <_ProjectFileVersion>10.0.30319.1 10 | $(SolutionDir)Staging\$(PlatformName)\$(Configuration)\$(ProjectName)\ 11 | $(SolutionDir)Temp\$(PlatformName)\$(Configuration)\$(ProjectName)\ 12 | 13 | 14 | 15 | $(ProjectDir)..\NifPlugins\pch.h;%(ForcedIncludeFiles) 16 | /LD /Zm200 %(AdditionalOptions) 17 | $(MaxSDKDir)\include;$(ProjectDir)..\NifCommon;%(AdditionalIncludeDirectories) 18 | _WINDOWS;_USRDLL;_USE_MATH_DEFINES;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) 19 | Async 20 | true 21 | false 22 | Use 23 | $(ProjectDir)..\NifPlugins\pch.h 24 | Level3 25 | true 26 | Default 27 | 28 | 29 | odbc32.lib;odbccp32.lib;comctl32.lib;shlwapi.lib;core.lib;geom.lib;gfx.lib;mesh.lib;maxutil.lib;maxscrpt.lib;paramblk2.lib;bmm.lib;mnmath.lib;%(AdditionalDependencies) 30 | true 31 | $(ProjectDir)..\NifPlugins\NifPlugins.def 32 | Windows 33 | 0x16860000 34 | $(OutDir)NifPlugins.dlu 35 | $(IntDir)$(ProjectName).lib 36 | 37 | 38 | NIFPLUGINS;%(PreprocessorDefinitions) 39 | $(ProjectDir)..\NifCommon;%(AdditionalIncludeDirectories) 40 | 41 | 42 | 43 | 44 | $(MaxPluginDir) 45 | true 46 | 47 | 48 | $(MaxPlugcfgDir) 49 | true 50 | 51 | 52 | $(MaxSDKDir) 53 | true 54 | 55 | 56 | -------------------------------------------------------------------------------- /Build/Sheets/Max_System_Default.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 13 | 28 | 38 | 39 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Build/Sheets/Max_System_Win32.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | <_ProjectFileVersion>10.0.30319.1 9 | 10 | 11 | 12 | WIN32;_WIN32_WINNT=0x0500;%(PreprocessorDefinitions) 13 | 14 | 15 | /MACHINE:I386 %(AdditionalOptions) 16 | $(MaxSDKDir)\lib;%(AdditionalLibraryDirectories) 17 | 18 | 19 | -------------------------------------------------------------------------------- /Build/Sheets/Max_System_Win32.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 13 | 18 | 19 | -------------------------------------------------------------------------------- /Build/Sheets/Max_System_x64.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | <_ProjectFileVersion>10.0.30319.1 9 | 10 | 11 | 12 | WIN32;_WIN32_WINNT=0x0500;%(PreprocessorDefinitions) 13 | 14 | 15 | $(MaxSDKDir)\x64\lib;%(AdditionalLibraryDirectories) 16 | /MACHINE:X64 %(AdditionalOptions) 17 | 18 | 19 | -------------------------------------------------------------------------------- /Build/Sheets/Max_System_x64.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 13 | 18 | 19 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_2008.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | $(MAXINSTALLPATH2008)\ 8 | 9 | 10 | <_ProjectFileVersion>10.0.30319.1 11 | 12 | 13 | 14 | USE_BIPED;%(PreprocessorDefinitions) 15 | 16 | 17 | Checking Environment Variables ... 18 | IF NOT EXIST "$(MaxInstallDir)" ( 19 | echo : 20 | echo : The variable MAXINSTALLPATH2008 is not defined. 21 | echo : Set environment variable or edit User_Settings.vsprops to correct. 22 | echo : 23 | EXIT 2 24 | ) else ( 25 | echo : Using MAXINSTALLPATH2008=$(MAXINSTALLPATH2008) 26 | ) 27 | 28 | 29 | 30 | 31 | 32 | $(MaxInstallDir) 33 | true 34 | 35 | 36 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_2008.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_2009.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | $(MAXINSTALLPATH2009)\ 8 | 9 | 10 | <_ProjectFileVersion>10.0.30319.1 11 | 12 | 13 | 14 | USE_BIPED;%(PreprocessorDefinitions) 15 | 16 | 17 | Checking Environment Variables ... 18 | IF NOT EXIST "$(MaxInstallDir)" ( 19 | echo : 20 | echo : The variable MAXINSTALLPATH2009 is not defined. 21 | echo : Set environment variable or edit User_Settings.vsprops to correct. 22 | echo : 23 | EXIT 2 24 | ) else ( 25 | echo : Using MAXINSTALLPATH2009=$(MAXINSTALLPATH2009) 26 | ) 27 | 28 | 29 | 30 | 31 | 32 | $(MaxInstallDir) 33 | true 34 | 35 | 36 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_2009.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_2010.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | $(MAXINSTALLPATH2010)\ 8 | 9 | 10 | <_ProjectFileVersion>10.0.30319.1 11 | 12 | 13 | 14 | USE_BIPED;%(PreprocessorDefinitions) 15 | 16 | 17 | Checking Environment Variables ... 18 | IF NOT EXIST "$(MaxInstallDir)" ( 19 | echo : 20 | echo : The variable MAXINSTALLPATH2010 is not defined. 21 | echo : Set environment variable or edit User_Settings.vsprops to correct. 22 | echo : 23 | EXIT 2 24 | ) else ( 25 | echo : Using MAXINSTALLPATH2010=$(MAXINSTALLPATH2010) 26 | ) 27 | 28 | 29 | 30 | 31 | 32 | $(MaxInstallDir) 33 | true 34 | 35 | 36 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_2010.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_2011.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | $(MAXINSTALLPATH2011)\ 8 | 9 | 10 | <_ProjectFileVersion>10.0.30319.1 11 | 12 | 13 | 14 | USE_BIPED;%(PreprocessorDefinitions) 15 | 16 | 17 | Checking Environment Variables ... 18 | IF NOT EXIST "$(MaxInstallDir)" ( 19 | echo : 20 | echo : The variable MAXINSTALLPATH2011 is not defined. 21 | echo : Set environment variable or edit User_Settings.vsprops to correct. 22 | echo : 23 | EXIT 2 24 | ) else ( 25 | echo : Using MAXINSTALLPATH2011=$(MAXINSTALLPATH2011) 26 | ) 27 | 28 | 29 | 30 | 31 | 32 | $(MaxInstallDir) 33 | true 34 | 35 | 36 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_2011.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_2012.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | $(MAXINSTALLPATH2012)\ 8 | 9 | 10 | <_ProjectFileVersion>10.0.30319.1 11 | 12 | 13 | 14 | USE_BIPED;%(PreprocessorDefinitions) 15 | 16 | 17 | Checking Environment Variables ... 18 | IF NOT EXIST "$(MaxInstallDir)" ( 19 | echo : 20 | echo : The variable MAXINSTALLPATH2012 is not defined. 21 | echo : Set environment variable or edit User_Settings.vsprops to correct. 22 | echo : 23 | EXIT 2 24 | ) else ( 25 | echo : Using MAXINSTALLPATH2012=$(MAXINSTALLPATH2012) 26 | ) 27 | 28 | 29 | 30 | 31 | 32 | $(MaxInstallDir) 33 | true 34 | 35 | 36 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_2012.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_4.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 13 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_42.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 13 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_5.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 13 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_6.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_7.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_8.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_9.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | $(MAXINSTALLPATH90)\ 8 | 9 | 10 | <_ProjectFileVersion>10.0.30319.1 11 | 12 | 13 | 14 | USE_BIPED;%(PreprocessorDefinitions) 15 | 16 | 17 | Checking Environment Variables ... 18 | IF NOT EXIST "$(MaxInstallDir)" ( 19 | echo : 20 | echo : The variable MAXINSTALLPATH90 is not defined. 21 | echo : Set environment variable or edit User_Settings.vsprops to correct. 22 | echo : 23 | EXIT 2 24 | ) else ( 25 | echo : Using MAXINSTALLPATH90=$(MAXINSTALLPATH90) 26 | ) 27 | 28 | 29 | 30 | 31 | 32 | $(MaxInstallDir) 33 | true 34 | 35 | 36 | -------------------------------------------------------------------------------- /Build/Sheets/Max_Version_9.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Build/Sheets/Niflib_Settings.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.30319.1 5 | 6 | 7 | 8 | $(ProjectDir)..\..\niflib\include;$(ProjectDir)..\..\niflib;%(AdditionalIncludeDirectories) 9 | USE_NIFLIB_TEMPLATE_HELPERS;NIFLIB_STATIC_LINK;%(PreprocessorDefinitions) 10 | 11 | 12 | $(ProjectDir)..\..\niflib\lib;%(AdditionalLibraryDirectories) 13 | 14 | 15 | -------------------------------------------------------------------------------- /Build/Sheets/Niflib_Settings.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /Build/Sheets/Release_Settings.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Release 5 | 6 | 7 | <_ProjectFileVersion>10.0.30319.1 8 | false 9 | 10 | 11 | 12 | AnySuitable 13 | MaxSpeed 14 | NDEBUG;%(PreprocessorDefinitions) 15 | ProgramDatabase 16 | false 17 | true 18 | MultiThreaded 19 | 20 | 21 | true 22 | $(IntDir)$(TargetName).pdb 23 | true 24 | true 25 | true 26 | 27 | 28 | NDEBUG;%(PreprocessorDefinitions) 29 | 30 | 31 | NDEBUG;%(PreprocessorDefinitions) 32 | 33 | 34 | pushd $(SolutionDir) 35 | call "$(SolutionDir)makeconfig.bat" 36 | popd 37 | 38 | 39 | 40 | if exist "$(MaxInstallDir)\plugcfg" ( 41 | if not exist "$(MaxInstallDir)\plugcfg\MaxNifTools.ini" ( 42 | copy "$(SolutionDir)MaxNifTools.ini" "$(MaxInstallDir)\plugcfg\MaxNifTools.ini" 43 | ) 44 | ) 45 | xcopy /D /Y /I "$(SolutionDir)Readme.txt" "$(OutDir)" 46 | xcopy /D /Y /I "$(SolutionDir)license.txt" "$(OutDir)" 47 | xcopy /D /Y /I "$(SolutionDir)ChangeLog.txt" "$(OutDir)" 48 | xcopy /D /Y /I "$(SolutionDir)Authors.txt" "$(OutDir)" 49 | xcopy /D /Y /I "$(SolutionDir)MaxNifTools.ini" "$(OutDir)" 50 | xcopy /D /Y /I "$(TargetPath)" "$(OutDir)" 51 | 52 | 53 | 54 | 55 | 56 | $(NifBuildType) 57 | 58 | 59 | -------------------------------------------------------------------------------- /Build/Sheets/Release_Settings.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 7 | 17 | 26 | 30 | 34 | 38 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Build/Sheets/gmax_Version_12.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /CHANGELOG.TXT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niftools/max_nif_plugin/f131c8c4ddefb12f6252d469552f607e5fdc7c4f/CHANGELOG.TXT -------------------------------------------------------------------------------- /LICENSE.TXT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niftools/max_nif_plugin/f131c8c4ddefb12f6252d469552f607e5fdc7c4f/LICENSE.TXT -------------------------------------------------------------------------------- /MaxNifTools.iss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niftools/max_nif_plugin/f131c8c4ddefb12f6252d469552f607e5fdc7c4f/MaxNifTools.iss -------------------------------------------------------------------------------- /NifCommon/AppSettings.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: AppSettings.h 4 | 5 | DESCRIPTION: AppSetting helper class for managing game specific 6 | file settings. 7 | 8 | CREATED BY: tazpn (Theo) 9 | 10 | HISTORY: 11 | 12 | *> Copyright (c) 2006, All Rights Reserved. 13 | **********************************************************************/ 14 | #ifndef _APPSETTINGS_H_ 15 | #define _APPSETTINGS_H_ 16 | 17 | #include "niutils.h" 18 | 19 | class AppSettings 20 | { 21 | public: 22 | AppSettings(const std::string& name) 23 | : Name(name) 24 | , parsedImages(false) 25 | , useSkeleton(false) 26 | , goToSkeletonBindPosition(true) 27 | , disableCreateNubsForBones(false) 28 | , textureUseFullPath(0) 29 | , supportPrnStrings(false) 30 | , doNotReuseExistingBones(false) 31 | {} 32 | 33 | std::string Name; 34 | std::string rootPath; 35 | bool parsedImages; 36 | stringlist searchPaths; 37 | stringlist textureRootPaths; 38 | stringlist rootPaths; 39 | stringlist extensions; 40 | std::string Skeleton; 41 | bool useSkeleton; 42 | bool goToSkeletonBindPosition; 43 | bool disableCreateNubsForBones; 44 | int textureUseFullPath; 45 | NameValueCollection Environment; 46 | NameValueCollection imgTable; 47 | stringlist dummyNodeMatches; 48 | int applyOverallTransformToSkinAndBones; 49 | std::string NiVersion; 50 | int NiUserVersion; 51 | int NiUserVersion2; 52 | stringlist rotate90Degrees; 53 | bool supportPrnStrings; 54 | bool doNotReuseExistingBones; 55 | string skeletonCheck; 56 | 57 | static void Initialize(Interface *gi); 58 | void ReadSettings(std::string iniFile); 59 | void WriteSettings(Interface *gi); 60 | std::string FindImage(const std::string& fname); 61 | 62 | // Check whether the given file is a child of the root paths 63 | bool IsFileInRootPaths(const std::string& fname); 64 | 65 | // Return the Relative Texture Path for filename or empty 66 | std::string GetRelativeTexPath(const std::string& fname, const std::string& prefix); 67 | 68 | template 69 | inline T GetSetting(std::string setting){ 70 | T v; 71 | NameValueCollection::iterator itr = Environment.find(setting); 72 | if (itr != Environment.end()){ 73 | stringstream sstr((*itr).second); 74 | sstr >> v; 75 | } 76 | return v; 77 | } 78 | template<> 79 | inline std::string GetSetting(std::string setting){ 80 | NameValueCollection::iterator itr = Environment.find(setting); 81 | if (itr != Environment.end()) 82 | return (*itr).second; 83 | return std::string(); 84 | } 85 | 86 | template 87 | inline T GetSetting(std::string setting, T Default){ 88 | NameValueCollection::iterator itr = Environment.find(setting); 89 | if (itr != Environment.end()){ 90 | T v; 91 | stringstream sstr((*itr).second); 92 | sstr >> v; 93 | return v; 94 | } 95 | return Default; 96 | } 97 | template<> 98 | inline std::string GetSetting(std::string setting, std::string Default){ 99 | NameValueCollection::iterator itr = Environment.find(setting); 100 | if (itr != Environment.end()) 101 | return (*itr).second; 102 | return Default; 103 | } 104 | }; 105 | 106 | typedef std::list AppSettingsMap; 107 | 108 | struct AppSettingsNameEquivalence : public ltstr 109 | { 110 | bool operator()(const AppSettings& n1, const AppSettings& n2) const { 111 | return ltstr::operator()(n1.Name, n2.Name); 112 | } 113 | bool operator()(const string& n1, const AppSettings& n2) const { 114 | return ltstr::operator()(n1, n2.Name); 115 | } 116 | bool operator()(const AppSettings& n1, const string& n2) const { 117 | return ltstr::operator()(n1.Name, n2); 118 | } 119 | }; 120 | 121 | // The Global Map 122 | // Global so that I dont have to parse the texture directories on every import 123 | extern AppSettingsMap TheAppSettings; 124 | 125 | inline AppSettings* FindAppSetting(const std::string& name){ 126 | AppSettingsNameEquivalence equiv; 127 | for (AppSettingsMap::iterator itr=TheAppSettings.begin(), end = TheAppSettings.end(); itr != end; ++itr){ 128 | if (!equiv(*itr, name) && !equiv(name, *itr)) 129 | return &(*itr); 130 | } 131 | return NULL; 132 | } 133 | 134 | #endif //_APPSETTINGS_H_ -------------------------------------------------------------------------------- /NifCommon/Hyperlinks.cpp: -------------------------------------------------------------------------------- 1 | // Hyperlinks.cpp 2 | // 3 | // Copyright 2002 Neal Stublen 4 | // All rights reserved. 5 | // 6 | // http://www.awesoftware.com 7 | // 8 | 9 | #include 10 | 11 | #include "Hyperlinks.h" 12 | 13 | 14 | #define PROP_ORIGINAL_FONT TEXT("_Hyperlink_Original_Font_") 15 | #define PROP_ORIGINAL_PROC TEXT("_Hyperlink_Original_Proc_") 16 | #define PROP_STATIC_HYPERLINK TEXT("_Hyperlink_From_Static_") 17 | #define PROP_UNDERLINE_FONT TEXT("_Hyperlink_Underline_Font_") 18 | 19 | 20 | LRESULT CALLBACK _HyperlinkParentProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 21 | { 22 | WNDPROC pfnOrigProc = (WNDPROC) GetProp(hwnd, PROP_ORIGINAL_PROC); 23 | 24 | switch (message) 25 | { 26 | case WM_CTLCOLORSTATIC: 27 | { 28 | HDC hdc = (HDC) wParam; 29 | HWND hwndCtl = (HWND) lParam; 30 | 31 | BOOL fHyperlink = (NULL != GetProp(hwndCtl, PROP_STATIC_HYPERLINK)); 32 | if (fHyperlink) 33 | { 34 | LRESULT lr = CallWindowProc(pfnOrigProc, hwnd, message, wParam, lParam); 35 | SetTextColor(hdc, RGB(0, 0, 192)); 36 | return lr; 37 | } 38 | 39 | break; 40 | } 41 | case WM_DESTROY: 42 | { 43 | SetWindowLong(hwnd, GWLP_WNDPROC, (LONG) pfnOrigProc); 44 | RemoveProp(hwnd, PROP_ORIGINAL_PROC); 45 | break; 46 | } 47 | } 48 | return CallWindowProc(pfnOrigProc, hwnd, message, wParam, lParam); 49 | } 50 | 51 | LRESULT CALLBACK _HyperlinkProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) 52 | { 53 | WNDPROC pfnOrigProc = (WNDPROC) GetProp(hwnd, PROP_ORIGINAL_PROC); 54 | 55 | switch (message) 56 | { 57 | case WM_DESTROY: 58 | { 59 | SetWindowLong(hwnd, GWLP_WNDPROC, (LONG) pfnOrigProc); 60 | RemoveProp(hwnd, PROP_ORIGINAL_PROC); 61 | 62 | HFONT hOrigFont = (HFONT) GetProp(hwnd, PROP_ORIGINAL_FONT); 63 | SendMessage(hwnd, WM_SETFONT, (WPARAM) hOrigFont, 0); 64 | RemoveProp(hwnd, PROP_ORIGINAL_FONT); 65 | 66 | HFONT hFont = (HFONT) GetProp(hwnd, PROP_UNDERLINE_FONT); 67 | DeleteObject(hFont); 68 | RemoveProp(hwnd, PROP_UNDERLINE_FONT); 69 | 70 | RemoveProp(hwnd, PROP_STATIC_HYPERLINK); 71 | 72 | break; 73 | } 74 | case WM_MOUSEMOVE: 75 | { 76 | if (GetCapture() != hwnd) 77 | { 78 | HFONT hFont = (HFONT) GetProp(hwnd, PROP_UNDERLINE_FONT); 79 | SendMessage(hwnd, WM_SETFONT, (WPARAM) hFont, FALSE); 80 | InvalidateRect(hwnd, NULL, FALSE); 81 | SetCapture(hwnd); 82 | } 83 | else 84 | { 85 | RECT rect; 86 | GetWindowRect(hwnd, &rect); 87 | 88 | POINT pt = { LOWORD(lParam), HIWORD(lParam) }; 89 | ClientToScreen(hwnd, &pt); 90 | 91 | if (!PtInRect(&rect, pt)) 92 | { 93 | HFONT hFont = (HFONT) GetProp(hwnd, PROP_ORIGINAL_FONT); 94 | SendMessage(hwnd, WM_SETFONT, (WPARAM) hFont, FALSE); 95 | InvalidateRect(hwnd, NULL, FALSE); 96 | ReleaseCapture(); 97 | SetCursor(LoadCursor(NULL, IDC_ARROW)); 98 | } 99 | } 100 | break; 101 | } 102 | case WM_SETCURSOR: 103 | { 104 | // Since IDC_HAND is not available on all operating systems, 105 | // we will load the arrow cursor if IDC_HAND is not present. 106 | HCURSOR hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND)); 107 | if (NULL == hCursor) 108 | { 109 | hCursor = LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)); 110 | } 111 | SetCursor(hCursor); 112 | return TRUE; 113 | } 114 | case WM_KILLFOCUS: 115 | { 116 | if (GetCapture() == hwnd) 117 | { 118 | HFONT hFont = (HFONT) GetProp(hwnd, PROP_ORIGINAL_FONT); 119 | SendMessage(hwnd, WM_SETFONT, (WPARAM) hFont, FALSE); 120 | InvalidateRect(hwnd, NULL, FALSE); 121 | ReleaseCapture(); 122 | SetCursor(LoadCursor(NULL, IDC_ARROW)); 123 | } 124 | } 125 | break; 126 | } 127 | 128 | return CallWindowProc(pfnOrigProc, hwnd, message, wParam, lParam); 129 | } 130 | 131 | BOOL ConvertStaticToHyperlink(HWND hwndCtl) 132 | { 133 | // Subclass the parent so we can color the controls as we desire. 134 | 135 | HWND hwndParent = GetParent(hwndCtl); 136 | if (NULL != hwndParent) 137 | { 138 | WNDPROC pfnOrigProc = (WNDPROC) GetWindowLong(hwndParent, GWLP_WNDPROC); 139 | if (pfnOrigProc != _HyperlinkParentProc) 140 | { 141 | SetProp(hwndParent, PROP_ORIGINAL_PROC, (HANDLE) pfnOrigProc); 142 | SetWindowLong(hwndParent, GWLP_WNDPROC, (LONG) (WNDPROC) _HyperlinkParentProc); 143 | } 144 | } 145 | 146 | // Make sure the control will send notifications. 147 | 148 | DWORD dwStyle = GetWindowLong(hwndCtl, GWL_STYLE); 149 | SetWindowLong(hwndCtl, GWL_STYLE, dwStyle | SS_NOTIFY); 150 | 151 | // Subclass the existing control. 152 | 153 | WNDPROC pfnOrigProc = (WNDPROC) GetWindowLong(hwndCtl, GWLP_WNDPROC); 154 | SetProp(hwndCtl, PROP_ORIGINAL_PROC, (HANDLE) pfnOrigProc); 155 | SetWindowLong(hwndCtl, GWLP_WNDPROC, (LONG) (WNDPROC) _HyperlinkProc); 156 | 157 | // Create an updated font by adding an underline. 158 | 159 | HFONT hOrigFont = (HFONT) SendMessage(hwndCtl, WM_GETFONT, 0, 0); 160 | SetProp(hwndCtl, PROP_ORIGINAL_FONT, (HANDLE) hOrigFont); 161 | 162 | LOGFONT lf; 163 | GetObject(hOrigFont, sizeof(lf), &lf); 164 | lf.lfUnderline = TRUE; 165 | 166 | HFONT hFont = CreateFontIndirect(&lf); 167 | SetProp(hwndCtl, PROP_UNDERLINE_FONT, (HANDLE) hFont); 168 | 169 | // Set a flag on the control so we know what color it should be. 170 | 171 | SetProp(hwndCtl, PROP_STATIC_HYPERLINK, (HANDLE) 1); 172 | 173 | return TRUE; 174 | } 175 | 176 | BOOL ConvertStaticToHyperlink(HWND hwndParent, UINT uiCtlId) 177 | { 178 | return ConvertStaticToHyperlink(GetDlgItem(hwndParent, uiCtlId)); 179 | } 180 | -------------------------------------------------------------------------------- /NifCommon/Hyperlinks.h: -------------------------------------------------------------------------------- 1 | // Hyperlinks.h 2 | // 3 | // Copyright 2002 Neal Stublen 4 | // All rights reserved. 5 | // 6 | // http://www.awesoftware.com 7 | // 8 | 9 | BOOL ConvertStaticToHyperlink(HWND hwndCtl); 10 | BOOL ConvertStaticToHyperlink(HWND hwndParent, UINT uiCtlId); 11 | -------------------------------------------------------------------------------- /NifCommon/IniSection.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | enum VARIABLETYPE 7 | { 8 | vtUnknown, 9 | vtInteger, 10 | vtFloat, 11 | vtDouble, 12 | vtBoolean, 13 | vtText, 14 | vtPointer, 15 | vtHandle, 16 | vtVector = 0x1000, 17 | vtFixedVector = vtVector | 0x2000, 18 | vtMatrix = 0x4000, 19 | }; 20 | 21 | struct VARIABLE 22 | { 23 | VARIABLE() : ShortName(NULL), IniName(NULL), MemberAddr(0), Description(NULL), DefaultValue(NULL), ValueSize(0) { 24 | } 25 | 26 | ~VARIABLE() { 27 | if (ValueSize && DefaultValue) { 28 | delete DefaultValue; 29 | DefaultValue = NULL; 30 | ValueSize = 0; 31 | } 32 | } 33 | 34 | template 35 | VARIABLE(LPCTSTR sName, LPCTSTR iName, const U& member, U default, LPCTSTR desc, VARIABLETYPE type) 36 | : ShortName(sName), IniName(iName), MemberAddr(NULL), Description(NULL), MemberType(type) { 37 | SetDefault(default); 38 | } 39 | 40 | template<> 41 | VARIABLE(LPCTSTR sName, LPCTSTR iName, const std::string& member, std::string default, LPCTSTR desc, VARIABLETYPE type) 42 | : ShortName(sName), IniName(iName), MemberAddr((DWORD)&member), Description(NULL) { 43 | MemberType = type==vtUnknown?vtText:type; 44 | SetDefault(default); 45 | } 46 | 47 | template<> 48 | VARIABLE(LPCTSTR sName, LPCTSTR iName, const int& member, int default, LPCTSTR desc, VARIABLETYPE type) 49 | : ShortName(sName), IniName(iName), MemberAddr((DWORD)&member), Description(NULL) { 50 | MemberType = type==vtUnknown?vtInteger:type; 51 | SetDefault(default); 52 | } 53 | 54 | template<> 55 | VARIABLE(LPCTSTR sName, LPCTSTR iName, const float& member, float default, LPCTSTR desc, VARIABLETYPE type) 56 | : ShortName(sName), IniName(iName), MemberAddr((DWORD)&member), Description(NULL) { 57 | MemberType = type==vtUnknown?vtFloat:type; 58 | SetDefault(default); 59 | } 60 | 61 | template<> 62 | VARIABLE(LPCTSTR sName, LPCTSTR iName, const double& member, double default, LPCTSTR desc, VARIABLETYPE type) 63 | : ShortName(sName), IniName(iName), MemberAddr((DWORD)&member), Description(NULL) { 64 | MemberType = type==vtUnknown?vtDouble:type; 65 | SetDefault(default); 66 | } 67 | 68 | template<> 69 | VARIABLE(LPCTSTR sName, LPCTSTR iName, const bool& member, bool default, LPCTSTR desc, VARIABLETYPE type) 70 | : ShortName(sName), IniName(iName), MemberAddr((DWORD)&member), Description(NULL) { 71 | MemberType = type==vtUnknown?vtBoolean:type; 72 | SetDefault(default); 73 | } 74 | 75 | template 76 | void SetDefault(U default) { 77 | ValueSize = sizeof(U); 78 | DefaultValue = new U(default); 79 | } 80 | 81 | template 82 | const U& GetDefault() const { 83 | return *(U*)DefaultValue; 84 | } 85 | 86 | LPCTSTR ShortName; 87 | LPCTSTR IniName; 88 | DWORD MemberAddr; 89 | VARIABLETYPE MemberType; 90 | LPCTSTR Description; 91 | LPVOID DefaultValue; 92 | DWORD ValueSize; 93 | }; 94 | 95 | #define BEGIN_INI_MAP(name) \ 96 | virtual void *GetMember(const VARIABLE* memptr) const { return (void*)(((char*)this) + memptr->MemberAddr); } \ 97 | virtual const VARIABLE* GetInfDefmap() const { return InternalGetInfDefmap(); } \ 98 | static VARIABLE* InternalGetInfDefmap() { \ 99 | const name* pThis = 0; \ 100 | static VARIABLE map[] = { \ 101 | 102 | #define BEGIN_INI_MAP_WITH_BASE(name, base) \ 103 | virtual void *GetMember(const VARIABLE* memptr) const { return (void*)(((char*)this) + memptr->MemberAddr); } \ 104 | virtual const VARIABLE* GetInfDefmap() const { return InternalGetInfDefmap(); } \ 105 | static VARIABLE* InternalGetInfDefmap() { \ 106 | const name* pThis = 0; \ 107 | static VARIABLE map[] = { \ 108 | 109 | #define END_INI_MAP() \ 110 | VARIABLE() };\ 111 | return map;\ 112 | } 113 | 114 | #define ADDITEM(sName, iName, member, desc) \ 115 | VARIABLE(sName, iName, pThis->member, desc, vtUnknown), \ 116 | 117 | #define ADDITEMEX(sName, iName, member, type, desc) \ 118 | VARIABLE(sName, iName, pThis->member, desc, type), \ 119 | 120 | struct IniFileSection 121 | { 122 | virtual LPCTSTR GetName() const = 0; 123 | virtual const VARIABLE* GetInfDefmap() const = 0; 124 | virtual void *GetMember(const VARIABLE* memptr) const = 0; 125 | }; 126 | 127 | typedef std::list IniFileSectionList; 128 | 129 | inline int GetIniDefSectionSize(IniFileSection *section) { 130 | int len = 0; 131 | 132 | for (const VARIABLE *inidef = section->GetInfDefmap() 133 | ; inidef != NULL && inidef->ShortName 134 | ; ++inidef) 135 | ++len; 136 | return len; 137 | } -------------------------------------------------------------------------------- /NifCommon/NifGui.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "NifGui.h" 3 | 4 | NpComboBox::NpComboBox(HWND hWnd) 5 | { 6 | init(hWnd); 7 | } 8 | 9 | void NpComboBox::init(HWND hWnd) 10 | { 11 | mWnd = hWnd; 12 | } 13 | 14 | int NpComboBox::add(const char *s) 15 | { 16 | SendMessage(mWnd, CB_ADDSTRING, 0, (LPARAM)s); 17 | return count()-1; 18 | } 19 | 20 | int NpComboBox::count() const 21 | { 22 | return SendMessage(mWnd, CB_GETCOUNT, 0, 0); 23 | } 24 | 25 | void NpComboBox::select(int i) 26 | { 27 | SendMessage(mWnd, CB_SETCURSEL, (WPARAM)i, 0); 28 | } 29 | 30 | int NpComboBox::selection() const 31 | { 32 | return SendMessage(mWnd, CB_GETCURSEL, 0, 0); 33 | } 34 | -------------------------------------------------------------------------------- /NifCommon/NifGui.h: -------------------------------------------------------------------------------- 1 | #ifndef __NIFGUI_H__ 2 | #define __NIFGUI_H__ 3 | 4 | /* Combo box control wrapper. */ 5 | class NpComboBox 6 | { 7 | 8 | public: 9 | 10 | NpComboBox(HWND hWnd=NULL); 11 | 12 | void init(HWND hWnd); 13 | 14 | int add(const char *); 15 | 16 | int count() const; 17 | void select(int i); 18 | int selection() const; 19 | 20 | private: 21 | 22 | HWND mWnd; 23 | }; 24 | 25 | #endif __NIFGUI_H__ 26 | -------------------------------------------------------------------------------- /NifCommon/NifPlugins.cpp: -------------------------------------------------------------------------------- 1 | #include "Max.h" 2 | #include "NifPlugins.h" 3 | 4 | bool npIsCollision(INode *node) 5 | { 6 | int i; 7 | return npGetProp(node, NP_HASCOLL, i) && i; 8 | } 9 | 10 | void npSetCollision(INode *node, bool coll) 11 | { 12 | npSetProp(node, NP_HASCOLL, (bool)coll); 13 | } 14 | 15 | bool npGetProp(INode *node, const TSTR &prop, int &value, int def) 16 | { 17 | bool ret; 18 | if (node) 19 | { 20 | if (!node->GetUserPropInt(prop, value)) 21 | { 22 | value = def; 23 | ret = false; 24 | } else 25 | ret = true; 26 | } else 27 | { 28 | value = def; 29 | ret = false; 30 | } 31 | 32 | return ret; 33 | } 34 | 35 | void npSetProp(INode *node, const TSTR &prop, int value) 36 | { 37 | if (node) 38 | node->SetUserPropInt(prop, value); 39 | } 40 | 41 | bool npGetProp(INode *node, const TSTR &prop, float &value, float def) 42 | { 43 | bool ret; 44 | if (node) 45 | { 46 | if (!node->GetUserPropFloat(prop, value)) 47 | { 48 | value = def; 49 | ret = false; 50 | } else 51 | ret = true; 52 | } else 53 | { 54 | value = def; 55 | ret = false; 56 | } 57 | 58 | return ret; 59 | } 60 | 61 | void npSetProp(INode *node, const TSTR &prop, float value) 62 | { 63 | if (node) 64 | node->SetUserPropFloat(prop, value); 65 | } 66 | 67 | bool npGetProp(INode *node, const TSTR &prop, Vector3 &value, const Vector3 def) 68 | { 69 | bool ret = false; 70 | if (node) 71 | { 72 | TSTR tmp; 73 | if (node->GetUserPropString(prop, tmp)) 74 | { 75 | value = def; 76 | TCHAR *endp = NULL; 77 | value.x = _tcstod(tmp, &endp); 78 | if (endp) 79 | value.y = _tcstod(endp, &endp); 80 | if (endp) 81 | value.z = _tcstod(endp, &endp); 82 | 83 | ret = true; 84 | } else 85 | { 86 | value = def; 87 | ret = false; 88 | } 89 | 90 | } else 91 | { 92 | value = def; 93 | ret = false; 94 | } 95 | 96 | return ret; 97 | 98 | } 99 | 100 | void npSetProp(INode *node, const TSTR &prop, const Vector3 &value) 101 | { 102 | if (node) 103 | { 104 | // TSTR's printf function seems to be locale-aware (prints ',') 105 | // so we have to do it this way... 106 | TCHAR tmp[256]; 107 | _stprintf(tmp, "%f %f %f", value.x, value.y, value.z); 108 | node->SetUserPropString(prop, tmp); 109 | } 110 | } 111 | 112 | 113 | bool npGetProp(INode *node, const TSTR &prop, TSTR &value, TSTR def) 114 | { 115 | bool ret; 116 | if (node) 117 | { 118 | if (!node->GetUserPropString(prop, value)) 119 | { 120 | value = def; 121 | ret = false; 122 | } 123 | else 124 | ret = true; 125 | } 126 | else 127 | { 128 | value = def; 129 | ret = false; 130 | } 131 | return ret; 132 | } 133 | 134 | void npSetProp(INode *node, const TSTR &prop, const TSTR& value) 135 | { 136 | if (node) 137 | node->SetUserPropString(prop, value); 138 | } -------------------------------------------------------------------------------- /NifCommon/NifPlugins.h: -------------------------------------------------------------------------------- 1 | #ifndef __NIFPLUGINS_H__ 2 | #define __NIFPLUGINS_H__ 3 | 4 | #include "nif_math.h" 5 | using Niflib::Vector3; 6 | 7 | /* node properties */ 8 | 9 | 10 | // Custom Properties shared with Havok 11 | #define NP_HVK_MASS _T("Mass") 12 | #define NP_HVK_FRICTION _T("Friction") 13 | #define NP_HVK_RESTITUTION _T("Ellasticity") 14 | #define NP_HVK_PROXY_GEOM _T("Proxy_Geometry") 15 | 16 | #define NP_HVK_MASS_OLD _T("np_hvk_mass") 17 | #define NP_HVK_FRICTION_OLD _T("np_hvk_frict") 18 | #define NP_HVK_RESTITUTION_OLD _T("np_hvk_resti") 19 | 20 | 21 | /* default values */ 22 | #define NP_DEFAULT_HVK_EMPTY 3.402823466e+38F 23 | #define NP_DEFAULT_HVK_MASS 0.0f 24 | #define NP_DEFAULT_HVK_FRICTION 0.3f 25 | #define NP_DEFAULT_HVK_RESTITUTION 0.3f 26 | #define NP_DEFAULT_PROXY_GEOM _T("") 27 | 28 | 29 | // Custom Properties 30 | #define NP_HASCOLL _T("np_coll") 31 | #define NP_HVK_LAYER _T("np_hvk_layer") 32 | #define NP_HVK_MATERIAL _T("np_hvk_mtl") 33 | #define NP_HVK_CENTER _T("np_hvk_center") 34 | #define NP_HVK_LINEAR_DAMPING _T("np_hvk_ldamp") 35 | #define NP_HVK_ANGULAR_DAMPING _T("np_hvk_adamp") 36 | #define NP_HVK_MAX_LINEAR_VELOCITY _T("np_hvk_max_lvel") 37 | #define NP_HVK_MAX_ANGULAR_VELOCITY _T("np_hvk_max_avel") 38 | #define NP_HVK_PENETRATION_DEPTH _T("np_hvk_pdepth") 39 | #define NP_HVK_MOTION_SYSTEM _T("np_hvk_msys") 40 | #define NP_HVK_QUALITY_TYPE _T("np_hvk_qtype") 41 | 42 | #define NP_FRN_POS _T("np_frn_pos") 43 | 44 | #define NP_ANM_PRI _T("np_anm_pri") 45 | 46 | /* default values */ 47 | #define NP_INVALID_HVK_MATERIAL -1 48 | #define NP_DEFAULT_HVK_MATERIAL 0 49 | #define NP_DEFAULT_HVK_LAYER 1 50 | #define NP_DEFAULT_HVK_LINEAR_DAMPING 0.1f 51 | #define NP_DEFAULT_HVK_ANGULAR_DAMPING 0.05f 52 | #define NP_DEFAULT_HVK_MAX_LINEAR_VELOCITY 200.0f 53 | #define NP_DEFAULT_HVK_MAX_ANGULAR_VELOCITY 200.0f 54 | #define NP_DEFAULT_HVK_PENETRATION_DEPTH 0.15f 55 | #define NP_DEFAULT_HVK_MOTION_SYSTEM 7 56 | #define NP_DEFAULT_HVK_QUALITY_TYPE 1 57 | #define NP_DEFAULT_HVK_FILTER 0 58 | 59 | #define NP_DEFAULT_ANM_PRI 0.0f 60 | 61 | #define NP_DEFAULT_FRN_MARKER_TYPE NP_FRN_SLEEP_LEFT 62 | 63 | /* other constants */ 64 | enum NpFrnPos 65 | { 66 | NP_FRN_SLEEP_LEFT = 1, 67 | NP_FRN_SLEEP_RIGHT = 2, 68 | NP_FRN_BEDROLL_LEFT = 3, 69 | NP_FRN_BEDROLL_RIGHT = 4, 70 | NP_FRN_SIT_LEFT = 11, 71 | NP_FRN_SIT_RIGHT = 12, 72 | NP_FRN_SIT_BACK = 13, 73 | NP_FRN_SIT_FRONT = 14 74 | }; 75 | 76 | /* property access */ 77 | bool npIsCollision(INode *node); 78 | void npSetCollision(INode *node, bool coll); 79 | 80 | bool npGetProp(INode *node, const TSTR &prop, int &value, int def=0); 81 | void npSetProp(INode *node, const TSTR &prop, int value); 82 | 83 | bool npGetProp(INode *node, const TSTR &prop, float &value, float def=0.0f); 84 | void npSetProp(INode *node, const TSTR &prop, float value); 85 | 86 | bool npGetProp(INode *node, const TSTR &prop, Vector3 &value, const Vector3 def=Vector3(0,0,0)); 87 | void npSetProp(INode *node, const TSTR &prop, const Vector3 &value); 88 | 89 | bool npGetProp(INode *node, const TSTR &prop, TSTR &value, TSTR def=TSTR()); 90 | void npSetProp(INode *node, const TSTR &prop, const TSTR& value); 91 | 92 | #endif // __NIFPLUGINS_H__ 93 | -------------------------------------------------------------------------------- /NifCommon/NifQHull.cpp: -------------------------------------------------------------------------------- 1 | #include "Max.h" 2 | #include "MeshDelta.h" 3 | 4 | extern "C" 5 | { 6 | #include <../qhull/src/libqhull/libqhull.h> 7 | #include <../qhull/src/libqhull/mem.h> 8 | #include <../qhull/src/libqhull/qset.h> 9 | #include <../qhull/src/libqhull/geom.h> 10 | #include <../qhull/src/libqhull/merge.h> 11 | #include <../qhull/src/libqhull/poly.h> 12 | #include <../qhull/src/libqhull/io.h> 13 | #include <../qhull/src/libqhull/stat.h> 14 | }; 15 | 16 | using namespace Niflib; 17 | 18 | void compute_convex_hull(Mesh& mesh, Mesh& outmesh) 19 | { 20 | MNMesh mn; 21 | map ptmap; 22 | 23 | vector tris; 24 | 25 | int dim=3; /* dimension of points */ 26 | int numpoints=0; /* number of points */ 27 | coordT *points=0; /* array of coordinates for each point */ 28 | boolT ismalloc=0; /* True if qhull should free points in qh_freeqhull() or reallocation */ 29 | char flags[]= "qhull i Qt"; /* option flags for qhull, see qh_opt.htm */ 30 | FILE *outfile= stdout; /* output from qh_produce_output() 31 | use NULL to skip qh_produce_output() */ 32 | FILE *errfile= stderr; /* error messages from qhull code */ 33 | int exitcode; /* 0 if no error from qhull */ 34 | facetT *facet; /* set by FORALLfacets */ 35 | int curlong, totlong; /* memory remaining after qh_memfreeshort */ 36 | setT *vertices; 37 | 38 | setT *pts; 39 | pointT *point; 40 | 41 | numpoints = mesh.getNumVerts(); 42 | points = new coordT[3 * numpoints]; 43 | for (int i=0; ipoint); 63 | if (id >= 0) { 64 | SETelem_(pts, id)= vertex->point; 65 | numpoints++; 66 | } 67 | } 68 | qh_settempfree (&vertices); 69 | 70 | int i=0; 71 | FOREACHpoint_i_(pts) { 72 | if (point) { 73 | int id = qh_pointid(point); 74 | ptmap[id] = mn.NewVert(Point3(point[0], point[1], point[2])); 75 | i++; 76 | } 77 | } 78 | qh_settempfree (&pts); 79 | 80 | FORALLfacets { 81 | vertices = qh_facet3vertex (facet); 82 | if (qh_setsize (vertices) == 3) { 83 | Triangle tri; 84 | int i = 0; 85 | FOREACHvertex_(vertices) { 86 | int id = qh_pointid(vertex->point); 87 | tri[i++] = ptmap[id]; 88 | } 89 | mn.NewTri(tri.v1, tri.v2, tri.v3); 90 | } 91 | qh_settempfree(&vertices); 92 | } 93 | } 94 | qh_freeqhull(!qh_ALL); 95 | qh_memfreeshort (&curlong, &totlong); 96 | delete[] points; 97 | 98 | mn.MakeConvex(); 99 | mn.FillInMesh(); 100 | mn.EliminateBadVerts(0); 101 | mn.Triangulate(); 102 | mn.OutToTri(outmesh); 103 | } -------------------------------------------------------------------------------- /NifCommon/NifVersion.h: -------------------------------------------------------------------------------- 1 | //********************************************************************** 2 | // 3 | // FILE: BaseImporter.h 4 | // 5 | // CREATED BY: tazpn (Theo) 6 | // 7 | // HISTORY: 8 | // Copyright (c) 2006, All Rights Reserved. 9 | //**********************************************************************/ 10 | #ifndef NIFVERSION_H 11 | #define NIFVERSION_H 12 | 13 | #include "config.h" 14 | 15 | // 16 | // Define the major, minor, build, patch version numbers 17 | // 18 | #define VERSION_MAJOR_INT 3 19 | #define VERSION_MINOR_INT 7 20 | #define VERSION_BUILD_INT 2 21 | 22 | #ifndef NIFTOOLS_REVISION_INT 23 | #define VERSION_PATCH_INT 0 24 | #else 25 | #define VERSION_PATCH_INT NIFTOOLS_REVISION_INT 26 | #endif 27 | 28 | #ifndef VERSION_STRING 29 | #ifndef NIFTOOLS_REVISION 30 | #define VERSION_STRING "3, 7, 2, 0" 31 | #else 32 | #define VERSION_STRING "3, 7, 2, " NIFTOOLS_REVISION 33 | #endif 34 | #endif 35 | 36 | //#define DEF_VERSION_STRING(a,b,c,d) "##a, ##b , ##c , ##d" 37 | //#define VERSION_STRING DEF_VERSION_STRING(a,b,c,d) 38 | 39 | #define COPYRIGHTYEARINT 2012 40 | #define COPYRIGHTYEAR "2012" 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /NifCommon/build.isi: -------------------------------------------------------------------------------- 1 | // 2 | // Versioning functions for Inno Setup 3 | // 4 | #define VERSION_STRING 5 | #include "nifversion.h" 6 | 7 | function GetParam(Param: String): String; 8 | begin 9 | Result := ''; 10 | case Param of 11 | 'version' : Result := IntToStr( {#VERSION_MAJOR_INT} ) + '.' + IntToStr({#VERSION_MINOR_INT}) + '.' + IntToStr({#VERSION_BUILD_INT}); 12 | 'fullver' : Result := IntToStr( {#VERSION_MAJOR_INT} ) + '.' + IntToStr({#VERSION_MINOR_INT}) + '.' + IntToStr({#VERSION_BUILD_INT}) + '.' + IntToStr({#NIFTOOLS_REVISION_INT}); 13 | end; 14 | end; -------------------------------------------------------------------------------- /NifCommon/config.h: -------------------------------------------------------------------------------- 1 | // NOTE: Run this file through the makeconfig.sh script 2 | 3 | // ***** BEGIN LICENSE BLOCK ***** 4 | // 5 | // BSD License 6 | // 7 | // Copyright (c) 2005-2008, NIF File Format Library and Tools 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without 11 | // modification, are permitted provided that the following conditions 12 | // are met: 13 | // 1. Redistributions of source code must retain the above copyright 14 | // notice, this list of conditions and the following disclaimer. 15 | // 2. Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the distribution. 18 | // 3. The name of the NIF File Format Library and Tools projectmay not be 19 | // used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 | // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 | // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | // ***** END LICENCE BLOCK *****/ 34 | 35 | // defines 36 | 37 | #ifndef CONFIG_H 38 | #define CONFIG_H 39 | 40 | #define NIFTOOLS_REVISION "$WCREV$" 41 | #define NIFTOOLS_REVISION_INT 0x$WCREV$ 42 | 43 | // NIFTOOLS_SVN_VERSION kept for compatibility 44 | #define NIFTOOLS_SVN_VERSION "Not modified" 45 | 46 | #define NIFTOOLS_SVN_DATE "$WCDATE$" 47 | 48 | // NIFTOOLS_SVN_RANGE kept, and defined as WCREV, for compatibility 49 | #define NIFTOOLS_SVN_RANGE "$WCREV$" 50 | 51 | // NIFTOOLS_SVN_MIXED kept for compatibility 52 | #define NIFTOOLS_SVN_MIXED "Not mixed" 53 | 54 | #define NIFTOOLS_SVN_URL "$WCURL$" 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /NifCommon/config.h.in: -------------------------------------------------------------------------------- 1 | // NOTE: Run this file through the makeconfig.sh script 2 | 3 | // ***** BEGIN LICENSE BLOCK ***** 4 | // 5 | // BSD License 6 | // 7 | // Copyright (c) 2005-2008, NIF File Format Library and Tools 8 | // All rights reserved. 9 | // 10 | // Redistribution and use in source and binary forms, with or without 11 | // modification, are permitted provided that the following conditions 12 | // are met: 13 | // 1. Redistributions of source code must retain the above copyright 14 | // notice, this list of conditions and the following disclaimer. 15 | // 2. Redistributions in binary form must reproduce the above copyright 16 | // notice, this list of conditions and the following disclaimer in the 17 | // documentation and/or other materials provided with the distribution. 18 | // 3. The name of the NIF File Format Library and Tools projectmay not be 19 | // used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 | // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 | // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 | // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 | // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 | // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | // 33 | // ***** END LICENCE BLOCK *****/ 34 | 35 | // defines 36 | 37 | #ifndef CONFIG_H 38 | #define CONFIG_H 39 | 40 | #define NIFTOOLS_REVISION "$WCREV$" 41 | #define NIFTOOLS_REVISION_INT 0x$WCREV$ 42 | 43 | // NIFTOOLS_SVN_VERSION kept for compatibility 44 | #define NIFTOOLS_SVN_VERSION "Not modified" 45 | 46 | #define NIFTOOLS_SVN_DATE "$WCDATE$" 47 | 48 | // NIFTOOLS_SVN_RANGE kept, and defined as WCREV, for compatibility 49 | #define NIFTOOLS_SVN_RANGE "$WCREV$" 50 | 51 | // NIFTOOLS_SVN_MIXED kept for compatibility 52 | #define NIFTOOLS_SVN_MIXED "Not mixed" 53 | 54 | #define NIFTOOLS_SVN_URL "$WCURL$" 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /NifCommon/nifversion.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niftools/max_nif_plugin/f131c8c4ddefb12f6252d469552f607e5fdc7c4f/NifCommon/nifversion.rc -------------------------------------------------------------------------------- /NifCommon/pch.cpp: -------------------------------------------------------------------------------- 1 | // pch.cpp : source file that includes just the standard includes 2 | // NifCommon.pch will be the pre-compiled header 3 | // pch.obj will contain the pre-compiled type information 4 | 5 | #include "pch.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /NifCommon/pch.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | // _WIN32 will detect windows on most compilers 26 | #define WIN32_LEAN_AND_MEAN 27 | #include 28 | #include 29 | #include 30 | 31 | -------------------------------------------------------------------------------- /NifExport/DllEntry.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | #include "niutils.h" 3 | 4 | extern ClassDesc2* GetNifExportDesc(); 5 | extern ClassDesc2* GetKfExportDesc(); 6 | 7 | static void InitializeLibSettings(); 8 | HINSTANCE hInstance; 9 | int controlsInit = FALSE; 10 | int libVersion = VERSION_3DSMAX; 11 | 12 | // This function is called by Windows when the DLL is loaded. This 13 | // function may also be called many times during time critical operations 14 | // like rendering. Therefore developers need to be careful what they 15 | // do inside this function. In the code below, note how after the DLL is 16 | // loaded the first time only a few statements are executed. 17 | 18 | BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) 19 | { 20 | hInstance = hinstDLL; // Hang on to this DLL's instance handle. 21 | 22 | if (!controlsInit) { 23 | controlsInit = TRUE; 24 | InitCustomControls(hInstance); // Initialize MAX's custom controls 25 | InitCommonControls(); // Initialize Win95 controls 26 | } 27 | if (fdwReason == DLL_PROCESS_ATTACH) 28 | InitializeLibSettings(); 29 | return (TRUE); 30 | } 31 | 32 | void InitializeLibSettings() 33 | { 34 | Interface *gi = GetCOREInterface(); 35 | TCHAR iniName[MAX_PATH]; 36 | if (gi) { 37 | LPCTSTR pluginDir = gi->GetDir(APP_PLUGCFG_DIR); 38 | PathCombine(iniName, pluginDir, "MaxNifTools.ini"); 39 | } else { 40 | GetModuleFileName(NULL, iniName, _countof(iniName)); 41 | if (LPTSTR fname = PathFindFileName(iniName)) 42 | fname = NULL; 43 | PathAddBackslash(iniName); 44 | PathAppend(iniName, "plugcfg"); 45 | PathAppend(iniName, "MaxNifTools.ini"); 46 | } 47 | libVersion = GetIniValue("MaxNifExport", "MaxSDKVersion", libVersion, iniName); 48 | if (libVersion == 0) 49 | libVersion = VERSION_3DSMAX; 50 | } 51 | 52 | // This function returns a string that describes the DLL and where the user 53 | // could purchase the DLL if they don't have it. 54 | __declspec( dllexport ) const TCHAR* LibDescription() 55 | { 56 | return GetString(IDS_LIBDESCRIPTION); 57 | } 58 | 59 | // This function returns the number of plug-in classes this DLL 60 | //TODO: Must change this number when adding a new class 61 | __declspec( dllexport ) int LibNumberClasses() 62 | { 63 | return 1; 64 | } 65 | 66 | // This function returns the number of plug-in classes this DLL 67 | __declspec( dllexport ) ClassDesc* LibClassDesc(int i) 68 | { 69 | switch(i) { 70 | case 0: return GetNifExportDesc(); 71 | case 1: return GetKfExportDesc(); 72 | default: return 0; 73 | } 74 | } 75 | 76 | // This function returns a pre-defined constant indicating the version of 77 | // the system under which it was compiled. It is used to allow the system 78 | // to catch obsolete DLLs. 79 | __declspec( dllexport ) ULONG LibVersion() 80 | { 81 | return libVersion; 82 | } 83 | 84 | TCHAR *GetString(int id) 85 | { 86 | static TCHAR buf[256]; 87 | 88 | if (hInstance) 89 | return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; 90 | return NULL; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /NifExport/NifExport.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | LibDescription @1 3 | LibNumberClasses @2 4 | LibClassDesc @3 5 | LibVersion @4 6 | SECTIONS 7 | .data READ WRITE 8 | -------------------------------------------------------------------------------- /NifExport/NifExport.h: -------------------------------------------------------------------------------- 1 | #ifndef __NIFEXPORT__H 2 | #define __NIFEXPORT__H 3 | 4 | extern TCHAR *GetString(int id); 5 | 6 | extern HINSTANCE hInstance; 7 | 8 | #endif 9 | -------------------------------------------------------------------------------- /NifExport/NifExport.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 7.00 2 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NifExport", "NifExport.vcproj", "{E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}" 3 | EndProject 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "niflib", "niflib\niflib.vcproj", "{3654B4B3-0B58-4C0A-8915-18A388C4A4DF}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfiguration) = preSolution 8 | ConfigName.0 = Debug 9 | ConfigName.1 = Hybrid 10 | ConfigName.2 = Release 11 | EndGlobalSection 12 | GlobalSection(ProjectDependencies) = postSolution 13 | EndGlobalSection 14 | GlobalSection(ProjectConfiguration) = postSolution 15 | {E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Debug.ActiveCfg = Debug|Win32 16 | {E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Debug.Build.0 = Debug|Win32 17 | {E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Hybrid.ActiveCfg = Hybrid|Win32 18 | {E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Hybrid.Build.0 = Hybrid|Win32 19 | {E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Release.ActiveCfg = Release|Win32 20 | {E7CB76AA-6113-46BA-8EBC-8AE1D2B81210}.Release.Build.0 = Release|Win32 21 | {3654B4B3-0B58-4C0A-8915-18A388C4A4DF}.Debug.ActiveCfg = Debug|Win32 22 | {3654B4B3-0B58-4C0A-8915-18A388C4A4DF}.Debug.Build.0 = Debug|Win32 23 | {3654B4B3-0B58-4C0A-8915-18A388C4A4DF}.Hybrid.ActiveCfg = Release|Win32 24 | {3654B4B3-0B58-4C0A-8915-18A388C4A4DF}.Hybrid.Build.0 = Release|Win32 25 | {3654B4B3-0B58-4C0A-8915-18A388C4A4DF}.Release.ActiveCfg = Release|Win32 26 | {3654B4B3-0B58-4C0A-8915-18A388C4A4DF}.Release.Build.0 = Release|Win32 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | EndGlobalSection 30 | GlobalSection(ExtensibilityAddIns) = postSolution 31 | EndGlobalSection 32 | EndGlobal 33 | -------------------------------------------------------------------------------- /NifExport/NvTriStrip/NvTriStrip.h: -------------------------------------------------------------------------------- 1 | #ifndef NVTRISTRIP_H 2 | #define NVTRISTRIP_H 3 | 4 | #ifndef NULL 5 | #define NULL 0 6 | #endif 7 | 8 | namespace NvTriStrip { 9 | 10 | //////////////////////////////////////////////////////////////////////////////////////// 11 | // Public interface for stripifier 12 | //////////////////////////////////////////////////////////////////////////////////////// 13 | 14 | //GeForce1 and 2 cache size 15 | #define CACHESIZE_GEFORCE1_2 16 16 | 17 | //GeForce3 cache size 18 | #define CACHESIZE_GEFORCE3 24 19 | 20 | enum PrimType 21 | { 22 | PT_LIST, 23 | PT_STRIP, 24 | PT_FAN 25 | }; 26 | 27 | struct PrimitiveGroup 28 | { 29 | PrimType type; 30 | unsigned int numIndices; 31 | unsigned short* indices; 32 | 33 | //////////////////////////////////////////////////////////////////////////////////////// 34 | 35 | PrimitiveGroup() : type(PT_STRIP), numIndices(0), indices(NULL) {} 36 | ~PrimitiveGroup() 37 | { 38 | if(indices) 39 | delete[] indices; 40 | indices = NULL; 41 | } 42 | }; 43 | 44 | 45 | //////////////////////////////////////////////////////////////////////////////////////// 46 | // EnableRestart() 47 | // 48 | // For GPUs that support primitive restart, this sets a value as the restart index 49 | // 50 | // Restart is meaningless if strips are not being stitched together, so enabling restart 51 | // makes NvTriStrip forcing stitching. So, you'll get back one strip. 52 | // 53 | // Default value: disabled 54 | // 55 | void EnableRestart(const unsigned int restartVal); 56 | 57 | //////////////////////////////////////////////////////////////////////////////////////// 58 | // DisableRestart() 59 | // 60 | // For GPUs that support primitive restart, this disables using primitive restart 61 | // 62 | void DisableRestart(); 63 | 64 | 65 | //////////////////////////////////////////////////////////////////////////////////////// 66 | // SetCacheSize() 67 | // 68 | // Sets the cache size which the stripfier uses to optimize the data. 69 | // Controls the length of the generated individual strips. 70 | // This is the "actual" cache size, so 24 for GeForce3 and 16 for GeForce1/2 71 | // You may want to play around with this number to tweak performance. 72 | // 73 | // Default value: 16 74 | // 75 | void SetCacheSize(const unsigned int cacheSize); 76 | 77 | 78 | //////////////////////////////////////////////////////////////////////////////////////// 79 | // SetStitchStrips() 80 | // 81 | // bool to indicate whether to stitch together strips into one huge strip or not. 82 | // If set to true, you'll get back one huge strip stitched together using degenerate 83 | // triangles. 84 | // If set to false, you'll get back a large number of separate strips. 85 | // 86 | // Default value: true 87 | // 88 | void SetStitchStrips(const bool bStitchStrips); 89 | 90 | 91 | //////////////////////////////////////////////////////////////////////////////////////// 92 | // SetMinStripSize() 93 | // 94 | // Sets the minimum acceptable size for a strip, in triangles. 95 | // All strips generated which are shorter than this will be thrown into one big, separate list. 96 | // 97 | // Default value: 0 98 | // 99 | void SetMinStripSize(const unsigned int minSize); 100 | 101 | 102 | //////////////////////////////////////////////////////////////////////////////////////// 103 | // SetListsOnly() 104 | // 105 | // If set to true, will return an optimized list, with no strips at all. 106 | // 107 | // Default value: false 108 | // 109 | void SetListsOnly(const bool bListsOnly); 110 | 111 | 112 | //////////////////////////////////////////////////////////////////////////////////////// 113 | // GenerateStrips() 114 | // 115 | // in_indices: input index list, the indices you would use to render 116 | // in_numIndices: number of entries in in_indices 117 | // primGroups: array of optimized/stripified PrimitiveGroups 118 | // numGroups: number of groups returned 119 | // 120 | // Be sure to call delete[] on the returned primGroups to avoid leaking mem 121 | // 122 | bool GenerateStrips(const unsigned short* in_indices, const unsigned int in_numIndices, 123 | PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled = false); 124 | 125 | 126 | //////////////////////////////////////////////////////////////////////////////////////// 127 | // RemapIndices() 128 | // 129 | // Function to remap your indices to improve spatial locality in your vertex buffer. 130 | // 131 | // in_primGroups: array of PrimitiveGroups you want remapped 132 | // numGroups: number of entries in in_primGroups 133 | // numVerts: number of vertices in your vertex buffer, also can be thought of as the range 134 | // of acceptable values for indices in your primitive groups. 135 | // remappedGroups: array of remapped PrimitiveGroups 136 | // 137 | // Note that, according to the remapping handed back to you, you must reorder your 138 | // vertex buffer. 139 | // 140 | // Credit goes to the MS Xbox crew for the idea for this interface. 141 | // 142 | void RemapIndices(const PrimitiveGroup* in_primGroups, const unsigned short numGroups, 143 | const unsigned short numVerts, PrimitiveGroup** remappedGroups); 144 | 145 | } //End namespace 146 | 147 | #endif -------------------------------------------------------------------------------- /NifExport/NvTriStrip/VertexCache.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include "VertexCache.h" 4 | using namespace NvTriStrip; 5 | 6 | VertexCache::VertexCache() 7 | { 8 | VertexCache(16); 9 | } 10 | 11 | 12 | VertexCache::VertexCache(int size) 13 | { 14 | numEntries = size; 15 | 16 | entries = new int[numEntries]; 17 | 18 | for(int i = 0; i < numEntries; i++) 19 | entries[i] = -1; 20 | } 21 | 22 | 23 | VertexCache::~VertexCache() 24 | { 25 | delete[] entries; 26 | } 27 | 28 | 29 | int VertexCache::At(int index) 30 | { 31 | return entries[index]; 32 | } 33 | 34 | 35 | void VertexCache::Set(int index, int value) 36 | { 37 | entries[index] = value; 38 | } 39 | 40 | 41 | void VertexCache::Clear() 42 | { 43 | for(int i = 0; i < numEntries; i++) 44 | entries[i] = -1; 45 | } 46 | 47 | void VertexCache::Copy(VertexCache* inVcache) 48 | { 49 | for(int i = 0; i < numEntries; i++) 50 | { 51 | inVcache->Set(i, entries[i]); 52 | } 53 | } 54 | 55 | bool VertexCache::InCache(int entry) 56 | { 57 | bool returnVal = false; 58 | 59 | for(int i = 0; i < numEntries; i++) 60 | { 61 | if(entries[i] == entry) 62 | { 63 | returnVal = true; 64 | break; 65 | } 66 | } 67 | 68 | return returnVal; 69 | } 70 | 71 | 72 | int VertexCache::AddEntry(int entry) 73 | { 74 | int removed; 75 | 76 | removed = entries[numEntries - 1]; 77 | 78 | //push everything right one 79 | for(int i = numEntries - 2; i >= 0; i--) 80 | { 81 | entries[i + 1] = entries[i]; 82 | } 83 | 84 | entries[0] = entry; 85 | 86 | return removed; 87 | } 88 | -------------------------------------------------------------------------------- /NifExport/NvTriStrip/VertexCache.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef VERTEX_CACHE_H 3 | 4 | #define VERTEX_CACHE_H 5 | 6 | namespace NvTriStrip { 7 | 8 | class VertexCache 9 | { 10 | 11 | public: 12 | VertexCache(int size); 13 | VertexCache(); 14 | ~VertexCache(); 15 | bool InCache(int entry); 16 | int AddEntry(int entry); 17 | void Clear(); 18 | void Copy(VertexCache* inVcache) ; 19 | int At(int index); 20 | void Set(int index, int value); 21 | 22 | private: 23 | 24 | int *entries; 25 | int numEntries; 26 | 27 | }; 28 | 29 | } //End namespace 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /NifExport/Strips.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | 3 | #include "NvTriStrip/NvTriStrip.h" 4 | using namespace NvTriStrip; 5 | /* 6 | using namespace triangle_stripper; 7 | 8 | void Exporter::strippify(TriStrips &strips, vector &verts, vector &norms, const Triangles &tris) 9 | { 10 | vector idcs(tris.size()*3); 11 | int i; 12 | for (i=0; i0)?(size-1):0; j 0) 54 | { 55 | strip.push_back(strips.back()[strips.back().size()-1]); 56 | strip.push_back(stris[0][0]); 57 | } 58 | for (i=0; i 0) 61 | { 62 | strip.push_back(stris[i][0]); 63 | strip.push_back(stris[i][0]); 64 | } 65 | 66 | strip.push_back(stris[i][0]); 67 | strip.push_back(stris[i][1]); 68 | strip.push_back(stris[i][2]); 69 | if (i < stris.size()-1) 70 | strip.push_back(stris[i][2]); 71 | } 72 | strips.push_back(strip); 73 | } 74 | } 75 | */ 76 | void Exporter::strippify(FaceGroup &grp) 77 | { 78 | TriStrips &strips = grp.strips; 79 | strips.clear(); 80 | unsigned short *data = (unsigned short *)malloc(grp.faces.size() * 3 * 2); 81 | 82 | unsigned int i; 83 | for (i=0; i 0) 141 | grp.uvs[a] = tmp.uvs[b]; 142 | if (grp.vcolors.size() > 0) 143 | grp.vcolors[a] = tmp.vcolors[b]; 144 | } 145 | } 146 | } 147 | delete [] rmGroups; 148 | } 149 | delete [] groups; 150 | } 151 | 152 | NiTriStripsDataRef Exporter::makeTriStripsData(const TriStrips &strips) 153 | { 154 | NiTriStripsDataRef stripData = new NiTriStripsData(); 155 | 156 | if (strips.size() > 0) 157 | { 158 | stripData->SetStripCount(strips.size()); 159 | 160 | int i = 0; 161 | TriStrips::const_iterator it; 162 | for (it=strips.begin(); it!=strips.end(); ++it) 163 | stripData->SetStrip(i++, *it); 164 | } 165 | 166 | return stripData; 167 | } 168 | -------------------------------------------------------------------------------- /NifExport/pch.cpp: -------------------------------------------------------------------------------- 1 | // Dummy file for creating precompiled headers 2 | // The project contains the linke /FI"$(ProjectDir)pch.h" which automatically adds 3 | // the header to the top of the file. 4 | #include "pch.h" -------------------------------------------------------------------------------- /NifExport/pch.h: -------------------------------------------------------------------------------- 1 | #pragma warning( disable:4800 ) 2 | 3 | #include "resource.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #include "Max.h" 13 | #include "resource.h" 14 | #include "istdplug.h" 15 | #include "iparamb2.h" 16 | #include "iparamm2.h" 17 | #include "objectParams.h" 18 | #undef ALPHA_NONE 19 | 20 | #ifndef BIPSLAVE_CONTROL_CLASS_ID 21 | #define BIPSLAVE_CONTROL_CLASS_ID Class_ID(0x9154,0) 22 | #endif 23 | // this is the class for the center of mass, biped root controller ("Bip01") 24 | #ifndef BIPBODY_CONTROL_CLASS_ID 25 | #define BIPBODY_CONTROL_CLASS_ID Class_ID(0x9156,0) 26 | #endif 27 | // this is the class for the biped footstep controller ("Bip01 Footsteps") 28 | #ifndef FOOTPRINT_CLASS_ID 29 | #define FOOTPRINT_CLASS_ID Class_ID(0x3011,0) 30 | #endif 31 | // this is the class for biped geometric objects 32 | #ifdef SKELOBJ_CLASS_ID 33 | #define SKELOBJ_CLASS_ID Class_ID(0x9125, 0) 34 | #endif 35 | // this is the class for the biped master controller 36 | #ifdef BIPED_CLASS_ID 37 | #define BIPED_CLASS_ID Class_ID(0x9155, 0) 38 | #endif 39 | 40 | // niflib/Ref.h' header guard caused havok! 41 | // near & far 42 | //#include "niflib/pch.h" 43 | #include "niflib.h" 44 | #include "obj/NiNode.h" 45 | #include "obj/NiTriStrips.h" 46 | #include "obj/NiTriStripsData.h" 47 | #include "obj/NiTriShape.h" 48 | #include "obj/NiTriShapeData.h" 49 | #include "obj/bhkCollisionObject.h" 50 | #include "obj/bhkRigidBody.h" 51 | #include "obj/bhkNiTriStripsShape.h" 52 | #include "obj/bhkBoxShape.h" 53 | #include "obj/bhkSphereShape.h" 54 | #include "obj/bhkCapsuleShape.h" 55 | #include "obj/NiMaterialProperty.h" 56 | #include "obj/NiTexturingProperty.h" 57 | #include "obj/NiSourceTexture.h" 58 | #include "obj/BsxFlags.h" 59 | #include "obj/NiStringExtraData.h" 60 | #include "obj/bhkRigidBodyT.h" 61 | 62 | // undef macros for tristripper 63 | //#undef max 64 | //#undef min 65 | #include "../NvTriStrip/NvTriStrip.h" 66 | //#include "TriStripper/detail/types.h" 67 | //#include "TriStripper/detail/policy.h" 68 | //#include "TriStripper/detail/cache_simulator.h" 69 | //#include "TriStripper/tri_stripper.h" 70 | 71 | #include "NifPlugins.h" 72 | #include "Exporter.h" 73 | #include "NifExport.h" 74 | 75 | #if VERSION_3DSMAX >= (14000<<16) // Version 14 (2012) 76 | #define SDK_RESERVED_METHOD(a) 77 | #endif 78 | 79 | #include "niutils.h" 80 | #include 81 | -------------------------------------------------------------------------------- /NifExport/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by NifExport.rc 4 | // 5 | #define IDC_CLOSEBUTTON 13000 6 | #define IDC_DOSTUFF 13000 7 | #define IDS_LIBDESCRIPTION 13001 8 | #define IDD_PANEL 13001 9 | #define IDD_NIF_PANEL 13001 10 | #define IDS_CATEGORY 13002 11 | #define IDD_KF_PANEL 13002 12 | #define IDS_CLASS_NAME 13003 13 | #define IDS_NIF_CLASS_NAME 13003 14 | #define IDC_CHK_HIDDEN 13003 15 | #define IDS_PARAMS 13004 16 | #define IDC_CHK_STRIPS 13004 17 | #define IDS_SPIN 13005 18 | #define IDC_CHK_FURN 13005 19 | #define IDS_KF_CLASS_NAME 13006 20 | #define IDC_ED_TEXPREFIX 13006 21 | #define IDC_CHK_LIGHTS 13007 22 | #define IDC_ED_WELDTHRESH 13008 23 | #define IDC_CHK_STRIPS2 13008 24 | #define IDC_CHK_PARTSTRIPS 13008 25 | #define IDC_LBL_WELDTHRESH 13009 26 | #define IDC_CHK_COLL 13010 27 | #define IDC_ED_PRIORITY 13010 28 | #define IDC_LBL_LINK 13011 29 | #define IDC_CHK_VCOLORS 13012 30 | #define IDC_LBL_PRIORITY 13012 31 | #define IDC_CHK_REMAP 13013 32 | #define IDC_CB_GAME 13014 33 | #define IDC_CB_VERSION 13015 34 | #define IDC_CB_USER_VERSION 13016 35 | #define IDC_CHK_SKIN 13017 36 | #define IDC_CHK_ANIMATION 13018 37 | #define IDC_LBL_PRIORITY2 13018 38 | #define IDC_CHK_EXTRA 13019 39 | #define IDC_CHK_UPB 13020 40 | #define IDC_CHK_HIER 13021 41 | #define IDC_CHK_REM_BONES 13022 42 | #define IDC_CHK_SORTNODES 13023 43 | #define IDC_CHK_SKEL_ONLY 13024 44 | #define IDC_CHK_CAMERA 13025 45 | #define IDC_CHK_SKEL_ONLY2 13026 46 | #define IDC_CHK_BONE_COLL 13026 47 | #define IDC_CHK_TRANSFORMS 13026 48 | #define IDC_CHK_TRANSFORMS2 13027 49 | #define IDC_GRP_ANIMATION 13028 50 | #define IDC_ED_PRIORITY2 13029 51 | #define IDC_CBO_ACCUM 13030 52 | #define IDC_CHK_USE_TIME_TAGS 13030 53 | #define IDC_CBO_ANIM_TYPE 13031 54 | #define IDC_CHECK1 13032 55 | #define IDC_CHK_AUTO_DETECT 13032 56 | #define IDC_CHK_SORTNODES2 13033 57 | #define IDC_CHK_ALLOW_ACCUM 13033 58 | #define IDC_LBL_BONES_VERTEX 13034 59 | #define IDC_ED_BONES_VERTEX 13035 60 | #define IDC_LBL_BONES_PART 13036 61 | #define IDC_ED_BONES_PART 13037 62 | #define IDC_CHK_SKINPART 13038 63 | #define IDC_CB_USER_VERSION2 13039 64 | #define IDC_CHK_START_NIFSKOPE 13040 65 | #define IDC_LBL_BONES_VERTEX2 13041 66 | #define IDC_ED_WELDTHRESH2 13042 67 | #define IDC_CBO_ROOT_TYPE 13044 68 | #define IDC_LBL_ROOT_TYPE 13045 69 | #define IDC_COLOR 13456 70 | #define IDC_EDIT 13490 71 | #define IDC_SPIN 13496 72 | #define IDC_LBL_WIKI 13497 73 | #define IDC_CHK_TANGENTS 13498 74 | #define IDC_CHECK2 13499 75 | #define IDC_CHK_COLLAPSE_TRANS 13499 76 | #define IDC_CHK_COLLAPSE_TRANS2 13500 77 | #define IDC_CHK_ZERO_TRANS 13500 78 | 79 | // Next default values for new objects 80 | // 81 | #ifdef APSTUDIO_INVOKED 82 | #ifndef APSTUDIO_READONLY_SYMBOLS 83 | #define _APS_NEXT_RESOURCE_VALUE 103 84 | #define _APS_NEXT_COMMAND_VALUE 40001 85 | #define _APS_NEXT_CONTROL_VALUE 13500 86 | #define _APS_NEXT_SYMED_VALUE 101 87 | #endif 88 | #endif 89 | -------------------------------------------------------------------------------- /NifFurniture/DllEntry.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: DllEntry.cpp 4 | 5 | DESCRIPTION: Contains the Dll Entry stuff 6 | 7 | CREATED BY: 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2003, All Rights Reserved. 12 | **********************************************************************/ 13 | #include "NifFurniture.h" 14 | 15 | extern ClassDesc2* GetNifFurnitureDesc(); 16 | 17 | HINSTANCE hInstance; 18 | int controlsInit = FALSE; 19 | 20 | // This function is called by Windows when the DLL is loaded. This 21 | // function may also be called many times during time critical operations 22 | // like rendering. Therefore developers need to be careful what they 23 | // do inside this function. In the code below, note how after the DLL is 24 | // loaded the first time only a few statements are executed. 25 | 26 | BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) 27 | { 28 | hInstance = hinstDLL; // Hang on to this DLL's instance handle. 29 | 30 | if (!controlsInit) { 31 | controlsInit = TRUE; 32 | InitCustomControls(hInstance); // Initialize MAX's custom controls 33 | InitCommonControls(); // Initialize Win95 controls 34 | } 35 | 36 | return (TRUE); 37 | } 38 | 39 | // This function returns a string that describes the DLL and where the user 40 | // could purchase the DLL if they don't have it. 41 | __declspec( dllexport ) const TCHAR* LibDescription() 42 | { 43 | return GetString(IDS_LIBDESCRIPTION); 44 | } 45 | 46 | // This function returns the number of plug-in classes this DLL 47 | //TODO: Must change this number when adding a new class 48 | __declspec( dllexport ) int LibNumberClasses() 49 | { 50 | return 1; 51 | } 52 | 53 | // This function returns the number of plug-in classes this DLL 54 | __declspec( dllexport ) ClassDesc* LibClassDesc(int i) 55 | { 56 | switch(i) { 57 | case 0: return GetNifFurnitureDesc(); 58 | default: return 0; 59 | } 60 | } 61 | 62 | // This function returns a pre-defined constant indicating the version of 63 | // the system under which it was compiled. It is used to allow the system 64 | // to catch obsolete DLLs. 65 | __declspec( dllexport ) ULONG LibVersion() 66 | { 67 | return VERSION_3DSMAX; 68 | } 69 | 70 | TCHAR *GetString(int id) 71 | { 72 | static TCHAR buf[256]; 73 | 74 | if (hInstance) 75 | return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; 76 | return NULL; 77 | } 78 | 79 | -------------------------------------------------------------------------------- /NifFurniture/NifFurniture.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | LibDescription @1 3 | LibNumberClasses @2 4 | LibClassDesc @3 5 | LibVersion @4 6 | SECTIONS 7 | .data READ WRITE 8 | -------------------------------------------------------------------------------- /NifFurniture/NifFurniture.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: NifFurniture.h 4 | 5 | DESCRIPTION: Includes for Plugins 6 | 7 | CREATED BY: 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2003, All Rights Reserved. 12 | **********************************************************************/ 13 | 14 | #ifndef __NifFurniture__H 15 | #define __NifFurniture__H 16 | 17 | #include "Max.h" 18 | #include "resource.h" 19 | #include "istdplug.h" 20 | #include "iparamb2.h" 21 | #include "iparamm2.h" 22 | //SIMPLE TYPE 23 | 24 | 25 | 26 | extern TCHAR *GetString(int id); 27 | 28 | extern HINSTANCE hInstance; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /NifFurniture/NifFurniture.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | #ifndef NIFPLUGINS 13 | #define DLLNAME "NifFurniture.dlu" // DLL Name 14 | #define DLLDESCRIPTION "3ds Max Nif Furniture Plugin" 15 | #include "..\nifcommon\nifversion.rc" 16 | #endif 17 | 18 | ///////////////////////////////////////////////////////////////////////////// 19 | #undef APSTUDIO_READONLY_SYMBOLS 20 | 21 | ///////////////////////////////////////////////////////////////////////////// 22 | // German (Germany) resources 23 | 24 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU) 25 | #ifdef _WIN32 26 | LANGUAGE LANG_GERMAN, SUBLANG_GERMAN 27 | #pragma code_page(1252) 28 | #endif //_WIN32 29 | 30 | #ifdef APSTUDIO_INVOKED 31 | ///////////////////////////////////////////////////////////////////////////// 32 | // 33 | // TEXTINCLUDE 34 | // 35 | 36 | 3 TEXTINCLUDE 37 | BEGIN 38 | "\r\0" 39 | END 40 | 41 | #endif // APSTUDIO_INVOKED 42 | 43 | #endif // German (Germany) resources 44 | ///////////////////////////////////////////////////////////////////////////// 45 | 46 | 47 | ///////////////////////////////////////////////////////////////////////////// 48 | // English (U.S.) resources 49 | 50 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 51 | #ifdef _WIN32 52 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 53 | #pragma code_page(1252) 54 | #endif //_WIN32 55 | 56 | #ifdef APSTUDIO_INVOKED 57 | ///////////////////////////////////////////////////////////////////////////// 58 | // 59 | // TEXTINCLUDE 60 | // 61 | 62 | 1 TEXTINCLUDE 63 | BEGIN 64 | "resource.h\0" 65 | END 66 | 67 | 2 TEXTINCLUDE 68 | BEGIN 69 | "#include ""winres.h""\r\n" 70 | "\r\n" 71 | "#ifndef NIFPLUGINS\r\n" 72 | "#define DLLNAME ""NifFurniture.dlu"" // DLL Name\r\n" 73 | "#define DLLDESCRIPTION ""3ds Max Nif Furniture Plugin""\r\n" 74 | "#include ""..\\nifcommon\\nifversion.rc"" \r\n" 75 | "#endif\r\0" 76 | END 77 | 78 | #endif // APSTUDIO_INVOKED 79 | 80 | 81 | ///////////////////////////////////////////////////////////////////////////// 82 | // 83 | // Dialog 84 | // 85 | 86 | IDD_PANEL DIALOGEX 0, 0, 108, 38 87 | STYLE DS_SETFONT | WS_CHILD | WS_VISIBLE 88 | FONT 8, "MS Sans Serif", 0, 0, 0x0 89 | BEGIN 90 | COMBOBOX IDC_CB_TYPE,6,18,96,60,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP 91 | LTEXT "Type",IDC_STATIC,6,6,17,8 92 | END 93 | 94 | 95 | ///////////////////////////////////////////////////////////////////////////// 96 | // 97 | // DESIGNINFO 98 | // 99 | 100 | #ifdef APSTUDIO_INVOKED 101 | GUIDELINES DESIGNINFO 102 | BEGIN 103 | IDD_PANEL, DIALOG 104 | BEGIN 105 | LEFTMARGIN, 7 106 | RIGHTMARGIN, 101 107 | TOPMARGIN, 7 108 | BOTTOMMARGIN, 31 109 | END 110 | END 111 | #endif // APSTUDIO_INVOKED 112 | 113 | 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // String Table 117 | // 118 | 119 | STRINGTABLE 120 | BEGIN 121 | IDS_LIBDESCRIPTION "Allow placting of furniture markers used in Oblivion." 122 | IDS_CATEGORY "NifTools" 123 | IDS_CLASS_NAME "NifFurniture" 124 | IDS_PARAMS "Parameters" 125 | IDS_SPIN "Spin" 126 | IDS_FURNITURE_MARKER "Furniture Marker" 127 | END 128 | 129 | #endif // English (U.S.) resources 130 | ///////////////////////////////////////////////////////////////////////////// 131 | 132 | 133 | 134 | #ifndef APSTUDIO_INVOKED 135 | ///////////////////////////////////////////////////////////////////////////// 136 | // 137 | // Generated from the TEXTINCLUDE 3 resource. 138 | // 139 | 140 | 141 | ///////////////////////////////////////////////////////////////////////////// 142 | #endif // not APSTUDIO_INVOKED 143 | 144 | -------------------------------------------------------------------------------- /NifFurniture/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by NifFurniture.rc 4 | // 5 | #define IDC_CLOSEBUTTON 12000 6 | #define IDC_DOSTUFF 12000 7 | #define IDS_LIBDESCRIPTION 12001 8 | #define IDD_PANEL 12001 9 | #define IDC_CB_TYPE 12001 10 | #define IDS_CATEGORY 12002 11 | #define IDS_CLASS_NAME 12003 12 | #define IDS_PARAMS 12004 13 | #define IDS_SPIN 12005 14 | #define IDS_FURNITURE_MARKER 12006 15 | #define IDC_COLOR 12456 16 | #define IDC_EDIT 12490 17 | #define IDC_EDIT2 12491 18 | #define IDC_SPIN 12496 19 | 20 | // Next default values for new objects 21 | // 22 | #ifdef APSTUDIO_INVOKED 23 | #ifndef APSTUDIO_READONLY_SYMBOLS 24 | #define _APS_NEXT_RESOURCE_VALUE 102 25 | #define _APS_NEXT_COMMAND_VALUE 40001 26 | #define _APS_NEXT_CONTROL_VALUE 1002 27 | #define _APS_NEXT_SYMED_VALUE 101 28 | #endif 29 | #endif 30 | -------------------------------------------------------------------------------- /NifImport/BaseImporter.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: BaseImporter.h 4 | 5 | DESCRIPTION: Base Importer class 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2006, All Rights Reserved. 12 | **********************************************************************/ 13 | 14 | #ifndef __BASEIMPORTER_H__ 15 | #define __BASEIMPORTER_H__ 16 | 17 | class IBipMaster; 18 | 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); 19 | extern IBipMaster * (_cdecl * Max7CreateNewBiped)(float,float,class Point3 const &,int,int,int,int,int,int,int,int,int,int,int,int,float,int,int,int,int); 20 | 21 | // Importer Base 22 | class BaseImporter 23 | { 24 | public: 25 | string name; 26 | string path; 27 | ImpInterface *i; 28 | Interface *gi; 29 | BOOL suppressPrompts; 30 | bool iniFileValid; 31 | string iniFileName; 32 | AppSettings *appSettings; 33 | TSTR webSite; 34 | TSTR wikiSite; 35 | int nifVersion; 36 | int userVersion; 37 | 38 | bool hasErrors; 39 | string errorMsg; 40 | 41 | Niflib::NiObjectRef root; 42 | 43 | BaseImporter(){} 44 | 45 | void BaseInit(const TCHAR *Name,ImpInterface *I,Interface *GI, BOOL SuppressPrompts) 46 | { 47 | name = Name; 48 | i=I; 49 | gi=GI; 50 | suppressPrompts = SuppressPrompts; 51 | 52 | char buffer[MAX_PATH] = {0}, *p = NULL; 53 | GetFullPathName(Name, _countof(buffer), buffer, &p); 54 | 55 | if (-1 == _access(buffer, 0)) { 56 | throw RuntimeError(FormatText("File does not exist: %s", buffer)); 57 | } 58 | 59 | if (p) *p = 0; 60 | path = buffer; 61 | iniFileValid = false; 62 | 63 | HMODULE hBiped = GetModuleHandle("biped.dlc"); 64 | if (NULL != hBiped) 65 | { 66 | if (0 == Max8CreateNewBiped && 0 == Max7CreateNewBiped){ 67 | LPCTSTR Max8CreateNewBipedName = TEXT("?CreateNewBiped@@YAPAVIBipMaster@@MMABVPoint3@@HHHHHHHHHHHHMHHHHHHHH@Z"); 68 | *(FARPROC*)&Max8CreateNewBiped = GetProcAddress(hBiped, Max8CreateNewBipedName); 69 | } 70 | if (0 == Max8CreateNewBiped && 0 == Max7CreateNewBiped) { 71 | LPCTSTR Max7CreateNewBipedName = TEXT("?CreateNewBiped@@YAPAVIBipMaster@@MMABVPoint3@@HHHHHHHHHHHHMHHHH@Z"); 72 | *(FARPROC*)&Max7CreateNewBiped = GetProcAddress(hBiped, Max7CreateNewBipedName); 73 | } 74 | } 75 | 76 | webSite = GetIniValue("System", "Website", "http://niftools.sourceforge.net"); 77 | wikiSite = GetIniValue("System", "Wiki", "http://niftools.sourceforge.net/wiki/3ds_Max"); 78 | 79 | nifVersion = Niflib::GetNifVersion(this->name); 80 | 81 | hasErrors = false; 82 | 83 | // Load ini settings 84 | iniFileValid = false; 85 | LoadIniSettings(); 86 | 87 | ReadBlocks(); 88 | 89 | Initialize(); 90 | } 91 | 92 | virtual void LoadIniSettings() = 0; 93 | virtual void ReadBlocks() = 0; 94 | virtual void Initialize() = 0; 95 | 96 | virtual bool isValid() const { return (NULL != root); } 97 | 98 | // Generic IniFile reading routine 99 | template 100 | T GetIniValue(LPCTSTR Section, LPCTSTR Setting, T Default){ 101 | if (!iniFileValid) 102 | return Default; 103 | return ::GetIniValue(Section, Setting, Default, iniFileName.c_str()); 104 | } 105 | // Generic IniFile reading routine 106 | template 107 | void SetIniValue(LPCTSTR Section, LPCTSTR Setting, T value){ 108 | if (!iniFileValid) 109 | return; 110 | ::SetIniValue(Section, Setting, value, iniFileName.c_str()); 111 | } 112 | }; 113 | 114 | extern void GoToSkeletonBindPosition(std::vector& blocks); 115 | 116 | #endif 117 | -------------------------------------------------------------------------------- /NifImport/DllEntry.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: DllEntry.cpp 4 | 5 | DESCRIPTION: Contains the Dll Entry stuff 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2006, All Rights Reserved. 12 | **********************************************************************/ 13 | #include "stdafx.h" 14 | #include "MaxNifImport.h" 15 | 16 | extern ClassDesc2* GetMaxNifImportDesc(); 17 | static void InitializeLibSettings(); 18 | 19 | HINSTANCE hInstance; 20 | int controlsInit = FALSE; 21 | int libVersion = VERSION_3DSMAX; 22 | 23 | // This function is called by Windows when the DLL is loaded. This 24 | // function may also be called many times during time critical operations 25 | // like rendering. Therefore developers need to be careful what they 26 | // do inside this function. In the code below, note how after the DLL is 27 | // loaded the first time only a few statements are executed. 28 | 29 | BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) 30 | { 31 | hInstance = hinstDLL; // Hang on to this DLL's instance handle. 32 | 33 | if (!controlsInit) { 34 | controlsInit = TRUE; 35 | InitCustomControls(hInstance); // Initialize MAX's custom controls 36 | InitCommonControls(); // Initialize Win95 controls 37 | } 38 | if (fdwReason == DLL_PROCESS_ATTACH) 39 | InitializeLibSettings(); 40 | 41 | return (TRUE); 42 | } 43 | 44 | void InitializeLibSettings() 45 | { 46 | Interface *gi = GetCOREInterface(); 47 | TCHAR iniName[MAX_PATH]; 48 | if (gi) { 49 | LPCTSTR pluginDir = gi->GetDir(APP_PLUGCFG_DIR); 50 | PathCombine(iniName, pluginDir, "MaxNifTools.ini"); 51 | } else { 52 | GetModuleFileName(NULL, iniName, _countof(iniName)); 53 | if (LPTSTR fname = PathFindFileName(iniName)) 54 | fname = NULL; 55 | PathAddBackslash(iniName); 56 | PathAppend(iniName, "plugcfg"); 57 | PathAppend(iniName, "MaxNifTools.ini"); 58 | } 59 | libVersion = GetIniValue("MaxNifImport", "MaxSDKVersion", libVersion, iniName); 60 | if (libVersion == 0) 61 | libVersion = VERSION_3DSMAX; 62 | 63 | } 64 | 65 | // This function returns a string that describes the DLL and where the user 66 | // could purchase the DLL if they don't have it. 67 | __declspec( dllexport ) const TCHAR* LibDescription() 68 | { 69 | return GetString(IDS_LIBDESCRIPTION); 70 | } 71 | 72 | // This function returns the number of plug-in classes this DLL 73 | //TODO: Must change this number when adding a new class 74 | __declspec( dllexport ) int LibNumberClasses() 75 | { 76 | return 1; 77 | } 78 | 79 | // This function returns the number of plug-in classes this DLL 80 | __declspec( dllexport ) ClassDesc* LibClassDesc(int i) 81 | { 82 | switch(i) { 83 | case 0: return GetMaxNifImportDesc(); 84 | default: return 0; 85 | } 86 | } 87 | 88 | TCHAR *GetString(int id) 89 | { 90 | static TCHAR buf[256]; 91 | 92 | if (hInstance) 93 | return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; 94 | return NULL; 95 | } 96 | 97 | // This function returns a pre-defined constant indicating the version of 98 | // the system under which it was compiled. It is used to allow the system 99 | // to catch obsolete DLLs. 100 | __declspec( dllexport ) ULONG LibVersion() 101 | { 102 | return ULONG(libVersion); 103 | } 104 | -------------------------------------------------------------------------------- /NifImport/ImportLights.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: ImportSkeleton.cpp 4 | 5 | DESCRIPTION: Skeleton import routines 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2006, All Rights Reserved. 12 | **********************************************************************/ 13 | #include "stdafx.h" 14 | #include "MaxNifImport.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | using namespace Niflib; 24 | 25 | // Targeted Lights 26 | // Normal Lights 27 | static GenLight *CreateLight(Interface *gi, const NiLightRef& light, int lightType) 28 | { 29 | if (GenLight *ob = gi->CreateLightObject(lightType)) { 30 | float dimmer = light->GetDimmer(); 31 | Point3 ambient = TOPOINT3(light->GetAmbientColor()); 32 | Point3 diffuse = TOPOINT3(light->GetDiffuseColor()); 33 | Point3 specular = TOPOINT3(light->GetSpecularColor()); 34 | Point3 black(0,0,0); 35 | 36 | ob->Enable(1); 37 | ob->SetUseLight(1); 38 | ob->SetIntensity(0, dimmer); 39 | if (diffuse != black) { 40 | ob->SetAffectDiffuse(TRUE); 41 | ob->SetRGBColor(0, diffuse); 42 | } else { 43 | ob->SetAffectDiffuse(FALSE); 44 | } 45 | if (specular != black) { 46 | ob->SetAffectSpecular(TRUE); 47 | ob->SetRGBColor(0, specular); 48 | } else { 49 | ob->SetAffectSpecular(FALSE); 50 | } 51 | return ob; 52 | } 53 | return NULL; 54 | } 55 | 56 | bool NifImporter::ImportLights(NiNodeRef node) 57 | { 58 | bool ok = false; 59 | vector children = node->GetChildren(); 60 | ok |= ImportLights(DynamicCast(children)); 61 | vector childNodes = DynamicCast(children); 62 | for (vector::iterator itr=childNodes.begin(), end=childNodes.end(); itr != end; ++itr) 63 | ok |= ImportLights(*itr); 64 | return ok; 65 | } 66 | 67 | bool NifImporter::ImportLights(vector lights) 68 | { 69 | bool ok = false; 70 | for (vector::iterator itr=lights.begin(), end=lights.end(); itr != end; ++itr) 71 | { 72 | GenLight *ob = NULL; 73 | NiLightRef& light = (*itr); 74 | 75 | if (light->IsSameType(NiPointLight::TYPE)){ 76 | ob = CreateLight(gi, light, OMNI_LIGHT); 77 | NiPointLightRef ptLight = light; 78 | float c = ptLight->GetConstantAttenuation(); 79 | float l = ptLight->GetLinearAttenuation(); 80 | float q = ptLight->GetQuadraticAttenuation(); 81 | if (c != 0.0f){ 82 | ob->SetDecayType(0); 83 | } else if (l != 0.0f) { 84 | ob->SetDecayType(1); 85 | ob->SetUseAtten(1); 86 | ob->SetAtten(0, ATTEN_START, 4.0f/l); 87 | } else if (q != 0.0f) { 88 | ob->SetDecayType(2); 89 | ob->SetAtten(0, ATTEN_START, 4.0f/(l*l)); 90 | } 91 | } else if (light->IsSameType(NiDirectionalLight::TYPE)){ 92 | ob = CreateLight(gi, light, DIR_LIGHT); 93 | } else if (light->IsSameType(NiAmbientLight::TYPE)){ 94 | ob = CreateLight(gi, light, OMNI_LIGHT); 95 | ob->SetAmbientOnly(TRUE); 96 | } else if (light->IsSameType(NiSpotLight::TYPE)){ 97 | ob = CreateLight(gi, light, FSPOT_LIGHT); 98 | } 99 | if (INode *n = CreateImportNode(light->GetName().c_str(), ob, NULL)) { 100 | string name = light->GetName(); 101 | if (!name.empty()) { 102 | n->SetName(const_cast(name.c_str())); 103 | } 104 | Matrix44 m4 = light->GetWorldTransform(); 105 | Vector3 pos; Matrix33 rot; float scale; 106 | m4.Decompose(pos, rot, scale); 107 | Point3 p = TOPOINT3(pos); 108 | Quat q = TOQUAT(rot.AsQuaternion()); 109 | 110 | PosRotScaleNode(n, p, q, scale, prsDefault); 111 | n->Hide(light->GetVisibility() ? FALSE : TRUE ); 112 | 113 | RegisterNode(light, n); 114 | } 115 | ok = true; 116 | } 117 | return ok; 118 | } 119 | -------------------------------------------------------------------------------- /NifImport/KFImporter.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "KFImporter.h" 3 | #include 4 | #include "gen/ControllerLink.h" 5 | #include "obj/NiSequenceStreamHelper.h" 6 | #include "obj/NiTextKeyExtraData.h" 7 | #include "obj/NiTimeController.h" 8 | #include 9 | using namespace Niflib; 10 | 11 | KFImporter::KFImporter(const TCHAR *Name,ImpInterface *I,Interface *GI, BOOL SuppressPrompts) 12 | : BaseClass() 13 | { 14 | BaseInit(Name, I, GI, SuppressPrompts); 15 | } 16 | 17 | KFImporter::~KFImporter(void) 18 | { 19 | } 20 | 21 | void KFImporter::ReadBlocks() 22 | { 23 | try 24 | { 25 | Niflib::NifInfo info; 26 | int opts=0; 27 | 28 | // Handle Freedom Force Animation Import 29 | std::vector roots = ReadNifList(name.c_str(), &info); 30 | kf = DynamicCast(roots); 31 | if (kf.size() == 0) 32 | { 33 | std::vector helpers = DynamicCast(roots); 34 | for (std::vector::iterator itr = helpers.begin(); itr != helpers.end(); ++itr) 35 | { 36 | NiSequenceStreamHelperRef helper = (*itr); 37 | 38 | list< Ref > data = helper->GetExtraData(); 39 | NiTextKeyExtraDataRef textKey = DynamicCast(data).front(); 40 | list< NiStringExtraDataRef > keys = DynamicCast(data); 41 | list< Ref > controllers = helper->GetControllers(); 42 | 43 | if (keys.size() == controllers.size()) 44 | { 45 | int nk = keys.size(); 46 | 47 | NiControllerSequenceRef seq = new NiControllerSequence(); 48 | seq->SetName( helper->GetName() ); 49 | seq->SetTargetName( keys.front()->GetData() ); // Set target name as first 50 | seq->SetTextKey( textKey ); 51 | 52 | float start = FLT_MAX, stop = FLT_MIN; 53 | vector< Key > textKeys = textKey->GetKeys(); 54 | for (vector< Key >::iterator tItr = textKeys.begin(); tItr != textKeys.end(); ++tItr) { 55 | start = min(start, tItr->time); 56 | stop = max(stop, tItr->time); 57 | } 58 | seq->SetStartTime( start ); 59 | seq->SetStopTime( stop ); 60 | 61 | list< NiStringExtraDataRef >::iterator keyItr = keys.begin(); 62 | list< NiTimeControllerRef >::iterator ctrlItr = controllers.begin(); 63 | for (int i=0; iAddController( (*keyItr)->GetData(), (*ctrlItr) ); 65 | } 66 | kf.push_back( seq ); 67 | } 68 | } 69 | } 70 | 71 | BuildNodes(); 72 | } 73 | catch (std::exception&) 74 | { 75 | } 76 | catch (...) 77 | { 78 | } 79 | } 80 | 81 | bool KFImporter::DoImport() 82 | { 83 | if (!suppressPrompts) 84 | { 85 | if (!ShowDialog()) 86 | return true; 87 | ApplyAppSettings(); 88 | SaveIniSettings(); 89 | } 90 | 91 | ClearAnimation(); 92 | return ImportAnimation(); 93 | } 94 | -------------------------------------------------------------------------------- /NifImport/KFImporter.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: KFImporter.h 4 | 5 | DESCRIPTION: KF Importer helper class 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2006, All Rights Reserved. 12 | **********************************************************************/ 13 | #ifndef _KFIMPORTER_H_ 14 | #define _KFIMPORTER_H_ 15 | 16 | #pragma once 17 | #include "NIFImporter.h" 18 | #include "KFMImporter.h" 19 | #include "niutils.h" 20 | #include "obj/NiControllerSequence.h" 21 | 22 | class KFImporter : public KFMImporter 23 | { 24 | typedef KFMImporter BaseClass; 25 | public: 26 | KFImporter(const TCHAR *Name,ImpInterface *I,Interface *GI, BOOL SuppressPrompts); 27 | ~KFImporter(void); 28 | 29 | void ReadBlocks(); 30 | virtual bool DoImport(); 31 | }; 32 | 33 | 34 | #endif -------------------------------------------------------------------------------- /NifImport/KFMImporter.cpp: -------------------------------------------------------------------------------- 1 | #include "StdAfx.h" 2 | #include "KFMImporter.h" 3 | #include 4 | #include "gen/ControllerLink.h" 5 | using namespace Niflib; 6 | 7 | extern LPCTSTR AnimImportSection; 8 | 9 | KFMImporter::KFMImporter(const TCHAR *Name,ImpInterface *I,Interface *GI, BOOL SuppressPrompts) 10 | : BaseClass() 11 | { 12 | BaseInit(Name, I, GI, SuppressPrompts); 13 | } 14 | 15 | KFMImporter::KFMImporter() 16 | { 17 | } 18 | 19 | KFMImporter::~KFMImporter(void) 20 | { 21 | } 22 | 23 | void KFMImporter::ReadBlocks() 24 | { 25 | try 26 | { 27 | Kfm kfm; 28 | int ver = kfm.Read(name); 29 | if (ver != VER_UNSUPPORTED) 30 | { 31 | TCHAR buffer[MAX_PATH]; 32 | GetFullPathName(name.c_str(), MAX_PATH, buffer, NULL); 33 | PathRemoveFileSpec(buffer); 34 | string nif_filename = path + '\\' + kfm.nif_filename; 35 | if (_taccess(nif_filename.c_str(), 0) != -1) 36 | root = ReadNifTree(nif_filename); 37 | 38 | //root = kfm.MergeActions(string(buffer)); 39 | BuildNodes(); 40 | 41 | string last_file; 42 | vector ctrllist; 43 | 44 | for ( vector::iterator it = kfm.actions.begin(); it != kfm.actions.end(); it++ ) { 45 | string action_filename = path + '\\' + it->action_filename; 46 | if (-1 != _taccess(action_filename.c_str(), 0)){ 47 | if (action_filename != last_file) { 48 | Niflib::NifInfo info; 49 | int opts; 50 | ctrllist = DynamicCast(ReadNifList(action_filename, &info)); 51 | } 52 | if (((*it).unk_int2 && (*it).unk_int2 <= ctrllist.size())) { 53 | if (NiControllerSequenceRef ctrlSeq = ctrllist[(*it).unk_int2-1]) 54 | kf.push_back(ctrlSeq); 55 | } else if (!(*it).unk_int2 && ctrllist.size() == 1) { 56 | if (NiControllerSequenceRef ctrlSeq = ctrllist[0]) 57 | kf.push_back(ctrlSeq); 58 | } 59 | } 60 | } 61 | } 62 | } 63 | catch (std::exception&) 64 | { 65 | } 66 | catch (...) 67 | { 68 | } 69 | } 70 | 71 | bool KFMImporter::DoImport() 72 | { 73 | bool ok = true; 74 | if (!suppressPrompts) 75 | { 76 | if (!ShowDialog()) 77 | return true; 78 | ApplyAppSettings(); 79 | SaveIniSettings(); 80 | } 81 | 82 | // might check if blocks exist and if not go ahead and import nif. 83 | if (root) 84 | { 85 | int n = nodes.size(); 86 | int m = 0; 87 | for (vector::iterator itr = nodes.begin(), end = nodes.end(); itr != end; ++itr) { 88 | if (INode *p = FindNode(*itr)) 89 | m++; 90 | } 91 | if (m != n) { 92 | BaseClass::DoImport(); 93 | } 94 | } 95 | 96 | ClearAnimation(); 97 | return ImportAnimation(); 98 | //return BaseClass::DoImport(); 99 | } 100 | 101 | void KFMImporter::SaveIniSettings() 102 | { 103 | SetIniValue(AnimImportSection, "ClearAnimation", clearAnimation); 104 | SetIniValue(AnimImportSection, "AddNoteTracks", addNoteTracks); 105 | SetIniValue(AnimImportSection, "AddTimeTags", addTimeTags); 106 | } -------------------------------------------------------------------------------- /NifImport/KFMImporter.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: KFMImporter.h 4 | 5 | DESCRIPTION: KFM Importer helper class 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2006, All Rights Reserved. 12 | **********************************************************************/ 13 | #ifndef _KFMIMPORTER_H_ 14 | #define _KFMIMPORTER_H_ 15 | 16 | #pragma once 17 | #include "NIFImporter.h" 18 | #include "niutils.h" 19 | #include "obj/NiControllerSequence.h" 20 | 21 | class KFMImporter : public NifImporter 22 | { 23 | typedef NifImporter BaseClass; 24 | public: 25 | KFMImporter(const TCHAR *Name,ImpInterface *I,Interface *GI, BOOL SuppressPrompts); 26 | KFMImporter(); 27 | ~KFMImporter(void); 28 | 29 | void ReadBlocks(); 30 | virtual bool DoImport(); 31 | 32 | virtual bool isValid() const { return (NULL != root) || !kf.empty(); } 33 | 34 | // Implemented in ImportAnimation.cpp 35 | virtual bool ImportAnimation(); 36 | virtual void SaveIniSettings(); 37 | 38 | bool ShowDialog(); 39 | 40 | std::vector kf; 41 | }; 42 | 43 | 44 | #endif -------------------------------------------------------------------------------- /NifImport/KfDialog.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: ImporterCore.cpp 4 | 5 | DESCRIPTION: Core Import helper routines 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2006, All Rights Reserved. 12 | **********************************************************************/ 13 | #include "stdafx.h" 14 | #include "MaxNifImport.h" 15 | #include "KFMImporter.h" 16 | #include "resource.h" 17 | #include "shellapi.h" 18 | #include "Hyperlinks.h" 19 | using namespace Niflib; 20 | 21 | static INT_PTR CALLBACK MaxNifImportOptionsDlgProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam) { 22 | static KFMImporter *imp = NULL; 23 | static DWORD dlgRes = IDCANCEL; 24 | 25 | switch(message) { 26 | case WM_INITDIALOG: 27 | { 28 | dlgRes = IDCANCEL; 29 | 30 | // Append file version to dialog 31 | TSTR version = GetFileVersion(NULL); 32 | if (!version.isNull()) { 33 | char buffer[256]; 34 | GetWindowText(hWnd, buffer, _countof(buffer)); 35 | _tcscat(buffer, TEXT(" ")); 36 | _tcscat(buffer, version); 37 | SetWindowText(hWnd, buffer); 38 | } 39 | 40 | imp = (KFMImporter *)lParam; 41 | CenterWindow(hWnd,GetParent(hWnd)); 42 | 43 | CheckDlgButton(hWnd, IDC_CHK_CLEARANIM, imp->clearAnimation); 44 | CheckDlgButton(hWnd, IDC_CHK_KEYNOTES, imp->addNoteTracks); 45 | CheckDlgButton(hWnd, IDC_CHK_TIMETAGS, imp->addTimeTags); 46 | 47 | ConvertStaticToHyperlink(hWnd, IDC_LBL_LINK); 48 | ConvertStaticToHyperlink(hWnd, IDC_LBL_WIKI); 49 | 50 | } 51 | return TRUE; 52 | 53 | case WM_CLOSE: 54 | { 55 | EndDialog(hWnd, dlgRes); 56 | } 57 | return TRUE; 58 | 59 | case WM_COMMAND : 60 | { 61 | if (HIWORD(wParam) == BN_CLICKED) 62 | { 63 | switch (LOWORD(wParam)) 64 | { 65 | case IDOK: 66 | imp->clearAnimation = IsDlgButtonChecked(hWnd, IDC_CHK_CLEARANIM) ? true : false; 67 | imp->addNoteTracks = IsDlgButtonChecked(hWnd, IDC_CHK_KEYNOTES) ? true : false; 68 | imp->addTimeTags = IsDlgButtonChecked(hWnd, IDC_CHK_TIMETAGS) ? true : false; 69 | EndDialog(hWnd, dlgRes=IDOK); 70 | return TRUE; 71 | 72 | case IDCANCEL: 73 | EndDialog(hWnd, dlgRes=IDCANCEL); 74 | return TRUE; 75 | 76 | case IDC_LBL_LINK: 77 | ShellExecute(hWnd, "open", imp->webSite, NULL, NULL, SW_SHOWNORMAL); 78 | break; 79 | 80 | case IDC_LBL_WIKI: 81 | ShellExecute(hWnd, "open", imp->wikiSite, NULL, NULL, SW_SHOWNORMAL); 82 | break; 83 | } 84 | } 85 | } 86 | break; 87 | } 88 | return FALSE; 89 | } 90 | 91 | bool KFMImporter::ShowDialog() 92 | { 93 | return (IDOK == DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_KF_PANEL), GetActiveWindow(), MaxNifImportOptionsDlgProc, (LPARAM)this)); 94 | } -------------------------------------------------------------------------------- /NifImport/MaxNifImport.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: MaxNifImport.cpp 4 | 5 | DESCRIPTION: Appwizard generated plugin 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2006, All Rights Reserved. 12 | **********************************************************************/ 13 | #include "stdafx.h" 14 | #include "MaxNifImport.h" 15 | #include "KFMImporter.h" 16 | #include "KFImporter.h" 17 | using namespace Niflib; 18 | 19 | #define MaxNifImport_CLASS_ID Class_ID(0x794ac1c1, 0x8b4c64c7) 20 | 21 | 22 | class MaxNifImport : public SceneImport { 23 | public: 24 | 25 | static HWND hParams; 26 | TSTR shortDescription; 27 | TSTR webSite; 28 | TSTR wikiSite; 29 | 30 | int ExtCount(); // Number of extensions supported 31 | const TCHAR * Ext(int n); // Extension #n (i.e. "3DS") 32 | const TCHAR * LongDesc(); // Long ASCII description (i.e. "Autodesk 3D Studio File") 33 | const TCHAR * ShortDesc(); // Short ASCII description (i.e. "3D Studio") 34 | const TCHAR * AuthorName(); // ASCII Author name 35 | const TCHAR * CopyrightMessage(); // ASCII Copyright message 36 | const TCHAR * OtherMessage1(); // Other message #1 37 | const TCHAR * OtherMessage2(); // Other message #2 38 | unsigned int Version(); // Version number * 100 (i.e. v3.01 = 301) 39 | void ShowAbout(HWND hWnd); // Show DLL's "About..." box 40 | int DoImport(const TCHAR *name,ImpInterface *i,Interface *gi, BOOL suppressPrompts=FALSE); // Import file 41 | 42 | //SDK_RESERVED_METHOD(1); // russom 02/26/01 43 | //SDK_RESERVED_METHOD(2); // russom 02/26/01 44 | //SDK_RESERVED_METHOD(3); // russom 02/26/01 45 | //SDK_RESERVED_METHOD(4); // russom 02/26/01 46 | //SDK_RESERVED_METHOD(5); // russom 02/26/01 47 | //SDK_RESERVED_METHOD(6); // russom 02/26/01 48 | 49 | //Constructor/Destructor 50 | MaxNifImport(); 51 | ~MaxNifImport(); 52 | 53 | string iniFileName; 54 | }; 55 | 56 | 57 | 58 | class MaxNifImportClassDesc : public ClassDesc2 { 59 | public: 60 | int IsPublic() { return TRUE; } 61 | void * Create(BOOL loading = FALSE) { return new MaxNifImport(); } 62 | const TCHAR * ClassName() { return GetString(IDS_CLASS_NAME); } 63 | SClass_ID SuperClassID() { return SCENE_IMPORT_CLASS_ID; } 64 | Class_ID ClassID() { return MaxNifImport_CLASS_ID; } 65 | const TCHAR* Category() { return GetString(IDS_CATEGORY); } 66 | 67 | const TCHAR* InternalName() { return _T("MaxNifImport"); } // returns fixed parsable name (scripter-visible name) 68 | HINSTANCE HInstance() { return hInstance; } // returns owning module handle 69 | 70 | 71 | }; 72 | 73 | static MaxNifImportClassDesc MaxNifImportDesc; 74 | ClassDesc2* GetMaxNifImportDesc() { return &MaxNifImportDesc; } 75 | 76 | 77 | //--- MaxNifImport ------------------------------------------------------- 78 | MaxNifImport::MaxNifImport() 79 | { 80 | Interface *gi = GetCOREInterface(); 81 | TCHAR iniName[MAX_PATH]; 82 | GetIniFileName(iniName); 83 | iniFileName = iniName; 84 | shortDescription = GetIniValue("System", "ShortDescription", "Netimmerse/Gamebryo", iniFileName.c_str()); 85 | webSite = GetIniValue("System", "Website", "http://niftools.sourceforge.net", iniFileName.c_str()); 86 | wikiSite = GetIniValue("System", "Wiki", "http://niftools.sourceforge.net/wiki/3ds_Max", iniFileName.c_str()); 87 | } 88 | 89 | MaxNifImport::~MaxNifImport() 90 | { 91 | 92 | } 93 | 94 | int MaxNifImport::ExtCount() 95 | { 96 | return 2; 97 | } 98 | 99 | const TCHAR *MaxNifImport::Ext(int n) 100 | { 101 | switch (n) 102 | { 103 | case 0: return _T("NIF"); 104 | case 1: return _T("KF"); 105 | case 2: return _T("KFM"); 106 | } 107 | return _T(""); 108 | } 109 | 110 | const TCHAR *MaxNifImport::LongDesc() 111 | { 112 | //TODO: Return long ASCII description (i.e. "Targa 2.0 Image File") 113 | return _T("Netimmerse/Gamebryo"); 114 | } 115 | 116 | const TCHAR *MaxNifImport::ShortDesc() 117 | { 118 | //TODO: Return short ASCII description (i.e. "Targa") 119 | return shortDescription; 120 | } 121 | 122 | const TCHAR *MaxNifImport::AuthorName() 123 | { 124 | //TODO: Return ASCII Author name 125 | return _T("Theo"); 126 | } 127 | 128 | const TCHAR *MaxNifImport::CopyrightMessage() 129 | { 130 | // Return ASCII Copyright message 131 | return _T( 132 | "Copyright (c) 2006, NIF File Format Library and Tools\n" 133 | "All rights reserved." 134 | ); 135 | } 136 | 137 | const TCHAR *MaxNifImport::OtherMessage1() 138 | { 139 | return _T( 140 | "THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n" 141 | "\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n" 142 | "LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n" 143 | "FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n" 144 | "COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n" 145 | "INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n" 146 | "BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n" 147 | "LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n" 148 | "CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n" 149 | "LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n" 150 | "ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n" 151 | "POSSIBILITY OF SUCH DAMAGE.\n" 152 | ); 153 | } 154 | 155 | const TCHAR *MaxNifImport::OtherMessage2() 156 | { 157 | //TODO: Return other message #2 in any 158 | return _T(""); 159 | } 160 | 161 | unsigned int MaxNifImport::Version() 162 | { 163 | //TODO: Return Version number * 100 (i.e. v3.01 = 301) 164 | return 1 * 100; 165 | } 166 | 167 | void MaxNifImport::ShowAbout(HWND hWnd) 168 | { 169 | // Optional 170 | } 171 | 172 | 173 | int MaxNifImport::DoImport(const TCHAR *filename,ImpInterface *i, Interface *gi, BOOL suppressPrompts) 174 | { 175 | bool ok = true; 176 | try 177 | { 178 | HoldSuspend myHold(TRUE); 179 | 180 | AppSettings::Initialize(gi); 181 | 182 | std::string current_file = filename; 183 | 184 | LPCTSTR ext = PathFindExtension(filename); 185 | 186 | if (_tcsicmp(ext, ".NIF") == 0) 187 | { 188 | NifImporter importer(filename, i, gi, suppressPrompts); 189 | if (!importer.isValid()) 190 | return FALSE; 191 | ok = importer.DoImport(); 192 | } 193 | else if (_tcsicmp(ext, ".KFM") == 0) 194 | { 195 | KFMImporter importer(filename, i, gi, suppressPrompts); 196 | if (!importer.isValid()) 197 | return FALSE; 198 | ok = importer.DoImport(); 199 | } 200 | else if (_tcsicmp(ext, ".KF") == 0) 201 | { 202 | KFImporter importer(filename, i, gi, suppressPrompts); 203 | if (!importer.isValid()) 204 | return FALSE; 205 | ok = importer.DoImport(); 206 | } 207 | } 208 | catch (exception &e) 209 | { 210 | MessageBox(NULL, e.what(), "Import Error", MB_OK); 211 | return TRUE; 212 | } 213 | catch (RuntimeError &e) 214 | { 215 | #if VERSION_3DSMAX > ((5000<<16)+(15<<8)+0) // Version 6+ 216 | MessageBox(NULL, e.desc1, "Import Error", MB_OK); 217 | #endif 218 | return TRUE; 219 | } 220 | catch (...) 221 | { 222 | MessageBox(NULL, "Unknown error.", "Import Error", MB_OK); 223 | return TRUE; 224 | } 225 | return ok ? TRUE : FALSE; 226 | } 227 | 228 | -------------------------------------------------------------------------------- /NifImport/MaxNifImport.def: -------------------------------------------------------------------------------- 1 | LIBRARY MaxNifImport.dli 2 | EXPORTS 3 | LibDescription @1 4 | LibNumberClasses @2 5 | LibClassDesc @3 6 | LibVersion @4 7 | SECTIONS 8 | .data READ WRITE 9 | -------------------------------------------------------------------------------- /NifImport/MaxNifImport.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: MaxNifImport.h 4 | 5 | DESCRIPTION: Includes for Plugins 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2006, All Rights Reserved. 12 | **********************************************************************/ 13 | 14 | #ifndef __MaxNifImport__H 15 | #define __MaxNifImport__H 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | #include "resource.h" 23 | #include 24 | #include 25 | #include 26 | #ifdef USE_BIPED 27 | # include 28 | #endif 29 | #include 30 | //#include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include "objectParams.h" 41 | #undef ALPHA_NONE 42 | 43 | #include 44 | #include 45 | 46 | #include "niflib.h" 47 | #include "obj\NiObject.h" 48 | #include "obj\NiNode.h" 49 | #include "obj\NiTriShape.h" 50 | #include "obj\NiTriShapeData.h" 51 | #include "obj\NiTriStrips.h" 52 | #include "obj\NiTriStripsData.h" 53 | #include "obj\NiMaterialProperty.h" 54 | #include "obj\NiTexturingProperty.h" 55 | #include "obj\NiSourceTexture.h" 56 | #include "obj\NiExtraData.h" 57 | #include "obj\BSBound.h" 58 | #include "obj\NiSkinData.h" 59 | #include "obj\NiSkinInstance.h" 60 | #include "obj\NiSkinPartition.h" 61 | #include "obj\NiLight.h" 62 | #include "obj\NiTextureProperty.h" 63 | 64 | #include "niutils.h" 65 | #include "AppSettings.h" 66 | 67 | #ifndef ASSERT 68 | #ifdef _DEBUG 69 | #include 70 | #define ASSERT _ASSERTE 71 | #else 72 | #define ASSERT(exp) 73 | #endif 74 | #endif 75 | 76 | #include 77 | #include 78 | 79 | #include "NifImporter.h" 80 | 81 | extern TCHAR *GetString(int id); 82 | extern TSTR shortDescription; 83 | extern HINSTANCE hInstance; 84 | 85 | #endif 86 | -------------------------------------------------------------------------------- /NifImport/NIFImporter.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: NifImporter.h 4 | 5 | DESCRIPTION: NIF Importer 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | 11 | *> Copyright (c) 2006, All Rights Reserved. 12 | **********************************************************************/ 13 | 14 | #ifndef __NIFIMPORTER_H__ 15 | #define __NIFIMPORTER_H__ 16 | 17 | #include "BaseImporter.h" 18 | #include "IniSection.h" 19 | 20 | namespace Niflib 21 | { 22 | class NiTextKeyExtraData; 23 | } 24 | 25 | // NIF Importer 26 | class NifImporter : public BaseImporter//, public IniFileSection 27 | { 28 | public: 29 | // Ini settings 30 | bool showTextures; // show textures in viewport 31 | bool removeIllegalFaces; 32 | bool removeDegenerateFaces; 33 | bool enableAutoSmooth; 34 | float autoSmoothAngle; 35 | bool flipUVTextures; 36 | bool enableSkinSupport; 37 | bool goToSkeletonBindPosition; 38 | bool enableCollision; 39 | int vertexColorMode; 40 | int useNiftoolsShader; 41 | bool mergeNonAccum; 42 | bool enableLights; 43 | bool enableCameras; 44 | bool importUPB; 45 | bool doNotReuseExistingBones; 46 | 47 | // Biped/Bones related settings 48 | bool importBones; 49 | string skeleton; 50 | float bipedHeight; 51 | string skeletonCheck; 52 | float bipedAngle; 53 | float bipedAnkleAttach; 54 | bool bipedTrianglePelvis; 55 | bool importSkeleton; 56 | bool useBiped; 57 | bool hasSkeleton; 58 | bool isBiped; 59 | bool removeUnusedImportedBones; 60 | bool forceRotation; 61 | bool browseForSkeleton; 62 | string defaultSkeletonName; 63 | float minBoneWidth; 64 | float maxBoneWidth; 65 | float boneWidthToLengthRatio; 66 | bool createNubsForBones; 67 | stringlist dummyNodeMatches; 68 | bool convertBillboardsToDummyNodes; 69 | bool uncontrolledDummies; 70 | bool ignoreRootNode; 71 | bool autoDetect; 72 | stringlist rotate90Degrees; 73 | bool supportPrnStrings; 74 | 75 | // Animation related Settings 76 | bool replaceTCBRotationWithBezier; 77 | bool enableAnimations; 78 | bool requireMultipleKeys; 79 | bool applyOverallTransformToSkinAndBones; 80 | bool clearAnimation; 81 | bool addNoteTracks; 82 | bool addTimeTags; 83 | 84 | // Collision settings 85 | float bhkScaleFactor; 86 | 87 | bool weldVertices; 88 | float weldVertexThresh; 89 | 90 | bool dummyBonesAsLines; 91 | 92 | vector blocks; 93 | vector nodes; 94 | map ctrlCount; // counter for number of controllers referencing a node 95 | 96 | typedef map NodeToNodeMap; 97 | typedef map NameToNodeMap; 98 | NodeToNodeMap nodeMap; 99 | NameToNodeMap nodeNameMap; 100 | 101 | 102 | NifImporter(const TCHAR *Name,ImpInterface *I,Interface *GI, BOOL SuppressPrompts); 103 | virtual void Initialize(); 104 | virtual void ReadBlocks(); 105 | void BuildNodes(); 106 | 107 | // Ini File related routines 108 | virtual void LoadIniSettings(); 109 | virtual void SaveIniSettings(); 110 | 111 | void ApplyAppSettings(); 112 | 113 | bool HasSkeleton(); 114 | bool IsBiped(); 115 | void ImportBones(vector& bones); 116 | void ImportBones(Niflib::NiNodeRef blocks, bool recurse = true); 117 | void ImportBipeds(vector& blocks); 118 | void AlignBiped(IBipMaster* master, Niflib::NiNodeRef block); 119 | bool ImportMeshes(Niflib::NiNodeRef block); 120 | string FindImage(const string& name); 121 | 122 | bool ImportUPB(INode *node, Niflib::NiNodeRef block); 123 | 124 | void SetTriangles(Mesh& mesh, const vector& v); 125 | void SetNormals(Mesh& mesh, const vector& t, const vector& v); 126 | 127 | bool ImportMesh(Niflib::NiTriShapeRef triShape); 128 | bool ImportMesh(Niflib::NiTriStripsRef triStrips); 129 | bool ImportMultipleGeometry(Niflib::NiNodeRef parent, vector& glist); 130 | StdMat2 *ImportMaterialAndTextures(ImpNode *node, Niflib::NiAVObjectRef avObject); 131 | bool ImportMaterialAndTextures(ImpNode *node, vector& glist); 132 | bool ImportNiftoolsShader(ImpNode *node, Niflib::NiAVObjectRef avObject, StdMat2 *m); 133 | bool ImportTransform(ImpNode *node, Niflib::NiAVObjectRef avObject); 134 | bool ImportMesh(ImpNode *node, TriObject *o, Niflib::NiTriBasedGeomRef triGeom, Niflib::NiTriBasedGeomDataRef triGeomData, vector& tris); 135 | bool ImportVertexColor(INode *tnode, TriObject *o, vector& tris, vector cv, int cv_offset=0); 136 | bool ImportSkin(ImpNode *node, Niflib::NiTriBasedGeomRef triGeom, int v_start=0); 137 | Texmap* CreateTexture(Niflib::TexDesc& desc); 138 | Texmap* CreateTexture(Niflib::NiTexturePropertyRef desc); 139 | Texmap* CreateTexture(const string& name); 140 | Texmap* CreateNormalBump(LPCTSTR name, Texmap* nmap); 141 | Texmap* CreateMask(LPCTSTR name, Texmap* nmap, Texmap* mask); 142 | 143 | INode *CreateBone(const string& name, Point3 startPos, Point3 endPos, Point3 zAxis); 144 | INode *CreateHelper(const string& name, Point3 startPos); 145 | INode *CreateCamera(const string& name); 146 | 147 | INode *CreateImportNode(const char *name, Object *obj, INode* parent); 148 | 149 | bool ImportLights(Niflib::NiNodeRef node); 150 | bool ImportLights(vector lights); 151 | 152 | // Primary Collision entry point. Tests for bhk objects 153 | bool ImportCollision(Niflib::NiNodeRef node); 154 | 155 | void RegisterNode(Niflib::NiObjectNETRef node, INode* inode); 156 | INode *FindNode(Niflib::NiObjectNETRef node); 157 | 158 | INode *GetNode(Niflib::NiNodeRef node); 159 | INode *GetNode(Niflib::NiObjectNETRef obj); 160 | 161 | void RegisterNode(const string& name, INode* inode); 162 | INode *GetNode(const string& name); 163 | INode *GetNode(const TSTR& name); 164 | 165 | string GetSkeleton(AppSettings *appSettings); 166 | 167 | bool ShowDialog(); 168 | virtual bool DoImport(); 169 | 170 | // Animation Helpers 171 | bool ImportAnimation(); 172 | void ClearAnimation(); 173 | void ClearAnimation(INode *node); 174 | bool AddNoteTracks(float time, string name, string target, Niflib::Ref textKeyData, bool loop); 175 | 176 | void WeldVertices(Mesh& mesh); 177 | 178 | bool IsSkyrim() const; 179 | bool IsFallout3() const; 180 | bool IsOblivion() const; 181 | bool IsMorrowind() const; 182 | 183 | protected: 184 | NifImporter(); 185 | }; 186 | 187 | #endif 188 | -------------------------------------------------------------------------------- /NifImport/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by MaxNifImport.rc 4 | // 5 | #define IDC_EDIT1 1003 6 | #define IDC_EDIT_WELDTHRESH 1003 7 | #define IDC_CLOSEBUTTON 10000 8 | #define IDS_LIBDESCRIPTION 10001 9 | #define IDC_EDITHEIGHT 10001 10 | #define IDS_CATEGORY 10002 11 | #define IDC_BUTTON1 10002 12 | #define IDC_BTN_BROWSE 10002 13 | #define IDS_CLASS_NAME 10003 14 | #define IDC_CHK_BONES 10003 15 | #define IDS_PARAMS 10004 16 | #define IDC_CHK_FLIP_UV 10004 17 | #define IDS_SPIN 10005 18 | #define IDC_CHK_FURN 10005 19 | #define IDD_PANEL 10006 20 | #define IDC_ED_SKELETON 10006 21 | #define IDD_NIF_PANEL 10007 22 | #define IDC_CHK_BIPED 10007 23 | #define IDD_KF_PANEL 10008 24 | #define IDC_CHK_LIGHTS 10008 25 | #define IDC_CHK_UPB 10009 26 | #define IDC_CHK_COLL 10010 27 | #define IDC_LBL_LINK 10011 28 | #define IDC_CHK_VCOLORS 10012 29 | #define IDC_CHK_SHOW_TEX 10013 30 | #define IDC_CB_GAME 10014 31 | #define IDC_CHK_IGNORE_ROOT 10015 32 | #define IDC_CB_USER_VERSION 10016 33 | #define IDC_CHK_LIGHTS2 10016 34 | #define IDC_CHK_AUTO_DETECT 10016 35 | #define IDC_CHK_SKIN 10017 36 | #define IDC_CHK_ANIMATION 10018 37 | #define IDC_CHK_AUTOSMOOTH 10019 38 | #define IDC_CHK_ILLEGAL 10020 39 | #define IDC_STC_SKELETON 10021 40 | #define IDC_CHK_WELD 10021 41 | #define IDC_CHK_REM_BONES 10022 42 | #define IDC_CHK_CLEARANIM 10023 43 | #define IDC_CHK_KEYNOTES 10024 44 | #define IDC_CHK_CAMERA 10025 45 | #define IDC_CHK_TIMETAGS 10026 46 | #define IDC_LBL_WIKI 10027 47 | #define IDC_CHK_IGNORE_ROOT2 10028 48 | #define IDC_CHK_USE_SHADER 10028 49 | 50 | // Next default values for new objects 51 | // 52 | #ifdef APSTUDIO_INVOKED 53 | #ifndef APSTUDIO_READONLY_SYMBOLS 54 | #define _APS_NEXT_RESOURCE_VALUE 101 55 | #define _APS_NEXT_COMMAND_VALUE 40001 56 | #define _APS_NEXT_CONTROL_VALUE 1004 57 | #define _APS_NEXT_SYMED_VALUE 101 58 | #endif 59 | #endif 60 | -------------------------------------------------------------------------------- /NifImport/stdafx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" -------------------------------------------------------------------------------- /NifImport/stdafx.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | // _WIN32 will detect windows on most compilers 19 | #define WIN32_LEAN_AND_MEAN 20 | #include 21 | #include 22 | #include 23 | 24 | #include "MaxNifImport.h" 25 | #include "MAX_MemDirect.h" 26 | 27 | #if VERSION_3DSMAX >= (14000<<16) // Version 14 (2012) 28 | #define SDK_RESERVED_METHOD(a) 29 | #endif 30 | -------------------------------------------------------------------------------- /NifPlugins/NifPlugins.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | LibDescription @1 3 | LibNumberClasses @2 4 | LibClassDesc @3 5 | LibVersion @4 6 | SECTIONS 7 | .data READ WRITE 8 | -------------------------------------------------------------------------------- /NifPlugins/NifPlugins.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | #ifdef NIFPLUGINS 13 | #define DLLNAME "NifPlugins.dlu" // DLL Name 14 | #define DLLDESCRIPTION "3ds Max Nif Plugins" // DLL Description 15 | #include "..\nifcommon\nifversion.rc" 16 | #endif 17 | 18 | ///////////////////////////////////////////////////////////////////////////// 19 | #undef APSTUDIO_READONLY_SYMBOLS 20 | 21 | ///////////////////////////////////////////////////////////////////////////// 22 | // English (U.S.) resources 23 | 24 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 25 | #ifdef _WIN32 26 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 27 | #pragma code_page(1252) 28 | #endif //_WIN32 29 | 30 | #ifdef APSTUDIO_INVOKED 31 | ///////////////////////////////////////////////////////////////////////////// 32 | // 33 | // TEXTINCLUDE 34 | // 35 | 36 | 1 TEXTINCLUDE 37 | BEGIN 38 | "resource.h\0" 39 | END 40 | 41 | 2 TEXTINCLUDE 42 | BEGIN 43 | "#include ""winres.h""\r\n" 44 | "\r\n" 45 | "#ifdef NIFPLUGINS\r\n" 46 | "#define DLLNAME ""NifPlugins.dlu"" // DLL Name\r\n" 47 | "#define DLLDESCRIPTION ""3ds Max Nif Plugins"" // DLL Description\r\n" 48 | "#include ""..\\nifcommon\\nifversion.rc""\r\n" 49 | "#endif\r\n" 50 | END 51 | 52 | 3 TEXTINCLUDE 53 | BEGIN 54 | "\r\n" 55 | END 56 | 57 | #endif // APSTUDIO_INVOKED 58 | 59 | #endif // English (U.S.) resources 60 | ///////////////////////////////////////////////////////////////////////////// 61 | 62 | 63 | 64 | #ifndef APSTUDIO_INVOKED 65 | ///////////////////////////////////////////////////////////////////////////// 66 | // 67 | // Generated from the TEXTINCLUDE 3 resource. 68 | // 69 | 70 | 71 | ///////////////////////////////////////////////////////////////////////////// 72 | #endif // not APSTUDIO_INVOKED 73 | 74 | -------------------------------------------------------------------------------- /NifPlugins/pch.cpp: -------------------------------------------------------------------------------- 1 | // Dummy file for creating precompiled headers 2 | // The project contains the linke /FI"$(ProjectDir)pch.h" which automatically adds 3 | // the header to the top of the file. 4 | #include "pch.h" -------------------------------------------------------------------------------- /NifPlugins/pch.h: -------------------------------------------------------------------------------- 1 | #pragma warning( disable:4800 ) 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | // _WIN32 will detect windows on most compilers 23 | #define WIN32_LEAN_AND_MEAN 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #ifndef ASSERT 35 | #ifdef _DEBUG 36 | #include 37 | #define ASSERT _ASSERTE 38 | #else 39 | #define ASSERT(exp) 40 | #endif 41 | #endif 42 | 43 | #include 44 | #include "MAX_MemDirect.h" 45 | #include 46 | #include 47 | #include 48 | #ifdef USE_BIPED 49 | # include 50 | #endif 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include "objectParams.h" 58 | 59 | #undef ALPHA_NONE 60 | #undef DECAY_NONE 61 | 62 | #include "niflib.h" 63 | #include "obj/NiObject.h" 64 | #include "obj/NiNode.h" 65 | #include "obj/NiTriShape.h" 66 | #include "obj/NiTriShapeData.h" 67 | #include "obj/NiTriStrips.h" 68 | #include "obj/NiTriStripsData.h" 69 | #include "obj/NiMaterialProperty.h" 70 | #include "obj/NiTexturingProperty.h" 71 | #include "obj/NiSourceTexture.h" 72 | #include "obj/NiExtraData.h" 73 | #include "obj/BSBound.h" 74 | #include "obj/NiSkinData.h" 75 | #include "obj/NiSkinInstance.h" 76 | #include "obj/NiSkinPartition.h" 77 | #include "obj/NiLight.h" 78 | #include "obj/bhkCollisionObject.h" 79 | #include "obj/bhkRigidBody.h" 80 | #include "obj/bhkNiTriStripsShape.h" 81 | #include "obj/bhkBoxShape.h" 82 | #include "obj/bhkSphereShape.h" 83 | #include "obj/bhkCapsuleShape.h" 84 | #include "obj/NiMaterialProperty.h" 85 | #include "obj/NiTexturingProperty.h" 86 | #include "obj/NiSourceTexture.h" 87 | #include "obj/BsxFlags.h" 88 | #include "obj/NiStringExtraData.h" 89 | #include "obj/bhkRigidBodyT.h" 90 | 91 | #include "niutils.h" 92 | #include "AppSettings.h" 93 | 94 | // undef macros for tristripper 95 | #undef max 96 | #undef min 97 | #include "NvTriStrip/NvTriStrip.h" 98 | #include "TriStripper/tri_stripper.h" 99 | 100 | #include "NifPlugins.h" 101 | -------------------------------------------------------------------------------- /NifPlugins/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by NifPlugins.rc 4 | // 5 | 6 | // Next default values for new objects 7 | // 8 | #ifdef APSTUDIO_INVOKED 9 | #ifndef APSTUDIO_READONLY_SYMBOLS 10 | #define _APS_NEXT_RESOURCE_VALUE 101 11 | #define _APS_NEXT_COMMAND_VALUE 40001 12 | #define _APS_NEXT_CONTROL_VALUE 1000 13 | #define _APS_NEXT_SYMED_VALUE 101 14 | #endif 15 | #endif 16 | -------------------------------------------------------------------------------- /NifPlugins_Development_Readme.txt: -------------------------------------------------------------------------------- 1 | NifPlugins for 3ds Max 2 | ====================== 3 | 4 | This document describes the how to setup your build environment to use this 5 | project. 6 | 7 | Report problems and ask questions here: 8 | 9 | http://niftools.sourceforge.net/forum/viewforum.php?f=6 10 | 11 | A tutorial on how to use the exporter and utility plugins can be found here: 12 | 13 | http://www.silgrad.com/wbb2/thread.php?threadid=2477 14 | 15 | Enjoy! 16 | 17 | 18 | Requirements 19 | ------------ 20 | Microsoft Visual Studio 2005 21 | - Visual C++ Express Edition 22 | URL: http://msdn.microsoft.com/vstudio/express/visualc/download/ 23 | 24 | Installation 25 | ------------ 26 | 27 | 28 | Copyright 29 | --------- 30 | 31 | Copyright (c) 2006, NIF File Format Library and Tools. All rights reserved. 32 | 33 | Legal 34 | ----- 35 | 36 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 39 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 40 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 41 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 42 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 43 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 44 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 45 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 46 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 47 | POSSIBILITY OF SUCH DAMAGE. 48 | -------------------------------------------------------------------------------- /NifProps/DllEntry.cpp: -------------------------------------------------------------------------------- 1 | #include "NifProps.h" 2 | 3 | extern ClassDesc2* GetNifPropsDesc(); 4 | 5 | HINSTANCE hInstance; 6 | int controlsInit = FALSE; 7 | 8 | // This function is called by Windows when the DLL is loaded. This 9 | // function may also be called many times during time critical operations 10 | // like rendering. Therefore developers need to be careful what they 11 | // do inside this function. In the code below, note how after the DLL is 12 | // loaded the first time only a few statements are executed. 13 | 14 | BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) 15 | { 16 | hInstance = hinstDLL; // Hang on to this DLL's instance handle. 17 | 18 | if (!controlsInit) { 19 | controlsInit = TRUE; 20 | InitCustomControls(hInstance); // Initialize MAX's custom controls 21 | InitCommonControls(); // Initialize Win95 controls 22 | } 23 | 24 | return (TRUE); 25 | } 26 | 27 | // This function returns a string that describes the DLL and where the user 28 | // could purchase the DLL if they don't have it. 29 | __declspec( dllexport ) const TCHAR* LibDescription() 30 | { 31 | return GetString(IDS_LIBDESCRIPTION); 32 | } 33 | 34 | // This function returns the number of plug-in classes this DLL 35 | //TODO: Must change this number when adding a new class 36 | __declspec( dllexport ) int LibNumberClasses() 37 | { 38 | return 1; 39 | } 40 | 41 | // This function returns the number of plug-in classes this DLL 42 | __declspec( dllexport ) ClassDesc* LibClassDesc(int i) 43 | { 44 | switch(i) { 45 | case 0: return GetNifPropsDesc(); 46 | default: return 0; 47 | } 48 | } 49 | 50 | // This function returns a pre-defined constant indicating the version of 51 | // the system under which it was compiled. It is used to allow the system 52 | // to catch obsolete DLLs. 53 | __declspec( dllexport ) ULONG LibVersion() 54 | { 55 | return VERSION_3DSMAX; 56 | } 57 | 58 | TCHAR *GetString(int id) 59 | { 60 | static TCHAR buf[256]; 61 | 62 | if (hInstance) 63 | return LoadString(hInstance, id, buf, sizeof(buf)) ? buf : NULL; 64 | return NULL; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /NifProps/Modifier/AddDel16.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niftools/max_nif_plugin/f131c8c4ddefb12f6252d469552f607e5fdc7c4f/NifProps/Modifier/AddDel16.bmp -------------------------------------------------------------------------------- /NifProps/Modifier/AddDelMask16.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niftools/max_nif_plugin/f131c8c4ddefb12f6252d469552f607e5fdc7c4f/NifProps/Modifier/AddDelMask16.bmp -------------------------------------------------------------------------------- /NifProps/Modifier/bmp00003.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niftools/max_nif_plugin/f131c8c4ddefb12f6252d469552f607e5fdc7c4f/NifProps/Modifier/bmp00003.bmp -------------------------------------------------------------------------------- /NifProps/Modifier/selmask.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niftools/max_nif_plugin/f131c8c4ddefb12f6252d469552f607e5fdc7c4f/NifProps/Modifier/selmask.bmp -------------------------------------------------------------------------------- /NifProps/NifProps.def: -------------------------------------------------------------------------------- 1 | EXPORTS 2 | LibDescription @1 3 | LibNumberClasses @2 4 | LibClassDesc @3 5 | LibVersion @4 6 | SECTIONS 7 | .data READ WRITE 8 | -------------------------------------------------------------------------------- /NifProps/NifProps.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Max.h" 4 | #include "resource.h" 5 | #include "istdplug.h" 6 | #include "iparamb2.h" 7 | #include "iparamm2.h" 8 | 9 | #include "utilapi.h" 10 | 11 | extern TCHAR *GetString(int id); 12 | extern HINSTANCE hInstance; 13 | -------------------------------------------------------------------------------- /NifProps/NifStrings.h: -------------------------------------------------------------------------------- 1 | static const char *NpHvkMaterialNames[] = 2 | { 3 | "Stone", 4 | "Cloth", 5 | "Dirt", 6 | "Glass", 7 | "Grass", 8 | "Metal", 9 | "Organic", 10 | "Skin", 11 | "Water", 12 | "Wood", 13 | "Heavy Stone", 14 | "Heavy Metal", 15 | "Heavy Wood", 16 | "Chain", 17 | "Snow", 18 | "Stone Stairs", 19 | "Cloth Stairs", 20 | "Dirt Stairs", 21 | "Glass Stairs", 22 | "Grass Stairs", 23 | "Metal Stairs", 24 | "Organic Stairs", 25 | "Skin Stairs", 26 | "Water Stairs", 27 | "Wood Stairs", 28 | "Heavy Stone Stairs", 29 | "Heavy Metal Stairs", 30 | "Heavy Wood Stairs", 31 | "Chain Stairs", 32 | "Snow Stairs", 33 | "Elevator", 34 | NULL 35 | }; 36 | 37 | static const char *NpHvkLayerNames[] = 38 | { 39 | "Unidentified", 40 | "Static", 41 | "AnimStatic", 42 | "Transparent", 43 | "Clutter", 44 | "Weapon", 45 | "Projectile", 46 | "Spell", 47 | "Biped", 48 | "Tree", 49 | "Prop", 50 | "Water", 51 | "Trigger", 52 | "Terrain", 53 | "Trap", 54 | "NonCollidable", 55 | "CloudTrap", 56 | "Ground", 57 | "Portal", 58 | "Stairs", 59 | "CharController", 60 | "AvoidBox", 61 | "?", 62 | "?", 63 | "CameraPick", 64 | "ItemPick", 65 | "LineOfSight", 66 | "PathPick", 67 | "CustomPick1", 68 | "CustomPick2", 69 | "SpellExplosion", 70 | "DroppingPick", 71 | "Other", 72 | "Head", 73 | "Body", 74 | "Spine1", 75 | "Spine2", 76 | "LUpperArm", 77 | "LForeArm", 78 | "LHand", 79 | "LThigh", 80 | "LCalf", 81 | "LFoot", 82 | "RUpperArm", 83 | "RForeArm", 84 | "RHand", 85 | "RThigh", 86 | "RCalf", 87 | "RFoot", 88 | "Tail", 89 | "SideWeapon", 90 | "Shield", 91 | "Quiver", 92 | "BackWeapon", 93 | "BackWeapon", 94 | "PonyTail", 95 | "Wing", 96 | NULL 97 | }; 98 | 99 | static const char *NpHvkMotionSystems[] = 100 | { 101 | "0: Invalid", 102 | "1: Dynamic", 103 | "2: Sphere", 104 | "3: Sphere Inertia", 105 | "4: Box", 106 | "5: Box Stabilized", 107 | "6: Keyframed", 108 | "7: Fixed", 109 | "8: Thin Box", 110 | "9: Character", 111 | NULL 112 | }; 113 | 114 | static const char *NpHvkQualityTypes[] = 115 | { 116 | "0: Invalid", 117 | "1: Fixed", 118 | "2: Keyframed", 119 | "3: Debris", 120 | "4: Moving" 121 | "5: Critical", 122 | "6: Bullet", 123 | "7: User", 124 | "8: Character", 125 | "9: Keyframed Report", 126 | NULL 127 | }; 128 | -------------------------------------------------------------------------------- /NifProps/Shader/shaderutil.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////// 2 | // 3 | // Shader UI Utility routines 4 | // 5 | 6 | #ifndef SHADERUTIL_H 7 | #define SHADERUTIL_H 8 | 9 | //#include "ICompositeShader.h" 10 | //#include "expmtlControl.h" 11 | 12 | #define ALPHA_MIN 0.015f 13 | #define ALPHA_MAX 0.5f 14 | #define SPEC_MAX 0.5f 15 | 16 | #define ALPHA_SZ (ALPHA_MAX - ALPHA_MIN) 17 | 18 | #define DEFAULT_GLOSS2 0.03f 19 | #define DEFAULT_K_REFL 1.0f 20 | 21 | #define MIN_ORIENT -999.99 22 | #define MAX_ORIENT 999.99 23 | // 24 | // 25 | //class CombineComponentsCompShader : public Shader, public ISpecularCompositeShader, 26 | // public ExposureMaterialControl { 27 | //public: 28 | // CombineComponentsCompShader() : useComposite(false) {} 29 | // 30 | // ULONG GetRequirements( int subMtlNum ){ return isNoExposure() | MTLREQ_PHONG | MTLREQ_PREPRO; } 31 | // void CombineComponents( ShadeContext &sc, IllumParams& ip ); 32 | // 33 | // // [dl | 13march2003] Replaced this using statement by this inline function to 34 | // // resolve compile errors. 35 | // //using Shader::GetInterface; 36 | // virtual void* GetInterface(ULONG id) { return Shader::GetInterface(id); } 37 | // 38 | // virtual BaseInterface* GetInterface(Interface_ID id); 39 | // virtual void ChooseSpecularMethod(TimeValue t, RenderGlobalContext* rgc); 40 | // 41 | // bool getUseComposite() { return useComposite; } 42 | // 43 | //private: 44 | // bool useComposite; 45 | //}; 46 | 47 | 48 | void CombineComponentsAdd( IllumParams& ip ); 49 | 50 | #define TRANSP_SUB 0 51 | #define TRANSP_ADD 1 52 | #define TRANSP_FILTER 2 53 | 54 | Color transpColor( ULONG flags, float opac, Color& filt, Color& diff ); 55 | 56 | Color OrenNayarIllum( Point3& N, Point3& L, Point3& V, float rough, Color& rho, float* pDiffIntensOut, float NL = -2.0f ); 57 | 58 | float GaussHighlight( float gloss, float aniso, float orient, 59 | Point3& N, Point3& V, Point3& L, Point3& U, float* pNL ); 60 | 61 | Point3 GetTangent( ShadeContext &sc, int uvChan ); 62 | 63 | float GaussHiliteCurve2( float x, float y, float sLevel, float gloss, float aniso ); 64 | 65 | BOOL IsButtonChecked(HWND hWnd,int id); 66 | void CheckButton(HWND hWnd,int id, BOOL check); 67 | 68 | void SetupLockButton(HWND hWnd,int id, BOOL check); 69 | void SetupPadLockButton(HWND hWnd,int id, BOOL check); 70 | void LoadStdShaderResources(); 71 | 72 | // 2D version 73 | void DrawHilite(HDC hdc, Rect& rect, Shader* pShader ); 74 | LRESULT CALLBACK HiliteWndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); 75 | 76 | // anisotropic version, w layers: layer 0= ignore layers, 1=layer1, 2=layer2 77 | void DrawHilite2(HDC hdc, Rect& rect, Shader* pShader, int layer=0 ); 78 | LRESULT CALLBACK Hilite2WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); 79 | LRESULT CALLBACK Hilite2Layer1WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); 80 | LRESULT CALLBACK Hilite2Layer2WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ); 81 | void UpdateHilite( HWND hwHilite, Shader* pShader, int layer=0 ); 82 | void UpdateHilite2( HWND hwHilite, Shader* pShader, int layer=0 ); 83 | 84 | 85 | Color GetMtlColor( int i, Shader* pShader ) ; 86 | TCHAR *GetColorName( int i ); 87 | //void SetMtlColor(int i, Color c, StdShader* pShader, ColorSwatch* cs); 88 | void SetMtlColor(int i, Color c, Shader* pShader, IColorSwatch** cs, TimeValue t); 89 | 90 | inline float PcToFrac(int pc) { return (float)pc/100.0f; } 91 | 92 | inline int FracToPc(float f) { 93 | if (f<0.0) return (int)(100.0f*f - .5f); 94 | else return (int) (100.0f*f + .5f); 95 | } 96 | 97 | // Soften polynomials 98 | #define Soften SoftSpline2 99 | 100 | // Quadratic 101 | static inline float SoftSpline2(float r) { 102 | return r*(2.0f-r); 103 | } 104 | 105 | // Cubic 106 | static inline float SoftSpline3(float r) { 107 | return r*r*(3.0f-2.0f*r); 108 | } 109 | 110 | extern float const Pi; 111 | extern float const Pi2; 112 | 113 | // General math inlines 114 | inline float Sqr( float x ) { return x * x; } 115 | inline float Cube( float x ) { return x * x * x; } 116 | inline float Abs( float a ) { return (a < 0.0f) ? -a : a; } 117 | inline void MinMax( float& a, float& b ) { if (a > b){ float tmp=a; a=b; b=tmp;} } 118 | inline float Dot( Point3& a, Point3& b ) { return a.x * b.x + a.y * b.y + a.z * b.z; } 119 | inline float Len2( Point3& a ) { return Dot(a,a); } 120 | inline float Len( Point3& a ) { return float( sqrt( Len2(a))); } 121 | inline Point3 Normalize( Point3& a ) { float d = Len(a); return d==0.0f ? Point3(0,0,1) : a*(1.0f/d); } 122 | inline float AngleBetween( Point3& a, Point3& b ) { 123 | return float( acos( Dot(a,b)/(Len(a)*Len(b)) )); 124 | } 125 | inline float Min( float a, float b ) { return (a < b) ? a : b; } 126 | inline float Min( float a, float b, float c ) { return (a < b) ? Min(a,c) : Min(b,c); } 127 | inline float Min( Color& c ){ return Min( c.r, c.g, c.b ); } 128 | inline float Max( float a, float b ) { return (a < b) ? b : a; } 129 | inline float Max( float a, float b, float c ) { return (a < b) ? Max( b, c ) : Max(a,c); } 130 | inline float Max( Color& c ){ return Max( c.r, c.g, c.b ); } 131 | 132 | inline float NormClr( Color& a ){ float m = Max( a ); if(m !=0.0f) a /= m; return m; } 133 | 134 | inline float Bound0_1( float x ){ return x < 0.0f ? 0.0f : ( x > 1.0f ? 1.0f : x); } 135 | inline float Bound( float x, float min = 0.0f, float max = 1.0f ){ return x < min? min:( x > max? max : x); } 136 | inline float UBound( float x, float max = 1.0f ){ return x > max ? max : x; } 137 | inline float LBound( float x, float min = 0.0f ){ return x < min ? min : x; } 138 | inline Color Bound( Color& c ) 139 | { return Color( Bound(c.r), Bound(c.g), Bound(c.b) ); } 140 | 141 | inline Color UBound( Color& c, float max = 1.0f ) 142 | { return Color( UBound(c.r,max), UBound(c.g,max), UBound(c.b,max) ); } 143 | inline Color LBound( Color& c, float min = 0.0f ) 144 | { return Color( LBound(c.r, min), LBound(c.g, min), LBound(c.b, min) ); } 145 | 146 | //inline Point3 Cross( Point3 v0, Point3 v1 ){ return CrossProd( v0, v1 ); } 147 | 148 | 149 | inline float DegToRdn( float d ){ return d * (1.0f/180.0f) * Pi; } // d/360*2*pi 150 | inline float RdnToDeg( float r ){ return r * 180.0f * (1.0f/Pi); } // r/2pi*360 151 | 152 | Point3 RotateVec( Point3& p, Point3& axis, float rdn ); 153 | 154 | #endif -------------------------------------------------------------------------------- /NifProps/bhkHelperFuncs.h: -------------------------------------------------------------------------------- 1 | #ifndef __BHKHELPERFUNCS_H__ 2 | #define __BHKHELPERFUNCS_H__ 3 | 4 | extern void CalcAxisAlignedBox(Mesh& mesh, Box3& box); 5 | extern void CalcAxisAlignedBox(Mesh& mesh, Box3& box, Matrix3* tm); 6 | extern void CalcAxisAlignedSphere(Mesh& mesh, Point3& center, float& radius); 7 | extern void CalcCenteredSphere(Mesh& mesh, Point3& center, float& radius); 8 | extern void CalcCapsule(Mesh &mesh, Point3& pt1, Point3& pt2, float& r1, float& r2); 9 | extern void CalcOrientedBox(Mesh &mesh, float& udim, float& vdim, float& ndim, Point3& center, Matrix3& rtm); 10 | extern bool CanCalcCapsule(); 11 | extern bool CanCalcOrientedBox(); 12 | 13 | extern void BuildBox(Mesh&mesh, float l, float w, float h); 14 | extern void BuildSphere(Mesh&mesh, float radius, int segs=32, int smooth=1, float startAng = 0.0f); 15 | extern void BuildCapsule(Mesh &mesh, Point3 pt1, Point3 pt2, float r1, float r2); 16 | extern void BuildScubaMesh(Mesh &mesh, int segs, int smooth, int llsegs, 17 | float radius1, float radius2, float cylh); 18 | 19 | #endif -------------------------------------------------------------------------------- /NifProps/bhkHelperInterface.cpp: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: bhkHelperInterface.cpp 4 | 5 | DESCRIPTION: Collision Helper Object Implementation 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | V1.0 - Derived from 3ds max prim sphere example 11 | 12 | *> Copyright (c) 2006, All Rights Reserved. 13 | **********************************************************************/ 14 | #pragma warning( disable:4800 ) 15 | #include 16 | #include "MAX_Mem.h" 17 | #include 18 | #include "NifProps.h" 19 | #include "iparamm.h" 20 | #include "Simpobj.h" 21 | #include "notify.h" 22 | #include "macroRec.h" 23 | #include "bhkHelperInterface.h" 24 | #include "NifPlugins.h" 25 | #include "NifGui.h" 26 | #include "NifStrings.h" 27 | //--- Parameter map/block descriptors ------------------------------- 28 | 29 | 30 | FPInterfaceDesc thebhkHelperInterface( 31 | BHKHELPERINTERFACE_DESC, _T("bhkHelper"), -1/*IDS_OPS*/, 0, FP_MIXIN, 32 | 33 | bhkHelperInterface::get_mesh, _T("getMesh"), 0, TYPE_MESH, 0, 0, 34 | END); 35 | 36 | FPInterfaceDesc *bhkHelperInterface::GetDesc() { 37 | return &thebhkHelperInterface; 38 | } 39 | 40 | FPInterfaceDesc* GetbhkHelperInterfaceDesc() 41 | { 42 | return &thebhkHelperInterface; 43 | } 44 | -------------------------------------------------------------------------------- /NifProps/bhkHelperInterface.h: -------------------------------------------------------------------------------- 1 | /********************************************************************** 2 | *< 3 | FILE: bhkHelperInterface.hpp 4 | 5 | DESCRIPTION: Collision Helper Object Declration 6 | 7 | CREATED BY: tazpn (Theo) 8 | 9 | HISTORY: 10 | V1.0 - Derived from 3ds max prim Helper example 11 | 12 | *> Copyright (c) 2006, All Rights Reserved. 13 | **********************************************************************/ 14 | #ifndef __BHKHELPERINTERFACE__H 15 | #define __BHKHELPERINTERFACE__H 16 | 17 | #include 18 | 19 | #ifndef _countof 20 | #define _countof(x) (sizeof(x)/sizeof((x)[0])) 21 | #endif 22 | 23 | //! The unique instance of the helper interface 24 | extern CoreExport FPInterfaceDesc gbhkHelperDesc; 25 | 26 | const Interface_ID BHKHELPERINTERFACE_DESC(0xd4ecb630, 0x52c54024); 27 | 28 | extern FPInterfaceDesc* GetbhkHelperInterfaceDesc(); 29 | 30 | class bhkHelperInterface : public FPMixinInterface 31 | { 32 | public: 33 | virtual const Mesh* GetMesh() const = 0 ; 34 | 35 | //Function Publishing System 36 | enum { 37 | get_mesh, 38 | }; 39 | 40 | //Function Map For Mixin Interface 41 | //************************************************* 42 | BEGIN_FUNCTION_MAP 43 | FN_0(get_mesh, TYPE_MESH, GetMesh) \ 44 | END_FUNCTION_MAP 45 | 46 | FPInterfaceDesc* GetDesc(); // <--- Must Implement 47 | //************************************************** 48 | }; 49 | 50 | #endif -------------------------------------------------------------------------------- /NifProps/dds/dds.dep: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Generated Dependency File, included by dds.mak 2 | 3 | .\dds.cpp : \ 4 | "..\..\..\include\acolor.h"\ 5 | "..\..\..\include\ActionTable.h"\ 6 | "..\..\..\include\animtbl.h"\ 7 | "..\..\..\include\appio.h"\ 8 | "..\..\..\include\assert1.h"\ 9 | "..\..\..\include\baseinterface.h"\ 10 | "..\..\..\include\bitarray.h"\ 11 | "..\..\..\include\bitmap.h"\ 12 | "..\..\..\include\bmmlib.h"\ 13 | "..\..\..\include\box2.h"\ 14 | "..\..\..\include\box3.h"\ 15 | "..\..\..\include\buildver.h"\ 16 | "..\..\..\include\captypes.h"\ 17 | "..\..\..\include\channels.h"\ 18 | "..\..\..\include\cmdmode.h"\ 19 | "..\..\..\include\color.h"\ 20 | "..\..\..\include\coreexp.h"\ 21 | "..\..\..\include\custcont.h"\ 22 | "..\..\..\include\dbgprint.h"\ 23 | "..\..\..\include\dpoint3.h"\ 24 | "..\..\..\include\euler.h"\ 25 | "..\..\..\include\evuser.h"\ 26 | "..\..\..\include\excllist.h"\ 27 | "..\..\..\include\export.h"\ 28 | "..\..\..\include\gbuf.h"\ 29 | "..\..\..\include\gencam.h"\ 30 | "..\..\..\include\genhier.h"\ 31 | "..\..\..\include\genlight.h"\ 32 | "..\..\..\include\genshape.h"\ 33 | "..\..\..\include\geom.h"\ 34 | "..\..\..\include\geomlib.h"\ 35 | "..\..\..\include\gfloat.h"\ 36 | "..\..\..\include\gfx.h"\ 37 | "..\..\..\include\gfxlib.h"\ 38 | "..\..\..\include\gutil.h"\ 39 | "..\..\..\include\hitdata.h"\ 40 | "..\..\..\include\hold.h"\ 41 | "..\..\..\include\iColorMan.h"\ 42 | "..\..\..\include\iFnPub.h"\ 43 | "..\..\..\include\impapi.h"\ 44 | "..\..\..\include\impexp.h"\ 45 | "..\..\..\include\impexpintf.h"\ 46 | "..\..\..\include\imtl.h"\ 47 | "..\..\..\include\inode.h"\ 48 | "..\..\..\include\INodeGIProperties.h"\ 49 | "..\..\..\include\interval.h"\ 50 | "..\..\..\include\ioapi.h"\ 51 | "..\..\..\include\iparamb.h"\ 52 | "..\..\..\include\ipipelineclient.h"\ 53 | "..\..\..\include\ipoint2.h"\ 54 | "..\..\..\include\ipoint3.h"\ 55 | "..\..\..\include\istdplug.h"\ 56 | "..\..\..\include\iTreeVw.h"\ 57 | "..\..\..\include\linklist.h"\ 58 | "..\..\..\include\lockid.h"\ 59 | "..\..\..\include\log.h"\ 60 | "..\..\..\include\matrix2.h"\ 61 | "..\..\..\include\matrix3.h"\ 62 | "..\..\..\include\max.h"\ 63 | "..\..\..\include\maxapi.h"\ 64 | "..\..\..\include\maxcom.h"\ 65 | "..\..\..\include\maxtess.h"\ 66 | "..\..\..\include\maxtypes.h"\ 67 | "..\..\..\include\mesh.h"\ 68 | "..\..\..\include\meshlib.h"\ 69 | "..\..\..\include\MNBigMat.h"\ 70 | "..\..\..\include\MNCommon.h"\ 71 | "..\..\..\include\mnmath.h"\ 72 | "..\..\..\include\MNMesh.h"\ 73 | "..\..\..\include\MNNormalSpec.h"\ 74 | "..\..\..\include\mouseman.h"\ 75 | "..\..\..\include\mtl.h"\ 76 | "..\..\..\include\namesel.h"\ 77 | "..\..\..\include\nametab.h"\ 78 | "..\..\..\include\object.h"\ 79 | "..\..\..\include\objmode.h"\ 80 | "..\..\..\include\palutil.h"\ 81 | "..\..\..\include\paramtype.h"\ 82 | "..\..\..\include\patch.h"\ 83 | "..\..\..\include\patchlib.h"\ 84 | "..\..\..\include\patchobj.h"\ 85 | "..\..\..\include\pixelbuf.h"\ 86 | "..\..\..\include\plugapi.h"\ 87 | "..\..\..\include\plugin.h"\ 88 | "..\..\..\include\point2.h"\ 89 | "..\..\..\include\point3.h"\ 90 | "..\..\..\include\point4.h"\ 91 | "..\..\..\include\polyobj.h"\ 92 | "..\..\..\include\polyshp.h"\ 93 | "..\..\..\include\ptrvec.h"\ 94 | "..\..\..\include\quat.h"\ 95 | "..\..\..\include\random.h"\ 96 | "..\..\..\include\ref.h"\ 97 | "..\..\..\include\render.h"\ 98 | "..\..\..\include\RenderElements.h"\ 99 | "..\..\..\include\rtclick.h"\ 100 | "..\..\..\include\sbmtlapi.h"\ 101 | "..\..\..\include\sceneapi.h"\ 102 | "..\..\..\include\sfx.h"\ 103 | "..\..\..\include\shape.h"\ 104 | "..\..\..\include\shphier.h"\ 105 | "..\..\..\include\shpsels.h"\ 106 | "..\..\..\include\snap.h"\ 107 | "..\..\..\include\soundobj.h"\ 108 | "..\..\..\include\spline3d.h"\ 109 | "..\..\..\include\stack.h"\ 110 | "..\..\..\include\stack3.h"\ 111 | "..\..\..\include\strbasic.h"\ 112 | "..\..\..\include\strclass.h"\ 113 | "..\..\..\include\SvCore.h"\ 114 | "..\..\..\include\SystemUtilities.h"\ 115 | "..\..\..\include\tab.h"\ 116 | "..\..\..\include\templt.h"\ 117 | "..\..\..\include\trig.h"\ 118 | "..\..\..\include\triobj.h"\ 119 | "..\..\..\include\udmIA64.h"\ 120 | "..\..\..\include\units.h"\ 121 | "..\..\..\include\utilexp.h"\ 122 | "..\..\..\include\utilintf.h"\ 123 | "..\..\..\include\utillib.h"\ 124 | "..\..\..\include\vedge.h"\ 125 | "..\..\..\include\winutil.h"\ 126 | ".\DDS.H"\ 127 | ".\dxtlib.h"\ 128 | 129 | -------------------------------------------------------------------------------- /NifProps/dds/dds.h: -------------------------------------------------------------------------------- 1 | // File ....: dds.h 2 | // ---------------- 3 | // Author...: Sean Palmer 4 | // Date ....: April 2001 5 | // Descr....: DDS File I/O Module 6 | 7 | #ifndef _DDSCLASS_ 8 | #define _DDSCLASS_ 9 | 10 | #define DLLEXPORT __declspec(dllexport) 11 | 12 | #define DDS_CLASS_ID Class_ID(0xe3061ca, 0xd2120de) 13 | 14 | #pragma pack(push,1) 15 | 16 | struct DDSCOLORKEY 17 | { 18 | DWORD dwColorSpaceLowValue; // low boundary of color space that is to 19 | // be treated as Color Key, inclusive 20 | DWORD dwColorSpaceHighValue; // high boundary of color space that is 21 | }; 22 | 23 | struct DDSFILEHEADER 24 | { 25 | DWORD dwMagic; // (0x20534444, or "DDS ") 26 | 27 | // the following matches DDSURFACEDESC2 28 | DWORD dwSize; // size of the DDSURFACEDESC structure 29 | DWORD dwFlags; // determines what fields are valid 30 | DWORD dwHeight; // height of surface to be created 31 | DWORD dwWidth; // width of input surface 32 | long lPitch; // distance to start of next line (return value only) 33 | DWORD dwDepth; // the depth if this is a volume texture 34 | DWORD dwMipMapCount; // number of mip-map levels requested 35 | DWORD dwAlphaBitDepth; // depth of alpha buffer requested 36 | DWORD dwReserved; // reserved 37 | void* lpSurface; // pointer to the associated surface memory 38 | DDSCOLORKEY ddckCKDestOverlay; // color key for destination overlay use 39 | DDSCOLORKEY ddckCKDestBlt; // color key for destination blt use 40 | DDSCOLORKEY ddckCKSrcOverlay; // color key for source overlay use 41 | DDSCOLORKEY ddckCKSrcBlt; // color key for source blt use 42 | 43 | // from DDPIXELFORMAT structure 44 | DWORD dwPFSize; // size of DDPIXELFORMAT structure 45 | DWORD dwPFFlags; // pixel format flags 46 | DWORD dwFourCC; // (FOURCC code) 47 | DWORD dwRGBBitCount; // how many bits per pixel 48 | DWORD dwRBitMask; // mask for red bit 49 | DWORD dwGBitMask; // mask for green bits 50 | DWORD dwBBitMask; // mask for blue bits 51 | DWORD dwRGBAlphaBitMask; // mask for alpha channel 52 | 53 | // from DDSCAPS2 structure 54 | DWORD dwCaps; // capabilities of surface wanted 55 | DWORD dwCaps2; 56 | DWORD dwCaps3; 57 | DWORD dwVolumeDepth; 58 | 59 | DWORD dwTextureStage; // stage in multitexture cascade 60 | //BYTE bData1[]; // Data for the main surface 61 | //[BYTE bData2[]]; // Data for attached surfaces, if any, follows. 62 | }; 63 | 64 | #pragma pack(pop) 65 | 66 | enum 67 | { 68 | TF_DITHER = 0x40000000, 69 | TF_MIPMAPS = 0x80000000, 70 | TF_FMTMASK = 0x0000FFFF, 71 | }; 72 | 73 | struct DDSParams 74 | { 75 | int outFormat; // Output format 76 | }; 77 | 78 | class BitmapIO_DDS : public BitmapIO 79 | { 80 | 81 | private: 82 | 83 | DDSFILEHEADER hdr; 84 | DDSParams mParams; 85 | 86 | public: 87 | 88 | //-- Constructors/Destructors 89 | 90 | BitmapIO_DDS (); 91 | ~BitmapIO_DDS (); 92 | 93 | //-- Number of extemsions supported 94 | 95 | int ExtCount () { return 1; } 96 | 97 | //-- Extension #n (i.e. "3DS") 98 | 99 | const TCHAR *Ext (int n) { return _T("dds"); } 100 | 101 | //-- Descriptions 102 | 103 | const TCHAR *LongDesc (); 104 | const TCHAR *ShortDesc (); 105 | 106 | //-- Miscelaneous Messages 107 | 108 | const TCHAR *AuthorName () { return _T("Sean Palmer");} 109 | const TCHAR *CopyrightMessage () { return _T("Copyright 2001 Treyarch LLC");} 110 | const TCHAR *OtherMessage1 () { return _T("");} 111 | const TCHAR *OtherMessage2 () { return _T("");} 112 | 113 | unsigned int Version () { return (100);} 114 | 115 | //-- Driver capabilities 116 | 117 | int Capability () { return BMMIO_READER | 118 | // BMMIO_WRITER | 119 | BMMIO_EXTENSION | 120 | BMMIO_CONTROLWRITE;} 121 | 122 | //-- Driver Configuration 123 | 124 | BOOL LoadConfigure (void *ptr); 125 | BOOL SaveConfigure (void *ptr); 126 | DWORD EvaluateConfigure () { return sizeof(DDSParams); } 127 | 128 | //-- Show DLL's "About..." box 129 | 130 | void ShowAbout (HWND hWnd); 131 | 132 | //-- Show Image's control Dlg Box 133 | BOOL ShowControl (HWND hWnd, DWORD flag); 134 | 135 | //-- Return info about image 136 | 137 | BMMRES GetImageInfo (BitmapInfo *fbi); 138 | 139 | //-- Image Input 140 | 141 | BitmapStorage *Load (BitmapInfo *fbi, Bitmap *map, BMMRES *status); 142 | 143 | //-- Image Output 144 | 145 | BMMRES OpenOutput (BitmapInfo *fbi, Bitmap *map); 146 | BMMRES Write (int frame); 147 | int Close (int flag); 148 | 149 | //-- This handler's specialized functions 150 | 151 | int ReadDDSHeader (FILE *stream); 152 | 153 | //-- Dialog Proc for the Image control Dlg box 154 | 155 | BOOL ConfigCtrlDlgProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam); 156 | }; 157 | 158 | #endif _DDSCLASS_ 159 | 160 | -------------------------------------------------------------------------------- /NifProps/dds/dds.rc: -------------------------------------------------------------------------------- 1 | //Microsoft Developer Studio generated resource script. 2 | // 3 | #include "ddsres.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #define APSTUDIO_HIDDEN_SYMBOLS 11 | #include 12 | #undef APSTUDIO_HIDDEN_SYMBOLS 13 | 14 | ///////////////////////////////////////////////////////////////////////////// 15 | #undef APSTUDIO_READONLY_SYMBOLS 16 | 17 | ///////////////////////////////////////////////////////////////////////////// 18 | // English (U.S.) resources 19 | 20 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 21 | #ifdef _WIN32 22 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 23 | #pragma code_page(1252) 24 | #endif //_WIN32 25 | 26 | #ifdef APSTUDIO_INVOKED 27 | ///////////////////////////////////////////////////////////////////////////// 28 | // 29 | // TEXTINCLUDE 30 | // 31 | 32 | 1 TEXTINCLUDE DISCARDABLE 33 | BEGIN 34 | "ddsres.h\0" 35 | END 36 | 37 | 2 TEXTINCLUDE DISCARDABLE 38 | BEGIN 39 | "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" 40 | "#include \r\n" 41 | "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" 42 | "\0" 43 | END 44 | 45 | 3 TEXTINCLUDE DISCARDABLE 46 | BEGIN 47 | "#include ""veroverrides.h""\r\n" 48 | "#include ""maxversion.r""\r\n" 49 | "\0" 50 | END 51 | 52 | #endif // APSTUDIO_INVOKED 53 | 54 | 55 | ///////////////////////////////////////////////////////////////////////////// 56 | // 57 | // Dialog 58 | // 59 | 60 | IDD_DDS_ABOUT DIALOG DISCARDABLE 0, 0, 166, 97 61 | STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU 62 | CAPTION "About DDS Image File I/O" 63 | FONT 8, "MS Sans Serif" 64 | BEGIN 65 | DEFPUSHBUTTON "OK",IDOK,108,77,50,14 66 | RTEXT "DDS File I/O Module",IDC_STATIC,37,9,118,9 67 | RTEXT "Version 1.0",IDC_STATIC,37,19,118,9 68 | GROUPBOX "",IDC_STATIC,8,2,151,29 69 | RTEXT "Author: Sean L. Palmer",IDC_STATIC,9,38,148,8 70 | RTEXT "Copyright 2001 Treyarch LLC",IDC_STATIC,9,50,148,8 71 | RTEXT "Using NVIDIA nvDXTlib DDS converter",IDC_STATIC,9,62, 72 | 148,8 73 | END 74 | 75 | IDD_DDS_CONFIG DIALOG DISCARDABLE 0, 0, 177, 185 76 | STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU 77 | CAPTION "DDS Configuration" 78 | FONT 8, "MS Sans Serif" 79 | BEGIN 80 | GROUPBOX "Colors",-1,6,2,164,127,WS_GROUP 81 | CONTROL "DXT1 Compression",IDC_DDS_DXT1,"Button", 82 | BS_AUTORADIOBUTTON | WS_GROUP,29,15,128,10 83 | CONTROL "DXT1 with 1 bit alpha",IDC_DDS_DXT1ALPHA,"Button", 84 | BS_AUTORADIOBUTTON,29,29,125,10 85 | CONTROL "DXT3 Compressed with alpha",IDC_DDS_DXT3,"Button", 86 | BS_AUTORADIOBUTTON,29,43,125,10 87 | CONTROL "DXT5 Compressed with alpha",IDC_DDS_DXT5,"Button", 88 | BS_AUTORADIOBUTTON,29,57,125,10 89 | CONTROL "ARGB 4444",IDC_DDS_ARGB4444,"Button",BS_AUTORADIOBUTTON, 90 | 29,71,125,10 91 | CONTROL "ARGB 1555",IDC_DDS_ARGB1555,"Button",BS_AUTORADIOBUTTON, 92 | 29,85,125,10 93 | CONTROL "RGB 565",IDC_DDS_RGB565,"Button",BS_AUTORADIOBUTTON,29, 94 | 99,125,10 95 | CONTROL "ARGB 8888",IDC_DDS_ARGB8888,"Button",BS_AUTORADIOBUTTON, 96 | 29,113,125,10 97 | DEFPUSHBUTTON "OK",IDOK,38,165,50,14 98 | PUSHBUTTON "Cancel",IDCANCEL,94,165,50,14 99 | CONTROL "Dither",IDC_DDS_DITHER,"Button",BS_AUTOCHECKBOX | 100 | WS_TABSTOP,30,135,95,9 101 | CONTROL "Generate Mipmaps",IDC_DDS_MIPMAPS,"Button", 102 | BS_AUTOCHECKBOX | WS_TABSTOP,30,148,96,10 103 | END 104 | 105 | 106 | ///////////////////////////////////////////////////////////////////////////// 107 | // 108 | // DESIGNINFO 109 | // 110 | 111 | #ifdef APSTUDIO_INVOKED 112 | GUIDELINES DESIGNINFO DISCARDABLE 113 | BEGIN 114 | IDD_DDS_CONFIG, DIALOG 115 | BEGIN 116 | LEFTMARGIN, 7 117 | RIGHTMARGIN, 170 118 | TOPMARGIN, 7 119 | BOTTOMMARGIN, 179 120 | END 121 | END 122 | #endif // APSTUDIO_INVOKED 123 | 124 | 125 | ///////////////////////////////////////////////////////////////////////////// 126 | // 127 | // String Table 128 | // 129 | 130 | STRINGTABLE DISCARDABLE 131 | BEGIN 132 | IDS_DDS "DDS" 133 | IDS_BITMAP_IO "Bitmap I/O" 134 | IDS_DDS_FILE "DDS Image File" 135 | IDS_UNSUPPORTED "Unsupported DDS Image File" 136 | IDS_CONVERT_ERROR "Error converting bitmap" 137 | IDS_DDS_DESC "DDS file I/O" 138 | IDS_NONPOWEROF2_ERROR "Dimensions not power of 2" 139 | IDS_UNSUPPORTEDFORMAT_ERROR "Unsupported format" 140 | END 141 | 142 | #endif // English (U.S.) resources 143 | ///////////////////////////////////////////////////////////////////////////// 144 | 145 | 146 | 147 | #ifndef APSTUDIO_INVOKED 148 | ///////////////////////////////////////////////////////////////////////////// 149 | // 150 | // Generated from the TEXTINCLUDE 3 resource. 151 | // 152 | #include "veroverrides.h" 153 | 154 | ///////////////////////////////////////////////////////////////////////////// 155 | #endif // not APSTUDIO_INVOKED 156 | 157 | -------------------------------------------------------------------------------- /NifProps/dds/ddsres.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Developer Studio generated include file. 3 | // Used by dds.rc 4 | // 5 | #define IDS_DDS 1 6 | #define IDS_BITMAP_IO 2 7 | #define IDS_DDS_FILE 3 8 | #define IDS_UNSUPPORTED 4 9 | #define IDS_CONVERT_ERROR 5 10 | #define IDS_DDS_DESC 6 11 | #define IDS_NONPOWEROF2_ERROR 7 12 | #define IDS_UNSUPPORTEDFORMAT_ERROR 8 13 | #define IDD_DDS_ABOUT 101 14 | #define IDD_DDS_CONTROL 102 15 | #define IDD_DDS_CONFIG 102 16 | #define IDC_DDS_PALETTE 1000 17 | #define IDC_DDS_DXT1 1000 18 | #define IDC_RAD_NTSC 1001 19 | #define IDC_RAD_24 1001 20 | #define IDC_DDS_RGB24 1001 21 | #define IDC_DDS_ARGB8888 1001 22 | #define IDC_RAD_PAL 1002 23 | #define IDC_RAD_8 1002 24 | #define IDC_DDS_DXT3 1002 25 | #define IDC_EDIT_X 1003 26 | #define IDC_DDS_DXT1ALPHA 1003 27 | #define IDC_EDIT_Y 1004 28 | #define IDC_DDS_DXT5 1004 29 | #define IDC_RAD_CUSTOM 1005 30 | #define IDC_DDS_ARGB1555 1005 31 | #define IDC_DDS_ARGB4444 1006 32 | #define IDC_DDS_RGB565 1007 33 | #define IDC_DDS_DITHER 1008 34 | #define IDC_DDS_MIPMAPS 1009 35 | #define IDC_STATIC -1 36 | 37 | // Next default values for new objects 38 | // 39 | #ifdef APSTUDIO_INVOKED 40 | #ifndef APSTUDIO_READONLY_SYMBOLS 41 | #define _APS_NEXT_RESOURCE_VALUE 103 42 | #define _APS_NEXT_COMMAND_VALUE 40001 43 | #define _APS_NEXT_CONTROL_VALUE 1010 44 | #define _APS_NEXT_SYMED_VALUE 101 45 | #endif 46 | #endif 47 | -------------------------------------------------------------------------------- /NifProps/dds/dxtlib.h: -------------------------------------------------------------------------------- 1 | /*********************************************************************NVMH2**** 2 | Path: C:\Dev\devrel\Nv_sdk_4\Dx8_private\PhotoShop\dxtlib 3 | File: dxtlib.h 4 | 5 | Copyright (C) 1999, 2000 NVIDIA Corporation 6 | This file is provided without support, instruction, or implied warranty of any 7 | kind. NVIDIA makes no guarantee of its fitness for a particular purpose and is 8 | not liable under any circumstances for any damages or loss whatsoever arising 9 | from the use or inability to use this file or items derived from it. 10 | 11 | Comments: 12 | 13 | 14 | ******************************************************************************/ 15 | 16 | 17 | 18 | 19 | #pragma comment(lib, "..\\NifProps\\dds\\nvDXTlib.lib") 20 | //#pragma comment(lib, "..\\NifProps\\dds\\nvDXTlib.vc7.lib") 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | typedef HRESULT (*MIPcallback)(void * data, int miplevel, DWORD size); 30 | // call back 31 | // pointer to data 32 | // mip level 33 | // size of chunk 34 | 35 | 36 | /* 37 | Compresses an image with a user supplied callback with the data for each MIP level created 38 | Only supports input of RGB 24 or ARGB 32 bpp 39 | */ 40 | HRESULT nvDXTcompress(unsigned char * raw_data, // pointer to data (24 or 32 bit) 41 | unsigned long w, // width in texels 42 | unsigned long h, // height in texels 43 | DWORD TextureFormat, // list below 44 | bool bGenMipMaps, // auto gen MIP maps 45 | bool bDither, 46 | DWORD depth, // 3 or 4 47 | MIPcallback callback = 0); // callback for generated levels 48 | // if callback is == 0 (or not specified), then WriteDTXnFile is called with all file info 49 | // 50 | // You must write the routines (or provide stubs) 51 | // void WriteDTXnFile(count, buffer); 52 | // void ReadDTXnFile(count, buffer); 53 | // 54 | // 55 | /* returns 56 | w width 57 | h height 58 | depth ( 3 or 4) 59 | total_width 60 | rowBytes - pitch 61 | 62 | */ 63 | unsigned char * nvDXTdecompress(int & w, int & h, int & depth, int & total_width, int & rowBytes); 64 | 65 | 66 | // see examples 67 | 68 | 69 | void WriteDTXnFile(DWORD count, void * buffer); 70 | void ReadDTXnFile(DWORD count, void * buffer); 71 | 72 | 73 | // TextureFormat 74 | #define TF_DXT1 10 75 | #define TF_DXT1_1BitAlpha 11 76 | #define TF_DXT3 12 77 | #define TF_DXT5 13 78 | #define TF_RGB4444 14 79 | #define TF_RGB1555 15 80 | #define TF_RGB565 16 81 | #define TF_RGB8888 17 82 | 83 | 84 | #define DXTERR_INPUT_POINTER_ZERO -1 85 | #define DXTERR_DEPTH_IS_NOT_3_OR_4 -2 86 | #define DXTERR_NON_POWER_2 -3 87 | 88 | /* example 89 | 90 | LPDIRECT3DTEXTURE8 pCurrentTexture = 0; 91 | 92 | HRESULT LoadAllMipSurfaces(void * data, int iLevel) 93 | { 94 | HRESULT hr; 95 | LPDIRECT3DSURFACE8 psurf; 96 | D3DSURFACE_DESC sd; 97 | D3DLOCKED_RECT lr; 98 | 99 | hr = pCurrentTexture->GetSurfaceLevel(iLevel, &psurf); 100 | 101 | if (FAILED(hr)) 102 | return hr; 103 | psurf->GetDesc(&sd); 104 | 105 | 106 | hr = pCurrentTexture->LockRect(iLevel, &lr, NULL, 0); 107 | if (FAILED(hr)) 108 | return hr; 109 | 110 | memcpy(lr.pBits, data, sd.Size); 111 | 112 | hr = pCurrentTexture->UnlockRect(iLevel); 113 | 114 | ReleasePpo(&psurf); 115 | 116 | return 0; 117 | } 118 | 119 | 120 | hr = D3DXCreateTexture(m_pd3dDevice, Width, Height, nMips, 0, D3DFMT_DXT3, D3DPOOL_MANAGED, &pCurrentTexture); 121 | nvDXTcompress(raw_data, Width, Height, DXT3, true, 4, LoadAllMipSurfaces); 122 | 123 | */ 124 | 125 | -------------------------------------------------------------------------------- /NifProps/dds/nvDXTlib.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niftools/max_nif_plugin/f131c8c4ddefb12f6252d469552f607e5fdc7c4f/NifProps/dds/nvDXTlib.lib -------------------------------------------------------------------------------- /NifProps/dds/nvErrorCodes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef enum NV_ERROR_CODE 4 | { 5 | NV_OK = 0, 6 | NV_FAIL = -1, // generic 7 | NV_CANT_OPEN_INPUT_FILE = -2, 8 | NV_CANT_OPEN_OUTPUT_FILE = -3, 9 | NV_BAD_OPTION = -4, 10 | NV_BAD_OUTPUT_DIRECTORY = -5, 11 | NV_CANT_DECOMPRESS_IMAGE = -6, 12 | NV_BAD_LIST_FILE = -7, 13 | NV_CANT_OPEN_LIST_FILE = -8, 14 | NV_BAD_LIST_FILE_CONTENTS = -9, 15 | NV_IMAGE_NOT_SQUARE = -10, 16 | NV_IMAGES_NOT_SAME_SIZE = -11, 17 | NV_UNKNOWN_CONVERSION = -12, // for normal map generation 18 | NV_CANT_OPEN_PROFILE = -13, 19 | NV_IMAGE_NOT_MULT4 = -14, 20 | NV_OUTPUT_FILE_IS_READ_ONLY= -15, 21 | NV_INPUT_POINTER_ZERO = -16, 22 | NV_DEPTH_IS_NOT_3_OR_4 = -17, 23 | NV_IMAGE_NOT_POWER_2 = -18, 24 | NV_CANT_MAKE_MATRIX = -19, 25 | NV_CANT_NORMALIZE = -20, 26 | NV_CANT_INVERT_MATRIX = -21, 27 | NV_CANT_MAKE_VECTOR = -22, 28 | NV_CANT_INITIALIZE_CONVOLVER = -23, 29 | NV_EMPTY_IMAGE = -24, 30 | NV_BAD_FLAGS = -25, 31 | NV_GBM_IO_ERR = -26, 32 | NV_TGA_IO_ERR = -27, 33 | NV_TGA_RLE_ERR = -28, 34 | NV_PNG_IO_ERR = -29, 35 | NV_CANT_CREATE_INDEX_BUFFER= -30, 36 | NV_CANT_CREATE_CUBE_MAP = -31, 37 | NV_BAD_FORMAT = -32, 38 | NV_CANT_CREATE_TEXTURE = -33, 39 | NV_UNKNOWN_FORMAT = -34, 40 | NV_CANT_CREATE_VERTEX_BUFFER = -35, 41 | NV_CANT_CREATE_PIXEL_SHADER= -36, 42 | NV_CANT_CREATE_VERTEX_DECL = -37, 43 | NV_NEED_4_PLANES_FOR_RGBE = -38, 44 | NV_PSD_IO_ERR = -39, 45 | NV_NO_FILENAME = -40, 46 | 47 | NV_CANT_DECOMPOSE_MATRIX = -41, 48 | NV_HDR_IO_ERR = -42, 49 | NV_RGBA_IO_ERR = -43, 50 | NV_READ_FAILED = -44, 51 | NV_WRITE_FAILED = -45, 52 | NV_BAD_ARG = -46, 53 | NV_CANT_LOCK = -47, 54 | NV_FAILED_UNLOCK = -48, 55 | NV_NOT_RING_LOOP = -49, 56 | 57 | NV_CHART_FOLDED = -50, 58 | NV_CHART_CANNOT_INVERT = -51, 59 | NV_CHART_BAD_PERIMETER = -52, 60 | NV_CHART_NO_DATA = -53, 61 | NV_CHART_CANT_OPTIMIZE = -54, 62 | NV_CHART_NO_POINTS_FOUND = -55, 63 | NV_CHART_ZERO_SIZE = -56, 64 | NV_CHART_NO_UNPINNED = -57, 65 | NV_CHART_OVERLAP = -58, 66 | NV_CHART_NO_FACES = -59, 67 | NV_CHART_MAX_DISTORTION_EXCEEDED = -60, 68 | NV_CHART_AVE_DISTORTION_EXCEEDED = -61, 69 | 70 | NV_CANT_CREATE_PRECONDITIONER = -70, 71 | NV_NO_CONVERGENCE = -71, 72 | NV_ZERO_DIAGONAL = -72, 73 | NV_ZERO_TRIANGLE_AREA = -73, 74 | NV_LINE_ON_PLANE = -74, 75 | NV_LINE_AND_PLANE_PARALLEL = -75, 76 | NV_CANT_COMPILE_EFFECT_FILE = -76, 77 | // open 78 | NV_CANT_UNLOCK_INDEX_BUFFER = -78, 79 | NV_CANT_CLONE_MESH = -79, 80 | NV_CANT_FIND_FILE = -80, 81 | NV_INVALID_FILENAME = -81, 82 | NV_CANT_SET_MATRIX = -82, 83 | NV_NEED_PIXEL_SHADER2 = -83, 84 | NV_CANT_UNLOCK_TEXTURE = -84, 85 | NV_OUT_OF_MEMORY = -85, 86 | NV_TIFF_IO_ERR = -86, 87 | 88 | 89 | NV_FILE_BAD_INDEX = -90, 90 | NV_FILE_NOT_ENOUGH_INDICES = -91, 91 | NV_FILE_FORMAT_NOT_SUPPORTED= -92, 92 | NV_CANT_CREATE_EFFECT = -93, 93 | NV_NAN = -94, 94 | 95 | NV_SURFACE_IS_CUBE_MAP = -95, 96 | NV_SURFACE_IS_VOLUME_MAP = -96, 97 | NV_UNSUPPORTED_FORMAT = -97, 98 | NV_MEMORY_ALLOCATION_FAILED = -98, 99 | NV_CUBE_MAP_NEEDS_SIX_FACES = -99, 100 | NV_IMAGE_EXCEEDS_INTERNAL_SIZE = -100, 101 | NV_CUBE_MAP_WIDTH_IS_NOT_SIX_TIMES_HEIGHT = -101, 102 | NV_VOLUME_MAP_IS_NOT_POWER2 = -102, 103 | 104 | 105 | 106 | 107 | }; 108 | 109 | const char *getErrorString(NV_ERROR_CODE hr); 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /NifProps/dds/veroverrides.h: -------------------------------------------------------------------------------- 1 | // The to be #defined in a .h file included by a .rc file before maxversion.r 2 | 3 | 4 | #define MAXVER_INTERNALNAME "dds\0"//should be overidden on a per-dll level 5 | #define MAXVER_ORIGINALFILENAME "dds.bmi\0"//should be overidden on a per-dll level 6 | #define MAXVER_FILEDESCRIPTION "A DDS image IO plugin\0"//should be overidden on a per-dll level 7 | #define MAXVER_COMMENTS "TECH: neil.hazzard\0"//should be overidden on a per-dll level 8 | 9 | // #define MAXVER_PRODUCTNAME //generally not overridden at the maxversion.r level 10 | // #define MAXVER_COPYRIGHT //only in exceptions should this be overridden 11 | // #define MAXVER_LEGALTRADEMARKS //only in exceptions should this be overridden 12 | // #define MAXVER_COMPANYNAME //only in exceptions should this be overridden 13 | // #define MAX_VERSION_MAJOR //only in exceptions should this be overridden 14 | // #define MAX_VERSION_MINOR //only in exceptions should this be overridden 15 | // #define MAX_VERSION_POINT //only in exceptions should this be overridden 16 | -------------------------------------------------------------------------------- /README.TXT: -------------------------------------------------------------------------------- 1 | MaxPlugins 3.7.2 2 | ================ 3 | 4 | 5 | This plugin currently consists of an exporter, importer and a utility 6 | plugin for 3ds max and gmax for read and writing Gamebryo/Netimmerse 7 | related files. 8 | 9 | Report problems and ask questions here: 10 | 11 | http://www.niftools.org/forum/viewforum.php?f=6 12 | 13 | A wiki for the 3ds Max plugins is available at: 14 | 15 | http://www.niftools.org/wiki/index.php/3ds_Max 16 | 17 | 18 | Enjoy! 19 | 20 | Requirements 21 | ------------ 22 | 23 | Plugins: 24 | 3D Studio Max 5, 6, 7, 8, 9, 2008, 2009, 2010, 2011, 2012 25 | gmax 1.2 26 | 27 | Installation 28 | ------------ 29 | 30 | Installer: 31 | The installer will configure the plugins for whichever releases 32 | you have available on your machine. It will also optionally configure 33 | texture paths for various games that we know there settings for. 34 | 35 | Copy NifPlugins.dlu, to your 3dsmax\plugins directory. 36 | Copy MaxNifTools.ini to your 3dsmax\plugcfg directory. 37 | 38 | gmax notes: 39 | NifPlugins.dlu goes in gmax\plugin folder 40 | MaxNifTools.ini goes in gmax\plugCFG folder 41 | winmm.dll goes in gmax folder where gmax.exe is located. 42 | Do not place it in the windows system folder. 43 | 44 | Usage 45 | ----- 46 | 47 | Collision: 48 | 49 | Add bhkRigidBody from Create | Helpers | Niftools to represent 50 | a rigid body in havok. 51 | 52 | Add bhkCollProxy or bhkRigidBody Modifier to represent shapes 53 | and then link them to the bhkRigidBody. 54 | 55 | Exporter: 56 | Export files using "File | Export | Netimmerse/Gamebryo (*.NIF, *.KF)". 57 | 58 | Importer: 59 | Import files using "File | Import | Netimmerse/Gamebryo (*.NIF, *.KF)" 60 | 61 | Settings: 62 | Its recommended that you edit the MaxNifTools.ini file to adjust 63 | paths and other settings to your machine to make it easier to work with. 64 | 65 | 1. Remove irrelevant applications from the KnownApplications list 66 | 2. Fix the RootPaths, TexturePaths and TextureSearchPaths in the 67 | Applications for your machine. 68 | 69 | 70 | Additional Notes 71 | ---------------- 72 | 73 | If your collision mesh comes out deformed, go to the utilities tab, 74 | choose "Reset XForm" and click "Reset Selected". This should fix it. 75 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | Issues! 2 | 3 | import texture dosnt get imported correcly. 4 | export collision needs changing on scale and unkown 7 needs to be written of atleast teh 2 first values then needs to be 0 5 | export collision needs changing on area to 0.0010 or whatever it is 6 | export coll material needs update. 7 | 8 | and prolly some more -------------------------------------------------------------------------------- /User_Settings.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | <_ProjectFileVersion>10.0.30319.1 5 | 6 | -------------------------------------------------------------------------------- /User_Settings.vsprops: -------------------------------------------------------------------------------- 1 | 2 | 36 | 41 | 42 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /build.bat: -------------------------------------------------------------------------------- 1 | @echo on 2 | 3 | IF EXIST "setbuildenv.bat" call setbuildenv.bat 4 | 5 | pushd "%~dp0" 6 | 7 | REM using delayed expansion ! instead of % as it just works better with ProgramFiles(x86) env variable 8 | IF EXIST "%ProgramFiles(x86)%" set Program_32=%ProgramFiles(x86)% 9 | IF EXIST "%ProgramFiles(x86)%" set Program_64=%ProgramFiles% 10 | IF NOT EXIST "%ProgramFiles(x86)%" set Program_32=%ProgramFiles% 11 | IF NOT EXIST "%ProgramFiles(x86)%" set Program_64= 12 | 13 | if "%GMAXINSTALLPATH12%" == "" set GMAXINSTALLPATH12=%SystemDrive%\gmax12 14 | if "%MAXINSTALLPATH40%" == "" set MAXINSTALLPATH40=%SystemDrive%\3dsmax4 15 | if "%MAXINSTALLPATH42%" == "" set MAXINSTALLPATH42=%SystemDrive%\3dsmax42 16 | if "%MAXINSTALLPATH50%" == "" set MAXINSTALLPATH50=%SystemDrive%\3dsmax5 17 | if "%MAXINSTALLPATH60%" == "" set MAXINSTALLPATH60=%SystemDrive%\3dsmax6 18 | if "%MAXINSTALLPATH70%" == "" set MAXINSTALLPATH70=%SystemDrive%\3dsmax7 19 | if "%MAXINSTALLPATH80%" == "" set MAXINSTALLPATH80=%SystemDrive%\3dsmax8 20 | if "%MAXINSTALLPATH90%" == "" set MAXINSTALLPATH90=%Program_32%\AutoDesk\3ds Max 9 21 | if "%MAXINSTALLPATH2008%" == "" set MAXINSTALLPATH2008=%Program_32%\AutoDesk\3ds Max 2008 22 | if "%MAXINSTALLPATH2009%" == "" set MAXINSTALLPATH2009=%Program_32%\AutoDesk\3ds Max 2009 23 | if "%MAXINSTALLPATH2010%" == "" set MAXINSTALLPATH2010=%Program_32%\AutoDesk\3ds Max 2010 24 | if "%MAXINSTALLPATH2011%" == "" set MAXINSTALLPATH2011=%Program_32%\AutoDesk\Autodesk 3ds Max 2011 SDK 25 | if "%ADSK_3DSMAX_SDK_2012%" == "" set MAXINSTALLPATH2012=%ADSK_3DSMAX_SDK_2012% 26 | if "%MAXINSTALLPATH2012%" == "" set MAXINSTALLPATH2012=%Program_32%\AutoDesk\3ds Max 2012 SDK 27 | 28 | REM svn update 29 | call makeconfig.bat 30 | IF EXIST "%GMAXINSTALLPATH12%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - gmax" /p:Platform=Win32 31 | IF EXIST "%MAXINSTALLPATH42%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 4.2" /p:Platform=Win32 32 | IF EXIST "%MAXINSTALLPATH50%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 5" /p:Platform=Win32 33 | IF EXIST "%MAXINSTALLPATH60%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 6" /p:Platform=Win32 34 | IF EXIST "%MAXINSTALLPATH70%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 7" /p:Platform=Win32 35 | IF EXIST "%MAXINSTALLPATH80%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 8" /p:Platform=Win32 36 | IF EXIST "%MAXINSTALLPATH90%" ( 37 | msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 9" /p:Platform=Win32 38 | IF EXIST "%Program_64%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 9" /p:Platform=x64 39 | ) 40 | IF EXIST "%MAXINSTALLPATH2008%" ( 41 | msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 2008" /p:Platform=Win32 42 | IF EXIST "%Program_64%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 2008" /p:Platform=x64 43 | ) 44 | IF EXIST "%MAXINSTALLPATH2009%" ( 45 | msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 2009" /p:Platform=Win32 46 | IF EXIST "%Program_64%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 2009" /p:Platform=x64 47 | ) 48 | IF EXIST "%MAXINSTALLPATH2010%" ( 49 | msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 2010" /p:Platform=Win32 50 | IF EXIST "%Program_64%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 2010" /p:Platform=x64 51 | ) 52 | IF EXIST "%MAXINSTALLPATH2011%" ( 53 | msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 2011" /p:Platform=Win32 54 | IF EXIST "%Program_64%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 2011" /p:Platform=x64 55 | ) 56 | IF EXIST "%MAXINSTALLPATH2012%" ( 57 | msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 2012" /p:Platform=Win32 58 | IF EXIST "%Program_64%" msbuild NifPlugins_VC2008.sln "/p:Configuration=Release - Max 2012" /p:Platform=x64 59 | ) 60 | 61 | endlocal 62 | popd -------------------------------------------------------------------------------- /makeconfig.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM Quick script to create config.h 3 | setlocal 4 | 5 | set WCREV=0 6 | set WCDATE= 7 | set WCURL= 8 | 9 | for /f "usebackq delims=|" %%i in (`git log -1 "--pretty=format:%%h"`) do set WCREV=%%i 10 | for /f "usebackq delims=|" %%i in (`git log -1 "--pretty=format:%%cd"`) do set WCDATE=%%i 11 | for /f "usebackq delims=|" %%i in (`git config --get remote.origin.url`) do set WCURL=%%i 12 | sed "s/[$]WCREV[$]/%WCREV%/g" < NifCommon/config.h.in | sed "s/[$]WCDATE[$]/%WCDATE%/g" | sed "s![$]WCURL[$]!%WCURL%!g" > NifCommon/config.h 13 | 14 | endlocal -------------------------------------------------------------------------------- /makeconfig.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Quick script to create config.h 4 | 5 | WCREV=`git log -1 --pretty=format:%h` 6 | WCDATE=`git log -1 --pretty=format:%cd` 7 | WCURL=`git config --get remote.origin.url` 8 | cat NifCommon/config.h.in | sed "s/[$]WCREV[$]/$WCREV/g" | sed "s/[$]WCDATE[$]/$WCDATE/g" | sed "s![$]WCURL[$]!$WCURL!g" > NifCommon/config.h 9 | -------------------------------------------------------------------------------- /makezip.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # quick script to create zip file containing all sources 4 | # uses https://github.com/amorilia/git-archive-all 5 | 6 | VERSION="3.6.0" 7 | wcrev=`git log -1 --pretty=format:%h` 8 | if [ "$1" == "" ] 9 | then 10 | extversion=${VERSION}.${wcrev} 11 | else 12 | extversion=${VERSION}-$1.${wcrev} 13 | fi 14 | 15 | git clean -xfd 16 | ./makeconfig.sh 17 | git-archive-all max_nif_plugin-${extversion}.zip --prefix max_nif_plugin/ -v --extra NifCommon/config.h 18 | 19 | -------------------------------------------------------------------------------- /nif_maxsdk.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niftools/max_nif_plugin/f131c8c4ddefb12f6252d469552f607e5fdc7c4f/nif_maxsdk.zip -------------------------------------------------------------------------------- /stagenif.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | set SRC=%~dp0 5 | set DEST=%~dp0\output\%1 6 | 7 | if "%1" == "" ( 8 | echo Give a version ... 9 | goto exit 10 | ) 11 | 12 | rm -r -f "%DEST%" 13 | 14 | for %%j in (Win32) do ( 15 | for /L %%i in (5,1,8) do ( 16 | mkdir "%DEST%\%%j\max-%%i-plugins-%1\plugcfg" > nul 2<&1 17 | mkdir "%DEST%\%%j\max-%%i-plugins-%1\plugins" > nul 2<&1 18 | xcopy /D /Y /I "%SRC%*.txt" "%DEST%\%%j\max-%%i-plugins-%1\" > nul 2<&1 19 | xcopy /D /Y /I "%SRC%MaxNifTools.ini" "%DEST%\%%j\max-%%i-plugins-%1\plugcfg\" > nul 2<&1 20 | xcopy /D /Y /I "%SRC%staging\%%j\release - max %%i\NifPlugins\*.dl*" "%DEST%\%%j\max-%%i-plugins-%1\plugins\" > nul 2<&1 21 | xcopy /D /Y /I "%SRC%..\NifMopp\NifMopp.dll" "%DEST%\%%j\max-%%i-plugins-%1\plugins\" > nul 2<&1 22 | xcopy /D /Y /I "%SRC%..\NifMagic\%%j\NifMagic.dll" "%DEST%\%%j\max-%%i-plugins-%1\plugins\" > nul 2<&1 23 | REM pushd "%DEST%\max-%%i-plugins-%1\" && ntzip -9 -r "..\max-%%i-plugins-%1.zip" * && popd 24 | ) 25 | 26 | mkdir "%DEST%\%%j\gmax-1.2-plugins-%1\plugcfg" > nul 2<&1 27 | mkdir "%DEST%\%%j\gmax-1.2-plugins-%1\plugins" > nul 2<&1 28 | xcopy /D /Y /I "%SRC%README.txt" "%DEST%\%%j\gmax-1.2-plugins-%1\" > nul 2<&1 29 | xcopy /D /Y /I "%SRC%MaxNifTools.ini" "%DEST%\%%j\gmax-1.2-plugins-%1\plugcfg\" > nul 2<&1 30 | xcopy /D /Y /I "%SRC%staging\%%j\release - gmax\NifPlugins\*.dl*" "%DEST%\%%j\gmax-1.2-plugins-%1\plugins\" > nul 2<&1 31 | xcopy /D /Y /I "\gmax12\winmm.dll" "%DEST%\%%j\gmax-1.2-plugins-%1\" > nul 2<&1 32 | xcopy /D /Y /I "%SRC%..\NifMopp\%%j\NifMopp.dll" "%DEST%\%%j\gmax-1.2-plugins-%1\plugins\" > nul 2<&1 33 | xcopy /D /Y /I "%SRC%..\NifMagic\%%j\NifMagic.dll" "%DEST%\%%j\gmax-1.2-plugins-%1\plugins\" > nul 2<&1 34 | REM pushd "%DEST%\gmax-1.2-plugins-%1\" && ntzip -9 -r "..\gmax-1.2-plugins-%1.zip" * && popd 35 | ) 36 | 37 | for %%j in (Win32 x64) do ( 38 | for %%i in (9 2008 2009 2010 2011 2012) do ( 39 | mkdir "%DEST%\%%j\max-%%i-plugins-%1\plugcfg" > nul 2<&1 40 | mkdir "%DEST%\%%j\max-%%i-plugins-%1\plugins" > nul 2<&1 41 | xcopy /D /Y /I "%SRC%README.txt" "%DEST%\%%j\max-%%i-plugins-%1\" > nul 2<&1 42 | xcopy /D /Y /I "%SRC%MaxNifTools.ini" "%DEST%\%%j\max-%%i-plugins-%1\plugcfg\" > nul 2<&1 43 | xcopy /D /Y /I "%SRC%staging\%%j\release - max %%i\NifPlugins\*.dl*" "%DEST%\%%j\max-%%i-plugins-%1\plugins\" > nul 2<&1 44 | xcopy /D /Y /I "%SRC%..\NifMopp\%%j\NifMopp.dll" "%DEST%\%%j\max-%%i-plugins-%1\plugins\" > nul 2<&1 45 | xcopy /D /Y /I "%SRC%..\NifMagic\%%j\NifMagic.dll" "%DEST%\%%j\max-%%i-plugins-%1\plugins\" > nul 2<&1 46 | ) 47 | ) 48 | pushd "%DEST%" 49 | rm -r -f NifPlugins_Development_Readme.txt 50 | popd 51 | 52 | pushd "%SRC%" 53 | set VERSION=%1 54 | set GITVERSION=0 55 | for /f "usebackq delims=|" %%i in (`git log -1 "--pretty=format:%%h"`) do set VERSION=%VERSION%.%%i 56 | 57 | IF EXIST "c:\Program Files\7-Zip\7z.exe" ( 58 | pushd "%DEST%" 59 | "c:\Program Files\7-Zip\7z.exe" a -r niftools-max-plugins-%VERSION%.7z * 60 | popd 61 | ) 62 | 63 | IF EXIST "c:\Program Files\Inno Setup 5\ISCC.exe" ( 64 | pushd "%SRC%" 65 | "c:\Program Files\Inno Setup 5\ISCC.exe" /Q /fniftools-max-plugins-%VERSION% "/o%DEST%\" MaxNifTools.iss 66 | popd 67 | ) 68 | popd 69 | 70 | :exit 71 | endlocal 72 | popd 73 | 74 | REM cd "%DEST%\" 75 | -------------------------------------------------------------------------------- /start_devenv.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal 3 | pushd "%~dp0" 4 | 5 | IF EXIST "setbuildenv.bat" call setbuildenv.bat 6 | call "%ProgramFiles(x86)%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" amd64 7 | 8 | start devenv.exe 9 | 10 | popd 11 | endlocal 12 | --------------------------------------------------------------------------------