Browse Source

Merge pull request #360 from Hoikas/max-plugin

Fix More 3dsm Issues
Branan Purvine-Riley 11 years ago
parent
commit
51e600f6cf
  1. 23
      Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.cpp
  2. 7
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp
  3. 2
      Sources/Tools/MaxConvert/plLayerConverter.cpp
  4. 30
      Sources/Tools/MaxMain/GlobalUtility.cpp
  5. 14
      Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp
  6. 2
      Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.h
  7. 5
      Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp

23
Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.cpp

@ -164,26 +164,27 @@ bool plRegistryKeyList::SetKeyUnused(plKeyImp* key, LoadStatus& loadStatusChange
} }
uint32_t id = key->GetUoid().GetObjectID(); uint32_t id = key->GetUoid().GetObjectID();
hsAssert(id <= fKeys.size(), "Bad static key id"); plKeyImp* foundKey = nullptr;
// Fixed Keys will have id == 0. Let's just make sure we have it before we toss it. // Fixed Keys use ID == 0
if (id == 0) if (id == 0)
{
hsAssert(key->GetUoid().GetLocation() == plLocation::kGlobalFixedLoc, "key id == 0 but not fixed?"); hsAssert(key->GetUoid().GetLocation() == plLocation::kGlobalFixedLoc, "key id == 0 but not fixed?");
if (!FindKey(key->GetName())) else if (id < fKeys.size()) {
{ if (fKeys[id]->GetUoid().GetObjectID() == id)
hsAssert(false, "Couldn't find fixed key!"); foundKey = fKeys[id];
return false;
}
} }
else if (id > fKeys.size())
return false; // Last chance: do a slow name search for that key.
if (!foundKey)
foundKey = FindKey(key->GetUoid().GetObjectName());
// Got that key, decrement the key counter // Got that key, decrement the key counter
if (foundKey) {
--fReffedKeys; --fReffedKeys;
if (fReffedKeys == 0) if (fReffedKeys == 0)
loadStatusChange = kTypeUnloaded; loadStatusChange = kTypeUnloaded;
return true; }
return foundKey != nullptr;
} }
void plRegistryKeyList::Read(hsStream* s) void plRegistryKeyList::Read(hsStream* s)

7
Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp

