Browse Source

Merge pull request #360 from Hoikas/max-plugin

Fix More 3dsm Issues
Branan Purvine-Riley 11 years ago
parent
commit
51e600f6cf
  1. 29
      Sources/Plasma/PubUtilLib/plResMgr/plRegistryKeyList.cpp
  2. 7
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp
  3. 2
      Sources/Tools/MaxConvert/plLayerConverter.cpp
  4. 34
      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

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

@ -164,26 +164,27 @@ bool plRegistryKeyList::SetKeyUnused(plKeyImp* key, LoadStatus& loadStatusChange
}
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)
{
hsAssert(key->GetUoid().GetLocation() == plLocation::kGlobalFixedLoc, "key id == 0 but not fixed?");
if (!FindKey(key->GetName()))
{
hsAssert(false, "Couldn't find fixed key!");
return false;
}
else if (id < fKeys.size()) {
if (fKeys[id]->GetUoid().GetObjectID() == id)
foundKey = fKeys[id];
}
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
--fReffedKeys;
if (fReffedKeys == 0)
loadStatusChange = kTypeUnloaded;
return true;
if (foundKey) {
--fReffedKeys;
if (fReffedKeys == 0)
loadStatusChange = kTypeUnloaded;
}
return foundKey != nullptr;
}
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)
{
plRegistryPageNode* page = FindPage(key->GetUoid().GetLocation());
if (page == nil)
if (!page)
{
hsAssert(0, "Couldn't find page that key belongs to");
return;
}
bool removed = page->SetKeyUnused(key);
hsAssert(removed, "Key wasn't removed from page");
if (removed)
if (page->SetKeyUnused(key))
{
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
// 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?
key = node->FindPageKey( plDynamicTextMap::Index(), texName );

34
Sources/Tools/MaxMain/GlobalUtility.cpp

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

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

@ -186,7 +186,7 @@ BOOL plLayerTex::SetDlgThing(ParamDlg* dlg)
int plLayerTex::NumRefs()
{
return 2;
return 3;
}
//From ReferenceMaker
@ -223,15 +223,19 @@ void plLayerTex::SetReference(int i, RefTargetHandle rtarg)
int plLayerTex::NumParamBlocks()
{
return 1;
return 2;
}
IParamBlock2* plLayerTex::GetParamBlock(int i)
{
switch (i)
{
case 0: return fBitmapPB;
default: return NULL;
case kRefBasic:
// 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()
{
return 2;
return 3;
}
Animatable* plLayerTex::SubAnim(int i)

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

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

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

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

Loading…
Cancel
Save