From f3c787c1dc0e8b271da05a72f54160736b60bee0 Mon Sep 17 00:00:00 2001 From: Branan Purvine-Riley Date: Sat, 29 Oct 2011 20:22:41 -0700 Subject: [PATCH 01/16] Fixes for building on max2012 --- .../Tools/MaxComponent/plAudioComponents.cpp | 3 ++- .../Tools/MaxComponent/plClusterComponent.cpp | 9 ++++++++ .../MaxComponent/plParticleComponents.cpp | 23 ++++++++++--------- Sources/Tools/MaxConvert/hsConverterUtils.cpp | 15 ++++++++++++ Sources/Tools/MaxMain/MaxCompat.h | 14 +++++++++++ Sources/Tools/MaxMain/main.cpp | 2 +- Sources/Tools/MaxMain/plMaxNode.cpp | 20 ++++++++-------- Sources/Tools/MaxPlasmaLights/DLLEntry.cpp | 4 +++- .../MaxPlasmaLights/plRealTimeLightBase.h | 12 +++++----- .../MaxPlasmaMtls/Materials/plBumpMtl.cpp | 3 ++- .../MaxPlasmaMtls/Materials/plDecalMtl.cpp | 11 +++++---- .../MaxPlasmaMtls/Materials/plParticleMtl.cpp | 11 +++++---- .../MaxPlasmaMtls/Materials/plPassMtl.cpp | 11 +++++---- 13 files changed, 92 insertions(+), 46 deletions(-) diff --git a/Sources/Tools/MaxComponent/plAudioComponents.cpp b/Sources/Tools/MaxComponent/plAudioComponents.cpp index edd7ff36..9959738d 100644 --- a/Sources/Tools/MaxComponent/plAudioComponents.cpp +++ b/Sources/Tools/MaxComponent/plAudioComponents.cpp @@ -71,6 +71,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxConvert/hsControlConverter.h" #include "plInterp/plController.h" #include "MaxMain/plMaxNode.h" +#include "MaxMain/MaxCompat.h" #include "pnKeyedObject/plKey.h" //Physics Related @@ -924,7 +925,7 @@ hsBool plBaseSoundEmitterComponent::AddToAnim( plAGAnim *anim, plMaxNode *node end = anim->GetEnd(); } - ctl = cc.MakeScalarController( fCompPB->GetController( (ParamID)kSoundVolumeSlider ), node, start, end ); + ctl = cc.MakeScalarController( GetParamBlock2Controller(fCompPB, (ParamID)kSoundVolumeSlider ), node, start, end ); if( ctl != nil ) { // Better only do this when the sound component is applied to only one object... diff --git a/Sources/Tools/MaxComponent/plClusterComponent.cpp b/Sources/Tools/MaxComponent/plClusterComponent.cpp index fdaaa968..b329fca9 100644 --- a/Sources/Tools/MaxComponent/plClusterComponent.cpp +++ b/Sources/Tools/MaxComponent/plClusterComponent.cpp @@ -75,6 +75,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include +#if MAX_VERSION_MAJOR >= 13 +#include +#endif + ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // Start with the component bookkeeping song and dance. @@ -564,8 +568,13 @@ void plClusterComponent::Select() nodeTab.Append(1, &clust); } } +#if MAX_VERSION_MAJOR <= 12 GetCOREInterface()->RemoveNamedSelSet(TSTR(GetINode()->GetName())); GetCOREInterface()->AddNewNamedSelSet(nodeTab, TSTR(GetINode()->GetName())); +#else + INamedSelectionSetManager::GetInstance()->RemoveNamedSelSet(TSTR(GetINode()->GetName())); + INamedSelectionSetManager::GetInstance()->AddNewNamedSelSet(nodeTab, TSTR(GetINode()->GetName())); +#endif } void plClusterComponent::Clear() diff --git a/Sources/Tools/MaxComponent/plParticleComponents.cpp b/Sources/Tools/MaxComponent/plParticleComponents.cpp index 093d2546..d1e8332f 100644 --- a/Sources/Tools/MaxComponent/plParticleComponents.cpp +++ b/Sources/Tools/MaxComponent/plParticleComponents.cpp @@ -72,6 +72,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plInterp/hsInterp.h" #include "plInterp/plAnimEaseTypes.h" #include "MaxMain/plMaxNode.h" +#include "MaxMain/MaxCompat.h" #include "pnKeyedObject/plKey.h" #include "plSurface/hsGMaterial.h" #include "plPipeline/plGBufferGroup.h" @@ -222,7 +223,7 @@ hsBool plParticleCoreComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) // Need to do this even when immortal, so that maxTotalParticles is computed correctly. partLifeMin = fUserInput.fLifeMin; partLifeMax = fUserInput.fLifeMax; - plLeafController *ppsCtl = cc.MakeScalarController(fCompPB->GetController(ParamID(kPPS)), node); + plLeafController *ppsCtl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kPPS)), node); if (ppsCtl != nil && ppsCtl->GetLength() > 0) { // Simulate just the birth across the curve and record the max @@ -529,7 +530,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) if (fCompPB->GetInt(kGenType) != kGenOnePerVertex) { - ctl = cc.MakeScalarController(fCompPB->GetController(ParamID(kLifeMin)), node, start, end); + ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kLifeMin)), node, start, end); if (ctl != nil) { plParticleLifeMinApplicator *app = TRACKED_NEW plParticleLifeMinApplicator(); @@ -538,7 +539,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) result = true; } - ctl = cc.MakeScalarController(fCompPB->GetController(ParamID(kLifeMax)), node, start, end); + ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kLifeMax)), node, start, end); if (ctl != nil) { plParticleLifeMaxApplicator *app = TRACKED_NEW plParticleLifeMaxApplicator(); @@ -547,7 +548,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) result = true; } - ctl = cc.MakeScalarController(fCompPB->GetController(ParamID(kPPS)), node, start, end); + ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kPPS)), node, start, end); if (ctl != nil) { plParticlePPSApplicator *app = TRACKED_NEW plParticlePPSApplicator(); @@ -556,7 +557,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) result = true; } - ctl = cc.MakeScalarController(fCompPB->GetController(ParamID(kConeAngle)), node, start, end); + ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kConeAngle)), node, start, end); if (ctl != nil) { plParticleAngleApplicator *app = TRACKED_NEW plParticleAngleApplicator(); @@ -565,7 +566,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) result = true; } - ctl = cc.MakeScalarController(fCompPB->GetController(ParamID(kVelocityMin)), node, start, end); + ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kVelocityMin)), node, start, end); if (ctl != nil) { plParticleVelMinApplicator *app = TRACKED_NEW plParticleVelMinApplicator(); @@ -574,7 +575,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) result = true; } - ctl = cc.MakeScalarController(fCompPB->GetController(ParamID(kVelocityMax)), node, start, end); + ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kVelocityMax)), node, start, end); if (ctl != nil) { plParticleVelMaxApplicator *app = TRACKED_NEW plParticleVelMaxApplicator(); @@ -584,7 +585,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) } /* - ctl = cc.MakeScalarController(fCompPB->GetController(ParamID(kGravity)), node, start, end); + ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kGravity)), node, start, end); if (ctl != nil) { plParticleGravityApplicator *app = TRACKED_NEW plParticleGravityApplicator(); @@ -592,7 +593,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) result = true; } - ctl = cc.MakeScalarController(fCompPB->GetController(ParamID(kDrag)), node, start, end); + ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kDrag)), node, start, end); if (ctl != nil) { plParticleDragApplicator *app = TRACKED_NEW plParticleDragApplicator(); @@ -602,7 +603,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) */ } - ctl = cc.MakeScalarController(fCompPB->GetController(ParamID(kScaleMin)), node, start, end); + ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kScaleMin)), node, start, end); if (ctl != nil) { plParticleScaleMinApplicator *app = TRACKED_NEW plParticleScaleMinApplicator(); @@ -611,7 +612,7 @@ hsBool plParticleCoreComponent::AddToAnim(plAGAnim *anim, plMaxNode *node) result = true; } - ctl = cc.MakeScalarController(fCompPB->GetController(ParamID(kScaleMax)), node, start, end); + ctl = cc.MakeScalarController(GetParamBlock2Controller(fCompPB, ParamID(kScaleMax)), node, start, end); if (ctl != nil) { plParticleScaleMaxApplicator *app = TRACKED_NEW plParticleScaleMaxApplicator(); diff --git a/Sources/Tools/MaxConvert/hsConverterUtils.cpp b/Sources/Tools/MaxConvert/hsConverterUtils.cpp index 79936936..1c03866a 100644 --- a/Sources/Tools/MaxConvert/hsConverterUtils.cpp +++ b/Sources/Tools/MaxConvert/hsConverterUtils.cpp @@ -64,6 +64,12 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnKeyedObject/plKey.h" #include "pnKeyedObject/hsKeyedObject.h" +#include "MaxMain/MaxCompat.h" + +#if MAX_VERSION_MAJOR >= 13 +#include +#endif + const char hsConverterUtils::fTagSeps[] = " ,\t\n=:;"; extern UserPropMgr gUserPropMgr; @@ -416,11 +422,20 @@ Int32 hsConverterUtils::FindNamedSelSetFromName(const char *name) { hsGuardBegin("hsConverterUtils::FindNamedSelSetFromName"); + #if MAX_VERSION_MAJOR <= 12 for (Int32 i=0; iGetNumNamedSelSets(); i++) { if (!_stricmp(name, fInterface->GetNamedSelSetName(i))) return (i); } + #else + INamedSelectionSetManager* selSetMgr = INamedSelectionSetManager::GetInstance(); + for (Int32 i=0; iGetNumNamedSelSets(); i++) + { + if (!_stricmp(name, selSetMgr->GetNamedSelSetName(i))) + return (i); + } + #endif return (-1); hsGuardEnd; diff --git a/Sources/Tools/MaxMain/MaxCompat.h b/Sources/Tools/MaxMain/MaxCompat.h index 2500e73e..36702273 100644 --- a/Sources/Tools/MaxMain/MaxCompat.h +++ b/Sources/Tools/MaxMain/MaxCompat.h @@ -70,4 +70,18 @@ typedef TCHAR MCHAR; maxObject->DoEnumDependents(proc); #endif //MAX_VERSION_MAJOR +#if MAX_VERSION_MAJOR <= 13 +#define GetParamBlock2Controller(pb, id) pb->GetController(id) +#define SetParamBlock2Controller(pb, id, tab, ctl) pb->SetController(id, tab, ctl) +#else +#define GetParamBlock2Controller(pb, id) pb->GetControllerByID(id) +#define SetParamBlock2Controller(pb, id, tab, ctl) pb->SetControllerByID(id, tab, ctl) +#endif // MAX_VERSION_MAJOR + +#if MAX_VERSION_MAJOR <= 11 // max 2009. Just a guess, really. 2010 doesn't need this function. +#define INIT_CUSTOM_CONTROLLS(instance) InitCustomControls(instance) +#else +#define INIT_CUSTOM_CONTROLS(instance) +#endif + #endif // _PLASMA_MAXCOMPAT_H \ No newline at end of file diff --git a/Sources/Tools/MaxMain/main.cpp b/Sources/Tools/MaxMain/main.cpp index aa31bcf9..45afc05b 100644 --- a/Sources/Tools/MaxMain/main.cpp +++ b/Sources/Tools/MaxMain/main.cpp @@ -154,7 +154,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) controlsInit = TRUE; // jaguar controls - InitCustomControls(hInstance); + INIT_CUSTOM_CONTROLS(hInstance); // initialize Chicago controls InitCommonControls(); diff --git a/Sources/Tools/MaxMain/plMaxNode.cpp b/Sources/Tools/MaxMain/plMaxNode.cpp index 3ff99ef0..e51b6426 100644 --- a/Sources/Tools/MaxMain/plMaxNode.cpp +++ b/Sources/Tools/MaxMain/plMaxNode.cpp @@ -2945,19 +2945,19 @@ bool plMaxNode::IsAnimatedLight() hsControlConverter& cc = hsControlConverter::Instance(); // Is the color animated? - Control *colorCtl = pb->GetController( ParamID( plRTLightBase::kLightColor ) ); + Control *colorCtl = GetParamBlock2Controller(pb, ParamID( plRTLightBase::kLightColor ) ); if (colorCtl && cc.HasKeyTimes(colorCtl)) return true; // Is the specularity animated? - Control *specCtl = pb->GetController( ParamID( plRTLightBase::kSpecularColorSwatch ) ); + Control *specCtl = GetParamBlock2Controller(pb, ParamID( plRTLightBase::kSpecularColorSwatch ) ); if (specCtl && cc.HasKeyTimes(specCtl)) return true; // Is the attenuation animated? (Spot and Omni lights only) if (cid == RTSPOT_LIGHT_CLASSID || cid == RTOMNI_LIGHT_CLASSID) { - Control *falloffCtl = pb->GetController( ParamID( plRTLightBase::kAttenMaxFalloffEdit ) ); + Control *falloffCtl = GetParamBlock2Controller(pb, ParamID( plRTLightBase::kAttenMaxFalloffEdit ) ); if (falloffCtl && cc.HasKeyTimes(falloffCtl)) return true; } @@ -2965,11 +2965,11 @@ bool plMaxNode::IsAnimatedLight() // Is the cone animated? (Spot only) if (cid == RTSPOT_LIGHT_CLASSID) { - Control *innerCtl = pb->GetController( ParamID( plRTLightBase::kHotSpot ) ); + Control *innerCtl = GetParamBlock2Controller(pb, ParamID( plRTLightBase::kHotSpot ) ); if (innerCtl && cc.HasKeyTimes(innerCtl)) return true; - Control *outerCtl = pb->GetController( ParamID( plRTLightBase::kFallOff ) ); + Control *outerCtl = GetParamBlock2Controller(pb, ParamID( plRTLightBase::kFallOff ) ); if (outerCtl && cc.HasKeyTimes(outerCtl)) return true; } @@ -2982,7 +2982,7 @@ void plMaxNode::GetRTLightAttenAnim(IParamBlock2* ProperPB, plAGAnim *anim) { if( ProperPB->GetInt(plRTLightBase::kUseAttenuationBool, TimeValue(0)) ) { - Control* falloffCtl = ProperPB->GetController(ParamID(plRTLightBase::kAttenMaxFalloffEdit)); + Control* falloffCtl = GetParamBlock2Controller(ProperPB, ParamID(plRTLightBase::kAttenMaxFalloffEdit)); if( falloffCtl ) { plLeafController* subCtl; @@ -3118,8 +3118,8 @@ void plMaxNode::IAdjustRTColorByIntensity(plController* ctl, IParamBlock2* Prope void plMaxNode::GetRTLightColAnim(IParamBlock2* ProperPB, plAGAnim *anim) { Control* ambientCtl = nil; // Ambient not currently supported - Control* colorCtl = ProperPB->GetController(ParamID(plRTLightBase::kLightColor)); - Control* specCtl = ProperPB->GetController(ParamID(plRTLightBase::kSpecularColorSwatch)); + Control* colorCtl = GetParamBlock2Controller(ProperPB, ParamID(plRTLightBase::kLightColor)); + Control* specCtl = GetParamBlock2Controller(ProperPB, ParamID(plRTLightBase::kSpecularColorSwatch)); plPointControllerChannel *chan; if( ambientCtl ) @@ -3184,8 +3184,8 @@ void plMaxNode::GetRTLightColAnim(IParamBlock2* ProperPB, plAGAnim *anim) void plMaxNode::GetRTConeAnim(IParamBlock2* ProperPB, plAGAnim *anim) { - Control* innerCtl = ProperPB->GetController(ParamID(plRTLightBase::kHotSpot)); - Control* outerCtl = ProperPB->GetController(ParamID(plRTLightBase::kFallOff)); + Control* innerCtl = GetParamBlock2Controller(ProperPB, ParamID(plRTLightBase::kHotSpot)); + Control* outerCtl = GetParamBlock2Controller(ProperPB, ParamID(plRTLightBase::kFallOff)); plScalarControllerChannel *chan; if( innerCtl ) diff --git a/Sources/Tools/MaxPlasmaLights/DLLEntry.cpp b/Sources/Tools/MaxPlasmaLights/DLLEntry.cpp index 994dcbee..760585fb 100644 --- a/Sources/Tools/MaxPlasmaLights/DLLEntry.cpp +++ b/Sources/Tools/MaxPlasmaLights/DLLEntry.cpp @@ -48,6 +48,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "pnKeyedObject/pnKeyedObjectCreatable.h" #include "pnNetCommon/pnNetCommonCreatable.h" +#include "MaxMain/MaxCompat.h" + #include "plSurface/plLayerInterface.h" REGISTER_NONCREATABLE( plLayerInterface ); @@ -69,7 +71,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) controlsInit = TRUE; // Note: InitCustomControls is deprecated // New versions of 3dsm do this for us :) - InitCustomControls(hInstance); // Initialize MAX's custom controls + INIT_CUSTOM_CONTROLS(hInstance); // Initialize MAX's custom controls InitCommonControls(); // Initialize Win95 controls } diff --git a/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.h b/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.h index 385e64c8..a1aa749a 100644 --- a/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.h +++ b/Sources/Tools/MaxPlasmaLights/plRealTimeLightBase.h @@ -491,12 +491,12 @@ public: BOOL GetAttenNearDisplay() {return false;} ExclList& GetExclusionList() {return exclList;} void SetExclusionList(ExclList & a) {} - BOOL SetHotSpotControl(Control* a) {fLightPB->SetController(ParamID(kHotSpot),0, a); return true;} - BOOL SetFalloffControl(Control* a) {fLightPB->SetController(ParamID(kFallOff),0, a); return true;} - Control* GetHotSpotControl() {return fLightPB->GetController(ParamID(kHotSpot));} - Control* GetFalloffControl() {return fLightPB->GetController(ParamID(kFallOff));} - BOOL SetColorControl(Control * a) {fLightPB->SetController(ParamID(kLightColor),0, a); return true;} - Control* GetColorControl() {return fLightPB->GetController(ParamID(kLightColor)); } + BOOL SetHotSpotControl(Control* a) {SetParamBlock2Controller(fLightPB, ParamID(kHotSpot),0, a); return true;} + BOOL SetFalloffControl(Control* a) {SetParamBlock2Controller(fLightPB, ParamID(kFallOff),0, a); return true;} + Control* GetHotSpotControl() {return GetParamBlock2Controller(fLightPB, ParamID(kHotSpot));} + Control* GetFalloffControl() {return GetParamBlock2Controller(fLightPB, ParamID(kFallOff));} + BOOL SetColorControl(Control * a) {SetParamBlock2Controller(fLightPB, ParamID(kLightColor),0, a); return true;} + Control* GetColorControl() {return GetParamBlock2Controller(fLightPB, ParamID(kLightColor)); } BOOL GetDecayType() { return fLightPB->GetInt(kAttenTypeRadio, 0) + 1;} //Offset for the radio. void SetDecayType(BOOL onOff) {if (!onOff) return; else {fLightPB->SetValue(kAttenTypeRadio, 0, ((int) onOff - 1)); return;} } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp index 195ccd1b..2d9415a9 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtl.cpp @@ -52,6 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "../Layers/plLayerTex.h" #include "../Layers/plStaticEnvLayer.h" #include "MaxMain/plPlasmaRefMsgs.h" +#include "MaxMain/MaxCompat.h" extern HINSTANCE hInstance; @@ -665,7 +666,7 @@ Control *plBumpMtl::GetPreshadeColorController() { return nil; } Control *plBumpMtl::GetAmbColorController() { return nil; } Control *plBumpMtl::GetOpacityController() { return nil; } Control *plBumpMtl::GetSpecularColorController() { return nil; } -Control *plBumpMtl::GetRuntimeColorController() { return fBasicPB->GetController(ParamID(kBumpBasRunColor)); } +Control *plBumpMtl::GetRuntimeColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kBumpBasRunColor)); } // Layer block Texmap *plBumpMtl::GetBaseLayer() { return fBasicPB->GetTexmap(kBumpBasLayer); } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp index 8f35d50b..f0040c5f 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtl.cpp @@ -55,6 +55,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "../Layers/plLayerTex.h" #include "../Layers/plStaticEnvLayer.h" #include "MaxMain/plPlasmaRefMsgs.h" +#include "MaxMain/MaxCompat.h" extern HINSTANCE hInstance; @@ -782,13 +783,13 @@ int plDecalMtl::GetEmissive() { return fBasicPB->GetInt(kDecalBasEmissive); int plDecalMtl::GetUseSpec() { return fBasicPB->GetInt(kDecalBasUseSpec); } int plDecalMtl::GetShine() { return fBasicPB->GetInt(kDecalBasShine); } Color plDecalMtl::GetSpecularColor() { return fBasicPB->GetColor(kDecalBasSpecColor); } -Control *plDecalMtl::GetPreshadeColorController() { return fBasicPB->GetController(ParamID(kDecalBasColor)); } -Control *plDecalMtl::GetAmbColorController() { return fBasicPB->GetController(ParamID(kDecalBasColorAmb)); } -Control *plDecalMtl::GetOpacityController() { return fBasicPB->GetController(ParamID(kDecalBasOpacity)); } -Control *plDecalMtl::GetSpecularColorController() { return fBasicPB->GetController(ParamID(kDecalBasSpecColor)); } +Control *plDecalMtl::GetPreshadeColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kDecalBasColor)); } +Control *plDecalMtl::GetAmbColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kDecalBasColorAmb)); } +Control *plDecalMtl::GetOpacityController() { return GetParamBlock2Controller(fBasicPB, ParamID(kDecalBasOpacity)); } +Control *plDecalMtl::GetSpecularColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kDecalBasSpecColor)); } int plDecalMtl::GetDiffuseColorLock() { return fBasicPB->GetInt(kDecalBasDiffuseLock); } Color plDecalMtl::GetRuntimeColor() { return fBasicPB->GetColor(kDecalBasRunColor); } -Control *plDecalMtl::GetRuntimeColorController() { return fBasicPB->GetController(ParamID(kDecalBasRunColor)); } +Control *plDecalMtl::GetRuntimeColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kDecalBasRunColor)); } // Layer block Texmap *plDecalMtl::GetBaseLayer() { return fLayersPB->GetTexmap(kDecalLayBase); } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtl.cpp index 68dc0e97..fe0f8e2e 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtl.cpp @@ -52,6 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "stdmat.h" #include "../Layers/plLayerTex.h" #include "../Layers/plLayerTexBitmapPB.h" +#include "MaxMain/MaxCompat.h" extern HINSTANCE hInstance; @@ -629,8 +630,8 @@ Interval plParticleMtl::DisplacementValidity(TimeValue t) return iv; } -Control *plParticleMtl::GetAmbColorController() { return fBasicPB->GetController(ParamID(kColorAmb)); } -Control *plParticleMtl::GetColorController() { return fBasicPB->GetController(ParamID(kColor)); } -Control *plParticleMtl::GetOpacityController() { return fBasicPB->GetController(ParamID(kOpacity)); } -Control *plParticleMtl::GetWidthController() { return fBasicPB->GetController(ParamID(kWidth)); } -Control *plParticleMtl::GetHeightController() { return fBasicPB->GetController(ParamID(kHeight)); } +Control *plParticleMtl::GetAmbColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kColorAmb)); } +Control *plParticleMtl::GetColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kColor)); } +Control *plParticleMtl::GetOpacityController() { return GetParamBlock2Controller(fBasicPB, ParamID(kOpacity)); } +Control *plParticleMtl::GetWidthController() { return GetParamBlock2Controller(fBasicPB, ParamID(kWidth)); } +Control *plParticleMtl::GetHeightController() { return GetParamBlock2Controller(fBasicPB, ParamID(kHeight)); } diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp index d2a25468..9bdad591 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtl.cpp @@ -54,6 +54,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "../Layers/plLayerTex.h" #include "../Layers/plStaticEnvLayer.h" +#include "MaxMain/MaxCompat.h" #include "hsBitVector.h" @@ -847,11 +848,11 @@ int plPassMtl::GetShine() { return fBasicPB->GetInt(kPassBasShine); } Color plPassMtl::GetSpecularColor() { return fBasicPB->GetColor(kPassBasSpecColor); } int plPassMtl::GetDiffuseColorLock() { return fBasicPB->GetInt(kPassBasDiffuseLock); } Color plPassMtl::GetRuntimeColor() { return fBasicPB->GetColor(kPassBasRunColor); } -Control *plPassMtl::GetPreshadeColorController() { return fBasicPB->GetController(ParamID(kPassBasColor)); } -Control *plPassMtl::GetAmbColorController() { return fBasicPB->GetController(ParamID(kPassBasColorAmb)); } -Control *plPassMtl::GetOpacityController() { return fBasicPB->GetController(ParamID(kPassBasOpacity)); } -Control *plPassMtl::GetSpecularColorController() { return fBasicPB->GetController(ParamID(kPassBasSpecColor)); } -Control *plPassMtl::GetRuntimeColorController() { return fBasicPB->GetController(ParamID(kPassBasRunColor)); } +Control *plPassMtl::GetPreshadeColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kPassBasColor)); } +Control *plPassMtl::GetAmbColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kPassBasColorAmb)); } +Control *plPassMtl::GetOpacityController() { return GetParamBlock2Controller(fBasicPB, ParamID(kPassBasOpacity)); } +Control *plPassMtl::GetSpecularColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kPassBasSpecColor)); } +Control *plPassMtl::GetRuntimeColorController() { return GetParamBlock2Controller(fBasicPB, ParamID(kPassBasRunColor)); } // Layer block Texmap *plPassMtl::GetBaseLayer() { return fLayersPB->GetTexmap(kPassLayBase); } From 50b454c2765cda44c33df5028745d1668c318916 Mon Sep 17 00:00:00 2001 From: Branan Purvine-Riley Date: Sat, 29 Oct 2011 20:23:24 -0700 Subject: [PATCH 02/16] Move the export action to the Plasma menu on modern max versions --- Sources/Tools/MaxMain/plMaxMenu.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Sources/Tools/MaxMain/plMaxMenu.cpp b/Sources/Tools/MaxMain/plMaxMenu.cpp index 062da926..b87b9eba 100644 --- a/Sources/Tools/MaxMain/plMaxMenu.cpp +++ b/Sources/Tools/MaxMain/plMaxMenu.cpp @@ -243,7 +243,7 @@ plActionTableMgr theActionTableMgr(actionInfo, DoAction); MenuContextId kMyMenuContextId=0xcff95f6c; // static char *kMenuName = "Plasma"; -static int kMenuVersion = 10; // Increment this number if you add an entry to the menu +static int kMenuVersion = 11; // Increment this number if you add an entry to the menu extern TCHAR *GetString(int id); @@ -308,7 +308,9 @@ void AddPlasmaExportMenu() void plCreateMenu() { +#if MAX_VERSION_MAJOR <= 11 AddPlasmaExportMenu(); +#endif IMenuManager* pMenuMan = GetCOREInterface()->GetMenuManager(); bool newlyRegistered = pMenuMan->RegisterMenuBarContext(kMyMenuContextId, kMenuName); @@ -354,9 +356,17 @@ void plCreateMenu() ///////////////////////////////////////////////// // Add the menu items // + IMenuItem* pMenuItem; + +#if MAX_VERSION_MAJOR >= 12 + // Add the export action to the menu + pMenuItem = GetIMenuItem(); + pMenuItem->SetActionItem(pActionTable->GetAction(kActionExport)); + pPlasmaMenu->AddItem(pMenuItem); +#endif // Add the save selected action to the menu - IMenuItem* pMenuItem = GetIMenuItem(); + pMenuItem = GetIMenuItem(); pMenuItem->SetActionItem(pActionTable->GetAction(kActionSaveSel)); pPlasmaMenu->AddItem(pMenuItem); From f3889a3a44b1f32ea79a13d2541fd0fa4ea9d4b9 Mon Sep 17 00:00:00 2001 From: Branan Purvine-Riley Date: Sun, 30 Oct 2011 13:54:13 -0700 Subject: [PATCH 03/16] Don't build files that are #included in other files --- Sources/Tools/MaxPlasmaMtls/CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/Sources/Tools/MaxPlasmaMtls/CMakeLists.txt b/Sources/Tools/MaxPlasmaMtls/CMakeLists.txt index 63fba4b6..ff98faf4 100644 --- a/Sources/Tools/MaxPlasmaMtls/CMakeLists.txt +++ b/Sources/Tools/MaxPlasmaMtls/CMakeLists.txt @@ -97,16 +97,11 @@ set(MaxPlasmaMtls_SOURCES set(MaxPlasmaMtls_SOURCES_Layers Layers/plAngleAttenLayer.cpp Layers/plDynamicEnvLayer.cpp - Layers/plDynamicEnvLayerBitmapPB.cpp Layers/plDynamicTextLayer.cpp - Layers/plDynamicTextLayerBitmapPB.cpp Layers/plLayerTex.cpp - Layers/plLayerTexBasicPB.cpp - Layers/plLayerTexBitmapPB.cpp Layers/plMAXCameraLayer.cpp Layers/plPlasmaMAXLayer.cpp Layers/plStaticEnvLayer.cpp - Layers/plStaticEnvLayerBitmapPB.cpp ) set(MaxPlasmaMtls_SOURCES_Materials @@ -119,7 +114,6 @@ set(MaxPlasmaMtls_SOURCES_Materials Materials/plDecalMtl.cpp Materials/plMultipassMtl.cpp Materials/plMultipassMtlDlg.cpp - Materials/plMultipassMtlPB.cpp Materials/plNoteTrackWatcher.cpp Materials/plParticleMtl.cpp Materials/plPassAnimDlgProc.cpp From b9b72e060a06be0a0ab38217eb1702de7fc5fc12 Mon Sep 17 00:00:00 2001 From: Branan Purvine-Riley Date: Sun, 30 Oct 2011 16:11:27 -0700 Subject: [PATCH 04/16] Get rid of refereces to obsolete PB --- Sources/Tools/MaxConvert/plLayerConverter.cpp | 1 - .../Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp | 12 -- .../Tools/MaxPlasmaMtls/Layers/plLayerTex.h | 3 - .../Layers/plLayerTexBasicPB.cpp | 122 ------------------ .../MaxPlasmaMtls/Layers/plLayerTexBasicPB.h | 68 ---------- 5 files changed, 206 deletions(-) delete mode 100644 Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.cpp delete mode 100644 Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.h diff --git a/Sources/Tools/MaxConvert/plLayerConverter.cpp b/Sources/Tools/MaxConvert/plLayerConverter.cpp index 1e1b05e6..a2142dbc 100644 --- a/Sources/Tools/MaxConvert/plLayerConverter.cpp +++ b/Sources/Tools/MaxConvert/plLayerConverter.cpp @@ -101,7 +101,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "MaxPlasmaMtls/Layers/plPlasmaMAXLayer.h" #include "MaxPlasmaMtls/Layers/plLayerTex.h" -#include "MaxPlasmaMtls/Layers/plLayerTexBasicPB.h" #include "MaxPlasmaMtls/Layers/plLayerTexBitmapPB.h" #include "MaxPlasmaMtls/Layers/plStaticEnvLayer.h" #include "MaxPlasmaMtls/Layers/plDynamicEnvLayer.h" diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp index bd0a7e4d..cd8ea48b 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp @@ -69,10 +69,8 @@ ClassDesc2* GetLayerTexDesc() { return &plLayerTexDesc; } ParamDlg* plLayerTex::fUVGenDlg = NULL; // For initializing paramblock descriptor -//ParamBlockDesc2 *GetBasicBlk(); ParamBlockDesc2 *GetBitmapBlk(); -//#include "plLayerTexBasicPB.cpp" #include "plLayerTexBitmapPB.cpp" void plLayerTex::GetClassName( TSTR &s ) @@ -82,7 +80,6 @@ void plLayerTex::GetClassName( TSTR &s ) plLayerTex::plLayerTex() : fBitmapPB(NULL), - //fBasicPB(NULL), fUVGen(NULL), fTexHandle(NULL), fTexTime(0), @@ -95,7 +92,6 @@ plLayerTex::plLayerTex() : if (!descInit) { descInit = true; - //GetBasicBlk()->SetClassDesc(GetLayerTexDesc()); GetBitmapBlk()->SetClassDesc(GetLayerTexDesc()); } #endif @@ -159,7 +155,6 @@ Interval plLayerTex::Validity(TimeValue t) // No warranty on this not being stupid. Interval v = FOREVER; fBitmapPB->GetValidity(t, v); - //fBasicPB->GetValidity(t, v); v &= fUVGen->Validity(t); return v; } @@ -199,7 +194,6 @@ RefTargetHandle plLayerTex::GetReference(int i) { case kRefUVGen: return fUVGen; case kRefBitmap: return fBitmapPB; - //case kRefBasic: return fBasicPB; default: return NULL; } } @@ -235,7 +229,6 @@ IParamBlock2* plLayerTex::GetParamBlock(int i) switch (i) { case 0: return fBitmapPB; - //case 1: return fBasicPB; default: return NULL; } } @@ -244,8 +237,6 @@ IParamBlock2* plLayerTex::GetParamBlockByID(BlockID id) { if (fBitmapPB->ID() == id) return fBitmapPB; - //else if (fBasicPB->ID() == id) - // return fBasicPB; else return NULL; } @@ -255,7 +246,6 @@ RefTargetHandle plLayerTex::Clone(RemapDir &remap) { plLayerTex *mnew = TRACKED_NEW plLayerTex(); *((MtlBase*)mnew) = *((MtlBase*)this); // copy superclass stuff - //mnew->ReplaceReference(kRefBasic, remap.CloneRef(fBasicPB)); mnew->ReplaceReference(kRefBitmap, remap.CloneRef(fBitmapPB)); mnew->ReplaceReference(kRefUVGen, remap.CloneRef(fUVGen)); BaseClone(this, mnew, remap); @@ -274,7 +264,6 @@ Animatable* plLayerTex::SubAnim(int i) { case kRefUVGen: return fUVGen; case kRefBitmap: return fBitmapPB; - //case kRefBasic: return fBasicPB; default: return NULL; } } @@ -285,7 +274,6 @@ TSTR plLayerTex::SubAnimName(int i) { case kRefUVGen: return "UVGen"; case kRefBitmap: return fBitmapPB->GetLocalName(); - //case kRefBasic: return fBasicPB->GetLocalName(); default: return ""; } } diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.h b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.h index 63a14e4b..066599e4 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.h +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.h @@ -59,7 +59,6 @@ class plLayerTex : public plPlasmaMAXLayer protected: // Parameter block IParamBlock2 *fBitmapPB; - IParamBlock2 *fBasicPB; UVGen *fUVGen; IMtlParams *fMtlParams; @@ -78,14 +77,12 @@ public: enum { kRefUVGen, - kRefBasic, // DEAD, but left in for backwards compatability kRefBitmap, }; // Block ID's enum { - kBlkBasic, // DEAD kBlkBitmap, }; diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.cpp deleted file mode 100644 index a22930b9..00000000 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/*==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 "hsTypes.h" -#include "plLayerTex.h" -#include "plLayerTexBasicPB.h" -#include "../resource.h" - -class BasicDlgProc; -extern BasicDlgProc gBasicDlgProc; - -static ParamBlockDesc2 gBasicParamBlk -( - plLayerTex::kBlkBasic, _T("basicLayer"), 0, GetLayerTexDesc(),//NULL, - P_AUTO_CONSTRUCT + P_AUTO_UI, plLayerTex::kRefBasic, - - // UI - IDD_LAYER_BASIC, IDS_LAYER_BASIC, 0, 0, &gBasicDlgProc, - - // Usage - kBasicUsage, _T("usage"), TYPE_INT, 0, 0, - end, - - end -); -ParamBlockDesc2 *GetBasicBlk() { return &gBasicParamBlk; } - -static const char *kUsageTypes[] = -{ - "None", - "Base Texture", - "Detail", - "Grime", - "Map Blend", - "Highlight/Specular", - "Alpha Mask", - "Shadow/Light Map", - "Helper Object", - "Best Guess" -}; - -class BasicDlgProc : public ParamMap2UserDlgProc -{ -public: - virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - IParamBlock2 *pb = map->GetParamBlock(); - - switch (msg) - { - case WM_INITDIALOG: - { - HWND hUsage = GetDlgItem(hWnd, IDC_USAGE_TYPE); - for (int i = 0; i < kUsageNumTypes; i++) - SendMessage(hUsage, CB_ADDSTRING, 0, (LPARAM)kUsageTypes[i]); - SendMessage(hUsage, CB_SETCURSEL, pb->GetInt(kBasicUsage), 0); - } - break; - - case WM_COMMAND: - switch (HIWORD(wParam)) - { - case CBN_SELCHANGE: - switch (LOWORD(wParam)) - { - case IDC_USAGE_TYPE: - { - int cur = SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0); - if (LOWORD(wParam) == IDC_USAGE_TYPE) - pb->SetValue(kBasicUsage, t, cur); - return true; - } - break; - } - break; - } - break; - } - - return false; - } - virtual void DeleteThis() {}; -}; -static BasicDlgProc gBasicDlgProc; diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.h b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.h deleted file mode 100644 index ca0e7872..00000000 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.h +++ /dev/null @@ -1,68 +0,0 @@ -/*==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 PL_LAYERTEXBASICPB_H -#define PL_LAYERTEXBASICPB_H - -// Param ID's -enum -{ - kBasicUsage, -}; - -// Usage types -enum -{ - kUsageNone, - kUsageBase, - kUsageDetail, - kUsageGrime, - kUsageTransition, - kUsageHighlight, - kUsageAlphaMask, - kUsageShadowLight, - kUsageHelper, - kUsageGuess, - - kUsageNumTypes -}; - -#endif //PL_LAYERTEXBASICPB_H \ No newline at end of file From 220c05e82511ff214964933b4ff413f78103c8cd Mon Sep 17 00:00:00 2001 From: Branan Purvine-Riley Date: Sun, 30 Oct 2011 16:29:25 -0700 Subject: [PATCH 05/16] Fix cmake file for removed header --- Sources/Tools/MaxPlasmaMtls/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/Sources/Tools/MaxPlasmaMtls/CMakeLists.txt b/Sources/Tools/MaxPlasmaMtls/CMakeLists.txt index ff98faf4..4dfa698f 100644 --- a/Sources/Tools/MaxPlasmaMtls/CMakeLists.txt +++ b/Sources/Tools/MaxPlasmaMtls/CMakeLists.txt @@ -26,7 +26,6 @@ set(MaxPlasmaMtls_HEADERS_Layers Layers/plDynamicEnvLayer.h Layers/plDynamicTextLayer.h Layers/plLayerTex.h - Layers/plLayerTexBasicPB.h Layers/plLayerTexBitmapPB.h Layers/plMAXCameraLayer.h Layers/plPlasmaMAXLayer.h From c1deed66c7150411c5035d1042615b7df3866901 Mon Sep 17 00:00:00 2001 From: Branan Purvine-Riley Date: Tue, 1 Nov 2011 00:39:17 -0700 Subject: [PATCH 06/16] Force page stream to stay open during a room load --- Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp index effccaef..0350f6ed 100644 --- a/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp +++ b/Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp @@ -1193,6 +1193,9 @@ void plResManager::PageInRoom(const plLocation& page, UInt16 objClassToRef, plRe return; } + // Step 0.9: Open the stream on this page, so it remains open for the entire loading process + pageNode->OpenStream(); + // Step 1: We force a load on all the keys in the given page kResMgrLog(2, ILog(2, "...Loading page keys...")); LoadPageKeys(pageNode); @@ -1211,6 +1214,7 @@ void plResManager::PageInRoom(const plLocation& page, UInt16 objClassToRef, plRe kResMgrLog(1, ILog(1, "...SceneNode not found to base page-in op on. Aborting...")); // This is coming up a lot lately; too intrusive to be an assert. // hsAssert( false, "No object found on which to base our PageInRoom()" ); + pageNode->CloseStream(); return; } @@ -1229,6 +1233,9 @@ void plResManager::PageInRoom(const plLocation& page, UInt16 objClassToRef, plRe kResMgrLog(2, ILog(2, "...Dispatching refMessage...")); AddViaNotify(objKey, refMsg, plRefFlags::kActiveRef); + // Step 5.9: Close the page stream + pageNode->CloseStream(); + // All done! kResMgrLog(1, ILog(1, "...Page in complete!")); From 4e24d9d927ea1fdf2e1e6c41d8db0d298664807c Mon Sep 17 00:00:00 2001 From: branan Date: Wed, 2 Nov 2011 23:13:00 -0700 Subject: [PATCH 07/16] Fix MaxPlasmaLights for max 2012 closes #97 --- Sources/Tools/MaxPlasmaLights/DLLEntry.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Tools/MaxPlasmaLights/DLLEntry.cpp b/Sources/Tools/MaxPlasmaLights/DLLEntry.cpp index 760585fb..6643b08d 100644 --- a/Sources/Tools/MaxPlasmaLights/DLLEntry.cpp +++ b/Sources/Tools/MaxPlasmaLights/DLLEntry.cpp @@ -80,7 +80,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) __declspec(dllexport) const TCHAR* LibDescription() { - return NULL; + return TEXT("MaxPlasmaLights"); } __declspec(dllexport) int LibNumberClasses() From be39ca521067535ecd8c830f89380d4ea6b4834d Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 6 Nov 2011 17:36:39 -0800 Subject: [PATCH 08/16] Fix some bugs in plStatusLog. Closes #99. --- .../PubUtilLib/plStatusLog/plStatusLog.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index 096d4194..5df6ad41 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -90,6 +90,16 @@ plStatusLogMgr::plStatusLogMgr() fDrawer = nil; fLastLogChangeTime = 0; +#if HS_BUILD_FOR_WIN32 + SHGetSpecialFolderPathW(NULL, fBasePath, CSIDL_LOCAL_APPDATA, TRUE); +//#elif HS_BUILD_FOR_DARWIN +// Do some Mac specific thing here eventually +#else + wchar* temp = hsStringToWString(getenv("HOME")); + swprintf(fBasePath, MAX_PATH, L"%S/.cache/Uru Live", temp); + delete[] temp; +#endif + plFileUtils::ConcatFileName(fBasePath, L"log"); plFileUtils::EnsureFilePathExists(fBasePath); } @@ -820,7 +830,11 @@ bool plStatusLog::IPrintLineToFile( const char *line, UInt32 count ) strncat(buf, work, arrsize(work)); } - strncat(buf, line, arrsize(line)); + if (count < arrsize(buf) - strlen(buf)) { + strncat(buf, line, count); + } else { + strncat(buf, line, arrsize(buf) - strlen(buf)); + } if(!fEncryptMe ) { From 497aac7ab23cea79e72c5980ba978893a1686268 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sun, 20 Nov 2011 19:27:08 +0100 Subject: [PATCH 09/16] =?UTF-8?q?Fix=20buffer=20size=20check=20=E2=80=93?= =?UTF-8?q?=20previous=20version=20could=20still=20overrun=20by=201=20or?= =?UTF-8?q?=202=20bytes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index 5df6ad41..99ea3b44 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -830,10 +830,12 @@ bool plStatusLog::IPrintLineToFile( const char *line, UInt32 count ) strncat(buf, work, arrsize(work)); } - if (count < arrsize(buf) - strlen(buf)) { + size_t remaining = arrsize(buf) - strlen(buf) - 1; + if (!fEncryptMe) remaining -= 1; + if (count <= remaining) { strncat(buf, line, count); } else { - strncat(buf, line, arrsize(buf) - strlen(buf)); + strncat(buf, line, remaining); } if(!fEncryptMe ) From ea4ba5028ab3f050af36773b7f2d0cbf7840be03 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sun, 20 Nov 2011 19:28:08 +0100 Subject: [PATCH 10/16] Fix compilation: include proper header for SHGetSpecialFolderPathW(). --- Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index 99ea3b44..bceb0d0b 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -73,6 +73,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #if HS_BUILD_FOR_UNIX #include #define MAX_PATH PATH_MAX +#elif HS_BUILD_FOR_WIN32 + #include #endif ////////////////////////////////////////////////////////////////////////////// From f49b04e7f07a092dfe18d0c5fe531e1b6a5f0b1e Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sun, 20 Nov 2011 19:29:00 +0100 Subject: [PATCH 11/16] =?UTF-8?q?Add=20missing=20=E2=80=9CUru=20Live?= =?UTF-8?q?=E2=80=9D=20in=20log=20file=20path.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index bceb0d0b..91b92efd 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -94,6 +94,7 @@ plStatusLogMgr::plStatusLogMgr() #if HS_BUILD_FOR_WIN32 SHGetSpecialFolderPathW(NULL, fBasePath, CSIDL_LOCAL_APPDATA, TRUE); + plFileUtils::ConcatFileName(fBasePath, L"Uru Live"); //#elif HS_BUILD_FOR_DARWIN // Do some Mac specific thing here eventually #else From 39a35f5fd34e206f3d7e2d628e04c1bd4f3d88e5 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sun, 20 Nov 2011 19:29:42 +0100 Subject: [PATCH 12/16] =?UTF-8?q?Change=20log=20folder=20name=20back=20fro?= =?UTF-8?q?m=20=E2=80=9Clog=E2=80=9D=20to=20the=20original=20=E2=80=9CLog?= =?UTF-8?q?=E2=80=9D=20for=20consistency=20with=20other=20logging=20facili?= =?UTF-8?q?ties=20that=20still=20use=20PathGetLogDirectory().?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index 91b92efd..eea7463b 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -103,7 +103,7 @@ plStatusLogMgr::plStatusLogMgr() delete[] temp; #endif - plFileUtils::ConcatFileName(fBasePath, L"log"); + plFileUtils::ConcatFileName(fBasePath, L"Log"); plFileUtils::EnsureFilePathExists(fBasePath); } From ea515e58f293e0eabea438895796820f6ab6f231 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Mon, 21 Nov 2011 22:45:34 +0100 Subject: [PATCH 13/16] =?UTF-8?q?Don=E2=80=99t=20modify=20tuples=20that=20?= =?UTF-8?q?others=20may=20already=20have=20references=20to.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes egg room private chat channels and entering Teledahn buckets with Python 2.7. These and other uses of ptSDL.setIndex() only worked by chance with Python 2.3 because the tuples happened to have reference counts of 1. --HG-- branch : sdlsetindex --- .../pfPython/plPythonSDLModifier.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp index 9107ee55..14904436 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp @@ -192,6 +192,22 @@ void plPythonSDLModifier::SetItemIdx(const char* key, int idx, PyObject* value, return; } + if (pyTuple && pyTuple->ob_refcnt != 1) + { + // others already have references to the tuple and expect it to be immutable, must make a copy + int n = PyTuple_Size(pyTuple); + PyObject* newTuple = PyTuple_New(n); + for (int j = 0; j < n; j++) + { + PyObject* item = PyTuple_GetItem(pyTuple, j); + Py_INCREF(item); + PyTuple_SetItem(newTuple, j, item); + } + Py_DECREF(pyTuple); + pyTuple = newTuple; + it->second.obj = newTuple; + } + if (pyTuple) { if (PyTuple_Size(pyTuple) <= idx) @@ -205,6 +221,8 @@ void plPythonSDLModifier::SetItemIdx(const char* key, int idx, PyObject* value, Py_INCREF(Py_None); PyTuple_SetItem(pyTuple, j, Py_None); } + // _PyTuple_Resize may have changed pyTuple + it->second.obj = pyTuple; } } else From 8ec36007c134ebe6dbf434f8277250816fc8782a Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 26 Nov 2011 20:44:40 +0100 Subject: [PATCH 14/16] =?UTF-8?q?Don=E2=80=99t=20hardcode=20"Uru=20Live"?= =?UTF-8?q?=20but=20use=20ProductLongName().?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replicates behavior of PathGetLogDirectory(). --- Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index eea7463b..f0a08e03 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -94,15 +94,15 @@ plStatusLogMgr::plStatusLogMgr() #if HS_BUILD_FOR_WIN32 SHGetSpecialFolderPathW(NULL, fBasePath, CSIDL_LOCAL_APPDATA, TRUE); - plFileUtils::ConcatFileName(fBasePath, L"Uru Live"); //#elif HS_BUILD_FOR_DARWIN // Do some Mac specific thing here eventually #else wchar* temp = hsStringToWString(getenv("HOME")); - swprintf(fBasePath, MAX_PATH, L"%S/.cache/Uru Live", temp); + swprintf(fBasePath, MAX_PATH, L"%S/.cache", temp); delete[] temp; #endif + plFileUtils::ConcatFileName(fBasePath, ProductLongName()); plFileUtils::ConcatFileName(fBasePath, L"Log"); plFileUtils::EnsureFilePathExists(fBasePath); } From bb98cf94ba83c9addc4e48d7ae7ac7aac524ac52 Mon Sep 17 00:00:00 2001 From: Christian Walther Date: Sat, 26 Nov 2011 20:57:00 +0100 Subject: [PATCH 15/16] =?UTF-8?q?Don=E2=80=99t=20crash=20on=20Linux=20if?= =?UTF-8?q?=20environment=20variable=20HOME=20is=20not=20set.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index f0a08e03..7740cabd 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -97,7 +97,9 @@ plStatusLogMgr::plStatusLogMgr() //#elif HS_BUILD_FOR_DARWIN // Do some Mac specific thing here eventually #else - wchar* temp = hsStringToWString(getenv("HOME")); + const char* home = getenv("HOME"); + if (!home) home = ""; + wchar* temp = hsStringToWString(home); swprintf(fBasePath, MAX_PATH, L"%S/.cache", temp); delete[] temp; #endif From c145a3acbc90bf1ca8f315bf6dd47bffc8279786 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Sat, 26 Nov 2011 18:40:40 -0500 Subject: [PATCH 16/16] Fix the "bahro climbing a ladder" crash This fix will cause the armature brain to skip over animations that it doesn't have data for, rather than crashing. If you're in debug mode, you'll get a nice assert as well. --- .../Plasma/PubUtilLib/plAvatar/plAnimStage.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp index 431c9bd8..1e4032f5 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp +++ b/Sources/Plasma/PubUtilLib/plAvatar/plAnimStage.cpp @@ -425,6 +425,14 @@ bool plAnimStage::IMoveBackward(double time, float delta, float &overrun, plArma bool infiniteLoop = fLoops == -1; bool loopsRemain = fCurLoop > 0 || infiniteLoop; + // If we don't have this animation, just pretend to have worked. + // Otherwise, we crash the client. + if (!fAnimInstance) + { + hsAssert(false, "AnimInstance nil"); + return true; + } + // This must be here before we set the local time. if (fAnimInstance->GetTimeConvert()) fAnimInstance->GetTimeConvert()->Backwards(); @@ -477,6 +485,14 @@ bool plAnimStage::IMoveForward(double time, float delta, float &overrun, plArmat // first get the target time in local time, ignoring overruns float target = fLocalTime + delta; + // If we don't have this animation, just pretend to have worked. + // Otherwise, we crash the client. + if (!fAnimInstance) + { + hsAssert(false, "AnimInstance nil"); + return true; + } + if (fAnimInstance->GetTimeConvert()) fAnimInstance->GetTimeConvert()->Forewards();