Browse Source

Untangle MaxConvert

Fix compilation as a result of hsWindows. Also, add precompiled header
support (this shaves off 9 seconds on my machine) and fix some warnings.
As we saw in the PCH-ization of pfPython, includes were untangled (to some
extent) and forward declarations were introduced where appropriate.
Adam Johnson 12 years ago
parent
commit
586aa94e38
  1. 1
      Sources/Tools/MaxConvert/CMakeLists.txt
  2. 51
      Sources/Tools/MaxConvert/Pch.cpp
  3. 101
      Sources/Tools/MaxConvert/Pch.h
  4. 7
      Sources/Tools/MaxConvert/StringTokenizer.cpp
  5. 4
      Sources/Tools/MaxConvert/StringTokenizer.h
  6. 64
      Sources/Tools/MaxConvert/UserPropMgr.cpp
  7. 54
      Sources/Tools/MaxConvert/UserPropMgr.h
  8. 27
      Sources/Tools/MaxConvert/hsControlConverter.cpp
  9. 29
      Sources/Tools/MaxConvert/hsControlConverter.h
  10. 28
      Sources/Tools/MaxConvert/hsConverterUtils.cpp
  11. 15
      Sources/Tools/MaxConvert/hsConverterUtils.h
  12. 50
      Sources/Tools/MaxConvert/hsMaterialConverter.cpp
  13. 25
      Sources/Tools/MaxConvert/hsMaterialConverter.h
  14. 2
      Sources/Tools/MaxConvert/hsMaxLayerBase.h
  15. 21
      Sources/Tools/MaxConvert/hsVertexShader.cpp
  16. 8
      Sources/Tools/MaxConvert/plBitmapCreator.cpp
  17. 7
      Sources/Tools/MaxConvert/plBitmapCreator.h
  18. 25
      Sources/Tools/MaxConvert/plClusterUtil.cpp
  19. 12
      Sources/Tools/MaxConvert/plClusterUtil.h
  20. 23
      Sources/Tools/MaxConvert/plConvert.cpp
  21. 5
      Sources/Tools/MaxConvert/plConvert.h
  22. 5
      Sources/Tools/MaxConvert/plDistTree.cpp
  23. 2
      Sources/Tools/MaxConvert/plDistTree.h
  24. 19
      Sources/Tools/MaxConvert/plDistributor.cpp
  25. 37
      Sources/Tools/MaxConvert/plLayerConverter.cpp
  26. 4
      Sources/Tools/MaxConvert/plLayerConverter.h
  27. 22
      Sources/Tools/MaxConvert/plLightMapGen.cpp
  28. 4
      Sources/Tools/MaxConvert/plLightMapGen.h
  29. 30
      Sources/Tools/MaxConvert/plMeshConverter.cpp
  30. 4
      Sources/Tools/MaxConvert/plMeshConverter.h
  31. 14
      Sources/Tools/MaxConvert/plRenderGlobalContext.cpp
  32. 7
      Sources/Tools/MaxConvert/plRenderGlobalContext.h
  33. 5
      Sources/Tools/MaxConvert/plRenderInstance.cpp
  34. 2
      Sources/Tools/MaxConvert/plRenderInstance.h
  35. 2
      Sources/Tools/MaxMain/MaxCompat.h

1
Sources/Tools/MaxConvert/CMakeLists.txt

@ -48,6 +48,7 @@ set(MaxConvert_SOURCES
UserPropMgr.cpp UserPropMgr.cpp
) )
use_precompiled_header(Pch.h Pch.cpp MaxConvert_HEADERS MaxConvert_SOURCES)
add_library(MaxConvert STATIC ${MaxConvert_HEADERS} ${MaxConvert_SOURCES}) add_library(MaxConvert STATIC ${MaxConvert_HEADERS} ${MaxConvert_SOURCES})
source_group("Header Files" FILES ${MaxConvert_HEADERS}) source_group("Header Files" FILES ${MaxConvert_HEADERS})

51
Sources/Tools/MaxConvert/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 <http://www.gnu.org/licenses/>.
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 MaxConvert
*
* This file prompts MSVC to generate a PCH file for the MaxConvert project. It
* has no function if precompiled headers are disabled in cmake.
*/

101
Sources/Tools/MaxConvert/Pch.h

@ -0,0 +1,101 @@
/*==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 <http://www.gnu.org/licenses/>.
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 _MaxConvert_Pch_inc_
#define _MaxConvert_Pch_inc_
/**
* \file Pch.h
* \brief Precompiled Header for MaxConvert
*/
// Standard Library
#include <algorithm>
#include <float.h>
#include <math.h>
#include <string.h>
#include <vector>
// Core Plasma
#include "HeadSpin.h"
#include "hsBitVector.h"
#include "hsColorRGBA.h"
#include "plgDispatch.h"
#include "hsExceptionStack.h"
#include "hsFastMath.h"
#include "hsGeometry3.h"
#include "hsMatrix44.h"
#include "hsResMgr.h"
#include "plString.h"
#include "hsStringTokenizer.h"
#include "hsTemplates.h"
#include "plTweak.h"
// Windows
#include "hsWindows.h"
#include <CommCtrl.h>
#include <commdlg.h>
// MaxComponent
#include "MaxComponent/plComponent.h"
// 3ds Max SDK
// This stuff should ALWAYS come after hsWindows.h
#include <bmmlib.h>
#include <dummy.h>
#include <keyreduc.h>
#include <INode.h>
#include <ISkin.h>
#include <istdplug.h>
#include <iparamm2.h>
#include <maxversion.h>
#include <meshdlib.h>
#include <modstack.h>
#include <notify.h>
#include <stdmat.h>
#include <texutil.h>
#if MAX_VERSION_MAJOR >= 13
# include <INamedSelectionSetManager.h>
#endif
#endif // _MaxConvert_Pch_inc_

7
Sources/Tools/MaxConvert/StringTokenizer.cpp