@ -1665,16 +1665,13 @@ void plResManager::IKeyReffed(plKeyImp* key)
void plResManager::IKeyUnreffed(plKeyImp* key) void plResManager::IKeyUnreffed(plKeyImp* key)
{ {
plRegistryPageNode* page = FindPage(key->GetUoid().GetLocation()); plRegistryPageNode* page = FindPage(key->GetUoid().GetLocation());
if (page == nil) if (!page)
{ {
hsAssert(0, "Couldn't find page that key belongs to"); hsAssert(0, "Couldn't find page that key belongs to");
return; return;
} }
bool removed = page->SetKeyUnused(key); if (page->SetKeyUnused(key))
hsAssert(removed, "Key wasn't removed from page");
if (removed)
{ {
if (!page->IsLoaded()) if (!page->IsLoaded())
{ {

2
Sources/Tools/MaxConvert/plLayerConverter.cpp

@ -1003,7 +1003,7 @@ plDynamicTextMap *plLayerConverter::ICreateDynTextMap( const plString &layerN
// Need a unique key name for every layer that uses one. We could also key // Need a unique key name for every layer that uses one. We could also key
// off of width and height, but layerName should be more than plenty // off of width and height, but layerName should be more than plenty
plString texName = plString::Format( "%s_dynText", layerName ); plString texName = plString::Format( "%s_dynText", layerName.c_str() );
// Does it already exist? // Does it already exist?
key = node->FindPageKey( plDynamicTextMap::Index(), texName ); key = node->FindPageKey( plDynamicTextMap::Index(), texName );

30
Sources/Tools/MaxMain/GlobalUtility.cpp

@ -63,6 +63,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plMaxCFGFile.h" #include "plMaxCFGFile.h"
#include "pfLocalizationMgr/pfLocalizationMgr.h" #include "pfLocalizationMgr/pfLocalizationMgr.h"
#include "plGImage/plFontCache.h"
extern plActionTableMgr theActionTableMgr; extern plActionTableMgr theActionTableMgr;
extern HINSTANCE hInstance; extern HINSTANCE hInstance;
@ -208,14 +209,6 @@ DWORD PlasmaMax::Start()
SceneSync::Instance(); SceneSync::Instance();
#endif #endif
plComponentShow::Init();
plCreateMenu();
RegisterNotification(NotifyProc, 0, NOTIFY_FILE_POST_OPEN);
RegisterNotification(NotifyProc, 0, NOTIFY_SYSTEM_STARTUP);
#ifdef MAXSCENEVIEWER_ENABLED #ifdef MAXSCENEVIEWER_ENABLED
InitMaxFileData(); InitMaxFileData();
#endif #endif
@ -225,13 +218,25 @@ DWORD PlasmaMax::Start()
plFileName pathTemp = plMaxConfig::GetClientPath(false, true); plFileName pathTemp = plMaxConfig::GetClientPath(false, true);
if (!pathTemp.IsValid()) if (!pathTemp.IsValid())
{ {
hsMessageBox("PlasmaMAX2.ini is missing or invalid", "Plasma/2.0 Error", hsMessageBoxNormal); hsMessageBox("PlasmaMAX2.ini is missing or invalid.\nPlasmaMAX will be unavailable until this file is added.",
"PlasmaMAX2 Error", hsMessageBoxNormal, hsMessageBoxIconExclamation);
return GUPRESULT_NOKEEP;
} }
else
{ // Setup the doggone plugin
plComponentShow::Init();
plCreateMenu();
RegisterNotification(NotifyProc, 0, NOTIFY_FILE_POST_OPEN);
RegisterNotification(NotifyProc, 0, NOTIFY_SYSTEM_STARTUP);
// Now we have to init like we're a real doggone client...
plFileName clientPath = plFileName::Join(pathTemp, "dat"); plFileName clientPath = plFileName::Join(pathTemp, "dat");
pfLocalizationMgr::Initialize(clientPath); pfLocalizationMgr::Initialize(clientPath);
}
// init font cache singleton
plFontCache* fonts = new plFontCache();
fonts->LoadCustomFonts(clientPath);
return GUPRESULT_KEEP; return GUPRESULT_KEEP;
} }
@ -241,6 +246,7 @@ void PlasmaMax::Stop()
UnRegisterNotification(NotifyProc, 0, NOTIFY_FILE_POST_OPEN); UnRegisterNotification(NotifyProc, 0, NOTIFY_FILE_POST_OPEN);
pfLocalizationMgr::Shutdown(); pfLocalizationMgr::Shutdown();
plFontCache::GetInstance().UnRegisterAs(kFontCache_KEY);
PythonInterface::WeAreInShutdown(); PythonInterface::WeAreInShutdown();
PythonInterface::finiPython(); PythonInterface::finiPython();

14
Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp

@ -186,7 +186,7 @@ BOOL plLayerTex::SetDlgThing(ParamDlg* dlg)
int plLayerTex::NumRefs() int plLayerTex::NumRefs()
{ {
return 2; return 3;
} }
//From ReferenceMaker //From ReferenceMaker
@ -223,15 +223,19 @@ void plLayerTex::SetReference(int i, RefTargetHandle rtarg)
int plLayerTex::NumParamBlocks() int plLayerTex::NumParamBlocks()
{ {
return 1; return 2;
} }
IParamBlock2* plLayerTex::GetParamBlock(int i) IParamBlock2* plLayerTex::GetParamBlock(int i)
{ {
switch (i) switch (i)
{ {
case 0: return fBitmapPB; case kRefBasic:
default: return NULL; // So this was something... a long time ago. It probably doesn't exist anymore.
// We'll pretend it's a bitmap to keep everyone happy.
case kRefBitmap:
return fBitmapPB;
default: return nullptr;
} }
} }
@ -256,7 +260,7 @@ RefTargetHandle plLayerTex::Clone(RemapDir &remap)
int plLayerTex::NumSubs() int plLayerTex::NumSubs()
{ {
return 2; return 3;
} }
Animatable* plLayerTex::SubAnim(int i) Animatable* plLayerTex::SubAnim(int i)

2
Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.h

@ -76,12 +76,14 @@ public:
enum enum
{ {
kRefUVGen, kRefUVGen,
kRefBasic, // DEAD, but left in so we don't die.
kRefBitmap, kRefBitmap,
}; };
// Block ID's // Block ID's
enum enum
{ {
kBlkBasic,
kBlkBitmap, kBlkBitmap,
}; };

5
Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp

@ -410,10 +410,7 @@ RefTargetHandle plPassMtlBase::GetReference( int i )
{ {
if( i >= kRefNotetracks && i < kRefNotetracks + fNotetracks.GetCount() ) if( i >= kRefNotetracks && i < kRefNotetracks + fNotetracks.GetCount() )
return fNotetracks[ i - kRefNotetracks ]; return fNotetracks[ i - kRefNotetracks ];
else return nullptr;
hsAssert(false, "shit");
return nil;
} }
//// SetReference //////////////////////////////////////////////////////////// //// SetReference ////////////////////////////////////////////////////////////

Loading…
Cancel
Save