From 58d79679d30d7634cc650e0c4eb09cb9fde07746 Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Mon, 21 Apr 2014 05:35:54 -0700 Subject: [PATCH 1/3] Use std math functions in Max plugin. VS12 provides math functions which were conflicting with ones defined in texutil.h. This removes the reliance on texutil.h and uses the standard library's math in its place. --- Sources/Tools/MaxConvert/Pch.h | 1 - Sources/Tools/MaxConvert/hsControlConverter.cpp | 1 - .../Tools/MaxConvert/hsMaterialConverter.cpp | 1 - Sources/Tools/MaxPlasmaMtls/Pch.h | 1 - Sources/Tools/MaxPlasmaMtls/plBMSampler.cpp | 17 ++++++++--------- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Sources/Tools/MaxConvert/Pch.h b/Sources/Tools/MaxConvert/Pch.h index 526e6c2a..e3877404 100644 --- a/Sources/Tools/MaxConvert/Pch.h +++ b/Sources/Tools/MaxConvert/Pch.h @@ -92,7 +92,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include -#include // MaxComponent #include "MaxComponent/plComponent.h" diff --git a/Sources/Tools/MaxConvert/hsControlConverter.cpp b/Sources/Tools/MaxConvert/hsControlConverter.cpp index 557f1d6a..39cfa8d1 100644 --- a/Sources/Tools/MaxConvert/hsControlConverter.cpp +++ b/Sources/Tools/MaxConvert/hsControlConverter.cpp @@ -53,7 +53,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include -#include #include #include #include diff --git a/Sources/Tools/MaxConvert/hsMaterialConverter.cpp b/Sources/Tools/MaxConvert/hsMaterialConverter.cpp index 5fc1d64d..e1bf0180 100644 --- a/Sources/Tools/MaxConvert/hsMaterialConverter.cpp +++ b/Sources/Tools/MaxConvert/hsMaterialConverter.cpp @@ -57,7 +57,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include -#include #pragma hdrstop #include "hsMaterialConverter.h" diff --git a/Sources/Tools/MaxPlasmaMtls/Pch.h b/Sources/Tools/MaxPlasmaMtls/Pch.h index d9ff94af..72b671aa 100644 --- a/Sources/Tools/MaxPlasmaMtls/Pch.h +++ b/Sources/Tools/MaxPlasmaMtls/Pch.h @@ -68,7 +68,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include -#include #include // MaxMain diff --git a/Sources/Tools/MaxPlasmaMtls/plBMSampler.cpp b/Sources/Tools/MaxPlasmaMtls/plBMSampler.cpp index 3619b05e..553c2b84 100644 --- a/Sources/Tools/MaxPlasmaMtls/plBMSampler.cpp +++ b/Sources/Tools/MaxPlasmaMtls/plBMSampler.cpp @@ -45,7 +45,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include -#include #include #pragma hdrstop @@ -105,9 +104,9 @@ AColor plBMSampler::Sample(ShadeContext& sc, float u,float v) BMM_Color_64 c; int x,y; - float fu,fv; - fu = frac(u); - fv = 1.0f-frac(v); + float fu,fv, intpart; + fu = modf(u, &intpart); + fv = 1.0f - modf(v, &intpart); if (fData.fEnableCrop) { if (fData.fCropPlacement) @@ -119,8 +118,8 @@ AColor plBMSampler::Sample(ShadeContext& sc, float u,float v) } else { - x = mod(clipx + (int)(fu*fclipw+0.5f),bmw); - y = mod(clipy + (int)(fv*fcliph+0.5f),bmh); + x = clipx + static_cast(fu * fclipw + 0.5f) % bmw; + y = clipy + static_cast(fv * fcliph + 0.5f) % bmh; } } else @@ -156,9 +155,9 @@ AColor plBMSampler::SampleFilter(ShadeContext& sc, float u,float v, float du, fl fBM->SetFilter(BMM_FILTER_PYRAMID); BMM_Color_64 c; - float fu,fv; - fu = frac(u); - fv = 1.0f-frac(v); + float fu, fv, intpart; + fu = modf(u, &intpart); + fv = 1.0f - modf(v, &intpart); if (fData.fEnableCrop) { if (fData.fCropPlacement) From c3d8e7e1612620b0db47377088d43606b46b829d Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Mon, 21 Apr 2014 08:07:43 -0700 Subject: [PATCH 2/3] Add different SetText values to MaxCompat header. Restores compilation of Max 7 plugin, as its SetText expects a non-const pointer. Additionally, NotifyInfo should already be declared in notify.h. --- Sources/Tools/MaxComponent/plMultistageStage.cpp | 2 +- Sources/Tools/MaxMain/MaxCompat.h | 2 ++ Sources/Tools/MaxMain/plActionTableMgr.h | 1 - Sources/Tools/MaxMain/plComponentDlg.h | 8 -------- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Sources/Tools/MaxComponent/plMultistageStage.cpp b/Sources/Tools/MaxComponent/plMultistageStage.cpp index 847c6a00..cd81eec7 100644 --- a/Sources/Tools/MaxComponent/plMultistageStage.cpp +++ b/Sources/Tools/MaxComponent/plMultistageStage.cpp @@ -362,7 +362,7 @@ static void LoadCombo(HWND hCombo, NameType* nameInt, int size, int curVal) void plStandardStage::IInitDlg() { ICustEdit* edit = GetICustEdit(GetDlgItem(fDlg, IDC_ANIM_NAME)); - edit->SetText(fAnimName.c_str()); + edit->SetText(const_cast(fAnimName.c_str())); HWND hForward = GetDlgItem(fDlg, IDC_FORWARD_COMBO); LoadCombo(hForward, gForward, sizeof(gForward), fForward); diff --git a/Sources/Tools/MaxMain/MaxCompat.h b/Sources/Tools/MaxMain/MaxCompat.h index 2f1700f9..b557cafa 100644 --- a/Sources/Tools/MaxMain/MaxCompat.h +++ b/Sources/Tools/MaxMain/MaxCompat.h @@ -86,8 +86,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #if MAX_VERSION_MAJOR <= 10 // Max 2008 # define GETNAME_RETURN_TYPE TCHAR* +# define SETTEXT_VALUE_TYPE MCHAR* #else # define GETNAME_RETURN_TYPE const TCHAR* +# define SETTEXT_VALUE_TYPE const MCHAR* #endif // Old versions of Max define this as an integer, not a Class_ID diff --git a/Sources/Tools/MaxMain/plActionTableMgr.h b/Sources/Tools/MaxMain/plActionTableMgr.h index d15ce01a..4097c68b 100644 --- a/Sources/Tools/MaxMain/plActionTableMgr.h +++ b/Sources/Tools/MaxMain/plActionTableMgr.h @@ -50,7 +50,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class ActionCallback; struct ActionDescription; -struct NotifyInfo; typedef bool(*ActionCallbackFunc)(int); diff --git a/Sources/Tools/MaxMain/plComponentDlg.h b/Sources/Tools/MaxMain/plComponentDlg.h index 1b2862e9..d582fae3 100644 --- a/Sources/Tools/MaxMain/plComponentDlg.h +++ b/Sources/Tools/MaxMain/plComponentDlg.h @@ -44,14 +44,6 @@ class Class_ID; class Interface; class plMaxNode; -#include -#if MAX_VERSION_MAJOR >= 9 - struct NotifyInfo; -#else - // Max headers are more minimalistic in pre-9 maxes -# include -#endif - class plComponentDlg { protected: From 81214699ae494706b850c67dde1a345f470cb89c Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Fri, 25 Apr 2014 21:56:23 -0700 Subject: [PATCH 3/3] Fix scope on preprocessor variables for Max plugin. plAudioCore needs to know whether we intend to build the plugin, so the change introduced in 978edc1 was causing compilation to fail when building the plugin. This moves detection and definition back into the root CMakeList, but preserves the behavior of only looking for the SDK if needed. --- CMakeLists.txt | 6 ++++++ Sources/Tools/CMakeLists.txt | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b01d767..3e20c18f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,12 @@ option(PLASMA_BUILD_RESOURCE_DAT "Do we want to build resource.dat?" ON) option(PLASMA_BUILD_LAUNCHER "Do we want to build plUruLauncher?" ON) option(PLASMA_BUILD_TOOLS "Do we want to build the Plasma tools?" ON) +option(3dsm_BUILD_PLUGIN "Do we want to build the 3ds Max plugin?" OFF) +if(3dsm_BUILD_PLUGIN) + find_package(MaxSDK REQUIRED) + add_definitions(-DBUILDING_MAXPLUGIN) +endif(3dsm_BUILD_PLUGIN) + option(USE_VLD "Build and link with Visual Leak Detector (MSVC only)" OFF) if(USE_VLD) add_definitions(-DUSE_VLD) diff --git a/Sources/Tools/CMakeLists.txt b/Sources/Tools/CMakeLists.txt index b4e4c205..8bdc2fb3 100644 --- a/Sources/Tools/CMakeLists.txt +++ b/Sources/Tools/CMakeLists.txt @@ -8,12 +8,7 @@ if(PLASMA_BUILD_TOOLS) endif() # Max Stuff goes below here... -option(3dsm_BUILD_PLUGIN "Do we want to build the 3ds Max plugin?" OFF) if(3dsm_BUILD_PLUGIN) - find_package(MaxSDK REQUIRED) - add_definitions(-DBUILDING_MAXPLUGIN) - add_definitions(-DMAXPLUGINCODE) - add_subdirectory(MaxComponent) add_subdirectory(MaxConvert) add_subdirectory(MaxExport)