@ -39,10 +39,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021 Mead, WA 99021
*==LICENSE==*/ *==LICENSE==*/
// StringTokenizer.cpp
#include <string.h>
#pragma hdrstop
#include "StringTokenizer.h" #include "StringTokenizer.h"
#include "string.h"
// String Tokenizer routines // String Tokenizer routines
StringTokenizer::StringTokenizer() { StringTokenizer::StringTokenizer() {
@ -81,7 +82,7 @@ char *StringTokenizer::next() {
}; };
bool StringTokenizer::isSep(char c) { bool StringTokenizer::isSep(char c) {
if (!qAsTok || !inQuote) { if (!qAsTok || !inQuote) {
for (int32_t i=0; i<numSeps; i++) { for (int i=0; i<numSeps; i++) {
if (seps[i] == c) return true; if (seps[i] == c) return true;
} }
} }

4
Sources/Tools/MaxConvert/StringTokenizer.h

@ -43,14 +43,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef _STRING_TOKENIZER_H_ #ifndef _STRING_TOKENIZER_H_
#define _STRING_TOKENIZER_H_ #define _STRING_TOKENIZER_H_
#include "Headspin.h"
class StringTokenizer { class StringTokenizer {
private: private:
char *seps; char *seps;
char *tok; char *tok;
bool isSep(char c); bool isSep(char c);
int32_t numSeps; int numSeps;
bool qAsTok; bool qAsTok;
bool inQuote; bool inQuote;
public: public:

64
Sources/Tools/MaxConvert/UserPropMgr.cpp

@ -39,12 +39,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021 Mead, WA 99021
*==LICENSE==*/ *==LICENSE==*/
// UserPropMgr.cpp
#include "HeadSpin.h" #include "HeadSpin.h"
#include "hsWindows.h"
#include <max.h>
#include "UserPropMgr.h" #include "UserPropMgr.h"
#include "hsStringTokenizer.h" #include "hsStringTokenizer.h"
#include "hsHashTable.h" #include "hsHashTable.h"
#define REFMSG_USERPROP (REFMSG_USER + 1) #define REFMSG_USERPROP (REFMSG_USER + 1)
@ -69,7 +69,7 @@ UserPropMgr::~UserPropMgr()
CloseQuickTable(); CloseQuickTable();
} }
void UserPropMgr::SetUserPropFlag(INode *node, const char *name, const BOOL setFlag, const int32_t hFlag) void UserPropMgr::SetUserPropFlag(INode *node, const char *name, const bool setFlag, const int32_t hFlag)
{ {
if (setFlag) SetUserProp(node,name,NULL,hFlag); if (setFlag) SetUserProp(node,name,NULL,hFlag);
else ClearUserProp(node,name,hFlag); else ClearUserProp(node,name,hFlag);
@ -83,7 +83,7 @@ void UserPropMgr::ClearUserPropALL(const char *name, const int32_t hFlag)
} }
} }
void UserPropMgr::SelectUserPropFlagALL(INode *node, const char *name, const BOOL flag) { void UserPropMgr::SelectUserPropFlagALL(INode *node, const char *name, const bool flag) {
if (node) if (node)
{ {
if (UserPropExists(node,name) == flag) ip->SelectNode(node,false); if (UserPropExists(node,name) == flag) ip->SelectNode(node,false);
@ -96,7 +96,7 @@ void UserPropMgr::SelectUserPropFlagALL(INode *node, const char *name, const BOO
void UserPropMgr::DeSelectWithOut(const char *name, const char *value) { void UserPropMgr::DeSelectWithOut(const char *name, const char *value) {
BOOL oldProps = vProps; bool oldProps = vProps;
vProps=false; vProps=false;
TSTR val; TSTR val;
INode *nodes[1]; INode *nodes[1];
@ -169,7 +169,7 @@ ip->ThawSelection();
int UserPropMgr::RecursiveCountAlike(INode *node, BOOL MatchAll) { int UserPropMgr::RecursiveCountAlike(INode *node, bool MatchAll) {
int count=0; int count=0;
if (node) { if (node) {
if (!node->IsNodeHidden() && !node->IsFrozen() && IsAlike(node,MatchAll)) count++; if (!node->IsNodeHidden() && !node->IsFrozen() && IsAlike(node,MatchAll)) count++;
@ -182,18 +182,18 @@ int UserPropMgr::RecursiveCountAlike(INode *node, BOOL MatchAll) {
} }
int UserPropMgr::CountAlike(BOOL MatchAll) { int UserPropMgr::CountAlike(bool MatchAll) {
return RecursiveCountAlike(NULL, MatchAll); return RecursiveCountAlike(NULL, MatchAll);
} }
BOOL UserPropMgr::IsMatch(const char *val1, const char *val2) { bool UserPropMgr::IsMatch(const char *val1, const char *val2) {
if (!stricmp(val1,val2)) return true; if (!stricmp(val1,val2)) return true;
hsStringTokenizer toker(val1," ,@"); hsStringTokenizer toker(val1," ,@");
char *tok; char *tok;
while (tok=toker.next()) { while (tok=toker.next()) {
hsStringTokenizer toker2(val2," ,@"); hsStringTokenizer toker2(val2," ,@");
BOOL found = false; bool found = false;
char *tok2; char *tok2;
while ((tok2=toker2.next()) && !found) { while ((tok2=toker2.next()) && !found) {
if (tok[0] >= '1' && tok[0] <= '0') { if (tok[0] >= '1' && tok[0] <= '0') {
@ -210,11 +210,11 @@ BOOL UserPropMgr::IsMatch(const char *val1, const char *val2) {
} }
BOOL UserPropMgr::IsAlike(INode *node, BOOL MatchAll) { bool UserPropMgr::IsAlike(INode *node, bool MatchAll) {
TSTR buf; TSTR buf;
GetUserPropBuffer(node,buf); GetUserPropBuffer(node,buf);
BOOL oldProps = vProps; bool oldProps = vProps;
vProps=false; vProps=false;
hsStringTokenizer toker(buf," \r\n"); hsStringTokenizer toker(buf," \r\n");
@ -223,7 +223,7 @@ BOOL UserPropMgr::IsAlike(INode *node, BOOL MatchAll) {
TSTR name; TSTR name;
TSTR value; TSTR value;
TSTR tval; TSTR tval;
BOOL match = MatchAll; bool match = MatchAll;
bool isName = true; bool isName = true;
tok = toker.next(); tok = toker.next();
while (tok && (match==MatchAll)) { while (tok && (match==MatchAll)) {
@ -304,14 +304,14 @@ void UserPropMgr::SetUserPropBuffer(INode *node, const TSTR &buf)
} }
} }
void UserPropMgr::SetUserPropFlagALL(const char *name, const BOOL setFlag, const int32_t hFlag) void UserPropMgr::SetUserPropFlagALL(const char *name, const bool setFlag, const int32_t hFlag)
{ {
for (int i=0; i<GetSelNodeCount();i++) for (int i=0; i<GetSelNodeCount();i++)
{ {
SetUserPropFlag(GetSelNode(i),name,setFlag,hFlag); SetUserPropFlag(GetSelNode(i),name,setFlag,hFlag);
} }
} }
BOOL UserPropMgr::GetUserPropFlagALL(const char *name, BOOL &isSet, const int32_t hFlag) bool UserPropMgr::GetUserPropFlagALL(const char *name, bool &isSet, const int32_t hFlag)
{ {
isSet = UserPropMgr::UserPropExists(GetSelNode(0),name,hFlag); isSet = UserPropMgr::UserPropExists(GetSelNode(0),name,hFlag);
@ -419,7 +419,7 @@ void UserPropMgr::ClearUserProp(INode *node, const char *name, const int32_t hFl
} }
}; };
BOOL UserPropMgr::GetUserProp(INode *node, const char *name, TSTR &value, const int32_t hFlag) bool UserPropMgr::GetUserProp(INode *node, const char *name, TSTR &value, const int32_t hFlag)
{ {
node = GetAncestorIfNeeded(node,hFlag); node = GetAncestorIfNeeded(node,hFlag);
@ -575,7 +575,7 @@ void UserPropMgr::SetUserProp(INode *node, const char *name, const char *value,
} }
BOOL UserPropMgr::GetUserPropString(INode *node, const char *name, TSTR &value, const int32_t hFlag) bool UserPropMgr::GetUserPropString(INode *node, const char *name, TSTR &value, const int32_t hFlag)
{ {
return GetUserProp(node,name,value,hFlag); return GetUserProp(node,name,value,hFlag);
} }
@ -583,7 +583,7 @@ void UserPropMgr::SetUserPropString(INode *node, const char *name, const char *v
{ {
SetUserProp(node,name,value,hFlag); SetUserProp(node,name,value,hFlag);
} }
BOOL UserPropMgr::GetUserPropFloat(INode *node, const char *name, float &value, const int32_t hFlag) bool UserPropMgr::GetUserPropFloat(INode *node, const char *name, float &value, const int32_t hFlag)
{ {
TSTR valStr; TSTR valStr;
if (GetUserProp(node,name,valStr,hFlag)) if (GetUserProp(node,name,valStr,hFlag))
@ -598,7 +598,7 @@ void UserPropMgr::SetUserPropFloat(INode *node, const char *name, const float va
char valStr[50]; char valStr[50];
if (sprintf(valStr,"%g",value)) SetUserProp(node,name,valStr,hFlag); if (sprintf(valStr,"%g",value)) SetUserProp(node,name,valStr,hFlag);
} }
BOOL UserPropMgr::GetUserPropInt(INode *node, const char *name, int &value, const int32_t hFlag) bool UserPropMgr::GetUserPropInt(INode *node, const char *name, int &value, const int32_t hFlag)
{ {
TSTR valStr; TSTR valStr;
if (GetUserProp(node,name,valStr,hFlag)) { if (GetUserProp(node,name,valStr,hFlag)) {
@ -613,13 +613,13 @@ void UserPropMgr::SetUserPropInt(INode *node, const char *name, const int value,
if (sprintf(valStr,"%d",value)) SetUserProp(node,name,valStr,hFlag); if (sprintf(valStr,"%d",value)) SetUserProp(node,name,valStr,hFlag);
} }
BOOL UserPropMgr::UserPropExists(INode *node, const char *name, const int32_t hFlag) bool UserPropMgr::UserPropExists(INode *node, const char *name, const int32_t hFlag)
{ {
TSTR value; TSTR value;
return GetUserProp(node,name,value,hFlag); return GetUserProp(node,name,value,hFlag);
} }
BOOL UserPropMgr::GetUserPropStringList(INode *node, const char *name, int &num, TSTR list[]) { bool UserPropMgr::GetUserPropStringList(INode *node, const char *name, int &num, TSTR list[]) {
TSTR sdata; TSTR sdata;
if (UserPropMgr::GetUserPropString(node,name,sdata)) { if (UserPropMgr::GetUserPropString(node,name,sdata)) {
num=0; num=0;
@ -633,7 +633,7 @@ BOOL UserPropMgr::GetUserPropStringList(INode *node, const char *name, int &num,
} else return false; } else return false;
} }
BOOL UserPropMgr::GetUserPropIntList(INode *node, const char *name, int &num, int list[]) { bool UserPropMgr::GetUserPropIntList(INode *node, const char *name, int &num, int list[]) {
TSTR sdata; TSTR sdata;
if (UserPropMgr::GetUserPropString(node,name,sdata)) { if (UserPropMgr::GetUserPropString(node,name,sdata)) {
num=0; num=0;
@ -647,7 +647,7 @@ BOOL UserPropMgr::GetUserPropIntList(INode *node, const char *name, int &num, in
} else return false; } else return false;
} }
BOOL UserPropMgr::GetUserPropFloatList(INode *node, const char *name, int &num, float list[]) { bool UserPropMgr::GetUserPropFloatList(INode *node, const char *name, int &num, float list[]) {
TSTR sdata; TSTR sdata;
if (UserPropMgr::GetUserPropString(node,name,sdata)) { if (UserPropMgr::GetUserPropString(node,name,sdata)) {
num=0; num=0;
@ -661,13 +661,13 @@ BOOL UserPropMgr::GetUserPropFloatList(INode *node, const char *name, int &num,
} else return false; } else return false;
} }
BOOL UserPropMgr::GetUserPropStringALL(const char *name, TSTR &value, const int32_t hFlag) bool UserPropMgr::GetUserPropStringALL(const char *name, TSTR &value, const int32_t hFlag)
{ {
BOOL propSet = UserPropMgr::GetUserPropString(GetSelNode(0),name,value,hFlag); bool propSet = UserPropMgr::GetUserPropString(GetSelNode(0),name,value,hFlag);
TSTR tvalue; TSTR tvalue;
int i=1; int i=1;
BOOL propMixed = FALSE; bool propMixed = FALSE;
while (i < GetSelNodeCount() && !propMixed) { while (i < GetSelNodeCount() && !propMixed) {
if (propSet ^ UserPropMgr::GetUserPropString(GetSelNode(i),name,tvalue,hFlag)) propMixed = TRUE; if (propSet ^ UserPropMgr::GetUserPropString(GetSelNode(i),name,tvalue,hFlag)) propMixed = TRUE;
propMixed = (!(value == tvalue)); propMixed = (!(value == tvalue));
@ -683,25 +683,25 @@ void UserPropMgr::SetUserPropStringALL(const char *name, const char *value, cons
} }
} }
BOOL UserPropMgr::GetUserPropStringListALL(const char *name, int &num, TSTR list[]) { bool UserPropMgr::GetUserPropStringListALL(const char *name, int &num, TSTR list[]) {
TSTR val; TSTR val;
GetUserPropStringList(GetSelNode(0),name,num,list); GetUserPropStringList(GetSelNode(0),name,num,list);
return GetUserPropStringALL(name,val); return GetUserPropStringALL(name,val);
} }
BOOL UserPropMgr::GetUserPropIntListALL(const char *name, int &num, int *list) { bool UserPropMgr::GetUserPropIntListALL(const char *name, int &num, int *list) {
TSTR val; TSTR val;
GetUserPropIntList(GetSelNode(0),name,num,list); GetUserPropIntList(GetSelNode(0),name,num,list);
return GetUserPropStringALL(name,val); return GetUserPropStringALL(name,val);
} }
BOOL UserPropMgr::GetUserPropFloatListALL(const char *name, int &num, float *list) { bool UserPropMgr::GetUserPropFloatListALL(const char *name, int &num, float *list) {
TSTR val; TSTR val;
GetUserPropFloatList(GetSelNode(0),name,num,list); GetUserPropFloatList(GetSelNode(0),name,num,list);
return GetUserPropStringALL(name,val); return GetUserPropStringALL(name,val);
} }
BOOL UserPropMgr::GetNodeNameALL(TSTR &name) { bool UserPropMgr::GetNodeNameALL(TSTR &name) {
if (vProps) name = vname; if (vProps) name = vname;
else if (ip->GetSelNodeCount() == 1) name = ip->GetSelNode(0)->GetName(); else if (ip->GetSelNodeCount() == 1) name = ip->GetSelNode(0)->GetName();
else return false; else return false;
@ -725,7 +725,7 @@ void UserPropMgr::SetNodeNameALL(const char *name) {
} }
void UserPropMgr::LoadVirtualProps(BOOL reset) { void UserPropMgr::LoadVirtualProps(bool reset) {
if (reset) if (reset)
{ {
vbuf = ""; vbuf = "";
@ -736,7 +736,7 @@ void UserPropMgr::LoadVirtualProps(BOOL reset) {
void UserPropMgr::DestroyVirtualProps() { void UserPropMgr::DestroyVirtualProps() {
vProps = false; vProps = false;
} }
BOOL UserPropMgr::IsVirtual() { bool UserPropMgr::IsVirtual() {
return vProps; return vProps;
} }
@ -837,7 +837,7 @@ void UserPropMgr::IBuildQuickTable(INode* node)
} }
} }
BOOL UserPropMgr::ICheckQuickEntry(const char *key, TSTR &value) bool UserPropMgr::ICheckQuickEntry(const char *key, TSTR &value)
{ {
QuickPair q; QuickPair q;
q.SetKey(key); q.SetKey(key);

54
Sources/Tools/MaxConvert/UserPropMgr.h

@ -44,10 +44,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef _USERPROPMGR_H_ #ifndef _USERPROPMGR_H_
#define _USERPROPMGR_H_ #define _USERPROPMGR_H_
#include "Max.h"
#include "HeadSpin.h" #include "HeadSpin.h"
template <class T> class hsHashTable; template <class T> class hsHashTable;
class Interface;
class NameMaker;
class INode;
class UserPropMgr { class UserPropMgr {
public: public:
@ -64,40 +66,40 @@ public:
NameMaker *nm; NameMaker *nm;
void SetUserPropFlag(INode *node, const char *name, const BOOL setFlag, const int32_t hFlag=kMe); void SetUserPropFlag(INode *node, const char *name, const bool setFlag, const int32_t hFlag=kMe);
void SelectUserPropFlagALL(INode *node, const char *name, const BOOL flag); void SelectUserPropFlagALL(INode *node, const char *name, const bool flag);
void ClearUserProp(INode *node, const char *name, const int32_t hFlag=kMe); void ClearUserProp(INode *node, const char *name, const int32_t hFlag=kMe);
void ClearUserPropALL(const char *name, const int32_t hFlag=kMe); void ClearUserPropALL(const char *name, const int32_t hFlag=kMe);
void SetUserPropFlagALL(const char *name, const BOOL setFlag, const int32_t hFlag=kMe); void SetUserPropFlagALL(const char *name, const bool setFlag, const int32_t hFlag=kMe);
BOOL GetUserPropFlagALL(const char *name, BOOL &isSet, const int32_t hFlag=kMe); bool GetUserPropFlagALL(const char *name, bool &isSet, const int32_t hFlag=kMe);
BOOL GetUserProp(INode *node, const char *name, TSTR &value, const int32_t hFlag=kMe); bool GetUserProp(INode *node, const char *name, TSTR &value, const int32_t hFlag=kMe);
void SetUserProp(INode *node, const char *name, const char *value, const int32_t hFlag=kMe); void SetUserProp(INode *node, const char *name, const char *value, const int32_t hFlag=kMe);
BOOL UserPropExists(INode *node, const char *name, const int32_t hFlag=kMe); bool UserPropExists(INode *node, const char *name, const int32_t hFlag=kMe);
BOOL GetUserPropString(INode *node, const char *name, TSTR &value, const int32_t hFlag=kMe); bool GetUserPropString(INode *node, const char *name, TSTR &value, const int32_t hFlag=kMe);
void SetUserPropString(INode *node, const char *name, const char *value, const int32_t hFlag=kMe); void SetUserPropString(INode *node, const char *name, const char *value, const int32_t hFlag=kMe);
BOOL GetUserPropFloat(INode *node, const char *name, float &value, const int32_t hFlag=kMe); bool GetUserPropFloat(INode *node, const char *name, float &value, const int32_t hFlag=kMe);
void SetUserPropFloat(INode *node, const char *name, const float value, const int32_t hFlag=kMe); void SetUserPropFloat(INode *node, const char *name, const float value, const int32_t hFlag=kMe);
BOOL GetUserPropInt(INode *node, const char *name, int &value, const int32_t hFlag=kMe); bool GetUserPropInt(INode *node, const char *name, int &value, const int32_t hFlag=kMe);
void SetUserPropInt(INode *node, const char *name, const int value, const int32_t hFlag=kMe); void SetUserPropInt(INode *node, const char *name, const int value, const int32_t hFlag=kMe);
BOOL GetUserPropStringList(INode *node, const char *name, int &num, TSTR list[]); bool GetUserPropStringList(INode *node, const char *name, int &num, TSTR list[]);
BOOL GetUserPropIntList(INode *node, const char *name, int &num, int list[]); bool GetUserPropIntList(INode *node, const char *name, int &num, int list[]);
BOOL GetUserPropFloatList(INode *node, const char *name, int &num, float list[]); bool GetUserPropFloatList(INode *node, const char *name, int &num, float list[]);
BOOL GetUserPropStringALL(const char *name, TSTR &value, const int32_t hFlag=kMe); bool GetUserPropStringALL(const char *name, TSTR &value, const int32_t hFlag=kMe);
void SetUserPropStringALL(const char *name, const char *value, const int32_t hFlag=kMe); void SetUserPropStringALL(const char *name, const char *value, const int32_t hFlag=kMe);
BOOL GetUserPropStringListALL(const char *name, int &num, TSTR list[]); bool GetUserPropStringListALL(const char *name, int &num, TSTR list[]);
BOOL GetUserPropIntListALL(const char *name, int &num, int *list); bool GetUserPropIntListALL(const char *name, int &num, int *list);
BOOL GetUserPropFloatListALL(const char *name, int &num, float *list); bool GetUserPropFloatListALL(const char *name, int &num, float *list);
BOOL GetNodeNameALL(TSTR &name); bool GetNodeNameALL(TSTR &name);
void SetNodeNameALL(const char *name); void SetNodeNameALL(const char *name);
void LoadVirtualProps(BOOL reset=true); void LoadVirtualProps(bool reset=true);
void DestroyVirtualProps(); void DestroyVirtualProps();
BOOL IsVirtual(); bool IsVirtual();
int GetSelNodeCount(); int GetSelNodeCount();
INode *GetSelNode(int i); INode *GetSelNode(int i);
@ -106,8 +108,8 @@ public:
void GetUserPropBuffer(INode *node, TSTR &buf); void GetUserPropBuffer(INode *node, TSTR &buf);
void SetUserPropBuffer(INode *node, const TSTR &buf); void SetUserPropBuffer(INode *node, const TSTR &buf);
BOOL IsAlike(INode *node, BOOL MatchAll=true); bool IsAlike(INode *node, bool MatchAll=true);
int CountAlike(BOOL MatchAll=true); int CountAlike(bool MatchAll=true);
void DeSelectUnAlike(INode *node=NULL); void DeSelectUnAlike(INode *node=NULL);
Interface *GetInterface() { return ip; } Interface *GetInterface() { return ip; }
@ -119,9 +121,9 @@ private:
INode* GetAncestorIfNeeded(INode* node, const int32_t hFlag); INode* GetAncestorIfNeeded(INode* node, const int32_t hFlag);
void DeSelectWithOut(const char *name, const char *value); void DeSelectWithOut(const char *name, const char *value);
void RecursiveSelectAll(INode *node = NULL); void RecursiveSelectAll(INode *node = NULL);
int RecursiveCountAlike(INode *node = NULL, BOOL MatchAll=true); int RecursiveCountAlike(INode *node = NULL, bool MatchAll=true);
BOOL IsMatch(const char *val1, const char *val2); bool IsMatch(const char *val1, const char *val2);
BOOL vProps; bool vProps;
TSTR vbuf; TSTR vbuf;
TSTR vname; TSTR vname;
@ -150,7 +152,7 @@ private:
static const uint32_t kQuickSize; static const uint32_t kQuickSize;
INode* fQuickNode; INode* fQuickNode;
void IBuildQuickTable(INode* node); void IBuildQuickTable(INode* node);
BOOL ICheckQuickEntry(const char *key, TSTR &value); bool ICheckQuickEntry(const char *key, TSTR &value);
Interface *ip; Interface *ip;

27
Sources/Tools/MaxConvert/hsControlConverter.cpp

@ -41,18 +41,21 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include "HeadSpin.h" #include "HeadSpin.h"
#include "hsExceptionStack.h"
#include "hsTemplates.h"
#include "hsWindows.h"
#include <commdlg.h> #include <commdlg.h>
#include <math.h> #include <math.h>
#include <stdmat.h>
#include <bmmlib.h>
#include <istdplug.h>
#include <texutil.h>
#include <iparamb2.h>
#include <modstack.h>
#include <keyreduc.h>
#pragma hdrstop
//#include "Max.h"
#include "MaxMain/plMaxNode.h" #include "MaxMain/plMaxNode.h"
#include "stdmat.h"
#include "bmmlib.h"
#include "istdplug.h"
#include "texutil.h"
#include "iparamb2.h"
#include "modstack.h"
#include "keyreduc.h"
#include "hsMaxLayerBase.h" #include "hsMaxLayerBase.h"
#include "plInterp/plController.h" #include "plInterp/plController.h"
@ -62,7 +65,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsConverterUtils.h" #include "hsConverterUtils.h"
#include "hsControlConverter.h" #include "hsControlConverter.h"
#include "hsMaterialConverter.h" #include "hsMaterialConverter.h"
#include "hsExceptionStack.h"
#include "MaxExport/plErrorMsg.h" #include "MaxExport/plErrorMsg.h"
#include "MaxComponent/plNoteTrackAnim.h" #include "MaxComponent/plNoteTrackAnim.h"
#include "MaxComponent/plCameraComponents.h" #include "MaxComponent/plCameraComponents.h"
@ -2100,11 +2102,8 @@ void hsControlConverter::IExportAnimatedCameraFOV(plMaxNode* node, hsTArray <hsG
{ {
TimeValue t = TimeValue(GetTicksPerFrame() * (kfArray[0][i].fFrame)); TimeValue t = TimeValue(GetTicksPerFrame() * (kfArray[0][i].fFrame));
theCam = (GenCamera *) obj->ConvertToType(t, Class_ID(LOOKAT_CAM_CLASS_ID, 0)); theCam = (GenCamera *) obj->ConvertToType(t, Class_ID(LOOKAT_CAM_CLASS_ID, 0));
float FOVvalue= 0.0; //Currently in Radians float FOVvalue= theCam->GetFOV(t); // in radians
// radians FOVvalue *= (float)(180.f / M_PI); // to degrees
FOVvalue = theCam->GetFOV(t);
// convert
FOVvalue = FOVvalue*(180/3.141592);
int FOVType = theCam->GetFOVType(); int FOVType = theCam->GetFOVType();
float wDeg, hDeg; float wDeg, hDeg;
switch(FOVType) switch(FOVType)

29
Sources/Tools/MaxConvert/hsControlConverter.h

@ -42,18 +42,22 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef __HSCONTROLCONVERTER_H #ifndef __HSCONTROLCONVERTER_H
#define __HSCONTROLCONVERTER_H #define __HSCONTROLCONVERTER_H
#include <commdlg.h>
#include <math.h>
//#include "Max.h"
#include "stdmat.h"
#include "bmmlib.h"
#include "istdplug.h"
#include "texutil.h"
#include "plInterp/hsKeys.h" #include "plInterp/hsKeys.h"
#include "hsTemplates.h"
class Animatable;
class plCompoundController;
class Control;
class plController;
class hsConverterUtils;
class plErrorMsg;
class Interface;
struct hsKeyFrame;
class plLeafController;
class Matrix3;
class plMaxNode; class plMaxNode;
class IParamBlock2;
class plSceneObject;
class StdUVGen;
enum ControllerType enum ControllerType
{ {
@ -75,13 +79,6 @@ enum ControllerType
ctrlTypeRollAngle, ctrlTypeRollAngle,
}; };
class plController;
class plLeafController;
class plCompoundController;
struct hsKeyFrame;
class hsConverterUtils;
class plSceneObject;
class hsControlConverter class hsControlConverter
{ {
private: private:

28
Sources/Tools/MaxConvert/hsConverterUtils.cpp

@ -41,35 +41,33 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include "HeadSpin.h" #include "HeadSpin.h"
#include "hsConverterUtils.h" #include "hsExceptionStack.h"
#include "hsHashTable.h"
#include "hsStringTokenizer.h"
#include "hsResMgr.h" #include "hsResMgr.h"
#include "MaxMain/MaxCompat.h" #include <math.h>
#if HS_BUILD_FOR_WIN32 #include <max.h>
#include <stdmat.h>
#if MAX_VERSION_MAJOR >= 13
# include <INamedSelectionSetManager.h>
#endif
#pragma hdrstop
#include <math.h> #include "hsConverterUtils.h"
#include "MaxMain/MaxCompat.h"
#include "hsMaxLayerBase.h" #include "hsMaxLayerBase.h"
#include "plInterp/plController.h" #include "plInterp/plController.h"
#include "MaxExport/plErrorMsg.h" #include "MaxExport/plErrorMsg.h"
#include "UserPropMgr.h" #include "UserPropMgr.h"
#include "hsStringTokenizer.h"
//#include "hsDXTDirectXCodec.h"
//#include "hsDXTSoftwareCodec.h"
#include "plGImage/hsCodecManager.h" #include "plGImage/hsCodecManager.h"
///#include "SwitchUtil.h"
#include "hsExceptionStack.h"
#include "hsHashTable.h"
#include "pnKeyedObject/plKey.h" #include "pnKeyedObject/plKey.h"
#include "pnKeyedObject/hsKeyedObject.h" #include "pnKeyedObject/hsKeyedObject.h"
#include "MaxMain/MaxCompat.h" #include "MaxMain/MaxCompat.h"
#if MAX_VERSION_MAJOR >= 13
#include <INamedSelectionSetManager.h>
#endif
const char hsConverterUtils::fTagSeps[] = " ,\t\n=:;"; const char hsConverterUtils::fTagSeps[] = " ,\t\n=:;";
extern UserPropMgr gUserPropMgr; extern UserPropMgr gUserPropMgr;
@ -577,5 +575,3 @@ bool hsConverterUtils::CacheNode::operator==(const CacheNode& other) const
else else
return !_stricmp(k1,k2); return !_stricmp(k1,k2);
} }
#endif // HS_BUILD_FOR_WIN32

15
Sources/Tools/MaxConvert/hsConverterUtils.h

@ -42,20 +42,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef __HSCONVERTERUTILS_H #ifndef __HSCONVERTERUTILS_H
#define __HSCONVERTERUTILS_H #define __HSCONVERTERUTILS_H
#include "Max.h"
#include "stdmat.h"
#include <commdlg.h>
#include "bmmlib.h"
#include "istdplug.h"
#include "texutil.h"
#include "Headspin.h"
class INode;
class Control; class Control;
class INode;
class Interface; class Interface;
template <class T> class hsHashTable;
template <class T> class hsHashTable;
class hsMaxLayerBase; class hsMaxLayerBase;
class plSimplePosController; class plSimplePosController;
class plScalarController; class plScalarController;
@ -120,7 +111,7 @@ private:
plErrorMsg *fErrorMsg; plErrorMsg *fErrorMsg;
bool fSuppressMangling; bool fSuppressMangling;
uint32_t fWarned; uint32_t fWarned;
bool fSave; bool fSave;
struct CacheNode struct CacheNode

50
Sources/Tools/MaxConvert/hsMaterialConverter.cpp

@ -40,21 +40,30 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include "hsMaterialConverter.h" #include "HeadSpin.h"
#include <commdlg.h> #include "plgDispatch.h"
#include "hsExceptionStack.h"
#include "hsResMgr.h"
#include "hsStringTokenizer.h"
#include "hsTemplates.h"
#include "MaxComponent/plComponent.h"
#include <math.h> #include <math.h>
#include <float.h> #include <float.h>
#include "Max.h" #include <commdlg.h>
#include "stdmat.h" #include <bmmlib.h>
#include "bmmlib.h" #include <istdplug.h>
#include "istdplug.h" #include <pbbitmap.h>
#include "texutil.h" #include <stdmat.h>
#include <texutil.h>
#pragma hdrstop
#include "hsMaterialConverter.h"
#include "plLayerConverter.h" #include "plLayerConverter.h"
#include "MaxComponent/plMaxAnimUtils.h" #include "MaxComponent/plMaxAnimUtils.h"
#include "plResMgr/plKeyFinder.h" #include "plResMgr/plKeyFinder.h"
#include "hsResMgr.h"
#include "pnKeyedObject/plUoid.h" #include "pnKeyedObject/plUoid.h"
#include "hsMaxLayerBase.h" #include "hsMaxLayerBase.h"
@ -70,15 +79,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "MaxMain/MaxCompat.h" #include "MaxMain/MaxCompat.h"
#include "plInterp/plController.h" #include "plInterp/plController.h"
#include "hsExceptionStack.h"
#include "hsStringTokenizer.h"
#include "plSurface/plLayerInterface.h" #include "plSurface/plLayerInterface.h"
#include "plSurface/plLayer.h" #include "plSurface/plLayer.h"
#include "plSurface/plLayerAnimation.h" #include "plSurface/plLayerAnimation.h"
#include "plGImage/plMipmap.h" #include "plGImage/plMipmap.h"
#include "plgDispatch.h"
#include "pnMessage/plRefMsg.h" #include "pnMessage/plRefMsg.h"
#include "pnKeyedObject/plKey.h" #include "pnKeyedObject/plKey.h"
#include "pnKeyedObject/plKeyImp.h" #include "pnKeyedObject/plKeyImp.h"
@ -1124,8 +1129,6 @@ hsGMaterial *hsMaterialConverter::ICreateMaterial(Mtl *mtl, plMaxNode *node, con
hsGuardEnd; hsGuardEnd;
} }
#include "MaxPlasmaMtls/Materials/plMultipassMtl.h"
// //
// Handle materials for normal non-light, non-particle nodes. // Handle materials for normal non-light, non-particle nodes.
// //
@ -2369,7 +2372,7 @@ bool hsMaterialConverter::IProcessPlasmaMaterial(Mtl *mtl, plMaxNode *node, hsGM
if (passBase->GetUseSpec()) if (passBase->GetUseSpec())
{ {
shadeFlags |= hsGMatState::kShadeSpecular; shadeFlags |= hsGMatState::kShadeSpecular;
shine = passBase->GetShine(); shine = (float)passBase->GetShine();
specColor = passBase->GetSpecularColor(); specColor = passBase->GetSpecularColor();
} }
@ -2630,7 +2633,6 @@ void hsMaterialConverter::IAddLayerToMaterial(hsGMaterial *mat, plLayerInterface
// //
// Functions called by the converters up above... // Functions called by the converters up above...
// //
#include "MaxPlasmaMtls/Layers/plLayerTex.h"
//// IMustBeUniqueMaterial //////////////////////////////////////////////////// //// IMustBeUniqueMaterial ////////////////////////////////////////////////////
// Fun stuff here. If one of the layers of the material is a dynamic EnvMap, // Fun stuff here. If one of the layers of the material is a dynamic EnvMap,
@ -4246,7 +4248,7 @@ bool hsMaterialConverter::HasMaterialDiffuseOrOpacityAnimation(plMaxNode* nod
{ {
plPassMtlBase* passMtl = (plPassMtlBase*)subMtl; plPassMtlBase* passMtl = (plPassMtlBase*)subMtl;
if( plPassMtlBase::kBlendAlpha == passMtl->GetOutputBlend() ) if( plPassMtlBase::kBlendAlpha == passMtl->GetOutputBlend() )
baseOpac = passMtl->GetOpacity(); baseOpac = (float)passMtl->GetOpacity();
} }
int iMtl; int iMtl;
for( iMtl = 1; iMtl < mtl->NumSubMtls(); iMtl++ ) for( iMtl = 1; iMtl < mtl->NumSubMtls(); iMtl++ )
@ -4259,7 +4261,7 @@ bool hsMaterialConverter::HasMaterialDiffuseOrOpacityAnimation(plMaxNode* nod
{ {
if( baseOpac >= 0 ) if( baseOpac >= 0 )
return true; return true;
baseOpac = passMtl->GetOpacity(); baseOpac = (float)passMtl->GetOpacity();
} }
} }
} }
@ -4536,12 +4538,12 @@ plClothingItem *hsMaterialConverter::GenerateClothingItem(plClothingMtl *mtl, co
Color tint1 = mtl->GetDefaultTint1(); Color tint1 = mtl->GetDefaultTint1();
Color tint2 = mtl->GetDefaultTint2(); Color tint2 = mtl->GetDefaultTint2();
cloth->fDefaultTint1[0] = tint1.r * 255; cloth->fDefaultTint1[0] = (uint8_t)(tint1.r * 255.f);
cloth->fDefaultTint1[1] = tint1.g * 255; cloth->fDefaultTint1[1] = (uint8_t)(tint1.g * 255.f);
cloth->fDefaultTint1[2] = tint1.b * 255; cloth->fDefaultTint1[2] = (uint8_t)(tint1.b * 255.f);
cloth->fDefaultTint2[0] = tint2.r * 255; cloth->fDefaultTint2[0] = (uint8_t)(tint2.r * 255.f);
cloth->fDefaultTint2[1] = tint2.g * 255; cloth->fDefaultTint2[1] = (uint8_t)(tint2.g * 255.f);
cloth->fDefaultTint2[2] = tint2.b * 255; cloth->fDefaultTint2[2] = (uint8_t)(tint2.b * 255.f);
clothKeyName = plString::Format("CItm_%s", cloth->fName); clothKeyName = plString::Format("CItm_%s", cloth->fName);
hsgResMgr::ResMgr()->NewKey(clothKeyName, cloth, loc); hsgResMgr::ResMgr()->NewKey(clothKeyName, cloth, loc);

25
Sources/Tools/MaxConvert/hsMaterialConverter.h

@ -43,11 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define __HSMATERIALCONVERTER_H #define __HSMATERIALCONVERTER_H
#include "HeadSpin.h" #include "HeadSpin.h"
#include "hsTemplates.h"
#include "Max.h"
class Interface;
class hsStream; class hsStream;
class hsScene; class hsScene;
@ -64,19 +59,21 @@ class plBitmap;
class plMipmap; class plMipmap;
class plErrorMsg; class plErrorMsg;
class plString; class plString;
class plLocation;
class Mtl;
class Texmap;
class plMaxNode;
class StdUVGen;
class BitmapTex;
class StdMat;
class TSTR;
class Animatable; class Animatable;
struct BMM_Color_64;
class Bitmap; class Bitmap;
class plLocation; class BitmapTex;
class Color;
class Interface;
class Mtl;
class Point3;
class StdMat;
class StdUVGen;
class Texmap;
class plMaxNode;
class plLayerTex; class plLayerTex;
class plBitmapData; class plBitmapData;
class plCubicRenderTarget; class plCubicRenderTarget;

2
Sources/Tools/MaxConvert/hsMaxLayerBase.h

@ -42,8 +42,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef __HSMAXLAYERBASE_H #ifndef __HSMAXLAYERBASE_H
#define __HSMAXLAYERBASE_H #define __HSMAXLAYERBASE_H
#include "stdmat.h"
#define HSMAX_LAYER_CLASS_ID 0x41990fe7 #define HSMAX_LAYER_CLASS_ID 0x41990fe7
const Class_ID hsMaxLayerClassID(HSMAX_LAYER_CLASS_ID, 0x72404998); const Class_ID hsMaxLayerClassID(HSMAX_LAYER_CLASS_ID, 0x72404998);

21
Sources/Tools/MaxConvert/hsVertexShader.cpp

@ -52,18 +52,20 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h" #include "HeadSpin.h"
#include "Max.h"
#include "stdmat.h"
#include "istdplug.h"
#include "dummy.h"
#include "notetrck.h"
#include "MaxMain/plMaxNode.h"
#include "hsBitVector.h" #include "hsBitVector.h"
#include "hsExceptionStack.h"
#include "hsMatrix44.h" #include "hsMatrix44.h"
#include "hsTemplates.h" #include "hsTemplates.h"
#include "hsWindows.h"
#include <Max.h>
#include <stdmat.h>
#include <istdplug.h>
#include <dummy.h>
#include <notetrck.h>
#pragma hdrstop
#include "MaxMain/plMaxNode.h"
#include "plSurface/hsGMaterial.h" #include "plSurface/hsGMaterial.h"
#include "UserPropMgr.h" #include "UserPropMgr.h"
@ -72,7 +74,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsConverterUtils.h" #include "hsConverterUtils.h"
#include "hsControlConverter.h" #include "hsControlConverter.h"
#include "hsExceptionStack.h"
#include "plSurface/hsGMaterial.h" #include "plSurface/hsGMaterial.h"
#include "plSurface/plLayerInterface.h" #include "plSurface/plLayerInterface.h"

8
Sources/Tools/MaxConvert/plBitmapCreator.cpp

@ -39,10 +39,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021 Mead, WA 99021
*==LICENSE==*/ *==LICENSE==*/
#include "HeadSpin.h" #include "HeadSpin.h"
#include "max.h" #include "hsWindows.h"
#include <Max.h>
#include <commdlg.h> #include <commdlg.h>
#include "bmmlib.h" #include <bmmlib.h>
#pragma hdrstop
#include "plGImage/plMipmap.h" #include "plGImage/plMipmap.h"
#include "hsExceptionStack.h" #include "hsExceptionStack.h"

7
Sources/Tools/MaxConvert/plBitmapCreator.h

@ -39,16 +39,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021 Mead, WA 99021
*==LICENSE==*/ *==LICENSE==*/
#include "HeadSpin.h"
#include "pnKeyedObject/plKey.h"
class BitmapInfo; class BitmapInfo;
class Bitmap; class Bitmap;
class plBitmap; class plBitmap;
class plErrorMsg;
class plKey;
class plLocation;
class plMipmap; class plMipmap;
class hsMaxLayerBase; class hsMaxLayerBase;
class plLocation;
class plErrorMsg;
class plBitmapData class plBitmapData

25
Sources/Tools/MaxConvert/plClusterUtil.cpp

@ -41,21 +41,23 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include "HeadSpin.h" #include "HeadSpin.h"
#include <commdlg.h> #include "hsColorRGBA.h"
#include "hsGeometry3.h"
#include "Max.h" #include "hsResMgr.h"
#include "stdmat.h" #include "plTweak.h"
#include "bmmlib.h"
#include "iparamb2.h"
#include "meshdlib.h"
#include "HeadSpin.h" #include "MaxComponent/plComponent.h"
#include <vector>
#include <algorithm> #include <algorithm>
#include <commdlg.h>
#include <stdmat.h>
#include <bmmlib.h>
#include <iparamm2.h>
#include <meshdlib.h>
#include <vector>
#pragma hdrstop
#include "MaxMain/plMaxNode.h" #include "MaxMain/plMaxNode.h"
#include "MaxComponent/plComponent.h"
#include "MaxComponent/plLightGrpComponent.h" #include "MaxComponent/plLightGrpComponent.h"
#include "MaxComponent/plSoftVolumeComponent.h" #include "MaxComponent/plSoftVolumeComponent.h"
@ -76,13 +78,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsVertexShader.h" #include "hsVertexShader.h"
#include "plLightMapGen.h" #include "plLightMapGen.h"
#include "hsResMgr.h"
#include "pnKeyedObject/plUoid.h" #include "pnKeyedObject/plUoid.h"
#include "pnMessage/plNodeRefMsg.h" #include "pnMessage/plNodeRefMsg.h"
#include "plTweak.h"
plConst(int) kDefMinFaces(200); plConst(int) kDefMinFaces(200);
plConst(int) kDefMaxFaces(1000); plConst(int) kDefMaxFaces(1000);
plConst(float) kDefMinSize(50.f); plConst(float) kDefMinSize(50.f);

12
Sources/Tools/MaxConvert/plClusterUtil.h

@ -43,17 +43,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef plClusterUtil_inc #ifndef plClusterUtil_inc
#define plClusterUtil_inc #define plClusterUtil_inc
#include "hsGeometry3.h"
#include "hsColorRGBA.h"
#include "plDrawable/plSpanInstance.h" #include "plDrawable/plSpanInstance.h"
class plMaxNode;
class plClusterGroup;
class plSpanTemplateB;
class hsBounds3Ext; class hsBounds3Ext;
class plCluster; class plCluster;
class plClusterGroup;
class hsGMaterial; class hsGMaterial;
class plMaxNode;
class Point3;
class plSpanEncoding;
class plSpanTemplateB;
struct hsVector3;
class plDeformVert class plDeformVert
{ {

23
Sources/Tools/MaxConvert/plConvert.cpp

@ -44,16 +44,22 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// 3DSMax HeadSpin exporter // 3DSMax HeadSpin exporter
// //
#include "HeadSpin.h" #include "HeadSpin.h"
#include "Max.h" #include "plgDispatch.h"
#include "istdplug.h" #include "hsResMgr.h"
#include "Notify.h" #include "hsStringTokenizer.h"
#include "hsTemplates.h"
#include "hsWindows.h"
#include <max.h>
#include <istdplug.h>
#include <Notify.h>
#include <commdlg.h> #include <commdlg.h>
#include "bmmlib.h" #include <bmmlib.h>
#include "INode.h" #include <INode.h>
#include <stdmat.h>
#pragma hdrstop
#include "plConvert.h" #include "plConvert.h"
#include "hsResMgr.h"
#include "hsTemplates.h"
#include "hsConverterUtils.h" #include "hsConverterUtils.h"
#include "hsControlConverter.h" #include "hsControlConverter.h"
@ -61,12 +67,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsMaterialConverter.h" #include "hsMaterialConverter.h"
#include "plLayerConverter.h" #include "plLayerConverter.h"
#include "UserPropMgr.h" #include "UserPropMgr.h"
#include "hsStringTokenizer.h"
#include "MaxExport/plErrorMsg.h" #include "MaxExport/plErrorMsg.h"
#include "hsVertexShader.h" #include "hsVertexShader.h"
#include "plLightMapGen.h" #include "plLightMapGen.h"
#include "plBitmapCreator.h" #include "plBitmapCreator.h"
#include "plgDispatch.h"
#include "pnMessage/plTimeMsg.h" #include "pnMessage/plTimeMsg.h"
#include "MaxComponent/plComponent.h" #include "MaxComponent/plComponent.h"
@ -76,6 +80,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "MaxComponent/plClusterComponent.h" #include "MaxComponent/plClusterComponent.h"
#include "plPhysX/plSimulationMgr.h" #include "plPhysX/plSimulationMgr.h"
#include "MaxMain/plMaxMeshExtractor.h"
#include "MaxMain/plPhysXCooking.h" #include "MaxMain/plPhysXCooking.h"
#include "MaxExport/plExportProgressBar.h" #include "MaxExport/plExportProgressBar.h"

5
Sources/Tools/MaxConvert/plConvert.h

@ -43,11 +43,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef plConvert_inc #ifndef plConvert_inc
#define plConvert_inc #define plConvert_inc
#include "HeadSpin.h"
#include "hsTemplates.h"
#include "pnKeyedObject/plKey.h"
class plErrorMsg; class plErrorMsg;
class plKey;
class plLocation; class plLocation;
class plMaxNode; class plMaxNode;
class plMessage; class plMessage;

5
Sources/Tools/MaxConvert/plDistTree.cpp

@ -41,7 +41,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include "HeadSpin.h" #include "HeadSpin.h"
#include "Max.h" #include "hsTemplates.h"
#include "hsWindows.h"
#include <Max.h>
#pragma hdrstop
#include "plDistTree.h" #include "plDistTree.h"

2
Sources/Tools/MaxConvert/plDistTree.h

@ -43,8 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef plDistTree_inc #ifndef plDistTree_inc
#define plDistTree_inc #define plDistTree_inc
#include "hsTemplates.h"
class plDistNode class plDistNode
{ {
public: public:

19
Sources/Tools/MaxConvert/plDistributor.cpp

@ -41,13 +41,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include "HeadSpin.h" #include "HeadSpin.h"
#include <commdlg.h> #include "hsGeometry3.h"
#include "hsTemplates.h"
#include "hsWindows.h"
#include "Max.h" #include <commdlg.h>
#include "stdmat.h" #include <max.h>
#include "bmmlib.h" #include <stdmat.h>
#include "iparamb2.h" #include <bmmlib.h>
#include "meshdlib.h" #include <iparamb2.h>
#include <meshdlib.h>
#pragma hdrstop
#include "MaxExport/plExportProgressBar.h" #include "MaxExport/plExportProgressBar.h"
#include "MaxPlasmaMtls/Layers/plLayerTexBitmapPB.h" #include "MaxPlasmaMtls/Layers/plLayerTexBitmapPB.h"
@ -55,9 +59,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsMaterialConverter.h" #include "hsMaterialConverter.h"
#include "HeadSpin.h"
#include "hsGeometry3.h"
#include "plMath/plTriUtils.h" #include "plMath/plTriUtils.h"
#include "plDistributor.h" #include "plDistributor.h"

37
Sources/Tools/MaxConvert/plLayerConverter.cpp

@ -60,23 +60,25 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "HeadSpin.h" #include "HeadSpin.h"
#include "Max.h"
#include "stdmat.h"
#include "istdplug.h"
#include "iparamb2.h"
#include "iparamm2.h"
#include "hsExceptionStack.h" #include "hsExceptionStack.h"
#include "hsResMgr.h"
#include "hsTemplates.h"
#include "hsWindows.h"
#include <Max.h>
#include <stdmat.h>
#include <istdplug.h>
#include <iparamb2.h>
#include <iparamm2.h>
#pragma hdrstop
#include "plLayerConverter.h" #include "plLayerConverter.h"
#include "MaxConvert/hsMaxLayerBase.h" #include "hsMaxLayerBase.h"
#include "MaxConvert/hsConverterUtils.h" #include "hsConverterUtils.h"
#include "MaxConvert/hsControlConverter.h" #include "hsControlConverter.h"
#include "MaxConvert/hsMaterialConverter.h" #include "hsMaterialConverter.h"
#include "MaxConvert/plBitmapCreator.h" #include "plBitmapCreator.h"
#include "hsResMgr.h"
#include "MaxExport/plErrorMsg.h" #include "MaxExport/plErrorMsg.h"
#include "MaxMain/plMaxNode.h" #include "MaxMain/plMaxNode.h"
@ -750,10 +752,11 @@ uint32_t *plLayerConverter::IGetInitBitmapBuffer( plDynamicTextLayer *layer ) c
for( int x = 0; x < width; x++ ) for( int x = 0; x < width; x++ )
{ {
color.SetARGB( p64[ x ].a * 255.f / 65535.f, const float konst = 255.f / 65535.f;
p64[ x ].r * 255.f / 65535.f, color.SetARGB((uint8_t)(p64[ x ].a * konst),
p64[ x ].g * 255.f / 65535.f, (uint8_t)(p64[ x ].r * konst),
p64[ x ].b * 255.f / 65535.f ); (uint8_t)(p64[ x ].g * konst),
(uint8_t)(p64[ x ].b * konst));
buffPtr[ x ] = color; buffPtr[ x ] = color;
} }

4
Sources/Tools/MaxConvert/plLayerConverter.h

@ -53,10 +53,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef _plLayerConverter_h #ifndef _plLayerConverter_h
#define _plLayerConverter_h #define _plLayerConverter_h
#include "HeadSpin.h"
#include "hsTemplates.h"
#include "Max.h"
//// Class Definition ///////////////////////////////////////////////////////// //// Class Definition /////////////////////////////////////////////////////////

22
Sources/Tools/MaxConvert/plLightMapGen.cpp

@ -40,12 +40,17 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
//#define MF_NEW_RGC
#include "HeadSpin.h" #include "HeadSpin.h"
#include "Max.h" #include "hsFastMath.h"
#include "dummy.h" #include "hsTemplates.h"
#include "notify.h" #include "hsWindows.h"
#include "MaxComponent/plComponent.h"
#include <dummy.h>
#include <notify.h>
#include <vector>
#pragma hdrstop
#include "plLightMapGen.h" #include "plLightMapGen.h"
#include "plGImage/plMipmap.h" #include "plGImage/plMipmap.h"
@ -57,7 +62,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plSurface/hsGMaterial.h" #include "plSurface/hsGMaterial.h"
#include "MaxMain/plPluginResManager.h" #include "MaxMain/plPluginResManager.h"
#include "plDrawable/plGeometrySpan.h" #include "plDrawable/plGeometrySpan.h"
#include "hsFastMath.h"
#include "hsControlConverter.h" #include "hsControlConverter.h"
#include "plBitmapCreator.h" #include "plBitmapCreator.h"
#include "pnKeyedObject/plKey.h" #include "pnKeyedObject/plKey.h"
@ -968,7 +972,7 @@ bool plLightMapGen::ISpotAffectsNode(plLightMapInfo* liInfo, LightObject* liObj,
liObj->EvalLightState(TimeValue(0), FOREVER, &ls); liObj->EvalLightState(TimeValue(0), FOREVER, &ls);
float coneRad[2]; float coneRad[2];
coneRad[0] = ls.fallsize * M_PI / 180.f; coneRad[0] = (float)(ls.fallsize * M_PI / 180.f);
coneRad[1] = coneRad[0]; coneRad[1] = coneRad[0];
if( ls.shape == RECT_LIGHT ) if( ls.shape == RECT_LIGHT )
coneRad[1] /= ls.aspect; coneRad[1] /= ls.aspect;
@ -1567,7 +1571,7 @@ bool plLightMapGen::ISelectBitmapDimension(plMaxNode* node, const hsMatrix44& l2
if( duDr > 0 ) if( duDr > 0 )
{ {
fWidth = kTexPerFoot / duDr; fWidth = (int)(kTexPerFoot / duDr);
if( fWidth > kMaxSize ) if( fWidth > kMaxSize )
fWidth = kMaxSize; fWidth = kMaxSize;
@ -1583,7 +1587,7 @@ bool plLightMapGen::ISelectBitmapDimension(plMaxNode* node, const hsMatrix44& l2
if( dvDr > 0 ) if( dvDr > 0 )
{ {
fHeight = kTexPerFoot / duDr; fHeight = (int)(kTexPerFoot / duDr);
if( fHeight > kMaxSize ) if( fHeight > kMaxSize )
fHeight = kMaxSize; fHeight = kMaxSize;

4
Sources/Tools/MaxConvert/plLightMapGen.h

@ -43,10 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef plLightMapGen_inc #ifndef plLightMapGen_inc
#define plLightMapGen_inc #define plLightMapGen_inc
#include "hsTemplates.h"
#include <vector>
class plMaxLightContext; class plMaxLightContext;
class plRenderGlobalContext; class plRenderGlobalContext;
class plLayerInterface; class plLayerInterface;

30
Sources/Tools/MaxConvert/plMeshConverter.cpp

@ -50,17 +50,22 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
#include "HeadSpin.h" #include "HeadSpin.h"
#include "Max.h" #include "hsBitVector.h"
#include "iparamb2.h" #include "hsExceptionStack.h"
#include "modstack.h" #include "hsResMgr.h"
#include "ISkin.h" #include "hsTemplates.h"
#include "meshdlib.h" #include "plTweak.h"
#include "hsWindows.h"
#include <max.h>
#include <iparamb2.h>
#include <modstack.h>
#include <ISkin.h>
#include <meshdlib.h>
#include <stdmat.h>
#pragma hdrstop
#include "HeadSpin.h"
#include "hsBitVector.h"
#include "plMeshConverter.h" #include "plMeshConverter.h"
#include "hsResMgr.h"
#include "MaxMain/plMaxNode.h" #include "MaxMain/plMaxNode.h"
#include "MaxExport/plErrorMsg.h" #include "MaxExport/plErrorMsg.h"
#include "plSurface/hsGMaterial.h" #include "plSurface/hsGMaterial.h"
@ -69,7 +74,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsConverterUtils.h" #include "hsConverterUtils.h"
#include "hsMaterialConverter.h" #include "hsMaterialConverter.h"
#include "hsControlConverter.h" #include "hsControlConverter.h"
#include "hsExceptionStack.h"
#include "MaxPlasmaMtls/Materials/plCompositeMtl.h" #include "MaxPlasmaMtls/Materials/plCompositeMtl.h"
#include "MaxPlasmaMtls/Materials/plPassMtl.h" #include "MaxPlasmaMtls/Materials/plPassMtl.h"
#include "MaxPlasmaMtls/Materials/plCompositeMtlPB.h" #include "MaxPlasmaMtls/Materials/plCompositeMtlPB.h"
@ -85,8 +89,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plStatusLog/plStatusLog.h" #include "plStatusLog/plStatusLog.h"
#include "plTweak.h"
//// Static Members ////////////////////////////////////////////////////////// //// Static Members //////////////////////////////////////////////////////////
bool plMeshConverter::fWarnBadNormals = true; bool plMeshConverter::fWarnBadNormals = true;
@ -1351,9 +1353,9 @@ uint32_t plMeshConverter::ICreateHexColor( float r, float g, float b )
au = 0xff000000; au = 0xff000000;
ru = r * 255.0f; ru = (uint32_t)(r * 255.0f);
gu = g * 255.0f; gu = (uint32_t)(g * 255.0f);
bu = b * 255.0f; bu = (uint32_t)(b * 255.0f);
return au | ( ru << 16 ) | ( gu << 8 ) | ( bu ); return au | ( ru << 16 ) | ( gu << 8 ) | ( bu );
} }

4
Sources/Tools/MaxConvert/plMeshConverter.h

@ -54,10 +54,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef _plMeshConverter_h #ifndef _plMeshConverter_h
#define _plMeshConverter_h #define _plMeshConverter_h
#include "Max.h"
#include "HeadSpin.h"
#include "hsTemplates.h"
class plMaxNode; class plMaxNode;
class plErrorMsg; class plErrorMsg;
class hsConverterUtils; class hsConverterUtils;

14
Sources/Tools/MaxConvert/plRenderGlobalContext.cpp

@ -41,10 +41,14 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include "HeadSpin.h" #include "HeadSpin.h"
#include "Max.h" #include "hsTemplates.h"
#include "hsWindows.h"
#include <Max.h>
#pragma hdrstop
#include "MaxMain/plMaxNode.h" #include "MaxMain/plMaxNode.h"
#include "plRenderGlobalContext.h" #include "plRenderGlobalContext.h"
#include "plRenderInstance.h"
plRenderGlobalContext::plRenderGlobalContext(Interface* ip, TimeValue t) plRenderGlobalContext::plRenderGlobalContext(Interface* ip, TimeValue t)
{ {
@ -114,6 +118,14 @@ void plRenderGlobalContext::MakeRenderInstances(plMaxNode* root, TimeValue t)
fInstList[i].SetNext(&fInstList[i+1]); fInstList[i].SetNext(&fInstList[i+1]);
} }
RenderInstance* plRenderGlobalContext::GetRenderInstance(int i) const
{
if (fInstList.GetCount() > i)
return &fInstList[i];
else
return nil;
}
void plRenderGlobalContext::IMakeRenderInstances(plMaxNode* node, TimeValue t, bool isBarney) void plRenderGlobalContext::IMakeRenderInstances(plMaxNode* node, TimeValue t, bool isBarney)
{ {
const char* dbgNodeName = node->GetName(); const char* dbgNodeName = node->GetName();

7
Sources/Tools/MaxConvert/plRenderGlobalContext.h

@ -43,8 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef plRenderGlobalContext_inc #ifndef plRenderGlobalContext_inc
#define plRenderGlobalContext_inc #define plRenderGlobalContext_inc
#include "hsTemplates.h" class plRenderInstance;
#include "plRenderInstance.h"
class plRenderGlobalContext : public RenderGlobalContext class plRenderGlobalContext : public RenderGlobalContext
{ {
@ -63,8 +62,8 @@ public:
void MakeRenderInstances(plMaxNode* root, TimeValue t); void MakeRenderInstances(plMaxNode* root, TimeValue t);
virtual int NumRenderInstances() { return fInstList.GetCount(); } virtual int NumRenderInstances() const { return fInstList.GetCount(); }
virtual RenderInstance* GetRenderInstance( int i ) { return i < fInstList.GetCount() ? &fInstList[i] : nil; } virtual RenderInstance* GetRenderInstance( int i ) const;
virtual void IntersectRay(RenderInstance *inst, Ray& ray, ISect &isct, ISectList &xpList, BOOL findExit); virtual void IntersectRay(RenderInstance *inst, Ray& ray, ISect &isct, ISectList &xpList, BOOL findExit);
virtual BOOL IntersectWorld(Ray &ray, int skipID, ISect &hit, ISectList &xplist, int blurFrame = NO_MOTBLUR); virtual BOOL IntersectWorld(Ray &ray, int skipID, ISect &hit, ISectList &xplist, int blurFrame = NO_MOTBLUR);

5
Sources/Tools/MaxConvert/plRenderInstance.cpp

@ -41,7 +41,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/ *==LICENSE==*/
#include "HeadSpin.h" #include "HeadSpin.h"
#include "Max.h" #include "hsTemplates.h"
#include "hsWindows.h"
#include <Max.h>
#pragma hdrstop
#include "plRenderInstance.h" #include "plRenderInstance.h"

2
Sources/Tools/MaxConvert/plRenderInstance.h

@ -43,8 +43,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef plRenderInstance_inc #ifndef plRenderInstance_inc
#define plRenderInstance_inc #define plRenderInstance_inc
#include "hsTemplates.h"
class plRenderInstance : public RenderInstance class plRenderInstance : public RenderInstance
{ {
protected: protected:

2
Sources/Tools/MaxMain/MaxCompat.h

@ -48,7 +48,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#ifndef _PLASMA_MAXCOMPAT_H #ifndef _PLASMA_MAXCOMPAT_H
#define _PLASMA_MAXCOMPAT_H #define _PLASMA_MAXCOMPAT_H
#include "maxversion.h" #include <maxversion.h>
#if MAX_VERSION_MAJOR <= 9 #if MAX_VERSION_MAJOR <= 9
#define BMMCOLOR(x, y, z, w) \ #define BMMCOLOR(x, y, z, w) \

Loading…
Cancel
Save