From 4da092dbf860b6c9ac4d713ace5e5f4a88a80604 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 11:55:59 -0600 Subject: [PATCH 01/14] add cmake support for both 2023 and 2024 max --- cmake/Find3dsm.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/Find3dsm.cmake b/cmake/Find3dsm.cmake index 0a594570da..930e46832c 100644 --- a/cmake/Find3dsm.cmake +++ b/cmake/Find3dsm.cmake @@ -5,6 +5,8 @@ if(WIN32) # Of course, 32-bit 2013 is basically impossible to find. Oh well. if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(_3dsm_PATH_HINTS + ENV ADSK_3DSMAX_SDK_2024 + ENV ADSK_3DSMAX_SDK_2023 ENV ADSK_3DSMAX_SDK_2022 ENV ADSK_3DSMAX_SDK_2021 ENV ADSK_3DSMAX_SDK_2020 From c77f6aef15a6f4d50c07c1ac4488fe2a788b5ea6 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 13:11:18 -0600 Subject: [PATCH 02/14] handle the removed class id --- Sources/Tools/MaxComponent/plBipedKiller.cpp | 2 +- Sources/Tools/MaxMain/MaxCompat.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/Tools/MaxComponent/plBipedKiller.cpp b/Sources/Tools/MaxComponent/plBipedKiller.cpp index 1c2d1caf17..b053a12743 100644 --- a/Sources/Tools/MaxComponent/plBipedKiller.cpp +++ b/Sources/Tools/MaxComponent/plBipedKiller.cpp @@ -375,7 +375,7 @@ bool HasBipController(INode* node) if (!node) return false; Control* c = node->GetTMController(); - if (c && ((c->ClassID()== BIPSLAVE_CONTROL_CLASS_ID) || + if (c && ((c->ClassID()== BIPDRIVEN_CONTROL_CLASS_ID) || (c->ClassID()== BIPBODY_CONTROL_CLASS_ID) || (c->ClassID()== FOOTPRINT_CLASS_ID)) ) return true; diff --git a/Sources/Tools/MaxMain/MaxCompat.h b/Sources/Tools/MaxMain/MaxCompat.h index 3156d8ebc5..db8c96ddce 100644 --- a/Sources/Tools/MaxMain/MaxCompat.h +++ b/Sources/Tools/MaxMain/MaxCompat.h @@ -291,7 +291,10 @@ class plMaxObject : public plMaxAnimatable // Old versions of Max define this as an integer, not a Class_ID #define XREFOBJ_COMPAT_CLASS_ID Class_ID(0x92aab38c, 0) - +//this define is removed in later versions of the sdk +#if MAX_VERSION_MAJOR < 24 +# define BIPDRIVEN_CONTROL_CLASS_ID BIPSLAVE_CONTROL_CLASS_ID +#endif // Special 3ds Max message box support added in 2021 for HiDPI #if MAX_VERSION_MAJOR >= 23 # define plMaxMessageBox MaxSDK::MaxMessageBox From f5651bfef5c5db12f2468f7a29e17bf04d404675 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 13:11:57 -0600 Subject: [PATCH 03/14] change in return type --- Sources/Tools/MaxConvert/hsControlConverter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/Tools/MaxConvert/hsControlConverter.cpp b/Sources/Tools/MaxConvert/hsControlConverter.cpp index a1f13e9ea8..62f8b14503 100644 --- a/Sources/Tools/MaxConvert/hsControlConverter.cpp +++ b/Sources/Tools/MaxConvert/hsControlConverter.cpp @@ -127,7 +127,12 @@ void hsControlConverter::DeInit() class KRStatus : public KeyReduceStatus { void Init(int total) override { } + +#if MAX_VERSION_MAJOR >= 23 + KeyReduceResult Progress(int p) override { return KEYREDUCE_CONTINUE; } +#else int Progress(int p) override { return KEYREDUCE_CONTINUE; } +#endif }; void hsControlConverter::ReduceKeys(Control *control, float threshold) From d28e3ea30fc2b2e6a56401bea65db001b26c409e Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 13:30:48 -0600 Subject: [PATCH 04/14] these functions become virtual in 2024 --- Sources/Tools/MaxConvert/plMaxLightContext.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/Tools/MaxConvert/plMaxLightContext.h b/Sources/Tools/MaxConvert/plMaxLightContext.h index 0dc48a6b09..7c61978387 100644 --- a/Sources/Tools/MaxConvert/plMaxLightContext.h +++ b/Sources/Tools/MaxConvert/plMaxLightContext.h @@ -108,7 +108,11 @@ class plMaxLightContext : public ShadeContext void DPdUVW(Point3 dP[3],int channel=0) override { dP[0] = dP[1] = dP[2] = Point3(0,0,0); } // Bump vectors for UVW (camera space) void GetBGColor(Color &bgcol, Color& transp, BOOL fogBG=TRUE) override { bgcol.Black(); transp.Black(); } // returns Background color, bg transparency - + //these became virtual in 2023 + #if MAX_VERSION_MAJOR >= 25 + Matrix3 MatrixTo(RefFrame ito) override { return Matrix3::Identity; } + Matrix3 MatrixFrom(RefFrame ifrom) override { return Matrix3::Identity; } + #endif Point3 PointTo(const Point3& p, RefFrame ito) override { return p; } Point3 PointFrom(const Point3& p, RefFrame ifrom) override { return p; } Point3 VectorTo(const Point3& p, RefFrame ito) override { return p; } From 1c53eab9c1bde778eb10ded6e187a172ac75b703 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 18:32:48 -0600 Subject: [PATCH 05/14] fix comment to abide by formatting rules Co-authored-by: Adam Johnson --- Sources/Tools/MaxConvert/plMaxLightContext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tools/MaxConvert/plMaxLightContext.h b/Sources/Tools/MaxConvert/plMaxLightContext.h index 7c61978387..100a22a621 100644 --- a/Sources/Tools/MaxConvert/plMaxLightContext.h +++ b/Sources/Tools/MaxConvert/plMaxLightContext.h @@ -108,7 +108,7 @@ class plMaxLightContext : public ShadeContext void DPdUVW(Point3 dP[3],int channel=0) override { dP[0] = dP[1] = dP[2] = Point3(0,0,0); } // Bump vectors for UVW (camera space) void GetBGColor(Color &bgcol, Color& transp, BOOL fogBG=TRUE) override { bgcol.Black(); transp.Black(); } // returns Background color, bg transparency - //these became virtual in 2023 + // these became virtual in 2023 #if MAX_VERSION_MAJOR >= 25 Matrix3 MatrixTo(RefFrame ito) override { return Matrix3::Identity; } Matrix3 MatrixFrom(RefFrame ifrom) override { return Matrix3::Identity; } From bf8918b7a5e492fd6a1ba8d62c965c9524a01375 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 18:51:46 -0600 Subject: [PATCH 06/14] formatting and language fix Co-authored-by: Adam Johnson --- Sources/Tools/MaxMain/MaxCompat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tools/MaxMain/MaxCompat.h b/Sources/Tools/MaxMain/MaxCompat.h index db8c96ddce..60640b69f4 100644 --- a/Sources/Tools/MaxMain/MaxCompat.h +++ b/Sources/Tools/MaxMain/MaxCompat.h @@ -291,7 +291,7 @@ class plMaxObject : public plMaxAnimatable // Old versions of Max define this as an integer, not a Class_ID #define XREFOBJ_COMPAT_CLASS_ID Class_ID(0x92aab38c, 0) -//this define is removed in later versions of the sdk +// This definition is removed in later versions of the sdk #if MAX_VERSION_MAJOR < 24 # define BIPDRIVEN_CONTROL_CLASS_ID BIPSLAVE_CONTROL_CLASS_ID #endif From 72993c1b21912ed71f7fe6998ce0e32c127ebc81 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 18:52:23 -0600 Subject: [PATCH 07/14] untab endif Co-authored-by: Adam Johnson --- Sources/Tools/MaxConvert/plMaxLightContext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tools/MaxConvert/plMaxLightContext.h b/Sources/Tools/MaxConvert/plMaxLightContext.h index 100a22a621..20ad3a8f5d 100644 --- a/Sources/Tools/MaxConvert/plMaxLightContext.h +++ b/Sources/Tools/MaxConvert/plMaxLightContext.h @@ -112,7 +112,7 @@ class plMaxLightContext : public ShadeContext #if MAX_VERSION_MAJOR >= 25 Matrix3 MatrixTo(RefFrame ito) override { return Matrix3::Identity; } Matrix3 MatrixFrom(RefFrame ifrom) override { return Matrix3::Identity; } - #endif +#endif Point3 PointTo(const Point3& p, RefFrame ito) override { return p; } Point3 PointFrom(const Point3& p, RefFrame ifrom) override { return p; } Point3 VectorTo(const Point3& p, RefFrame ito) override { return p; } From f0977ade10182a0fa34f07e4dbb6f3a5ee22b0da Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 18:52:44 -0600 Subject: [PATCH 08/14] untab if Co-authored-by: Adam Johnson --- Sources/Tools/MaxConvert/plMaxLightContext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tools/MaxConvert/plMaxLightContext.h b/Sources/Tools/MaxConvert/plMaxLightContext.h index 20ad3a8f5d..9bd5e155da 100644 --- a/Sources/Tools/MaxConvert/plMaxLightContext.h +++ b/Sources/Tools/MaxConvert/plMaxLightContext.h @@ -109,7 +109,7 @@ class plMaxLightContext : public ShadeContext void GetBGColor(Color &bgcol, Color& transp, BOOL fogBG=TRUE) override { bgcol.Black(); transp.Black(); } // returns Background color, bg transparency // these became virtual in 2023 - #if MAX_VERSION_MAJOR >= 25 +#if MAX_VERSION_MAJOR >= 25 Matrix3 MatrixTo(RefFrame ito) override { return Matrix3::Identity; } Matrix3 MatrixFrom(RefFrame ifrom) override { return Matrix3::Identity; } #endif From 04b00a6bab2c5f247b175b3ba2063cbd3745dc2a Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 19:05:49 -0600 Subject: [PATCH 09/14] handle the type change in MaxCompat instead --- Sources/Tools/MaxConvert/hsControlConverter.cpp | 4 ---- Sources/Tools/MaxMain/MaxCompat.h | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Sources/Tools/MaxConvert/hsControlConverter.cpp b/Sources/Tools/MaxConvert/hsControlConverter.cpp index 62f8b14503..ca54fa59ad 100644 --- a/Sources/Tools/MaxConvert/hsControlConverter.cpp +++ b/Sources/Tools/MaxConvert/hsControlConverter.cpp @@ -128,11 +128,7 @@ class KRStatus : public KeyReduceStatus { void Init(int total) override { } -#if MAX_VERSION_MAJOR >= 23 KeyReduceResult Progress(int p) override { return KEYREDUCE_CONTINUE; } -#else - int Progress(int p) override { return KEYREDUCE_CONTINUE; } -#endif }; void hsControlConverter::ReduceKeys(Control *control, float threshold) diff --git a/Sources/Tools/MaxMain/MaxCompat.h b/Sources/Tools/MaxMain/MaxCompat.h index 60640b69f4..cd303afd63 100644 --- a/Sources/Tools/MaxMain/MaxCompat.h +++ b/Sources/Tools/MaxMain/MaxCompat.h @@ -292,9 +292,12 @@ class plMaxObject : public plMaxAnimatable // Old versions of Max define this as an integer, not a Class_ID #define XREFOBJ_COMPAT_CLASS_ID Class_ID(0x92aab38c, 0) // This definition is removed in later versions of the sdk +// In newer versions of the sdk Progress returns an enum value of KeyReduceResult #if MAX_VERSION_MAJOR < 24 # define BIPDRIVEN_CONTROL_CLASS_ID BIPSLAVE_CONTROL_CLASS_ID +using KeyReduceResult = int; #endif + // Special 3ds Max message box support added in 2021 for HiDPI #if MAX_VERSION_MAJOR >= 23 # define plMaxMessageBox MaxSDK::MaxMessageBox From 6a3b24ad14255add26222b644aeb09b98fdd9a12 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 19:26:10 -0600 Subject: [PATCH 10/14] use a define instead of a using --- Sources/Tools/MaxMain/MaxCompat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tools/MaxMain/MaxCompat.h b/Sources/Tools/MaxMain/MaxCompat.h index cd303afd63..146ee84454 100644 --- a/Sources/Tools/MaxMain/MaxCompat.h +++ b/Sources/Tools/MaxMain/MaxCompat.h @@ -295,7 +295,7 @@ class plMaxObject : public plMaxAnimatable // In newer versions of the sdk Progress returns an enum value of KeyReduceResult #if MAX_VERSION_MAJOR < 24 # define BIPDRIVEN_CONTROL_CLASS_ID BIPSLAVE_CONTROL_CLASS_ID -using KeyReduceResult = int; +# define KeyReduceResult int #endif // Special 3ds Max message box support added in 2021 for HiDPI From bd6718a69f452102e171f1dcccb832a9c33693a6 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 20:58:14 -0600 Subject: [PATCH 11/14] fix both slave and return result correctly --- Sources/Tools/MaxMain/MaxCompat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tools/MaxMain/MaxCompat.h b/Sources/Tools/MaxMain/MaxCompat.h index 146ee84454..6e05f9546c 100644 --- a/Sources/Tools/MaxMain/MaxCompat.h +++ b/Sources/Tools/MaxMain/MaxCompat.h @@ -293,7 +293,7 @@ class plMaxObject : public plMaxAnimatable #define XREFOBJ_COMPAT_CLASS_ID Class_ID(0x92aab38c, 0) // This definition is removed in later versions of the sdk // In newer versions of the sdk Progress returns an enum value of KeyReduceResult -#if MAX_VERSION_MAJOR < 24 +#if MAX_VERSION_MAJOR <= 25 # define BIPDRIVEN_CONTROL_CLASS_ID BIPSLAVE_CONTROL_CLASS_ID # define KeyReduceResult int #endif From 57ae7ea6874f5ae430556f0742b6e010c41edd75 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 21:03:00 -0600 Subject: [PATCH 12/14] correctly fix the matrix virtual functions --- Sources/Tools/MaxConvert/plMaxLightContext.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tools/MaxConvert/plMaxLightContext.h b/Sources/Tools/MaxConvert/plMaxLightContext.h index 9bd5e155da..ad0c5dd673 100644 --- a/Sources/Tools/MaxConvert/plMaxLightContext.h +++ b/Sources/Tools/MaxConvert/plMaxLightContext.h @@ -109,7 +109,7 @@ class plMaxLightContext : public ShadeContext void GetBGColor(Color &bgcol, Color& transp, BOOL fogBG=TRUE) override { bgcol.Black(); transp.Black(); } // returns Background color, bg transparency // these became virtual in 2023 -#if MAX_VERSION_MAJOR >= 25 +#if MAX_VERSION_MAJOR >= 26 Matrix3 MatrixTo(RefFrame ito) override { return Matrix3::Identity; } Matrix3 MatrixFrom(RefFrame ifrom) override { return Matrix3::Identity; } #endif From f7f25bbd05da3b32ce96a6b6e83c51fdd66be462 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Wed, 29 Nov 2023 21:45:15 -0600 Subject: [PATCH 13/14] add the missing versions of the max sdk to the ci build --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62ca9ed685..05002ca594 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,6 +117,8 @@ jobs: - { sdk-version: 2017, generator: Visual Studio 16 2019, arch: x64, str: windows-x64 } - { sdk-version: 2019, generator: Visual Studio 16 2019, arch: x64, str: windows-x64 } - { sdk-version: 2020, generator: Visual Studio 16 2019, arch: x64, str: windows-x64 } + - { sdk-version: 2023, generator: Visual Studio 16 2019, arch: x64, str: windows-x64 } + - { sdk-version: 2024, generator: Visual Studio 16 2019, arch: x64, str: windows-x64 } steps: - name: Checkout Plasma From 12997f4325bdb921c6d414ddecbfa55ae738dd07 Mon Sep 17 00:00:00 2001 From: noah the goodra Date: Thu, 30 Nov 2023 12:59:36 -0600 Subject: [PATCH 14/14] replace define with using --- Sources/Tools/MaxMain/MaxCompat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tools/MaxMain/MaxCompat.h b/Sources/Tools/MaxMain/MaxCompat.h index 6e05f9546c..91f00ef835 100644 --- a/Sources/Tools/MaxMain/MaxCompat.h +++ b/Sources/Tools/MaxMain/MaxCompat.h @@ -295,7 +295,7 @@ class plMaxObject : public plMaxAnimatable // In newer versions of the sdk Progress returns an enum value of KeyReduceResult #if MAX_VERSION_MAJOR <= 25 # define BIPDRIVEN_CONTROL_CLASS_ID BIPSLAVE_CONTROL_CLASS_ID -# define KeyReduceResult int + using KeyReduceResult = int; #endif // Special 3ds Max message box support added in 2021 for HiDPI