├── .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