From ad8e87370d2ee332c485d610e8f752ad3d46c813 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sun, 18 Nov 2012 20:52:10 -0500 Subject: [PATCH] Untangle MaxExport --- Sources/Tools/MaxConvert/plConvert.cpp | 2 + Sources/Tools/MaxExport/CMakeLists.txt | 1 + Sources/Tools/MaxExport/Pch.cpp | 51 ++++++++++++ Sources/Tools/MaxExport/Pch.h | 77 +++++++++++++++++++ Sources/Tools/MaxExport/SimpleExport.cpp | 14 ++-- Sources/Tools/MaxExport/SimpleExport.h | 5 -- Sources/Tools/MaxExport/plErrorMsg.cpp | 5 +- Sources/Tools/MaxExport/plErrorMsg.h | 2 - Sources/Tools/MaxExport/plExportDlg.cpp | 40 +++++----- Sources/Tools/MaxExport/plExportErrorMsg.cpp | 16 ++-- Sources/Tools/MaxExport/plExportErrorMsg.h | 1 - .../Tools/MaxExport/plExportLogErrorMsg.cpp | 8 +- Sources/Tools/MaxExport/plExportLogErrorMsg.h | 1 - .../Tools/MaxExport/plExportProgressBar.cpp | 8 +- Sources/Tools/MaxExport/plExportProgressBar.h | 3 +- 15 files changed, 181 insertions(+), 53 deletions(-) create mode 100644 Sources/Tools/MaxExport/Pch.cpp create mode 100644 Sources/Tools/MaxExport/Pch.h diff --git a/Sources/Tools/MaxConvert/plConvert.cpp b/Sources/Tools/MaxConvert/plConvert.cpp index bf255780..79889472 100644 --- a/Sources/Tools/MaxConvert/plConvert.cpp +++ b/Sources/Tools/MaxConvert/plConvert.cpp @@ -57,6 +57,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include #include #include + +#include #pragma hdrstop #include "plConvert.h" diff --git a/Sources/Tools/MaxExport/CMakeLists.txt b/Sources/Tools/MaxExport/CMakeLists.txt index fb4a2e3c..ad8ea9a0 100644 --- a/Sources/Tools/MaxExport/CMakeLists.txt +++ b/Sources/Tools/MaxExport/CMakeLists.txt @@ -28,6 +28,7 @@ set(MaxExport_SOURCES SimpleExport.cpp ) +use_precompiled_header(Pch.h Pch.cpp MaxExport_HEADERS MaxExport_SOURCES) add_library(MaxExport STATIC ${MaxExport_HEADERS} ${MaxExport_SOURCES}) source_group("Header Files" FILES ${MaxExport_HEADERS}) diff --git a/Sources/Tools/MaxExport/Pch.cpp b/Sources/Tools/MaxExport/Pch.cpp new file mode 100644 index 00000000..f246b9d3 --- /dev/null +++ b/Sources/Tools/MaxExport/Pch.cpp @@ -0,0 +1,51 @@ +/*==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Additional permissions under GNU GPL version 3 section 7 + +If you modify this Program, or any covered work, by linking or +combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, +NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent +JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK +(or a modified version of those libraries), +containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, +PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG +JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the +licensors of this Program grant you additional +permission to convey the resulting work. Corresponding Source for a +non-source form of such a combination shall include the source code for +the parts of OpenSSL and IJG JPEG Library used as well as that of the covered +work. + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + +*==LICENSE==*/ + +#include "Pch.h" + +/** + * \file Pch.cpp + * \brief Precompiled Header object for MaxExport + * + * This file prompts MSVC to generate a PCH file for the MaxExport project. It + * has no function if precompiled headers are disabled in cmake. + */ diff --git a/Sources/Tools/MaxExport/Pch.h b/Sources/Tools/MaxExport/Pch.h new file mode 100644 index 00000000..79dfc98e --- /dev/null +++ b/Sources/Tools/MaxExport/Pch.h @@ -0,0 +1,77 @@ +/*==LICENSE==* + +CyanWorlds.com Engine - MMOG client, server and tools +Copyright (C) 2011 Cyan Worlds, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + +Additional permissions under GNU GPL version 3 section 7 + +If you modify this Program, or any covered work, by linking or +combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK, +NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent +JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK +(or a modified version of those libraries), +containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA, +PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG +JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the +licensors of this Program grant you additional +permission to convey the resulting work. Corresponding Source for a +non-source form of such a combination shall include the source code for +the parts of OpenSSL and IJG JPEG Library used as well as that of the covered +work. + +You can contact Cyan Worlds, Inc. by email legal@cyan.com + or by snail mail at: + Cyan Worlds, Inc. + 14617 N Newport Hwy + Mead, WA 99021 + +*==LICENSE==*/ + +#ifndef _MaxExport_Pch_inc_ +#define _MaxExport_Pch_inc_ + +/** + * \file Pch.h + * \brief Precompiled Header for MaxConvert + */ + +// Standard Library + +#include +#include +#include + +// Core Plasma +#include "HeadSpin.h" +#include "hsExceptionStack.h" +#include "hsExceptions.h" +#include "plFileUtils.h" +#include "hsStlSortUtils.h" +#include "hsStream.h" + +// Windows +#include "hsWindows.h" +#include + +// 3ds Max SDK +// This stuff should ALWAYS come after hsWindows.h +#include +#include +#include +#include +#include + +#endif // _MaxExport_Pch_inc_ diff --git a/Sources/Tools/MaxExport/SimpleExport.cpp b/Sources/Tools/MaxExport/SimpleExport.cpp index a3a9faf2..f7ed661f 100644 --- a/Sources/Tools/MaxExport/SimpleExport.cpp +++ b/Sources/Tools/MaxExport/SimpleExport.cpp @@ -44,14 +44,20 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // #include "HeadSpin.h" -#include "SimpleExport.h" -#include "notify.h" +#include "hsExceptionStack.h" +#include "plFileUtils.h" +#include "hsStream.h" + +#include +#include +#include +#pragma hdrstop +#include "SimpleExport.h" #include "plExportErrorMsg.h" #include "plExportLogErrorMsg.h" #include "MaxConvert/UserPropMgr.h" -#include "hsExceptionStack.h" #include "MaxConvert/hsConverterUtils.h" #include "MaxConvert/plBitmapCreator.h" #include "pfPython/plPythonFileMod.h" @@ -59,7 +65,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxMain/plPluginResManager.h" #include "plResMgr/plRegistryHelpers.h" #include "plResMgr/plRegistryNode.h" -#include "hsStream.h" #include "MaxConvert/plConvert.h" #include "MaxConvert/hsMaterialConverter.h" @@ -79,7 +84,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plExportDlg.h" #include "plStatusLog/plStatusLog.h" -#include "plFileUtils.h" #include "plAvatar/plAvatarMgr.h" diff --git a/Sources/Tools/MaxExport/SimpleExport.h b/Sources/Tools/MaxExport/SimpleExport.h index 95f3a3d9..99590b3d 100644 --- a/Sources/Tools/MaxExport/SimpleExport.h +++ b/Sources/Tools/MaxExport/SimpleExport.h @@ -42,11 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef __SIMPLEEXPORT_H #define __SIMPLEEXPORT_H - -#include "MaxMain/resource.h" -#include "Max.h" -#include "HeadSpin.h" - // // Inlines // diff --git a/Sources/Tools/MaxExport/plErrorMsg.cpp b/Sources/Tools/MaxExport/plErrorMsg.cpp index 71bc5494..31a3c8be 100644 --- a/Sources/Tools/MaxExport/plErrorMsg.cpp +++ b/Sources/Tools/MaxExport/plErrorMsg.cpp @@ -39,11 +39,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ -#include "HeadSpin.h" -#include "plErrorMsg.h" + #include "HeadSpin.h" #include "hsExceptions.h" - +#pragma hdrstop #include "plErrorMsg.h" diff --git a/Sources/Tools/MaxExport/plErrorMsg.h b/Sources/Tools/MaxExport/plErrorMsg.h index 5737866a..8becec83 100644 --- a/Sources/Tools/MaxExport/plErrorMsg.h +++ b/Sources/Tools/MaxExport/plErrorMsg.h @@ -42,8 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef __plErrorMsg_h #define __plErrorMsg_h -#include "HeadSpin.h" - #define PL_ERR_MSG_MAX_MSG 2048 class plErrorMsg diff --git a/Sources/Tools/MaxExport/plExportDlg.cpp b/Sources/Tools/MaxExport/plExportDlg.cpp index db36091e..56d27036 100644 --- a/Sources/Tools/MaxExport/plExportDlg.cpp +++ b/Sources/Tools/MaxExport/plExportDlg.cpp @@ -39,18 +39,26 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com Mead, WA 99021 *==LICENSE==*/ + #include "HeadSpin.h" -#include "HeadSpin.h" -#include "plExportDlg.h" -#include "MaxMain/resource.h" -#include "max.h" +#include "hsStlSortUtils.h" +#include "hsWindows.h" -#include "MaxMain/plMaxCFGFile.h" +#include +#include +#include -#include +#include #include -using std::vector; -using std::string; +#include +#pragma hdrstop + +#include "plExportDlg.h" +#include "MaxComponent/plComponentBase.h" +#include "MaxComponent/plMiscComponents.h" +#include "MaxMain/resource.h" +#include "MaxMain/plMaxCFGFile.h" +#include "MaxMain/plMaxNode.h" extern HINSTANCE hInstance; @@ -146,12 +154,6 @@ const char* plExportDlgImp::GetExportPage() return fExportPage; } -#include "MaxComponent/plComponentBase.h" -#include "MaxComponent/plMiscComponents.h" -#include "MaxMain/plMaxNode.h" -#include "hsStlSortUtils.h" -#include - typedef std::set CompSet; static void GetPagesRecur(plMaxNode* node, CompSet& comps) @@ -385,7 +387,7 @@ void plExportDlgImp::Show() fDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_EXPORT), GetCOREInterface()->GetMAXHWnd(), ForwardDlgProc); } -static bool IsExcluded(const char* fileName, vector& excludeFiles) +static bool IsExcluded(const char* fileName, std::vector& excludeFiles) { for (int i = 0; i < excludeFiles.size(); i++) { @@ -396,7 +398,7 @@ static bool IsExcluded(const char* fileName, vector& excludeFiles) return false; } -static bool AutoExportDir(const char* inputDir, const char* outputDir, const char* groupFiles, vector& excludeFiles) +static bool AutoExportDir(const char* inputDir, const char* outputDir, const char* groupFiles, std::vector& excludeFiles) { bool exportedFile = false; @@ -466,7 +468,7 @@ static void ShutdownMax() PostMessage(GetCOREInterface()->GetMAXHWnd(), WM_CLOSE, 0, 0); } -static void GetStringSection(const char* configFile, const char* keyName, vector& strings) +static void GetStringSection(const char* configFile, const char* keyName, std::vector& strings) { char source[256]; GetPrivateProfileString("Settings", keyName, "", source, sizeof(source), configFile); @@ -501,13 +503,13 @@ void plExportDlgImp::StartAutoExport() hsMessageBox_SuppressPrompts = true; // Files to ignore - vector excludeFiles; + std::vector excludeFiles; GetStringSection(configFile, "ExcludeFiles", excludeFiles); // // Get the file substrings to export in one session // - vector groupedFiles; + std::vector groupedFiles; GetStringSection(configFile, "GroupedFiles", groupedFiles); for (int i = 0; i < groupedFiles.size(); i++) diff --git a/Sources/Tools/MaxExport/plExportErrorMsg.cpp b/Sources/Tools/MaxExport/plExportErrorMsg.cpp index ebf008de..c1a36753 100644 --- a/Sources/Tools/MaxExport/plExportErrorMsg.cpp +++ b/Sources/Tools/MaxExport/plExportErrorMsg.cpp @@ -40,12 +40,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" - -#include "HeadSpin.h" -#include "plExportErrorMsg.h" #include "hsExceptions.h" +#pragma hdrstop - +#include "plExportErrorMsg.h" bool plExportErrorMsg::Show() @@ -61,7 +59,7 @@ bool plExportErrorMsg::Ask() { if( GetBogus() ) { - return IDYES == hsMessageBox(GetMsg(), GetLabel(), hsMessageBoxYesNo/*|hsMessageBoxIconExclamation*/); + return hsMBoxYes == hsMessageBox(GetMsg(), GetLabel(), hsMessageBoxYesNo/*|hsMessageBoxIconExclamation*/); } return false; } @@ -86,12 +84,12 @@ bool plExportErrorMsg::CheckAskOrCancel() { strncat(GetMsg(), " - ABORT? (Cancel to mute warnings)", 255); int ret = hsMessageBox(GetMsg(), GetLabel(), hsMessageBoxYesNoCancel/*|hsMessageBoxIconExclamation*/); - if( IDYES == ret ) + if( hsMBoxYes == ret ) { sprintf(GetMsg(), "!Abort at user response to error!"); Check(); } - else if( IDCANCEL == ret ) + else if( hsMBoxCancel == ret ) return 1; } return false; @@ -131,9 +129,7 @@ void plExportErrorMsg::Quit() void plExportErrorMsg::IDebugThrow() { try { -#if HS_BUILD_FOR_WIN32 - DebugBreak(); -#endif // HS_BUILD_FOR_WIN32 + DebugBreakIfDebuggerPresent(); } catch(...) { diff --git a/Sources/Tools/MaxExport/plExportErrorMsg.h b/Sources/Tools/MaxExport/plExportErrorMsg.h index f97d812a..79999848 100644 --- a/Sources/Tools/MaxExport/plExportErrorMsg.h +++ b/Sources/Tools/MaxExport/plExportErrorMsg.h @@ -42,7 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plExportErrorMsg_inc #define plExportErrorMsg_inc -#include #include "plErrorMsg.h" #if !HS_BUILD_FOR_WIN32 diff --git a/Sources/Tools/MaxExport/plExportLogErrorMsg.cpp b/Sources/Tools/MaxExport/plExportLogErrorMsg.cpp index 0d44cff9..bc0e0761 100644 --- a/Sources/Tools/MaxExport/plExportLogErrorMsg.cpp +++ b/Sources/Tools/MaxExport/plExportLogErrorMsg.cpp @@ -40,14 +40,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" -#include "Max.h" +#include "hsExceptions.h" +#include "hsWindows.h" #include + +#include #include #include +#pragma hdrstop -#include "HeadSpin.h" #include "plExportLogErrorMsg.h" -#include "hsExceptions.h" // diff --git a/Sources/Tools/MaxExport/plExportLogErrorMsg.h b/Sources/Tools/MaxExport/plExportLogErrorMsg.h index 33a7df74..c901a468 100644 --- a/Sources/Tools/MaxExport/plExportLogErrorMsg.h +++ b/Sources/Tools/MaxExport/plExportLogErrorMsg.h @@ -48,7 +48,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com // If there is no errors then there should be no file created. // -#include #include "plErrorMsg.h" #if !HS_BUILD_FOR_WIN32 diff --git a/Sources/Tools/MaxExport/plExportProgressBar.cpp b/Sources/Tools/MaxExport/plExportProgressBar.cpp index 81f459f8..c9e242ed 100644 --- a/Sources/Tools/MaxExport/plExportProgressBar.cpp +++ b/Sources/Tools/MaxExport/plExportProgressBar.cpp @@ -40,11 +40,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com *==LICENSE==*/ #include "HeadSpin.h" -#include "Max.h" -#include "plExportProgressBar.h" +#include "hsWindows.h" #include + +#include #include #include +#pragma hdrstop + +#include "plExportProgressBar.h" namespace { DWORD WINAPI ProgressDummyFunc(LPVOID arg) diff --git a/Sources/Tools/MaxExport/plExportProgressBar.h b/Sources/Tools/MaxExport/plExportProgressBar.h index 2d8df767..5e600055 100644 --- a/Sources/Tools/MaxExport/plExportProgressBar.h +++ b/Sources/Tools/MaxExport/plExportProgressBar.h @@ -42,8 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #ifndef plExportProgressBar_inc #define plExportProgressBar_inc -#include "HeadSpin.h" - +class Interface; class INode; class plExportProgressBar