From c76c39b2770a275e3e3ac413467bd8a2e2689f7e Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Thu, 28 Apr 2011 02:02:16 -0400 Subject: [PATCH] Fix all of those stupid PlasmaMax purecalls on exit --- Sources/Tools/MaxComponent/plAnimCompProc.h | 4 +- .../Tools/MaxComponent/plCameraComponent.cpp | 49 +- .../Tools/MaxComponent/plCameraComponents.cpp | 52 +- .../MaxComponent/plClickDragComponent.cpp | 129 +- .../MaxComponent/plNavigableComponents.cpp | 119 +- .../MaxComponent/plParticleComponents.cpp | 248 ++-- .../Tools/MaxComponent/plParticleComponents.h | 3 - .../Tools/MaxComponent/plResponderAnim.cpp | 85 +- .../MaxComponent/plResponderComponent.cpp | 132 +-- .../Tools/MaxComponent/plResponderLink.cpp | 639 +++++----- Sources/Tools/MaxComponent/plResponderMtl.cpp | 37 +- .../Tools/MaxComponent/plResponderWait.cpp | 50 +- .../Layers/plDynamicEnvLayerBitmapPB.cpp | 5 +- .../Layers/plDynamicTextLayerBitmapPB.cpp | 5 +- .../Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp | 6 +- .../Layers/plLayerTexBasicPB.cpp | 4 +- .../Layers/plLayerTexBitmapPB.cpp | 1053 ++++++++--------- .../MaxPlasmaMtls/Layers/plMAXCameraLayer.cpp | 4 +- .../Layers/plStaticEnvLayerBitmapPB.cpp | 4 +- .../Materials/plAnimStealthNode.cpp | 6 +- .../Materials/plBumpMtlBasicPBDec.h | 59 +- .../Materials/plClothingMtlPBDec.h | 163 ++- .../Materials/plDecalMtlBasicPBDec.h | 111 +- .../Materials/plParticleMtlPBDec.h | 166 ++- .../Materials/plPassAnimDlgProc.h | 6 +- .../MaxPlasmaMtls/Materials/plPassMtlAnimPB.h | 4 +- .../MaxPlasmaMtls/Materials/plPassMtlBase.cpp | 4 +- .../Materials/plPassMtlBasicPBDec.h | 115 +- 28 files changed, 1584 insertions(+), 1678 deletions(-) diff --git a/Sources/Tools/MaxComponent/plAnimCompProc.h b/Sources/Tools/MaxComponent/plAnimCompProc.h index 276f9a4a..66f96c73 100644 --- a/Sources/Tools/MaxComponent/plAnimCompProc.h +++ b/Sources/Tools/MaxComponent/plAnimCompProc.h @@ -58,9 +58,9 @@ protected: public: plAnimCompProc(); - void DeleteThis() {} + virtual void DeleteThis() {} - BOOL DlgProc(TimeValue t, IParamMap2* pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + virtual BOOL DlgProc(TimeValue t, IParamMap2* pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); bool GetCompAndNode(IParamBlock2* pb, plComponentBase*& comp, plMaxNode*& node); }; diff --git a/Sources/Tools/MaxComponent/plCameraComponent.cpp b/Sources/Tools/MaxComponent/plCameraComponent.cpp index a4d6e857..fdd51dab 100644 --- a/Sources/Tools/MaxComponent/plCameraComponent.cpp +++ b/Sources/Tools/MaxComponent/plCameraComponent.cpp @@ -58,8 +58,29 @@ enum kSmooth, }; -class plCameraCmdComponentProc; -extern plCameraCmdComponentProc gCameraCmdComponentProc; +class plCameraCmdComponentProc : public ParamMap2UserDlgProc +{ +public: + BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + return false; + } + + void DeleteThis() {} + +protected: + void IEnableControls(IParamMap2 *map, int type) + { + } + + void IAddComboItem(HWND hCombo, const char *name, int id) + { + } + void ISetComboSel(HWND hCombo, int type) + { + } +}; +static plCameraCmdComponentProc gCameraCmdComponentProc; enum { @@ -136,27 +157,3 @@ hsBool plCameraCmdComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { return true; } - -class plCameraCmdComponentProc : public ParamMap2UserDlgProc -{ -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - return false; - } - - void DeleteThis() {} - -protected: - void IEnableControls(IParamMap2 *map, int type) - { - } - - void IAddComboItem(HWND hCombo, const char *name, int id) - { - } - void ISetComboSel(HWND hCombo, int type) - { - } -}; -static plCameraCmdComponentProc gCameraCmdComponentProc; diff --git a/Sources/Tools/MaxComponent/plCameraComponents.cpp b/Sources/Tools/MaxComponent/plCameraComponents.cpp index 8c039fb5..f35a95cc 100644 --- a/Sources/Tools/MaxComponent/plCameraComponents.cpp +++ b/Sources/Tools/MaxComponent/plCameraComponents.cpp @@ -2453,8 +2453,29 @@ enum kSmooth, }; -class plCameraCmdComponentProc; -extern plCameraCmdComponentProc gCameraCmdComponentProc; +class plCameraCmdComponentProc : public ParamMap2UserDlgProc +{ +public: + BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + return false; + } + + void DeleteThis() {} + +protected: + void IEnableControls(IParamMap2 *map, int type) + { + } + + void IAddComboItem(HWND hCombo, const char *name, int id) + { + } + void ISetComboSel(HWND hCombo, int type) + { + } +}; +static plCameraCmdComponentProc gCameraCmdComponentProc; enum { @@ -2531,30 +2552,3 @@ hsBool plCameraCmdComponent::Convert(plMaxNode *node, plErrorMsg *pErrMsg) { return true; } - -class plCameraCmdComponentProc : public ParamMap2UserDlgProc -{ -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - return false; - } - - void DeleteThis() {} - -protected: - void IEnableControls(IParamMap2 *map, int type) - { - } - - void IAddComboItem(HWND hCombo, const char *name, int id) - { - } - void ISetComboSel(HWND hCombo, int type) - { - } -}; -static plCameraCmdComponentProc gCameraCmdComponentProc; - - - diff --git a/Sources/Tools/MaxComponent/plClickDragComponent.cpp b/Sources/Tools/MaxComponent/plClickDragComponent.cpp index 8866e648..9f212685 100644 --- a/Sources/Tools/MaxComponent/plClickDragComponent.cpp +++ b/Sources/Tools/MaxComponent/plClickDragComponent.cpp @@ -89,8 +89,69 @@ enum }; -class plClickDragComponentProc; -extern plClickDragComponentProc gClickDragComponentProc; +#include "plNoteTrackDlgComp.h" + +class plClickDragComponentProc : public ParamMap2UserDlgProc +{ +protected: + plComponentNoteTrackDlg fNoteTrackDlgX; + plComponentNoteTrackDlg fNoteTrackDlgY; + IParamBlock2 *fPB; + +public: + BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + switch (msg) + { + case WM_INITDIALOG: + fPB = map->GetParamBlock(); + + fNoteTrackDlgX.Init(GetDlgItem(hWnd, IDC_COMP_CLICK_DRAG_ANIMX), + nil, + kClickDragAnimX, + -1, + fPB, + fPB->GetOwner()); + + fNoteTrackDlgX.Load(); + + EnableWindow(GetDlgItem(hWnd, IDC_COMP_CLICK_DRAG_ANIMX), true); + + fNoteTrackDlgY.Init(GetDlgItem(hWnd, IDC_COMP_CLICK_DRAG_ANIM_Y), + nil, + kClickDragAnimY, + -1, + fPB, + fPB->GetOwner()); + + fNoteTrackDlgY.Load(); + + EnableWindow(GetDlgItem(hWnd, IDC_COMP_CLICK_DRAG_ANIM_Y), true); + return TRUE; + + case WM_COMMAND: + if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMP_CLICK_DRAG_ANIMX) + { + fNoteTrackDlgX.AnimChanged(); + return TRUE; + } + if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMP_CLICK_DRAG_ANIM_Y) + { + fNoteTrackDlgY.AnimChanged(); + return TRUE; + } + break; + } + return false; + } + + void DeleteThis() + { + fNoteTrackDlgX.DeleteCache(); + fNoteTrackDlgY.DeleteCache(); + } +}; +static plClickDragComponentProc gClickDragComponentProc; ParamBlockDesc2 gClickDragBlock ( @@ -539,67 +600,3 @@ hsBool plClickDragComponent::DeInit( plMaxNode *node, plErrorMsg *pErrMsg ) fAxisKeys.clear(); return plActivatorBaseComponent::DeInit( node, pErrMsg ); } - -#include "plNoteTrackDlgComp.h" - -class plClickDragComponentProc : public ParamMap2UserDlgProc -{ -protected: - plComponentNoteTrackDlg fNoteTrackDlgX; - plComponentNoteTrackDlg fNoteTrackDlgY; - IParamBlock2 *fPB; - -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG: - fPB = map->GetParamBlock(); - - fNoteTrackDlgX.Init(GetDlgItem(hWnd, IDC_COMP_CLICK_DRAG_ANIMX), - nil, - kClickDragAnimX, - -1, - fPB, - fPB->GetOwner()); - - fNoteTrackDlgX.Load(); - - EnableWindow(GetDlgItem(hWnd, IDC_COMP_CLICK_DRAG_ANIMX), true); - - fNoteTrackDlgY.Init(GetDlgItem(hWnd, IDC_COMP_CLICK_DRAG_ANIM_Y), - nil, - kClickDragAnimY, - -1, - fPB, - fPB->GetOwner()); - - fNoteTrackDlgY.Load(); - - EnableWindow(GetDlgItem(hWnd, IDC_COMP_CLICK_DRAG_ANIM_Y), true); - return TRUE; - - case WM_COMMAND: - if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMP_CLICK_DRAG_ANIMX) - { - fNoteTrackDlgX.AnimChanged(); - return TRUE; - } - if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMP_CLICK_DRAG_ANIM_Y) - { - fNoteTrackDlgY.AnimChanged(); - return TRUE; - } - break; - } - return false; - } - - void DeleteThis() - { - fNoteTrackDlgX.DeleteCache(); - fNoteTrackDlgY.DeleteCache(); - } -}; -static plClickDragComponentProc gClickDragComponentProc; diff --git a/Sources/Tools/MaxComponent/plNavigableComponents.cpp b/Sources/Tools/MaxComponent/plNavigableComponents.cpp index bc7fd5d2..c3d2713e 100644 --- a/Sources/Tools/MaxComponent/plNavigableComponents.cpp +++ b/Sources/Tools/MaxComponent/plNavigableComponents.cpp @@ -56,9 +56,6 @@ void DummyCodeIncludeFuncNavigablesRegion() {} CLASS_DESC(plAvLadderComponent, gAvLadderComponentDesc, "(ex)Ladder Component", "(ex)LadderComp", COMP_TYPE_PHYS_TERRAINS, NAV_LADDER_CID) -class plAvLadderComponentProc; -extern plAvLadderComponentProc gAvLadderComponentProc; - enum kAvLadderFields { kTypeCombo, @@ -70,6 +67,63 @@ enum kAvLadderFields kLadderNode, }; +class plAvLadderComponentProc : public ParamMap2UserDlgProc +{ +public: + enum kLadderTypesEnums + { + kReallyBig, + kFourFeet, + kTwoFeet, + }; + + BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + switch (msg) + { + case WM_INITDIALOG: + { + HWND hLadder = GetDlgItem(hWnd,IDC_COMP_NAV_LADDER_COMBO); + + ComboBox_AddString(hLadder, "Big"); + ComboBox_AddString(hLadder, "4 feet"); + ComboBox_AddString(hLadder, "2 feet"); + + int type = map->GetParamBlock()->GetInt(kTypeCombo); + ComboBox_SetCurSel(hLadder, type); + } + return TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDC_COMP_NAV_LADDER_COMBO && HIWORD(wParam) == CBN_SELCHANGE) + { + //Util fcn found in plEventGroupRefs files in MaxMain + HWND hLadder = GetDlgItem(hWnd,IDC_COMP_NAV_LADDER_COMBO); + int idx = ComboBox_GetCurSel(hLadder); + map->GetParamBlock()->SetValue(kTypeCombo, 0, idx); +/* + if (idx == kReallyBig) + { + map->Enable(kLoopsInt, TRUE); +// map->Invalidate(kLoopsInt); + } + else + { + map->Enable(kLoopsInt, TRUE); +// map->Invalidate(kLoopsInt); + } +*/ + return TRUE; + } + break; + } + return FALSE; + } + + void DeleteThis() {} +}; +static plAvLadderComponentProc gAvLadderComponentProc; + ParamBlockDesc2 gAvLadderComponentBlock ( plComponent::kBlkComp, _T("(ex)Ladder Component"), 0, &gAvLadderComponentDesc, P_AUTO_CONSTRUCT + P_AUTO_UI, plComponent::kRefComp, @@ -219,62 +273,3 @@ hsBool plAvLadderComponent::DeInit(plMaxNode *node, plErrorMsg *pErrMsg) fKeys.Reset(); return true; } - -class plAvLadderComponentProc : public ParamMap2UserDlgProc -{ -public: - enum kLadderTypesEnums - { - kReallyBig, - kFourFeet, - kTwoFeet, - }; - - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG: - { - HWND hLadder = GetDlgItem(hWnd,IDC_COMP_NAV_LADDER_COMBO); - - ComboBox_AddString(hLadder, "Big"); - ComboBox_AddString(hLadder, "4 feet"); - ComboBox_AddString(hLadder, "2 feet"); - - int type = map->GetParamBlock()->GetInt(kTypeCombo); - ComboBox_SetCurSel(hLadder, type); - } - return TRUE; - - case WM_COMMAND: - if (LOWORD(wParam) == IDC_COMP_NAV_LADDER_COMBO && HIWORD(wParam) == CBN_SELCHANGE) - { - //Util fcn found in plEventGroupRefs files in MaxMain - HWND hLadder = GetDlgItem(hWnd,IDC_COMP_NAV_LADDER_COMBO); - int idx = ComboBox_GetCurSel(hLadder); - map->GetParamBlock()->SetValue(kTypeCombo, 0, idx); -/* - if (idx == kReallyBig) - { - map->Enable(kLoopsInt, TRUE); -// map->Invalidate(kLoopsInt); - } - else - { - map->Enable(kLoopsInt, TRUE); -// map->Invalidate(kLoopsInt); - } -*/ - return TRUE; - } - break; - } - return FALSE; - } - - void DeleteThis() {} -}; -static plAvLadderComponentProc gAvLadderComponentProc; - - diff --git a/Sources/Tools/MaxComponent/plParticleComponents.cpp b/Sources/Tools/MaxComponent/plParticleComponents.cpp index a60f25e0..b78703ef 100644 --- a/Sources/Tools/MaxComponent/plParticleComponents.cpp +++ b/Sources/Tools/MaxComponent/plParticleComponents.cpp @@ -618,6 +618,130 @@ void plParticleCoreComponent::SetParticleStats(plParticleMtl *mtl) fUserInput.fOrientation = pb->GetInt(plParticleMtl::kOrientation); } +class ParticleCompDlgProc : public ParamMap2UserDlgProc +{ +protected: + void EnableDynGenParams(IParamMap2 *pm, bool enabled) + { + pm->Enable(plParticleComponent::kConeAngle, enabled); + pm->Enable(plParticleComponent::kVelocityMin, enabled); + pm->Enable(plParticleComponent::kVelocityMax, enabled); + pm->Enable(plParticleComponent::kLifeMin, enabled); + pm->Enable(plParticleComponent::kLifeMax, enabled); + pm->Enable(plParticleComponent::kImmortal, enabled); + pm->Enable(plParticleComponent::kPPS, enabled); + pm->Enable(plParticleComponent::kGravity, enabled); + pm->Enable(plParticleComponent::kPreSim, enabled); + pm->Enable(plParticleComponent::kDrag, enabled); + } + +public: + ParticleCompDlgProc() {} + ~ParticleCompDlgProc() {} + + void IValidateSpinners(TimeValue t, IParamBlock2 *pb, IParamMap2 *map, UInt32 id) + { + UInt32 minIndex, maxIndex; + hsBool adjustMin; + switch(id) + { + case IDC_COMP_PARTICLE_VELMIN: + case IDC_COMP_PARTICLE_VELMIN_SPIN: + minIndex = plParticleCoreComponent::kVelocityMin; maxIndex = plParticleCoreComponent::kVelocityMax; adjustMin = false; + break; + case IDC_COMP_PARTICLE_VELMAX: + case IDC_COMP_PARTICLE_VELMAX_SPIN: + minIndex = plParticleCoreComponent::kVelocityMin; maxIndex = plParticleCoreComponent::kVelocityMax; adjustMin = true; + break; + case IDC_COMP_PARTICLE_LIFEMIN: + case IDC_COMP_PARTICLE_LIFEMIN_SPIN: + minIndex = plParticleCoreComponent::kLifeMin; maxIndex = plParticleCoreComponent::kLifeMax; adjustMin = false; + break; + case IDC_COMP_PARTICLE_LIFEMAX: + case IDC_COMP_PARTICLE_LIFEMAX_SPIN: + minIndex = plParticleCoreComponent::kLifeMin; maxIndex = plParticleCoreComponent::kLifeMax; adjustMin = true; + break; + default: + return; + } + + float min, max; + min = pb->GetFloat(minIndex, t); + max = pb->GetFloat(maxIndex, t); + + if (min > max) + { + if (adjustMin) + pb->SetValue(minIndex, t, max); + else + pb->SetValue(maxIndex, t, min); + + map->Invalidate(minIndex); + map->Invalidate(maxIndex); + } + } + + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + int id = LOWORD(wParam); + int code = HIWORD(wParam); + + IParamBlock2 *pb = map->GetParamBlock(); + HWND cbox = NULL; + + int selection; + switch (msg) + { + case WM_INITDIALOG: + int j; + for (j = 0; j < plParticleCoreComponent::kGenNumOptions; j++) + { + cbox = GetDlgItem(hWnd, IDC_GEN_TYPE); + SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plParticleCoreComponent::GenStrings[j]); + } + selection = pb->GetInt(plParticleCoreComponent::kGenType); + SendMessage(cbox, CB_SETCURSEL, selection, 0); + EnableDynGenParams(map, selection != plParticleCoreComponent::kGenOnePerVertex); + + CheckDlgButton(hWnd, IDC_TRACKVIEW_SHOW, plParticleComponent::fAllowUnhide ? BST_CHECKED : BST_UNCHECKED); + return TRUE; + + case WM_COMMAND: + if (id == IDC_GEN_TYPE) + { + selection = SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0); + pb->SetValue(plParticleCoreComponent::kGenType, t, selection); + EnableDynGenParams(map, selection != plParticleCoreComponent::kGenOnePerVertex); + return TRUE; + } + else if (id == IDC_COMP_PARTICLE_VELMIN || id == IDC_COMP_PARTICLE_VELMAX || + id == IDC_COMP_PARTICLE_LIFEMIN || id == IDC_COMP_PARTICLE_LIFEMAX) + { + IValidateSpinners(t, pb, map, id); + return TRUE; + } + else if (id == IDC_TRACKVIEW_SHOW && code == BN_CLICKED) + { + plParticleComponent::fAllowUnhide = (IsDlgButtonChecked(hWnd, IDC_TRACKVIEW_SHOW) == BST_CHECKED); + plComponentShow::Update(); + return TRUE; + } + break; + case CC_SPINNER_CHANGE: + if (id == IDC_COMP_PARTICLE_VELMIN_SPIN || id == IDC_COMP_PARTICLE_VELMAX_SPIN || + id == IDC_COMP_PARTICLE_LIFEMIN_SPIN || id == IDC_COMP_PARTICLE_LIFEMAX_SPIN) + { + IValidateSpinners(t, pb, map, id); + return TRUE; + } + break; + } + return FALSE; + } + virtual void DeleteThis() {} +}; +static ParticleCompDlgProc gParticleCompDlgProc; + CLASS_DESC(plParticleComponent, gParticleDesc, "Particle System", "ParticleSystem", COMP_TYPE_PARTICLE, PARTICLE_SYSTEM_COMPONENT_CLASS_ID) ParamBlockDesc2 gParticleBk @@ -778,130 +902,6 @@ hsBool plParticleComponent::GetParamVals(plMaxNode *pNode) return true; } -class ParticleCompDlgProc : public ParamMap2UserDlgProc -{ -protected: - void EnableDynGenParams(IParamMap2 *pm, bool enabled) - { - pm->Enable(plParticleComponent::kConeAngle, enabled); - pm->Enable(plParticleComponent::kVelocityMin, enabled); - pm->Enable(plParticleComponent::kVelocityMax, enabled); - pm->Enable(plParticleComponent::kLifeMin, enabled); - pm->Enable(plParticleComponent::kLifeMax, enabled); - pm->Enable(plParticleComponent::kImmortal, enabled); - pm->Enable(plParticleComponent::kPPS, enabled); - pm->Enable(plParticleComponent::kGravity, enabled); - pm->Enable(plParticleComponent::kPreSim, enabled); - pm->Enable(plParticleComponent::kDrag, enabled); - } - -public: - ParticleCompDlgProc() {} - ~ParticleCompDlgProc() {} - - void IValidateSpinners(TimeValue t, IParamBlock2 *pb, IParamMap2 *map, UInt32 id) - { - UInt32 minIndex, maxIndex; - hsBool adjustMin; - switch(id) - { - case IDC_COMP_PARTICLE_VELMIN: - case IDC_COMP_PARTICLE_VELMIN_SPIN: - minIndex = plParticleCoreComponent::kVelocityMin; maxIndex = plParticleCoreComponent::kVelocityMax; adjustMin = false; - break; - case IDC_COMP_PARTICLE_VELMAX: - case IDC_COMP_PARTICLE_VELMAX_SPIN: - minIndex = plParticleCoreComponent::kVelocityMin; maxIndex = plParticleCoreComponent::kVelocityMax; adjustMin = true; - break; - case IDC_COMP_PARTICLE_LIFEMIN: - case IDC_COMP_PARTICLE_LIFEMIN_SPIN: - minIndex = plParticleCoreComponent::kLifeMin; maxIndex = plParticleCoreComponent::kLifeMax; adjustMin = false; - break; - case IDC_COMP_PARTICLE_LIFEMAX: - case IDC_COMP_PARTICLE_LIFEMAX_SPIN: - minIndex = plParticleCoreComponent::kLifeMin; maxIndex = plParticleCoreComponent::kLifeMax; adjustMin = true; - break; - default: - return; - } - - float min, max; - min = pb->GetFloat(minIndex, t); - max = pb->GetFloat(maxIndex, t); - - if (min > max) - { - if (adjustMin) - pb->SetValue(minIndex, t, max); - else - pb->SetValue(maxIndex, t, min); - - map->Invalidate(minIndex); - map->Invalidate(maxIndex); - } - } - - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - int id = LOWORD(wParam); - int code = HIWORD(wParam); - - IParamBlock2 *pb = map->GetParamBlock(); - HWND cbox = NULL; - - int selection; - switch (msg) - { - case WM_INITDIALOG: - int j; - for (j = 0; j < plParticleCoreComponent::kGenNumOptions; j++) - { - cbox = GetDlgItem(hWnd, IDC_GEN_TYPE); - SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plParticleCoreComponent::GenStrings[j]); - } - selection = pb->GetInt(plParticleCoreComponent::kGenType); - SendMessage(cbox, CB_SETCURSEL, selection, 0); - EnableDynGenParams(map, selection != plParticleCoreComponent::kGenOnePerVertex); - - CheckDlgButton(hWnd, IDC_TRACKVIEW_SHOW, plParticleComponent::fAllowUnhide ? BST_CHECKED : BST_UNCHECKED); - return TRUE; - - case WM_COMMAND: - if (id == IDC_GEN_TYPE) - { - selection = SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0); - pb->SetValue(plParticleCoreComponent::kGenType, t, selection); - EnableDynGenParams(map, selection != plParticleCoreComponent::kGenOnePerVertex); - return TRUE; - } - else if (id == IDC_COMP_PARTICLE_VELMIN || id == IDC_COMP_PARTICLE_VELMAX || - id == IDC_COMP_PARTICLE_LIFEMIN || id == IDC_COMP_PARTICLE_LIFEMAX) - { - IValidateSpinners(t, pb, map, id); - return TRUE; - } - else if (id == IDC_TRACKVIEW_SHOW && code == BN_CLICKED) - { - plParticleComponent::fAllowUnhide = (IsDlgButtonChecked(hWnd, IDC_TRACKVIEW_SHOW) == BST_CHECKED); - plComponentShow::Update(); - return TRUE; - } - break; - case CC_SPINNER_CHANGE: - if (id == IDC_COMP_PARTICLE_VELMIN_SPIN || id == IDC_COMP_PARTICLE_VELMAX_SPIN || - id == IDC_COMP_PARTICLE_LIFEMIN_SPIN || id == IDC_COMP_PARTICLE_LIFEMAX_SPIN) - { - IValidateSpinners(t, pb, map, id); - return TRUE; - } - break; - } - return FALSE; - } - void DeleteThis() {} -}; -static ParticleCompDlgProc gParticleCompDlgProc; - ////////////////////////////////////////////////////////////////////////////////////////// // // Particle Effects Base class diff --git a/Sources/Tools/MaxComponent/plParticleComponents.h b/Sources/Tools/MaxComponent/plParticleComponents.h index 4880cac8..a66a3c2f 100644 --- a/Sources/Tools/MaxComponent/plParticleComponents.h +++ b/Sources/Tools/MaxComponent/plParticleComponents.h @@ -71,9 +71,6 @@ public: fXTiles(1), fYTiles(1), fHSize(1), fVSize(1), fImmortal(false) {} }; -class ParticleCompDlgProc; -extern ParticleCompDlgProc gParticleCompDlgProc; - class plParticleCoreComponent : public plComponent { protected: diff --git a/Sources/Tools/MaxComponent/plResponderAnim.cpp b/Sources/Tools/MaxComponent/plResponderAnim.cpp index 319ae996..2cf5c429 100644 --- a/Sources/Tools/MaxComponent/plResponderAnim.cpp +++ b/Sources/Tools/MaxComponent/plResponderAnim.cpp @@ -60,33 +60,6 @@ enum kRespAnimObjectType, }; -class plResponderAnimProc; -extern plResponderAnimProc gResponderAnimProc; - -ParamBlockDesc2 gResponderAnimBlock -( - kResponderAnimBlk, _T("animCmd"), 0, NULL, P_AUTO_UI, - - IDD_COMP_RESPOND_ANIM, IDS_COMP_CMD_PARAMS, 0, 0, &gResponderAnimProc, - - kRespAnimComp, _T("comp"), TYPE_REFTARG, 0, 0, - end, - - kRespAnimObject, _T("object"), TYPE_REFTARG, 0, 0, - end, - - kRespAnimLoop, _T("loop"), TYPE_STRING, 0, 0, - end, - - kRespAnimType, _T("type"), TYPE_INT, 0, 0, - end, - - kRespAnimObjectType, _T("objType"), TYPE_INT, 0, 0, - end, - - end -); - enum AnimObjectType { kNodePB, // Use the node in the PB @@ -99,11 +72,6 @@ plResponderCmdAnim& plResponderCmdAnim::Instance() return theInstance; } -ParamBlockDesc2 *plResponderCmdAnim::GetDesc() -{ - return &gResponderAnimBlock; -} - // Use the old types, for backwards compatibility enum { @@ -291,17 +259,6 @@ static bool IsSoundMsg(int type) return false; } -IParamBlock2 *plResponderCmdAnim::CreatePB(int idx) -{ - int type = IndexToOldType(idx); - - // Create the paramblock and save it's type - IParamBlock2 *pb = CreateParameterBlock2(&gResponderAnimBlock, nil); - pb->SetValue(kRespAnimType, 0, type); - - return pb; -} - plComponentBase *plResponderCmdAnim::GetComponent(IParamBlock2 *pb) { plMaxNode *node = (plMaxNode*)pb->GetReferenceTarget(kRespAnimComp); @@ -563,7 +520,7 @@ class plResponderAnimProc : public plAnimCompProc { public: plResponderAnimProc(); - BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + virtual BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); protected: virtual void IPickComponent(IParamBlock2* pb); @@ -673,6 +630,46 @@ void plResponderAnimProc::IPickComponent(IParamBlock2* pb) plPick::NodeRefKludge(pb, kRespAnimComp, &cids, true, false); } +ParamBlockDesc2 gResponderAnimBlock +( + kResponderAnimBlk, _T("animCmd"), 0, NULL, P_AUTO_UI, + + IDD_COMP_RESPOND_ANIM, IDS_COMP_CMD_PARAMS, 0, 0, &gResponderAnimProc, + + kRespAnimComp, _T("comp"), TYPE_REFTARG, 0, 0, + end, + + kRespAnimObject, _T("object"), TYPE_REFTARG, 0, 0, + end, + + kRespAnimLoop, _T("loop"), TYPE_STRING, 0, 0, + end, + + kRespAnimType, _T("type"), TYPE_INT, 0, 0, + end, + + kRespAnimObjectType, _T("objType"), TYPE_INT, 0, 0, + end, + + end +); + +ParamBlockDesc2 *plResponderCmdAnim::GetDesc() +{ + return &gResponderAnimBlock; +} + +IParamBlock2 *plResponderCmdAnim::CreatePB(int idx) +{ + int type = IndexToOldType(idx); + + // Create the paramblock and save it's type + IParamBlock2 *pb = CreateParameterBlock2(&gResponderAnimBlock, nil); + pb->SetValue(kRespAnimType, 0, type); + + return pb; +} + #include "plPickNodeBase.h" static const char* kResponderNodeName = "(Responder Node)"; diff --git a/Sources/Tools/MaxComponent/plResponderComponent.cpp b/Sources/Tools/MaxComponent/plResponderComponent.cpp index c476db80..4ea88c68 100644 --- a/Sources/Tools/MaxComponent/plResponderComponent.cpp +++ b/Sources/Tools/MaxComponent/plResponderComponent.cpp @@ -59,6 +59,68 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com IParamBlock2 *CreateWaitBlk(); +class plResponderProc : public ParamMap2UserDlgProc +{ +protected: + HWND fhDlg; + IParamBlock2 *fPB; + IParamBlock2 *fStatePB; + int fCurState; + + plResponderComponent *fComp; + + IParamMap2 *fCmdMap; + IParamMap2 *fWaitMap; + + int fCmdIdx; + + typedef std::map NameID; + NameID fNames; + + HMENU fhMenu; + typedef std::pair CmdID; + typedef std::map MenuCmd; + MenuCmd fMenuCmds; + + HWND fhList; + + bool fIgnoreNextDrop; + +public: + plResponderProc(); + + BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + void DeleteThis() { IRemoveCmdRollups(); } + +protected: + void ICreateMenu(); + void IAddMenuItem(HMENU hMenu, int id); + + void ICmdRightClick(HWND hCmdList); + + // Add and remove command rollups + void ICreateCmdRollups(); + void IRemoveCmdRollups(); + IParamMap2 *ICreateMap(IParamBlock2 *pb); // Helper + + const char* GetCommandName(int cmdIdx); + void LoadList(); + + BOOL DragListProc(HWND hWnd, DRAGLISTINFO *info); + + void IDrawComboItem(DRAWITEMSTRUCT *dis); + + void LoadState(); + + void AddCommand(); + void RemoveCurCommand(); + void MoveCommand(int oldIdx, int newIdx); + + // Takes a freshly created state PB and adds it as a new state, then returns its index + int AddState(IParamBlock2 *pb); +}; +static plResponderProc gResponderComponentProc; + int ResponderGetActivatorCount(plComponentBase *comp) { if (comp->ClassID() == RESPONDER_CID) @@ -93,8 +155,6 @@ plKey Responder::GetKey(plComponentBase *comp, plMaxNodeBase *node) CLASS_DESC(plResponderComponent, gResponderDesc, "Responder", "Responder", COMP_TYPE_LOGIC, RESPONDER_CID) -class plResponderProc; -extern plResponderProc gResponderComponentProc; // When one of our parameters that is a ref changes, send out the component ref // changed message. Normally, messages from component refs are ignored since @@ -494,8 +554,6 @@ void plResponderComponent::IFixOldPB() //////////////////////////////////////////////////////////////////////////////// -#define CUSTOM_DRAW - enum { kStateName, @@ -505,70 +563,6 @@ enum kStateCopy, }; -class plResponderProc : public ParamMap2UserDlgProc -{ -protected: - HWND fhDlg; - IParamBlock2 *fPB; - IParamBlock2 *fStatePB; - int fCurState; - - plResponderComponent *fComp; - - IParamMap2 *fCmdMap; - IParamMap2 *fWaitMap; - - int fCmdIdx; - - typedef std::map NameID; - NameID fNames; - - HMENU fhMenu; - typedef std::pair CmdID; - typedef std::map MenuCmd; - MenuCmd fMenuCmds; - - HWND fhList; - - bool fIgnoreNextDrop; - -public: - plResponderProc(); - - BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); - void DeleteThis() { IRemoveCmdRollups(); } - -protected: - void ICreateMenu(); - void IAddMenuItem(HMENU hMenu, int id); - - void ICmdRightClick(HWND hCmdList); - - // Add and remove command rollups - void ICreateCmdRollups(); - void IRemoveCmdRollups(); - IParamMap2 *ICreateMap(IParamBlock2 *pb); // Helper - - const char* GetCommandName(int cmdIdx); - void LoadList(); - - BOOL DragListProc(HWND hWnd, DRAGLISTINFO *info); - -#ifdef CUSTOM_DRAW - void IDrawComboItem(DRAWITEMSTRUCT *dis); -#endif - - void LoadState(); - - void AddCommand(); - void RemoveCurCommand(); - void MoveCommand(int oldIdx, int newIdx); - - // Takes a freshly created state PB and adds it as a new state, then returns its index - int AddState(IParamBlock2 *pb); -}; -static plResponderProc gResponderComponentProc; - void plResponderProc::IAddMenuItem(HMENU hMenu, int id) { AppendMenu(hMenu, MF_STRING, id+1, fNames[id]); @@ -861,7 +855,6 @@ BOOL plResponderProc::DragListProc(HWND hWnd, DRAGLISTINFO *info) return FALSE; } -#ifdef CUSTOM_DRAW void plResponderProc::IDrawComboItem(DRAWITEMSTRUCT *dis) { if (dis->itemID == -1) // empty item @@ -916,7 +909,6 @@ void plResponderProc::IDrawComboItem(DRAWITEMSTRUCT *dis) if (dis->itemState & ODS_FOCUS) DrawFocusRect(dis->hDC, &dis->rcItem); } -#endif void plResponderProc::LoadState() { diff --git a/Sources/Tools/MaxComponent/plResponderLink.cpp b/Sources/Tools/MaxComponent/plResponderLink.cpp index 46247685..1508e323 100644 --- a/Sources/Tools/MaxComponent/plResponderLink.cpp +++ b/Sources/Tools/MaxComponent/plResponderLink.cpp @@ -66,9 +66,59 @@ enum #define kDefaultLinkInAnimName "LinkOut" -class plResponderLinkProc; -extern plResponderLinkProc gResponderLinkProc; +class plResponderLinkProc : public ParamMap2UserDlgProc +{ +protected: + void ILoadLinkingRulesCombo(HWND hWnd, IParamBlock2* pb); + void ILoadAgeFilenamesCombo(HWND hWnd, IParamBlock2 *pb); + void ILoadParentAgeFilenamesCombo(HWND hWnd, IParamBlock2 *pb); +public: + virtual BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + switch (msg) + { + case WM_INITDIALOG: + ILoadLinkingRulesCombo(hWnd, pm->GetParamBlock()); + ILoadAgeFilenamesCombo(hWnd, pm->GetParamBlock()); + ILoadParentAgeFilenamesCombo(hWnd, pm->GetParamBlock()); + return TRUE; + + case WM_COMMAND: + if (HIWORD(wParam) == CBN_SELCHANGE) + { + int sel = ComboBox_GetCurSel((HWND)lParam); + if (sel != CB_ERR) + { + if (LOWORD(wParam) == IDC_LINKINGRULE) + { + int data = ComboBox_GetItemData((HWND)lParam, sel); + pm->GetParamBlock()->SetValue(kLinkingRule, 0, data); + return TRUE; + } + else if (LOWORD(wParam) == IDC_LINKAGEFILENAME) + { + char buf[256]; + SendMessage((HWND)lParam, CB_GETLBTEXT, sel, (LPARAM)buf); + pm->GetParamBlock()->SetValue(kLinkAgeFilename, 0, buf); + return TRUE; + } + else if (LOWORD(wParam) == IDC_PARENTAGEFILENAME) + { + char buf[256]; + SendMessage((HWND)lParam, CB_GETLBTEXT, sel, (LPARAM)buf); + pm->GetParamBlock()->SetValue(kLinkParentAgeFilename, 0, buf); + return TRUE; + } + } + } + break; + } + return FALSE; + } + virtual void DeleteThis() {} +}; +static plResponderLinkProc gResponderLinkProc; ParamBlockDesc2 gResponderLinkBlock ( @@ -200,60 +250,6 @@ plMessage *plResponderCmdLink::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, I return msg; } -class plResponderLinkProc : public ParamMap2UserDlgProc -{ -protected: - void ILoadLinkingRulesCombo(HWND hWnd, IParamBlock2* pb); - void ILoadAgeFilenamesCombo(HWND hWnd, IParamBlock2 *pb); - void ILoadParentAgeFilenamesCombo(HWND hWnd, IParamBlock2 *pb); - -public: - BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG: - ILoadLinkingRulesCombo(hWnd, pm->GetParamBlock()); - ILoadAgeFilenamesCombo(hWnd, pm->GetParamBlock()); - ILoadParentAgeFilenamesCombo(hWnd, pm->GetParamBlock()); - return TRUE; - - case WM_COMMAND: - if (HIWORD(wParam) == CBN_SELCHANGE) - { - int sel = ComboBox_GetCurSel((HWND)lParam); - if (sel != CB_ERR) - { - if (LOWORD(wParam) == IDC_LINKINGRULE) - { - int data = ComboBox_GetItemData((HWND)lParam, sel); - pm->GetParamBlock()->SetValue(kLinkingRule, 0, data); - return TRUE; - } - else if (LOWORD(wParam) == IDC_LINKAGEFILENAME) - { - char buf[256]; - SendMessage((HWND)lParam, CB_GETLBTEXT, sel, (LPARAM)buf); - pm->GetParamBlock()->SetValue(kLinkAgeFilename, 0, buf); - return TRUE; - } - else if (LOWORD(wParam) == IDC_PARENTAGEFILENAME) - { - char buf[256]; - SendMessage((HWND)lParam, CB_GETLBTEXT, sel, (LPARAM)buf); - pm->GetParamBlock()->SetValue(kLinkParentAgeFilename, 0, buf); - return TRUE; - } - } - } - break; - } - return FALSE; - } - void DeleteThis() {} -}; -static plResponderLinkProc gResponderLinkProc; - static int ComboBox_AddStringData(HWND hCombo, const char* str, int data) { int idx = ComboBox_AddString(hCombo, str); @@ -369,6 +365,7 @@ void plResponderLinkProc::ILoadParentAgeFilenamesCombo(HWND hWnd, IParamBlock2 * // Needed for message creation #include "plModifier/plResponderModifier.h" +#include "plResponderGetComp.h" enum { @@ -377,8 +374,56 @@ enum kEnableResponder, }; -class plResponderEnableProc; -extern plResponderEnableProc gResponderEnableProc; +class plResponderEnableProc : public ParamMap2UserDlgProc +{ +protected: + void IUpdateButton(HWND hWnd, IParamBlock2 *pb) + { + HWND hComp = GetDlgItem(hWnd, IDC_RESPONDER_BUTTON); + plComponentBase *comp = plResponderGetComp::Instance().GetSavedComp(pb, kEnableNode, kEnableResponder); + if (comp) + SetWindowText(hComp, comp->GetINode()->GetName()); + else + SetWindowText(hComp, "(none)"); + } + +public: + virtual BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + switch (msg) + { + case WM_INITDIALOG: + { + IParamBlock2 *pb = pm->GetParamBlock(); + + IUpdateButton(hWnd, pb); + } + return TRUE; + + case WM_COMMAND: + if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_BUTTON) + { + IParamBlock2 *pb = pm->GetParamBlock(); + + // If the responder component is hosed, remove it so the plResponderGetComp won't get bogus info + if (!plResponderGetComp::Instance().GetSavedComp(pb, kEnableNode, kEnableResponder)) + { + ReferenceTarget *empty = nil; + pb->SetValue(kEnableResponder, 0, empty); + } + + plResponderGetComp::ClassIDs cids; + cids.push_back(RESPONDER_CID); + plResponderGetComp::Instance().GetComp(pb, kEnableNode, kEnableResponder, &cids); + IUpdateButton(hWnd, pb); + } + break; + } + return FALSE; + } + virtual void DeleteThis() {} +}; +static plResponderEnableProc gResponderEnableProc; ParamBlockDesc2 gResponderEnableBlock ( @@ -411,8 +456,6 @@ ParamBlockDesc2 *plResponderCmdEnable::GetDesc() return &gResponderEnableBlock; } -#include "plResponderGetComp.h" - const char *plResponderCmdEnable::GetInstanceName(IParamBlock2 *pb) { static char name[256]; @@ -441,57 +484,6 @@ plMessage *plResponderCmdEnable::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, return msg; } -class plResponderEnableProc : public ParamMap2UserDlgProc -{ -protected: - void IUpdateButton(HWND hWnd, IParamBlock2 *pb) - { - HWND hComp = GetDlgItem(hWnd, IDC_RESPONDER_BUTTON); - plComponentBase *comp = plResponderGetComp::Instance().GetSavedComp(pb, kEnableNode, kEnableResponder); - if (comp) - SetWindowText(hComp, comp->GetINode()->GetName()); - else - SetWindowText(hComp, "(none)"); - } - -public: - BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG: - { - IParamBlock2 *pb = pm->GetParamBlock(); - - IUpdateButton(hWnd, pb); - } - return TRUE; - - case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_BUTTON) - { - IParamBlock2 *pb = pm->GetParamBlock(); - - // If the responder component is hosed, remove it so the plResponderGetComp won't get bogus info - if (!plResponderGetComp::Instance().GetSavedComp(pb, kEnableNode, kEnableResponder)) - { - ReferenceTarget *empty = nil; - pb->SetValue(kEnableResponder, 0, empty); - } - - plResponderGetComp::ClassIDs cids; - cids.push_back(RESPONDER_CID); - plResponderGetComp::Instance().GetComp(pb, kEnableNode, kEnableResponder, &cids); - IUpdateButton(hWnd, pb); - } - break; - } - return FALSE; - } - void DeleteThis() {} -}; -static plResponderEnableProc gResponderEnableProc; - /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// @@ -562,14 +554,56 @@ plMessage *plResponderCmdPhysEnable::CreateMsg(plMaxNode* node, plErrorMsg *pErr /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// +#include "plMessage/plOneShotMsg.h" +#include "plOneShotComponent.h" + enum { kOneShotComp, kOneShotNode, }; -class plResponderOneShotProc; -extern plResponderOneShotProc gResponderOneShotProc; +class plResponderOneShotProc : public ParamMap2UserDlgProc +{ +protected: + plResponderCompNode fCompNode; + +public: + BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + switch (msg) + { + case WM_INITDIALOG: + { + IParamBlock2 *pb = pm->GetParamBlock(); + + plResponderCompNode::ClassIDs cids; + cids.push_back(ONESHOTCLASS_ID); + fCompNode.Init(pb, kOneShotComp, kOneShotNode, IDC_RESPONDER_COMP, IDC_RESPONDER_NODE, &cids); + + fCompNode.InitDlg(hWnd); + } + return TRUE; + + case WM_COMMAND: + if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_COMP) + { + fCompNode.CompButtonPress(hWnd); + return TRUE; + } + else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_NODE) + { + fCompNode.NodeButtonPress(hWnd); + return TRUE; + } + break; + } + + return FALSE; + } + void DeleteThis() {} +}; +static plResponderOneShotProc gResponderOneShotProc; ParamBlockDesc2 gResponderOneShotBlock ( @@ -607,9 +641,6 @@ const char *plResponderCmdOneShot::GetInstanceName(IParamBlock2 *pb) return name; } -#include "plMessage/plOneShotMsg.h" -#include "plOneShotComponent.h" - plMessage *plResponderCmdOneShot::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, IParamBlock2 *pb) { plResponderCompNode compNode; @@ -643,48 +674,6 @@ void plResponderCmdOneShot::CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IPa oneShotMsg->fCallbacks->AddCallback(waitInfo.point, waitInfo.receiver, waitInfo.callbackUser); } -class plResponderOneShotProc : public ParamMap2UserDlgProc -{ -protected: - plResponderCompNode fCompNode; - -public: - BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG: - { - IParamBlock2 *pb = pm->GetParamBlock(); - - plResponderCompNode::ClassIDs cids; - cids.push_back(ONESHOTCLASS_ID); - fCompNode.Init(pb, kOneShotComp, kOneShotNode, IDC_RESPONDER_COMP, IDC_RESPONDER_NODE, &cids); - - fCompNode.InitDlg(hWnd); - } - return TRUE; - - case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_COMP) - { - fCompNode.CompButtonPress(hWnd); - return TRUE; - } - else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_NODE) - { - fCompNode.NodeButtonPress(hWnd); - return TRUE; - } - break; - } - - return FALSE; - } - void DeleteThis() {} -}; -static plResponderOneShotProc gResponderOneShotProc; - /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// @@ -721,12 +710,47 @@ plMessage *plResponderCmdNotify::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, /////////////////////////////////////////////////////////////////////////////////////////////// #include "plCameraComponents.h" - -class plResponderActivatorEnableProc; -extern plResponderActivatorEnableProc gResponderActivatorEnableProc; +#include "plPickNode.h" enum { kActivatorComp, kActivatorEnable }; +class plResponderActivatorEnableProc : public ParamMap2UserDlgProc +{ +protected: + void IUpdateButton(IParamBlock2 *pb, HWND hWnd) + { + INode *node = pb->GetINode(kActivatorComp); + if (node) + SetDlgItemText(hWnd, IDC_RESPONDER_BUTTON, node->GetName()); + else + SetDlgItemText(hWnd, IDC_RESPONDER_BUTTON, "(none)"); + } + +public: + BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + switch (msg) + { + case WM_INITDIALOG: + IUpdateButton(pm->GetParamBlock(), hWnd); + return TRUE; + + case WM_COMMAND: + if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_BUTTON) + { + if (plPick::DetectorEnable(pm->GetParamBlock(), kActivatorComp, true)) + IUpdateButton(pm->GetParamBlock(), hWnd); + return TRUE; + } + break; + } + + return FALSE; + } + void DeleteThis() {} +}; +static plResponderActivatorEnableProc gResponderActivatorEnableProc; + ParamBlockDesc2 gResponderActivatorEnableBlock ( kResponderActivatorEnableBlk, _T("detectorEnable"), 0, NULL, P_AUTO_UI, @@ -835,19 +859,18 @@ plMessage *plResponderCmdDetectorEnable::CreateMsg(plMaxNode* node, plErrorMsg * return msg; } -#include "plPickNode.h" +/////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////// -class plResponderActivatorEnableProc : public ParamMap2UserDlgProc +#include "plMessage/plExcludeRegionMsg.h" +#include "plExcludeRegionComponent.h" + +enum { kXRegionComp, kXRegionType, kXRegionNode }; + +class plResponderXRegionProc : public ParamMap2UserDlgProc { protected: - void IUpdateButton(IParamBlock2 *pb, HWND hWnd) - { - INode *node = pb->GetINode(kActivatorComp); - if (node) - SetDlgItemText(hWnd, IDC_RESPONDER_BUTTON, node->GetName()); - else - SetDlgItemText(hWnd, IDC_RESPONDER_BUTTON, "(none)"); - } + plResponderCompNode fCompNode; public: BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -855,14 +878,25 @@ public: switch (msg) { case WM_INITDIALOG: - IUpdateButton(pm->GetParamBlock(), hWnd); + { + IParamBlock2 *pb = pm->GetParamBlock(); + + plResponderCompNode::ClassIDs cids; + cids.push_back(XREGION_CID); + fCompNode.Init(pb, kXRegionComp, kXRegionNode, IDC_RESPONDER_COMP, IDC_RESPONDER_NODE, &cids); + fCompNode.InitDlg(hWnd); + } return TRUE; case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_BUTTON) + if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_COMP) { - if (plPick::DetectorEnable(pm->GetParamBlock(), kActivatorComp, true)) - IUpdateButton(pm->GetParamBlock(), hWnd); + fCompNode.CompButtonPress(hWnd); + return TRUE; + } + else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_NODE) + { + fCompNode.NodeButtonPress(hWnd); return TRUE; } break; @@ -872,15 +906,7 @@ public: } void DeleteThis() {} }; -static plResponderActivatorEnableProc gResponderActivatorEnableProc; - -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// - -class plResponderXRegionProc; -extern plResponderXRegionProc gResponderXRegionProc; - -enum { kXRegionComp, kXRegionType, kXRegionNode }; +static plResponderXRegionProc gResponderXRegionProc; ParamBlockDesc2 gResponderXRegionBlock ( @@ -963,9 +989,6 @@ const char *plResponderCmdXRegion::GetInstanceName(IParamBlock2 *pb) return name; } -#include "plMessage/plExcludeRegionMsg.h" -#include "plExcludeRegionComponent.h" - plMessage *plResponderCmdXRegion::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg, IParamBlock2 *pb) { plResponderCompNode compNode; @@ -1000,53 +1023,9 @@ plMessage *plResponderCmdXRegion::CreateMsg(plMaxNode* node, plErrorMsg *pErrMsg throw "No exclude region component specified"; } -class plResponderXRegionProc : public ParamMap2UserDlgProc -{ -protected: - plResponderCompNode fCompNode; - -public: - BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG: - { - IParamBlock2 *pb = pm->GetParamBlock(); - - plResponderCompNode::ClassIDs cids; - cids.push_back(XREGION_CID); - fCompNode.Init(pb, kXRegionComp, kXRegionNode, IDC_RESPONDER_COMP, IDC_RESPONDER_NODE, &cids); - fCompNode.InitDlg(hWnd); - } - return TRUE; - - case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_COMP) - { - fCompNode.CompButtonPress(hWnd); - return TRUE; - } - else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_NODE) - { - fCompNode.NodeButtonPress(hWnd); - return TRUE; - } - break; - } - - return FALSE; - } - void DeleteThis() {} -}; -static plResponderXRegionProc gResponderXRegionProc; - /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// -class plResponderCameraTransitionProc; -extern plResponderCameraTransitionProc gResponderCameraTransitionProc; - enum { kCameraObj, kPopCamera, @@ -1149,9 +1128,6 @@ plMessage *plResponderCmdCamTransition::CreateMsg(plMaxNode* node, plErrorMsg *p /////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////// -class plResponderCameraForceProc; -extern plResponderCameraForceProc gResponderCameraForceProc; - enum { kCamForce, @@ -1420,9 +1396,46 @@ plMessage *plResponderCmdVisibility::CreateMsg(plMaxNode* node, plErrorMsg *pErr /////////////////////////////////////////////////////////////////////////////////////////////// enum { kSubWorldNode, kSubWorldType }; +enum +{ + kRespondSubWorldEnter, + kRespondSubWorldExit, +}; + +class plResponderSubWorldProc : public ParamMap2UserDlgProc +{ +public: + virtual BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + switch (msg) + { + case WM_INITDIALOG: + { + IParamBlock2 *pb = pm->GetParamBlock(); + int type = pb->GetInt(kSubWorldType); + + HWND nButton = GetDlgItem(hWnd, IDC_NODE_BUTTON); + //HWND sEnterText = GetDlgItem(hWnd, IDC_SUBWORLD_ENTER); + HWND sExitText = GetDlgItem(hWnd, IDC_SUBWORLD_EXIT); + + BOOL isEnter = (type == kRespondSubWorldEnter) ? TRUE : FALSE; + + ShowWindow(nButton, (isEnter) ? SW_SHOW : SW_HIDE); + //ShowWindow(sEnterText,(isEnter) ? SW_SHOW : SW_HIDE); + ShowWindow(sExitText, (isEnter) ? SW_HIDE : SW_SHOW); + } + return TRUE; + + case WM_COMMAND: + break; + } + + return FALSE; + } + virtual void DeleteThis() {} +}; -class plResponderSubWorldProc; -extern plResponderSubWorldProc gResponderSubWorldProc; +static plResponderSubWorldProc gResponderSubWorldProc; ParamBlockDesc2 gResponderSubWorldBlock ( @@ -1440,12 +1453,6 @@ ParamBlockDesc2 gResponderSubWorldBlock end ); -enum -{ - kRespondSubWorldEnter, - kRespondSubWorldExit, -}; - plResponderCmdSubWorld& plResponderCmdSubWorld::Instance() { static plResponderCmdSubWorld theInstance; @@ -1532,54 +1539,45 @@ plMessage *plResponderCmdSubWorld::CreateMsg(plMaxNode* node, plErrorMsg *pErrMs return swMsg; } +/////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////// -class plResponderSubWorldProc : public ParamMap2UserDlgProc +#include "pfMessage/plArmatureEffectMsg.h" +#include "plAvatar/plArmatureEffects.h" + +enum +{ + kSurface, +}; + +class plResponderFootSurfaceProc : public ParamMap2UserDlgProc { public: BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { + IParamBlock2 *pb = pm->GetParamBlock(); + HWND hCB = GetDlgItem(hWnd, IDC_COMP_RESPOND_FOOT_SURFACE); + int i; + switch (msg) { case WM_INITDIALOG: - { - IParamBlock2 *pb = pm->GetParamBlock(); - int type = pb->GetInt(kSubWorldType); - - HWND nButton = GetDlgItem(hWnd, IDC_NODE_BUTTON); - //HWND sEnterText = GetDlgItem(hWnd, IDC_SUBWORLD_ENTER); - HWND sExitText = GetDlgItem(hWnd, IDC_SUBWORLD_EXIT); + for (i = 0; i < plArmatureEffectsMgr::kMaxSurface; i++) + ComboBox_AddString(hCB, plArmatureEffectsMgr::SurfaceStrings[i]); - BOOL isEnter = (type == kRespondSubWorldEnter) ? TRUE : FALSE; + ComboBox_SetCurSel(hCB, pb->GetInt(ParamID(kSurface))); - ShowWindow(nButton, (isEnter) ? SW_SHOW : SW_HIDE); - //ShowWindow(sEnterText,(isEnter) ? SW_SHOW : SW_HIDE); - ShowWindow(sExitText, (isEnter) ? SW_HIDE : SW_SHOW); - } return TRUE; case WM_COMMAND: - break; + if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMP_RESPOND_FOOT_SURFACE) + pb->SetValue(ParamID(kSurface), 0, ComboBox_GetCurSel(hCB)); } - return FALSE; } void DeleteThis() {} }; - -static plResponderSubWorldProc gResponderSubWorldProc; -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// - -#include "pfMessage/plArmatureEffectMsg.h" -#include "plAvatar/plArmatureEffects.h" - -class plResponderFootSurfaceProc; -extern plResponderFootSurfaceProc gResponderFootSurfaceProc; - -enum -{ - kSurface, -}; +static plResponderFootSurfaceProc gResponderFootSurfaceProc; ParamBlockDesc2 gResponderFootSurfaceBlock ( @@ -1623,44 +1621,52 @@ plMessage *plResponderCmdFootSurface::CreateMsg(plMaxNode* node, plErrorMsg *pEr return msg; } -class plResponderFootSurfaceProc : public ParamMap2UserDlgProc +/////////////////////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////////////////////// + +#include "plMultistageBehComponent.h" +enum { kMultistageComp, kMultistageNode }; + +class plResponderMultistageProc : public ParamMap2UserDlgProc { +protected: + plResponderCompNode fCompNode; + public: - BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + virtual BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - IParamBlock2 *pb = pm->GetParamBlock(); - HWND hCB = GetDlgItem(hWnd, IDC_COMP_RESPOND_FOOT_SURFACE); - int i; - switch (msg) { case WM_INITDIALOG: - for (i = 0; i < plArmatureEffectsMgr::kMaxSurface; i++) - ComboBox_AddString(hCB, plArmatureEffectsMgr::SurfaceStrings[i]); - - ComboBox_SetCurSel(hCB, pb->GetInt(ParamID(kSurface))); + { + IParamBlock2 *pb = pm->GetParamBlock(); + plResponderCompNode::ClassIDs cids; + cids.push_back(MULTISTAGE_BEH_CID); + fCompNode.Init(pb, kMultistageComp, kMultistageNode, IDC_RESPONDER_COMP, IDC_RESPONDER_NODE, &cids); + fCompNode.InitDlg(hWnd); + } return TRUE; case WM_COMMAND: - if (HIWORD(wParam) == CBN_SELCHANGE && LOWORD(wParam) == IDC_COMP_RESPOND_FOOT_SURFACE) - pb->SetValue(ParamID(kSurface), 0, ComboBox_GetCurSel(hCB)); + if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_COMP) + { + fCompNode.CompButtonPress(hWnd); + return TRUE; + } + else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_NODE) + { + fCompNode.NodeButtonPress(hWnd); + return TRUE; + } + break; } + return FALSE; } - void DeleteThis() {} + virtual void DeleteThis() {} }; -static plResponderFootSurfaceProc gResponderFootSurfaceProc; - -/////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////// - -#include "plMultistageBehComponent.h" - -class plResponderMultistageProc; -extern plResponderMultistageProc gResponderMultistageProc; - -enum { kMultistageComp, kMultistageNode }; +static plResponderMultistageProc gResponderMultistageProc; ParamBlockDesc2 gResponderMultistageBlock ( @@ -1722,44 +1728,3 @@ plMessage *plResponderCmdMultistage::CreateMsg(plMaxNode* node, plErrorMsg *pErr else throw "No Multistage component specified"; } - -class plResponderMultistageProc : public ParamMap2UserDlgProc -{ -protected: - plResponderCompNode fCompNode; - -public: - BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - switch (msg) - { - case WM_INITDIALOG: - { - IParamBlock2 *pb = pm->GetParamBlock(); - - plResponderCompNode::ClassIDs cids; - cids.push_back(MULTISTAGE_BEH_CID); - fCompNode.Init(pb, kMultistageComp, kMultistageNode, IDC_RESPONDER_COMP, IDC_RESPONDER_NODE, &cids); - fCompNode.InitDlg(hWnd); - } - return TRUE; - - case WM_COMMAND: - if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_COMP) - { - fCompNode.CompButtonPress(hWnd); - return TRUE; - } - else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_RESPONDER_NODE) - { - fCompNode.NodeButtonPress(hWnd); - return TRUE; - } - break; - } - - return FALSE; - } - void DeleteThis() {} -}; -static plResponderMultistageProc gResponderMultistageProc; diff --git a/Sources/Tools/MaxComponent/plResponderMtl.cpp b/Sources/Tools/MaxComponent/plResponderMtl.cpp index a0f59161..ba59aa12 100644 --- a/Sources/Tools/MaxComponent/plResponderMtl.cpp +++ b/Sources/Tools/MaxComponent/plResponderMtl.cpp @@ -72,8 +72,23 @@ enum MtlNodeType kNodeResponder // Use the node the responder is attached to }; -class plResponderMtlProc; -extern plResponderMtlProc gResponderMtlProc; +#include "plAnimCompProc.h" + +class plResponderMtlProc : public plMtlAnimProc +{ +public: + plResponderMtlProc(); + +protected: + virtual void IOnInitDlg(HWND hWnd, IParamBlock2* pb); + virtual void ILoadUser(HWND hWnd, IParamBlock2* pb); + virtual bool IUserCommand(HWND hWnd, IParamBlock2* pb, int cmd, int resID); + + virtual void IPickNode(IParamBlock2* pb); + + virtual void ISetNodeButtonText(HWND hWnd, IParamBlock2* pb); +}; +static plResponderMtlProc gResponderMtlProc; ParamBlockDesc2 gResponderMtlBlock ( @@ -461,24 +476,6 @@ void plResponderCmdMtl::CreateWait(plMaxNode* node, plErrorMsg* pErrMsg, IParamB //////////////////////////////////////////////////////////////////////////////// -#include "plAnimCompProc.h" - -class plResponderMtlProc : public plMtlAnimProc -{ -public: - plResponderMtlProc(); - -protected: - virtual void IOnInitDlg(HWND hWnd, IParamBlock2* pb); - virtual void ILoadUser(HWND hWnd, IParamBlock2* pb); - virtual bool IUserCommand(HWND hWnd, IParamBlock2* pb, int cmd, int resID); - - virtual void IPickNode(IParamBlock2* pb); - - virtual void ISetNodeButtonText(HWND hWnd, IParamBlock2* pb); -}; -static plResponderMtlProc gResponderMtlProc; - plResponderMtlProc::plResponderMtlProc() { fMtlButtonID = IDC_MTL_BUTTON; diff --git a/Sources/Tools/MaxComponent/plResponderWait.cpp b/Sources/Tools/MaxComponent/plResponderWait.cpp index cedff94a..3506cb16 100644 --- a/Sources/Tools/MaxComponent/plResponderWait.cpp +++ b/Sources/Tools/MaxComponent/plResponderWait.cpp @@ -32,8 +32,29 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "plResponderLink.h" -class plResponderWaitProc; -extern plResponderWaitProc gResponderWaitProc; +class plResponderWaitProc : public ParamMap2UserDlgProc +{ +protected: + IParamBlock2 *fStatePB; + IParamBlock2 *fWaitPB; + + int fCurCmd; + HWND fhDlg; + HWND fhList; + +public: + void Init(IParamBlock2 *curStatePB, int curCmd, HWND hList) { fStatePB = curStatePB; fCurCmd = curCmd; fhList = hList; } + + virtual BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); + virtual void DeleteThis() {} + +protected: + void LoadWho(bool setDefault=false); + void LoadPoint(bool force=false); + + IParamBlock2 *GetCmdParams(int cmdIdx); +}; +static plResponderWaitProc gResponderWaitProc; enum { @@ -111,30 +132,7 @@ const char* ResponderWait::GetWaitPoint(IParamBlock2* waitPB) return point; } -class plResponderWaitProc : public ParamMap2UserDlgProc -{ -protected: - IParamBlock2 *fStatePB; - IParamBlock2 *fWaitPB; - - int fCurCmd; - HWND fhDlg; - HWND fhList; - -public: - void Init(IParamBlock2 *curStatePB, int curCmd, HWND hList) { fStatePB = curStatePB; fCurCmd = curCmd; fhList = hList; } - - BOOL DlgProc(TimeValue t, IParamMap2 *pm, HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam); - - void DeleteThis() {} - -protected: - void LoadWho(bool setDefault=false); - void LoadPoint(bool force=false); - - IParamBlock2 *GetCmdParams(int cmdIdx); -}; -static plResponderWaitProc gResponderWaitProc; +///////////////////////////////////////////////////////////////////////////// void ResponderWait::InitDlg(IParamBlock2 *curStatePB, int curCmd, HWND hList) { diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicEnvLayerBitmapPB.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicEnvLayerBitmapPB.cpp index c084b69d..c0c6dc98 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicEnvLayerBitmapPB.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicEnvLayerBitmapPB.cpp @@ -99,6 +99,7 @@ class PickAnchorNode : public PickObjectProc class DELBitmapDlgProc : public ParamMap2UserDlgProc { +public: PickAnchorNode fPickAnchorCallback; /// Called to update the controls of the dialog @@ -149,7 +150,7 @@ class DELBitmapDlgProc : public ParamMap2UserDlgProc } /// Main message proc - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -183,7 +184,7 @@ class DELBitmapDlgProc : public ParamMap2UserDlgProc return FALSE; } - void DeleteThis() {}; + virtual void DeleteThis() {}; }; static DELBitmapDlgProc gDELBitmapDlgProc; diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayerBitmapPB.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayerBitmapPB.cpp index 4fefe691..e255f451 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayerBitmapPB.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plDynamicTextLayerBitmapPB.cpp @@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class DTLBitmapDlgProc : public ParamMap2UserDlgProc { +public: /// Called to update the controls of the dialog virtual void Update( TimeValue t, Interval &valid, IParamMap2 *map ) { @@ -69,7 +70,7 @@ class DTLBitmapDlgProc : public ParamMap2UserDlgProc } /// Main message proc - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) @@ -136,7 +137,7 @@ class DTLBitmapDlgProc : public ParamMap2UserDlgProc return FALSE; } - void DeleteThis() {}; + virtual void DeleteThis() {}; protected: /// Clamp texture sizes to a power of 2 diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp index c14277f4..2734b294 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTex.cpp @@ -173,7 +173,7 @@ BOOL plLayerTex::SetDlgThing(ParamDlg* dlg) int plLayerTex::NumRefs() { - return 3; + return 2; } //From ReferenceMaker @@ -211,7 +211,7 @@ void plLayerTex::SetReference(int i, RefTargetHandle rtarg) int plLayerTex::NumParamBlocks() { - return 2; + return 1; } IParamBlock2* plLayerTex::GetParamBlock(int i) @@ -248,7 +248,7 @@ RefTargetHandle plLayerTex::Clone(RemapDir &remap) int plLayerTex::NumSubs() { - return 3; + return 2; } Animatable* plLayerTex::SubAnim(int i) diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.cpp index 79d951bf..616896b5 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBasicPB.cpp @@ -64,7 +64,7 @@ static const char *kUsageTypes[] = class BasicDlgProc : public ParamMap2UserDlgProc { public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { IParamBlock2 *pb = map->GetParamBlock(); @@ -101,6 +101,6 @@ public: return false; } - void DeleteThis() {}; + virtual void DeleteThis() {}; }; static BasicDlgProc gBasicDlgProc; diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBitmapPB.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBitmapPB.cpp index caacd62c..dbf669de 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBitmapPB.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plLayerTexBitmapPB.cpp @@ -32,8 +32,365 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class BMTexPBAccessor; extern BMTexPBAccessor bmtex_accessor; -class BitmapDlgProc; -extern BitmapDlgProc gBitmapDlgProc; +class BMCropper : public CropCallback +{ + IParamBlock2 *fPBlock; + +public: + BMCropper(IParamBlock2* pblock) : fPBlock(pblock) {} + + float GetInitU() { return fPBlock->GetFloat(kBmpClipU); } + float GetInitV() { return fPBlock->GetFloat(kBmpClipV); } + float GetInitW() { return fPBlock->GetFloat(kBmpClipW); } + float GetInitH() { return fPBlock->GetFloat(kBmpClipH); } + BOOL GetInitMode() { return fPBlock->GetInt(kBmpCropPlace); } + void SetValues(float u, float v, float w, float h, BOOL md); + void OnClose(); +}; + +class BitmapDlgProc : public ParamMap2UserDlgProc +{ + friend class BMTexPBAccessor; + + + PBBitmap *fLastBMap; + bool fSettingDetailValues; + +public: + /// Called to update the controls of the dialog + /// Note: we're bad that we use a static here, but + virtual void Update( TimeValue t, Interval &valid, IParamMap2 *map ) + { + ICustButton *bmSelectBtn; + IParamBlock2 *pblock; + int width, height; + + + ParamMap2UserDlgProc::Update( t, valid, map ); + + if( fSettingDetailValues ) + { + // We're getting an update just because we changed detail values, so we + // know we don't have to do anything ourselves + return; + } + + pblock = map->GetParamBlock(); + + // Update texture map button + bmSelectBtn = GetICustButton( GetDlgItem( map->GetHWnd(), IDC_LAYER_NAME ) ); + PBBitmap *pbbm = pblock->GetBitmap( kBmpBitmap, t ); + if( pbbm ) + { + if( pbbm != fLastBMap ) + { + bmSelectBtn->SetText( (TCHAR *)pbbm->bi.Filename() ); + + // Init values for clamping spinners to powers of 2 + width = IFloorPow2( pbbm->bi.Width() ); + map->SetRange( kBmpExportWidth, 4.f, (float)width ); + + height = IFloorPow2( pbbm->bi.Height() ); + map->SetRange( kBmpExportHeight, 4.f, (float)height ); + + IClampTexSizeSpinner( t, map, true ); + ISetDetailCurveNumLevels( map, t ); + } + } + else if( pbbm != fLastBMap ) + bmSelectBtn->SetText( _T( "None" ) ); + + fLastBMap = pbbm; + + ReleaseICustButton( bmSelectBtn ); + + // Update detail curve control + HWND dlg = map->GetHWnd(); + + plDetailCurveCtrl *ctrl = GET_DETAIL_CURVE_CTRL( dlg, IDC_DETAIL_CURVE_CTRL ); + if( ctrl == NULL ) + { + // The control hasn't been created, so create it already! + HWND basis; + RECT r; + + // Create the detail map control + basis = GetDlgItem( dlg, IDC_DETAIL_SAMPLE ); + GetClientRect( basis, &r ); + MapWindowPoints( basis, dlg, (POINT *)&r, 2 ); + + ctrl = TRACKED_NEW plDetailCurveCtrl( dlg, IDC_DETAIL_CURVE_CTRL, &r ); + } + + EnableWindow( GetDlgItem( dlg, IDC_DETAIL_CURVE_CTRL ), (BOOL)pblock->GetInt( kBmpUseDetail, t ) ); + + if( ctrl != NULL ) + { + ctrl->SetStartPoint( (float)pblock->GetInt( kBmpDetailStartSize, t ) / 100.f, + (float)pblock->GetInt( kBmpDetailStartOpac, t ) / 100.f ); + ctrl->SetEndPoint( (float)pblock->GetInt( kBmpDetailStopSize, t ) / 100.f, + (float)pblock->GetInt( kBmpDetailStopOpac, t ) / 100.f ); + } + + } + + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + static ICustButton* bmSelectBtn; + + switch (msg) + { + case WM_INITDIALOG: + fLastBMap = NULL; + fSettingDetailValues = false; + break; + + /// Note: the following *could* be done in the accessor, except that you end up in an + /// infinite loop updating the values. Not good. + case CC_SPINNER_CHANGE: + + if( LOWORD( wParam ) == IDC_EXPORTWIDTH_SPINNER ) + IClampTexSizeSpinner( t, map, true ); + + else if( LOWORD( wParam ) == IDC_EXPORTHEIGHT_SPINNER ) + IClampTexSizeSpinner( t, map, false ); + + break; + + // Message from the detail curve that a point got dragged + case PL_DC_POINT_DRAGGED: + { + plDetailCurveCtrl *ctrl = (plDetailCurveCtrl *)lParam; + IParamBlock2 *pblock = map->GetParamBlock(); + float x, y; + + + fSettingDetailValues = true; + + if( wParam == PL_DC_START_POINT ) + { + ctrl->GetStartPoint( x, y ); + pblock->SetValue( kBmpDetailStartSize, t, (int)( x * 100.f ) ); + pblock->SetValue( kBmpDetailStartOpac, t, (int)( y * 100.f ) ); + } + else + { + ctrl->GetEndPoint( x, y ); + pblock->SetValue( kBmpDetailStopSize, t, (int)( x * 100.f ) ); + pblock->SetValue( kBmpDetailStopOpac, t, (int)( y * 100.f ) ); + } + + map->UpdateUI( t ); + fSettingDetailValues = false; + } + return 0; + + case WM_COMMAND: + if( HIWORD( wParam ) == EN_CHANGE && LOWORD( wParam ) == IDC_EXPORTWIDTH ) + IClampTexSizeSpinner( t, map, true ); + + else if( HIWORD( wParam ) == EN_CHANGE && LOWORD( wParam ) == IDC_EXPORTHEIGHT ) + IClampTexSizeSpinner( t, map, false ); + + else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BM_CROP_IMAGE) + { + IParamBlock2 *pblock = map->GetParamBlock(); + PBBitmap *pbbm = pblock->GetBitmap(kBmpBitmap, t); + if (pbbm) + { + if (!pbbm->bm) + pbbm->bm = TheManager->Load(&pbbm->bi); + + BMCropper *cropper = TRACKED_NEW BMCropper(pblock); + + pbbm->bm->Display("Specify Cropping/Placement", BMM_CN, FALSE, TRUE, cropper); + } + // bm->DeleteThis(); + return TRUE; + } + else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_LAYER_RELOAD) + { + // TEMP + IParamBlock2 *pblock = map->GetParamBlock(); + PBBitmap *pbbm = pblock->GetBitmap(kBmpBitmap, t); + if (pbbm) + { + plLayerTex *layer = (plLayerTex*)map->GetParamBlock()->GetOwner(); + + layer->RefreshBitmaps(); + + layer->fMtlParams->MtlChanged(); + layer->IChanged(); + } + return TRUE; + } + else if (LOWORD(wParam) == IDC_LAYER_NAME) + { + plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)map->GetParamBlock()->GetOwner(); + if (layer == nil) + return FALSE; + BOOL selectedNewBitmap = layer->HandleBitmapSelection(); + + if(selectedNewBitmap) + { + IParamBlock2 *pblock = map->GetParamBlock(); + //plLayerTex *layer = (plLayerTex*)map->GetParamBlock()->GetOwner(); + + //layer->SetBitmap(&bi); + //layer->IChanged(); + //BitmapInfo *bi = &layer->GetPBBitmap()->bi; + + bmSelectBtn = GetICustButton(GetDlgItem(hWnd,IDC_LAYER_NAME)); + PBBitmap *pbbm = layer->GetPBBitmap(); + bmSelectBtn->SetText(pbbm != nil ? (TCHAR*)pbbm->bi.Filename() : ""); + ReleaseICustButton(bmSelectBtn); + + if (pbbm != nil) + { + // Init values for clamping spinners to powers of 2 + int width = IFloorPow2( pbbm->bi.Width() ); + map->SetRange( kBmpExportWidth, 4.f, (float)width ); + + int height = IFloorPow2( pbbm->bi.Height() ); + map->SetRange( kBmpExportHeight, 4.f, (float)height ); + + if( width > 512 ) + { + height = (int)( 512.f * (float)( (float)height / (float)width ) ); + width = 512; + } + else if( height > 512 ) + { + width = (int)( 512.f * (float)( (float)width / (float)height ) ); + height = 512; + } + pblock->SetValue( kBmpExportWidth, t, width ); + pblock->SetValue( kBmpExportLastWidth, t, width ); + pblock->SetValue( kBmpExportHeight, t, height ); + pblock->SetValue( kBmpExportLastHeight, t, height ); + + IClampTexSizeSpinner( t, map, true ); + } + return TRUE; + } + else + { + return FALSE; + } + } + break; + } + + return FALSE; + } + virtual void DeleteThis() {}; + + void ISetDetailCurveNumLevels( IParamMap2 *map, TimeValue t ) + { + /// Set the level count on the detail control + plDetailCurveCtrl *ctrl = GET_DETAIL_CURVE_CTRL( map->GetHWnd(), IDC_DETAIL_CURVE_CTRL ); + if( ctrl != NULL ) + { + IParamBlock2 *pblock = map->GetParamBlock(); + int w = pblock->GetInt( kBmpExportWidth, t ); + int h = pblock->GetInt( kBmpExportHeight, t ); + int numLevels = 0; + while( w > 1 && h > 1 ) + { + w >>= 1; + h >>= 1; + numLevels++; + } + ctrl->SetNumLevels( numLevels ); + } + } + + /// Clamp texture sizes to a power of 2 + void IClampTexSizeSpinner( TimeValue t, IParamMap2 *map, bool clampWidth ) + { + IParamBlock2 *pblock = map->GetParamBlock(); + ParamID clampNew, clampOld; + ParamID otherNew, otherOld; + + if( clampWidth ) + { + clampNew = kBmpExportWidth; clampOld = kBmpExportLastWidth; + otherNew = kBmpExportHeight; otherOld = kBmpExportLastHeight; + } + else + { + clampNew = kBmpExportHeight; clampOld = kBmpExportLastHeight; + otherNew = kBmpExportWidth; otherOld = kBmpExportLastWidth; + } + + int lastVal = pblock->GetInt( clampOld, t ); + int tempVal, newVal = pblock->GetInt( clampNew, t ); + + if( newVal < lastVal ) + { + lastVal = newVal; + for( tempVal = 1; tempVal <= newVal; tempVal <<= 1 ); + newVal = tempVal >> 1; + } + else + { + lastVal = newVal; + for( tempVal = 1; tempVal < newVal; tempVal <<= 1 ); + newVal = tempVal; + } + + pblock->SetValue( clampNew, t, newVal ); + pblock->SetValue( clampOld, t, newVal ); + + // And clamp aspect ratio + PBBitmap *pbbm = pblock->GetBitmap( kBmpBitmap, t ); + + if( pbbm != NULL ) + { + int realWidth = pbbm->bi.Width(); + int realHeight = pbbm->bi.Height(); + + float aspect; + if( clampWidth ) + aspect = (float)realHeight / (float)realWidth; + else + aspect = (float)realWidth / (float)realHeight; + + int value = newVal; + value *= aspect; + + if( value < 4 ) + { + // Can't be below 4! + value = 4; + pblock->SetValue( otherNew, t, value ); + pblock->SetValue( otherOld, t, value ); + value = value / aspect; + pblock->SetValue( clampNew, t, value ); + pblock->SetValue( clampOld, t, value ); + } + else + { + pblock->SetValue( otherNew, t, value ); + pblock->SetValue( otherOld, t, value ); + } + } + + ISetDetailCurveNumLevels( map, t ); + } + + int IFloorPow2( int value ) + { + int v; + + + for( v = 1; v <= value; v <<= 1 ); + return v >> 1; + } + +}; + +static BitmapDlgProc gBitmapDlgProc; static ParamBlockDesc2 gBitmapParamBlk ( @@ -174,568 +531,208 @@ static ParamBlockDesc2 gBitmapParamBlk p_default, 512, end, kBmpExportHeight, _T("exportHeight"), TYPE_INT, 0, 0, - p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_EXPORTHEIGHT, IDC_EXPORTHEIGHT_SPINNER, SPIN_AUTOSCALE, - p_range, 4, 2048, - p_default, 512, - end, - kBmpExportLastWidth, _T("lastExportWidth"), TYPE_INT, 0, 0, - end, - kBmpExportLastHeight, _T("lastExportHeight"), TYPE_INT, 0, 0, - end, - - // Keep a sysmem copy at runtime (for image examination/manipulation). - kBmpNoDiscard, _T("noDiscard"), TYPE_BOOL, 0, 0, - p_ui, TYPE_SINGLECHEKBOX, IDC_NO_DISCARD, - p_default, FALSE, - end, - - end -); -ParamBlockDesc2 *GetBitmapBlk() { return &gBitmapParamBlk; } - -class BMCropper; - -class BMTexPBAccessor : public PBAccessor -{ -public: - void Set(PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) - { - plLayerTex* layer = (plLayerTex*)owner; - - if(layer == NULL) return; - - IParamBlock2 *pb = layer->GetParamBlockByID(plLayerTex::kBlkBitmap); - - switch (id) - { - case kBmpBitmap: - if (pb->GetMap()) - pb->GetMap()->Invalidate(kBmpBitmap); - - // Update the bitmap saved by the layer - //layer->SetBitmap(&val.bm->bi, tabIndex); - break; - -/* - case kBmpFilename: - bmt->SetMapName(val.s); - break; - - case kBmpFiltering: - bmt->filterType = val.i; - if (bmt->thebm) - bmt->thebm->SetFilter(bmFilterType(val.i)); - break; -*/ - case kBmpClipU: - { - float u = val.f; - float w = pb->GetFloat(kBmpClipW, t); - if (u + w > 1.0f) - { - pb->SetValue(kBmpClipW, t, 1.0f-u); - if (pb->GetMap()) - pb->GetMap()->Invalidate(kBmpClipW); - } - break; - } - case kBmpClipW: - { - float w = val.f; - float u = pb->GetFloat(kBmpClipU, t); - if (u + w > 1.0f) - { - pb->SetValue(kBmpClipU, t, 1.0f-w); - if (pb->GetMap()) - pb->GetMap()->Invalidate(kBmpClipU); - } - break; - } - case kBmpClipV: - { - float v = val.f; - float h = pb->GetFloat(kBmpClipH, t); - if (v + h > 1.0f) - { - pb->SetValue(kBmpClipH, t, 1.0f-v); - if (pb->GetMap()) - pb->GetMap()->Invalidate(kBmpClipH); - } - break; - } - case kBmpClipH: - { - float h = val.f; - float v = pb->GetFloat(kBmpClipV, t); - if (v + h > 1.0f) - { - pb->SetValue(kBmpClipV, t, 1.0f-h); - if (pb->GetMap()) - pb->GetMap()->Invalidate(kBmpClipV); - } - break; - } - - case kBmpDetailStartSize: - case kBmpDetailStopSize: - case kBmpDetailStartOpac: - case kBmpDetailStopOpac: - if( pb != NULL ) - { - if( IIsProcSettingDetailValues( pb ) ) - break; // Ignore, since we're the ones setting 'em - - HWND dlg = pb->GetMap()->GetHWnd(); - plDetailCurveCtrl *ctrl = GET_DETAIL_CURVE_CTRL( dlg, IDC_DETAIL_CURVE_CTRL ); - if( ctrl != NULL ) - { - if( id == kBmpDetailStartSize || id == kBmpDetailStartOpac ) - ctrl->SetStartPoint( (float)pb->GetInt( kBmpDetailStartSize, t ) / 100.f, - (float)pb->GetInt( kBmpDetailStartOpac, t ) / 100.f ); - else - ctrl->SetEndPoint( (float)pb->GetInt( kBmpDetailStopSize, t ) / 100.f, - (float)pb->GetInt( kBmpDetailStopOpac, t ) / 100.f ); - } - - // Make sure start is less than end - if( id == kBmpDetailStartSize ) - { - int end = pb->GetInt( kBmpDetailStopSize, t ); - if( val.i > end ) - pb->SetValue( kBmpDetailStopSize, t, val.i ); - } - else if( id == kBmpDetailStopSize ) - { - int start = pb->GetInt( kBmpDetailStartSize, t ); - if( val.i < start ) - pb->SetValue( kBmpDetailStartSize, t, val.i ); - } - - } - break; - - case kBmpUseDetail: - if( pb != NULL ) - { - HWND dlg = pb->GetMap()->GetHWnd(); - EnableWindow( GetDlgItem( dlg, IDC_DETAIL_CURVE_CTRL ), (BOOL)val.i ); - } - break; - } - } - void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid) - { - } - - // Gotta love hacks.... - bool IIsProcSettingDetailValues( IParamBlock2 *pb ); - -}; -static BMTexPBAccessor bmtex_accessor; - - -//========================================================================================= -// BMCropper -//========================================================================================= -class BMCropper : public CropCallback -{ - IParamBlock2 *fPBlock; - -public: - BMCropper(IParamBlock2* pblock) : fPBlock(pblock) {} - - float GetInitU() { return fPBlock->GetFloat(kBmpClipU); } - float GetInitV() { return fPBlock->GetFloat(kBmpClipV); } - float GetInitW() { return fPBlock->GetFloat(kBmpClipW); } - float GetInitH() { return fPBlock->GetFloat(kBmpClipH); } - BOOL GetInitMode() { return fPBlock->GetInt(kBmpCropPlace); } - void SetValues(float u, float v, float w, float h, BOOL md); - void OnClose(); -}; + p_ui, TYPE_SPINNER, EDITTYPE_INT, IDC_EXPORTHEIGHT, IDC_EXPORTHEIGHT_SPINNER, SPIN_AUTOSCALE, + p_range, 4, 2048, + p_default, 512, + end, + kBmpExportLastWidth, _T("lastExportWidth"), TYPE_INT, 0, 0, + end, + kBmpExportLastHeight, _T("lastExportHeight"), TYPE_INT, 0, 0, + end, -void BMCropper::SetValues(float u, float v, float w, float h, BOOL md) -{ - TimeValue t = GetCOREInterface()->GetTime(); + // Keep a sysmem copy at runtime (for image examination/manipulation). + kBmpNoDiscard, _T("noDiscard"), TYPE_BOOL, 0, 0, + p_ui, TYPE_SINGLECHEKBOX, IDC_NO_DISCARD, + p_default, FALSE, + end, - if (u != fPBlock->GetFloat(kBmpClipU, t)) - { - fPBlock->SetValue(kBmpClipU, t, u); - fPBlock->GetMap()->Invalidate(kBmpClipU); - } + end +); +ParamBlockDesc2 *GetBitmapBlk() { return &gBitmapParamBlk; } - if (v != fPBlock->GetFloat(kBmpClipV, t)) +class BMTexPBAccessor : public PBAccessor +{ +public: + void Set(PB2Value& val, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t) { - fPBlock->SetValue(kBmpClipV, t, v); - fPBlock->GetMap()->Invalidate(kBmpClipV); - } + plLayerTex* layer = (plLayerTex*)owner; - if (w != fPBlock->GetFloat(kBmpClipW, t)) - { - fPBlock->SetValue(kBmpClipW, t, w); - fPBlock->GetMap()->Invalidate(kBmpClipW); - } + if(layer == NULL) return; + + IParamBlock2 *pb = layer->GetParamBlockByID(plLayerTex::kBlkBitmap); - if (h != fPBlock->GetFloat(kBmpClipH, t)) - { - fPBlock->SetValue(kBmpClipH, t, h); - fPBlock->GetMap()->Invalidate(kBmpClipH); - } + switch (id) + { + case kBmpBitmap: + if (pb->GetMap()) + pb->GetMap()->Invalidate(kBmpBitmap); - if (md != fPBlock->GetInt(kBmpCropPlace)) - { - fPBlock->SetValue(kBmpCropPlace, t, md); - fPBlock->GetMap()->Invalidate(kBmpCropPlace); - } -} + // Update the bitmap saved by the layer + //layer->SetBitmap(&val.bm->bi, tabIndex); + break; -void BMCropper::OnClose() -{ - delete this; -} +/* + case kBmpFilename: + bmt->SetMapName(val.s); + break; -class BitmapDlgProc : public ParamMap2UserDlgProc -{ - friend class BMTexPBAccessor; - - - PBBitmap *fLastBMap; - bool fSettingDetailValues; - - - /// Called to update the controls of the dialog - /// Note: we're bad that we use a static here, but - virtual void Update( TimeValue t, Interval &valid, IParamMap2 *map ) - { - ICustButton *bmSelectBtn; - IParamBlock2 *pblock; - int width, height; - - - ParamMap2UserDlgProc::Update( t, valid, map ); - - if( fSettingDetailValues ) - { - // We're getting an update just because we changed detail values, so we - // know we don't have to do anything ourselves - return; - } - - pblock = map->GetParamBlock(); - - // Update texture map button - bmSelectBtn = GetICustButton( GetDlgItem( map->GetHWnd(), IDC_LAYER_NAME ) ); - PBBitmap *pbbm = pblock->GetBitmap( kBmpBitmap, t ); - if( pbbm ) - { - if( pbbm != fLastBMap ) - { - bmSelectBtn->SetText( (TCHAR *)pbbm->bi.Filename() ); - - // Init values for clamping spinners to powers of 2 - width = IFloorPow2( pbbm->bi.Width() ); - map->SetRange( kBmpExportWidth, 4.f, (float)width ); - - height = IFloorPow2( pbbm->bi.Height() ); - map->SetRange( kBmpExportHeight, 4.f, (float)height ); - - IClampTexSizeSpinner( t, map, true ); - ISetDetailCurveNumLevels( map, t ); - } - } - else if( pbbm != fLastBMap ) - bmSelectBtn->SetText( _T( "None" ) ); - - fLastBMap = pbbm; - - ReleaseICustButton( bmSelectBtn ); - - // Update detail curve control - HWND dlg = map->GetHWnd(); - - plDetailCurveCtrl *ctrl = GET_DETAIL_CURVE_CTRL( dlg, IDC_DETAIL_CURVE_CTRL ); - if( ctrl == NULL ) - { - // The control hasn't been created, so create it already! - HWND basis; - RECT r; - - // Create the detail map control - basis = GetDlgItem( dlg, IDC_DETAIL_SAMPLE ); - GetClientRect( basis, &r ); - MapWindowPoints( basis, dlg, (POINT *)&r, 2 ); - - ctrl = TRACKED_NEW plDetailCurveCtrl( dlg, IDC_DETAIL_CURVE_CTRL, &r ); - } - - EnableWindow( GetDlgItem( dlg, IDC_DETAIL_CURVE_CTRL ), (BOOL)pblock->GetInt( kBmpUseDetail, t ) ); - - if( ctrl != NULL ) - { - ctrl->SetStartPoint( (float)pblock->GetInt( kBmpDetailStartSize, t ) / 100.f, - (float)pblock->GetInt( kBmpDetailStartOpac, t ) / 100.f ); - ctrl->SetEndPoint( (float)pblock->GetInt( kBmpDetailStopSize, t ) / 100.f, - (float)pblock->GetInt( kBmpDetailStopOpac, t ) / 100.f ); - } - - } - - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - static ICustButton* bmSelectBtn; - - switch (msg) - { - case WM_INITDIALOG: - fLastBMap = NULL; - fSettingDetailValues = false; - break; - - /// Note: the following *could* be done in the accessor, except that you end up in an - /// infinite loop updating the values. Not good. - case CC_SPINNER_CHANGE: - - if( LOWORD( wParam ) == IDC_EXPORTWIDTH_SPINNER ) - IClampTexSizeSpinner( t, map, true ); - - else if( LOWORD( wParam ) == IDC_EXPORTHEIGHT_SPINNER ) - IClampTexSizeSpinner( t, map, false ); - - break; - - // Message from the detail curve that a point got dragged - case PL_DC_POINT_DRAGGED: + case kBmpFiltering: + bmt->filterType = val.i; + if (bmt->thebm) + bmt->thebm->SetFilter(bmFilterType(val.i)); + break; +*/ + case kBmpClipU: { - plDetailCurveCtrl *ctrl = (plDetailCurveCtrl *)lParam; - IParamBlock2 *pblock = map->GetParamBlock(); - float x, y; - - - fSettingDetailValues = true; - - if( wParam == PL_DC_START_POINT ) - { - ctrl->GetStartPoint( x, y ); - pblock->SetValue( kBmpDetailStartSize, t, (int)( x * 100.f ) ); - pblock->SetValue( kBmpDetailStartOpac, t, (int)( y * 100.f ) ); - } - else + float u = val.f; + float w = pb->GetFloat(kBmpClipW, t); + if (u + w > 1.0f) { - ctrl->GetEndPoint( x, y ); - pblock->SetValue( kBmpDetailStopSize, t, (int)( x * 100.f ) ); - pblock->SetValue( kBmpDetailStopOpac, t, (int)( y * 100.f ) ); + pb->SetValue(kBmpClipW, t, 1.0f-u); + if (pb->GetMap()) + pb->GetMap()->Invalidate(kBmpClipW); } - - map->UpdateUI( t ); - fSettingDetailValues = false; + break; } - return 0; - - case WM_COMMAND: - if( HIWORD( wParam ) == EN_CHANGE && LOWORD( wParam ) == IDC_EXPORTWIDTH ) - IClampTexSizeSpinner( t, map, true ); - - else if( HIWORD( wParam ) == EN_CHANGE && LOWORD( wParam ) == IDC_EXPORTHEIGHT ) - IClampTexSizeSpinner( t, map, false ); - - else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_BM_CROP_IMAGE) + case kBmpClipW: { - IParamBlock2 *pblock = map->GetParamBlock(); - PBBitmap *pbbm = pblock->GetBitmap(kBmpBitmap, t); - if (pbbm) + float w = val.f; + float u = pb->GetFloat(kBmpClipU, t); + if (u + w > 1.0f) { - if (!pbbm->bm) - pbbm->bm = TheManager->Load(&pbbm->bi); - - BMCropper *cropper = TRACKED_NEW BMCropper(pblock); - - pbbm->bm->Display("Specify Cropping/Placement", BMM_CN, FALSE, TRUE, cropper); + pb->SetValue(kBmpClipU, t, 1.0f-w); + if (pb->GetMap()) + pb->GetMap()->Invalidate(kBmpClipU); } - // bm->DeleteThis(); - return TRUE; + break; } - else if (HIWORD(wParam) == BN_CLICKED && LOWORD(wParam) == IDC_LAYER_RELOAD) + case kBmpClipV: { - // TEMP - IParamBlock2 *pblock = map->GetParamBlock(); - PBBitmap *pbbm = pblock->GetBitmap(kBmpBitmap, t); - if (pbbm) + float v = val.f; + float h = pb->GetFloat(kBmpClipH, t); + if (v + h > 1.0f) { - plLayerTex *layer = (plLayerTex*)map->GetParamBlock()->GetOwner(); - - layer->RefreshBitmaps(); - - layer->fMtlParams->MtlChanged(); - layer->IChanged(); + pb->SetValue(kBmpClipH, t, 1.0f-v); + if (pb->GetMap()) + pb->GetMap()->Invalidate(kBmpClipH); } - return TRUE; + break; } - else if (LOWORD(wParam) == IDC_LAYER_NAME) + case kBmpClipH: { - plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)map->GetParamBlock()->GetOwner(); - if (layer == nil) - return FALSE; - BOOL selectedNewBitmap = layer->HandleBitmapSelection(); - - if(selectedNewBitmap) + float h = val.f; + float v = pb->GetFloat(kBmpClipV, t); + if (v + h > 1.0f) { - IParamBlock2 *pblock = map->GetParamBlock(); - //plLayerTex *layer = (plLayerTex*)map->GetParamBlock()->GetOwner(); - - //layer->SetBitmap(&bi); - //layer->IChanged(); - //BitmapInfo *bi = &layer->GetPBBitmap()->bi; - - bmSelectBtn = GetICustButton(GetDlgItem(hWnd,IDC_LAYER_NAME)); - PBBitmap *pbbm = layer->GetPBBitmap(); - bmSelectBtn->SetText(pbbm != nil ? (TCHAR*)pbbm->bi.Filename() : ""); - ReleaseICustButton(bmSelectBtn); - - if (pbbm != nil) + pb->SetValue(kBmpClipV, t, 1.0f-h); + if (pb->GetMap()) + pb->GetMap()->Invalidate(kBmpClipV); + } + break; + } + + case kBmpDetailStartSize: + case kBmpDetailStopSize: + case kBmpDetailStartOpac: + case kBmpDetailStopOpac: + if( pb != NULL ) + { + if( IIsProcSettingDetailValues( pb ) ) + break; // Ignore, since we're the ones setting 'em + + HWND dlg = pb->GetMap()->GetHWnd(); + plDetailCurveCtrl *ctrl = GET_DETAIL_CURVE_CTRL( dlg, IDC_DETAIL_CURVE_CTRL ); + if( ctrl != NULL ) { - // Init values for clamping spinners to powers of 2 - int width = IFloorPow2( pbbm->bi.Width() ); - map->SetRange( kBmpExportWidth, 4.f, (float)width ); - - int height = IFloorPow2( pbbm->bi.Height() ); - map->SetRange( kBmpExportHeight, 4.f, (float)height ); - - if( width > 512 ) - { - height = (int)( 512.f * (float)( (float)height / (float)width ) ); - width = 512; - } - else if( height > 512 ) - { - width = (int)( 512.f * (float)( (float)width / (float)height ) ); - height = 512; - } - pblock->SetValue( kBmpExportWidth, t, width ); - pblock->SetValue( kBmpExportLastWidth, t, width ); - pblock->SetValue( kBmpExportHeight, t, height ); - pblock->SetValue( kBmpExportLastHeight, t, height ); - - IClampTexSizeSpinner( t, map, true ); - } - return TRUE; + if( id == kBmpDetailStartSize || id == kBmpDetailStartOpac ) + ctrl->SetStartPoint( (float)pb->GetInt( kBmpDetailStartSize, t ) / 100.f, + (float)pb->GetInt( kBmpDetailStartOpac, t ) / 100.f ); + else + ctrl->SetEndPoint( (float)pb->GetInt( kBmpDetailStopSize, t ) / 100.f, + (float)pb->GetInt( kBmpDetailStopOpac, t ) / 100.f ); + } + + // Make sure start is less than end + if( id == kBmpDetailStartSize ) + { + int end = pb->GetInt( kBmpDetailStopSize, t ); + if( val.i > end ) + pb->SetValue( kBmpDetailStopSize, t, val.i ); + } + else if( id == kBmpDetailStopSize ) + { + int start = pb->GetInt( kBmpDetailStartSize, t ); + if( val.i < start ) + pb->SetValue( kBmpDetailStartSize, t, val.i ); + } + } - else + break; + + case kBmpUseDetail: + if( pb != NULL ) { - return FALSE; + HWND dlg = pb->GetMap()->GetHWnd(); + EnableWindow( GetDlgItem( dlg, IDC_DETAIL_CURVE_CTRL ), (BOOL)val.i ); } - } - break; + break; } - - return FALSE; } - void DeleteThis() {}; - - void ISetDetailCurveNumLevels( IParamMap2 *map, TimeValue t ) + void Get(PB2Value& v, ReferenceMaker* owner, ParamID id, int tabIndex, TimeValue t, Interval &valid) { - /// Set the level count on the detail control - plDetailCurveCtrl *ctrl = GET_DETAIL_CURVE_CTRL( map->GetHWnd(), IDC_DETAIL_CURVE_CTRL ); - if( ctrl != NULL ) - { - IParamBlock2 *pblock = map->GetParamBlock(); - int w = pblock->GetInt( kBmpExportWidth, t ); - int h = pblock->GetInt( kBmpExportHeight, t ); - int numLevels = 0; - while( w > 1 && h > 1 ) - { - w >>= 1; - h >>= 1; - numLevels++; - } - ctrl->SetNumLevels( numLevels ); - } } - - /// Clamp texture sizes to a power of 2 - void IClampTexSizeSpinner( TimeValue t, IParamMap2 *map, bool clampWidth ) + + // Gotta love hacks.... + bool IIsProcSettingDetailValues( IParamBlock2 *pb ); + +}; + +static BMTexPBAccessor bmtex_accessor; + + +//========================================================================================= +// BMCropper +//========================================================================================= + +void BMCropper::SetValues(float u, float v, float w, float h, BOOL md) +{ + TimeValue t = GetCOREInterface()->GetTime(); + + if (u != fPBlock->GetFloat(kBmpClipU, t)) { - IParamBlock2 *pblock = map->GetParamBlock(); - ParamID clampNew, clampOld; - ParamID otherNew, otherOld; - - if( clampWidth ) - { - clampNew = kBmpExportWidth; clampOld = kBmpExportLastWidth; - otherNew = kBmpExportHeight; otherOld = kBmpExportLastHeight; - } - else - { - clampNew = kBmpExportHeight; clampOld = kBmpExportLastHeight; - otherNew = kBmpExportWidth; otherOld = kBmpExportLastWidth; - } - - int lastVal = pblock->GetInt( clampOld, t ); - int tempVal, newVal = pblock->GetInt( clampNew, t ); - - if( newVal < lastVal ) - { - lastVal = newVal; - for( tempVal = 1; tempVal <= newVal; tempVal <<= 1 ); - newVal = tempVal >> 1; - } - else - { - lastVal = newVal; - for( tempVal = 1; tempVal < newVal; tempVal <<= 1 ); - newVal = tempVal; - } - - pblock->SetValue( clampNew, t, newVal ); - pblock->SetValue( clampOld, t, newVal ); - - // And clamp aspect ratio - PBBitmap *pbbm = pblock->GetBitmap( kBmpBitmap, t ); - - if( pbbm != NULL ) - { - int realWidth = pbbm->bi.Width(); - int realHeight = pbbm->bi.Height(); - - float aspect; - if( clampWidth ) - aspect = (float)realHeight / (float)realWidth; - else - aspect = (float)realWidth / (float)realHeight; - - int value = newVal; - value *= aspect; - - if( value < 4 ) - { - // Can't be below 4! - value = 4; - pblock->SetValue( otherNew, t, value ); - pblock->SetValue( otherOld, t, value ); - value = value / aspect; - pblock->SetValue( clampNew, t, value ); - pblock->SetValue( clampOld, t, value ); - } - else - { - pblock->SetValue( otherNew, t, value ); - pblock->SetValue( otherOld, t, value ); - } - } - - ISetDetailCurveNumLevels( map, t ); + fPBlock->SetValue(kBmpClipU, t, u); + fPBlock->GetMap()->Invalidate(kBmpClipU); } - - int IFloorPow2( int value ) + + if (v != fPBlock->GetFloat(kBmpClipV, t)) { - int v; - - - for( v = 1; v <= value; v <<= 1 ); - return v >> 1; + fPBlock->SetValue(kBmpClipV, t, v); + fPBlock->GetMap()->Invalidate(kBmpClipV); } - -}; -static BitmapDlgProc gBitmapDlgProc; + if (w != fPBlock->GetFloat(kBmpClipW, t)) + { + fPBlock->SetValue(kBmpClipW, t, w); + fPBlock->GetMap()->Invalidate(kBmpClipW); + } + + if (h != fPBlock->GetFloat(kBmpClipH, t)) + { + fPBlock->SetValue(kBmpClipH, t, h); + fPBlock->GetMap()->Invalidate(kBmpClipH); + } + + if (md != fPBlock->GetInt(kBmpCropPlace)) + { + fPBlock->SetValue(kBmpCropPlace, t, md); + fPBlock->GetMap()->Invalidate(kBmpCropPlace); + } +} + +void BMCropper::OnClose() +{ + delete this; +} // Gotta love hacks.... diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.cpp index 3c3fa1ae..c9f42e92 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plMAXCameraLayer.cpp @@ -68,7 +68,7 @@ public: virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap) { UpdateDisplay(pmap); } - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { int id = LOWORD(wParam); int code = HIWORD(wParam); @@ -103,7 +103,7 @@ public: } return FALSE; } - void DeleteThis() {} + virtual void DeleteThis() {} }; static MAXCameraLayerDlgProc gMAXCameraLayerDlgProc; diff --git a/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayerBitmapPB.cpp b/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayerBitmapPB.cpp index e1f74da9..ece09e5a 100644 --- a/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayerBitmapPB.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Layers/plStaticEnvLayerBitmapPB.cpp @@ -195,7 +195,7 @@ public: } /// Main message proc - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static ICustButton* bmSelectBtn; long buttons[ 6 ] = { IDC_FRONT_NAME, IDC_BACK_NAME, IDC_LEFT_NAME, IDC_RIGHT_NAME, IDC_TOP_NAME, IDC_BOTTOM_NAME }; @@ -264,7 +264,7 @@ public: return FALSE; } - void DeleteThis() {}; + virtual void DeleteThis() {}; BOOL IDoSelectBaseFilename( IParamMap2 *map, TimeValue t, HWND hWnd ) { diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp index 773e2b7a..a5f4acd7 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plAnimStealthNode.cpp @@ -83,11 +83,11 @@ protected: HWND fhWnd; public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); - void DeleteThis() { IDeleteSegMap(); } + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + virtual void DeleteThis() { IDeleteSegMap(); } void SetThing(ReferenceTarget *m); - void Update( TimeValue t, Interval &valid, IParamMap2 *pmap ); + virtual void Update( TimeValue t, Interval &valid, IParamMap2 *pmap ); protected: // Set all the controls to their stored value diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtlBasicPBDec.h b/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtlBasicPBDec.h index 8bffa9f0..4ee01142 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtlBasicPBDec.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plBumpMtlBasicPBDec.h @@ -28,8 +28,33 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "../resource.h" #include "iparamm2.h" -class BumpBasicDlgProc; -extern BumpBasicDlgProc gBumpBasicDlgProc; +class BumpBasicDlgProc : public ParamMap2UserDlgProc +{ +#if 1 +protected: + +public: + BumpBasicDlgProc() {} + ~BumpBasicDlgProc() { } +#endif + +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: + { + } + return TRUE; + } + return FALSE; + } + virtual void DeleteThis() {} +}; +static BumpBasicDlgProc gBumpBasicDlgProc; static ParamBlockDesc2 gBumpBasicPB ( @@ -60,33 +85,3 @@ static ParamBlockDesc2 gBumpBasicPB end ); ParamBlockDesc2 *GetBumpBasicPB() { return &gBumpBasicPB; } - -class BumpBasicDlgProc : public ParamMap2UserDlgProc -{ -#if 1 -protected: - -public: - BumpBasicDlgProc() {} - ~BumpBasicDlgProc() { } -#endif - -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - IParamBlock2 *pb = map->GetParamBlock(); - - switch (msg) - { - case WM_INITDIALOG: - { - } - return TRUE; - } - return FALSE; - } - void DeleteThis() {} -}; -static BumpBasicDlgProc gBumpBasicDlgProc; - - diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtlPBDec.h b/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtlPBDec.h index 4366d7eb..fd692a82 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtlPBDec.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plClothingMtlPBDec.h @@ -121,87 +121,6 @@ public: } }; -class ClothingBasicDlgProc; -extern ClothingBasicDlgProc gClothingBasicDlgProc; - -static ParamBlockDesc2 gClothingMtlPB -( - plClothingMtl::kBlkBasic, _T("Clothing"), IDS_PASS_BASIC, GetClothingMtlDesc(), - P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plClothingMtl::kRefBasic, - - // UI - IDD_CLOTHING, IDS_PASS_BASIC, 0, 0, &gClothingBasicDlgProc, - - plClothingMtl::kTileset, _T("tileset"), TYPE_INT, 0, 0, - p_default, 0, - end, - - plClothingMtl::kTexmap, _T("texmap"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, - end, - - plClothingMtl::kDescription, _T("ItemDescription"), TYPE_STRING, 0, 0, - p_ui, TYPE_EDITBOX, IDC_CLOTHING_DESCRIPTION, - end, - - plClothingMtl::kThumbnail, _T("Thumbnail"), TYPE_TEXMAP, 0, 0, - end, - - plClothingMtl::kLayer, _T("Layer"), TYPE_INT, 0, 0, - p_default, plClothingElement::kLayerTint1, - end, - - plClothingMtl::kTexmapSkin, _T("SkinLayer"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, - end, - - plClothingMtl::kTexmap2, _T("TintLayer2"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, - end, - - plClothingMtl::kDefault, _T("Default"), TYPE_BOOL, 0, 0, - p_ui, TYPE_SINGLECHEKBOX, IDC_CLOTHING_DEFAULT, - p_default, 0, - end, - - plClothingMtl::kCustomTextSpecs, _T("TextSpecs"), TYPE_STRING, 0, 0, - end, - - plClothingMtl::kTexmapBase, _T("BaseLayer"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, - end, - - plClothingMtl::kTexmapSkinBlend1, _T("SkinBlend(1)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, - end, - - plClothingMtl::kTexmapSkinBlend2, _T("SkinBlend(2)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, - end, - - plClothingMtl::kTexmapSkinBlend3, _T("SkinBlend(3)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, - end, - - plClothingMtl::kTexmapSkinBlend4, _T("SkinBlend(4)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, - end, - - plClothingMtl::kTexmapSkinBlend5, _T("SkinBlend(5)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, - end, - - plClothingMtl::kTexmapSkinBlend6, _T("SkinBlend(6)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, - end, - - plClothingMtl::kDefaultTint1, _T("DefaultTint1"), TYPE_RGBA, 0, 0, - p_ui, TYPE_COLORSWATCH, IDC_CLOTHING_TINT1, - p_default, Color(1,1,1), - end, - - plClothingMtl::kDefaultTint2, _T("DefaultTint2"), TYPE_RGBA, 0, 0, - p_ui, TYPE_COLORSWATCH, IDC_CLOTHING_TINT2, - p_default, Color(1,1,1), - end, - - plClothingMtl::kForcedAcc, _T("ForcedAcc"), TYPE_STRING, 0, 0, - p_ui, TYPE_EDITBOX, IDC_CLOTHING_FORCED_ACC, - end, - - end -); - class ClothingBasicDlgProc : public ParamMap2UserDlgProc { protected: @@ -283,7 +202,7 @@ public: virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap) { UpdateDisplay(pmap); } - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { // Check if it is for our edit box if (fCustomText.ProcessMsg(map, hWnd, msg, wParam, lParam)) @@ -427,6 +346,84 @@ public: return FALSE; } - void DeleteThis() {} + virtual void DeleteThis() {} }; static ClothingBasicDlgProc gClothingBasicDlgProc; + +static ParamBlockDesc2 gClothingMtlPB +( + plClothingMtl::kBlkBasic, _T("Clothing"), IDS_PASS_BASIC, GetClothingMtlDesc(), + P_AUTO_CONSTRUCT + P_AUTO_UI + P_CALLSETS_ON_LOAD, plClothingMtl::kRefBasic, + + // UI + IDD_CLOTHING, IDS_PASS_BASIC, 0, 0, &gClothingBasicDlgProc, + + plClothingMtl::kTileset, _T("tileset"), TYPE_INT, 0, 0, + p_default, 0, + end, + + plClothingMtl::kTexmap, _T("texmap"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, + end, + + plClothingMtl::kDescription, _T("ItemDescription"), TYPE_STRING, 0, 0, + p_ui, TYPE_EDITBOX, IDC_CLOTHING_DESCRIPTION, + end, + + plClothingMtl::kThumbnail, _T("Thumbnail"), TYPE_TEXMAP, 0, 0, + end, + + plClothingMtl::kLayer, _T("Layer"), TYPE_INT, 0, 0, + p_default, plClothingElement::kLayerTint1, + end, + + plClothingMtl::kTexmapSkin, _T("SkinLayer"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, + end, + + plClothingMtl::kTexmap2, _T("TintLayer2"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, + end, + + plClothingMtl::kDefault, _T("Default"), TYPE_BOOL, 0, 0, + p_ui, TYPE_SINGLECHEKBOX, IDC_CLOTHING_DEFAULT, + p_default, 0, + end, + + plClothingMtl::kCustomTextSpecs, _T("TextSpecs"), TYPE_STRING, 0, 0, + end, + + plClothingMtl::kTexmapBase, _T("BaseLayer"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, + end, + + plClothingMtl::kTexmapSkinBlend1, _T("SkinBlend(1)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, + end, + + plClothingMtl::kTexmapSkinBlend2, _T("SkinBlend(2)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, + end, + + plClothingMtl::kTexmapSkinBlend3, _T("SkinBlend(3)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, + end, + + plClothingMtl::kTexmapSkinBlend4, _T("SkinBlend(4)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, + end, + + plClothingMtl::kTexmapSkinBlend5, _T("SkinBlend(5)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, + end, + + plClothingMtl::kTexmapSkinBlend6, _T("SkinBlend(6)"), TYPE_TEXMAP_TAB, plClothingMtl::kMaxTiles, 0, 0, + end, + + plClothingMtl::kDefaultTint1, _T("DefaultTint1"), TYPE_RGBA, 0, 0, + p_ui, TYPE_COLORSWATCH, IDC_CLOTHING_TINT1, + p_default, Color(1,1,1), + end, + + plClothingMtl::kDefaultTint2, _T("DefaultTint2"), TYPE_RGBA, 0, 0, + p_ui, TYPE_COLORSWATCH, IDC_CLOTHING_TINT2, + p_default, Color(1,1,1), + end, + + plClothingMtl::kForcedAcc, _T("ForcedAcc"), TYPE_STRING, 0, 0, + p_ui, TYPE_EDITBOX, IDC_CLOTHING_FORCED_ACC, + end, + + end +); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtlBasicPBDec.h b/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtlBasicPBDec.h index b251e9cd..6ce976c5 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtlBasicPBDec.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plDecalMtlBasicPBDec.h @@ -31,8 +31,59 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class DecalBasicPBAccessor; extern DecalBasicPBAccessor basicAccessor; -class DecalBasicDlgProc; -extern DecalBasicDlgProc gDecalBasicDlgProc; +class DecalBasicDlgProc : public ParamMap2UserDlgProc +{ +protected: + HIMAGELIST hLockButtons; + + void LoadLockButtons() + { + static bool loaded = false; + if (loaded) + return; + loaded = true; + + HINSTANCE hInst = hInstance; + hLockButtons = ImageList_Create(16, 15, TRUE, 2, 0); + HBITMAP hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTTONS)); + HBITMAP hMask = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MASKBUTTONS)); + ImageList_Add(hLockButtons, hBitmap, hMask); + DeleteObject(hBitmap); + DeleteObject(hMask); + } + void ISetLock(HWND hButton) + { + LoadLockButtons(); + + ICustButton *iBut = GetICustButton(hButton); + iBut->SetImage(hLockButtons,0,1,0,1,16,15); + iBut->SetType(CBT_CHECK); + ReleaseICustButton(iBut); + } + +public: + DecalBasicDlgProc() : hLockButtons(NULL) {} + ~DecalBasicDlgProc() { if (hLockButtons) ImageList_Destroy(hLockButtons); } + +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: + { + ISetLock(GetDlgItem(hWnd, IDC_LOCK_AD)); + ISetLock(GetDlgItem(hWnd, IDC_LOCK_COLORS)); + } + return TRUE; + } + return FALSE; + } + virtual void DeleteThis() {} +}; +static DecalBasicDlgProc gDecalBasicDlgProc; static ParamBlockDesc2 gDecalBasicPB ( @@ -178,59 +229,3 @@ public: } }; static DecalBasicPBAccessor basicAccessor; - -class DecalBasicDlgProc : public ParamMap2UserDlgProc -{ -#if 1 -protected: - HIMAGELIST hLockButtons; - - void LoadLockButtons() - { - static bool loaded = false; - if (loaded) - return; - loaded = true; - - HINSTANCE hInst = hInstance; - hLockButtons = ImageList_Create(16, 15, TRUE, 2, 0); - HBITMAP hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTTONS)); - HBITMAP hMask = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MASKBUTTONS)); - ImageList_Add(hLockButtons, hBitmap, hMask); - DeleteObject(hBitmap); - DeleteObject(hMask); - } - void ISetLock(HWND hButton) - { - LoadLockButtons(); - - ICustButton *iBut = GetICustButton(hButton); - iBut->SetImage(hLockButtons,0,1,0,1,16,15); - iBut->SetType(CBT_CHECK); - ReleaseICustButton(iBut); - } - -public: - DecalBasicDlgProc() : hLockButtons(NULL) {} - ~DecalBasicDlgProc() { if (hLockButtons) ImageList_Destroy(hLockButtons); } -#endif - -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - IParamBlock2 *pb = map->GetParamBlock(); - - switch (msg) - { - case WM_INITDIALOG: - { - ISetLock(GetDlgItem(hWnd, IDC_LOCK_AD)); - ISetLock(GetDlgItem(hWnd, IDC_LOCK_COLORS)); - } - return TRUE; - } - return FALSE; - } - void DeleteThis() {} -}; -static DecalBasicDlgProc gDecalBasicDlgProc; diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtlPBDec.h b/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtlPBDec.h index d68a5761..71d3ee19 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtlPBDec.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plParticleMtlPBDec.h @@ -28,8 +28,87 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class PartMtlPBAccessor; extern PartMtlPBAccessor partMtl_accessor; -class ParticleBasicDlgProc; -extern ParticleBasicDlgProc gParticleBasicDlgProc; +class ParticleBasicDlgProc : public ParamMap2UserDlgProc +{ +public: + ParticleBasicDlgProc() {} + ~ParticleBasicDlgProc() {} + + void UpdateDisplay(IParamMap2 *pmap) + { + HWND hWnd = pmap->GetHWnd(); + IParamBlock2 *pb = pmap->GetParamBlock(); + HWND cbox = GetDlgItem(hWnd, IDC_PARTICLE_NORMAL); + plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plParticleMtl::kTexmap)); + PBBitmap *pbbm; + ICustButton *bmSelectBtn; + + SendMessage(cbox, CB_SETCURSEL, pb->GetInt(plParticleMtl::kNormal), 0); + pbbm = (layer == nil ? nil : layer->GetPBBitmap()); + + bmSelectBtn = GetICustButton(GetDlgItem(hWnd,IDC_PARTICLE_TEXTURE)); + bmSelectBtn->SetText(pbbm ? (TCHAR*)pbbm->bi.Filename() : "(none)"); + ReleaseICustButton(bmSelectBtn); + } + + virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap) { UpdateDisplay(pmap); } + + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + int id = LOWORD(wParam); + int code = HIWORD(wParam); + + IParamBlock2 *pb = map->GetParamBlock(); + HWND cbox = NULL; + plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plParticleMtl::kTexmap)); + + switch (msg) + { + case WM_INITDIALOG: + int j; + for (j = 0; j < plParticleMtl::kNumNormalOptions; j++) + { + cbox = GetDlgItem(hWnd, IDC_PARTICLE_NORMAL); + SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plParticleMtl::NormalStrings[j]); + } + UpdateDisplay(map); + return TRUE; + + case WM_COMMAND: + if (id == IDC_PARTICLE_NORMAL) + { + pb->SetValue(plParticleMtl::kNormal, t, SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0)); + return TRUE; + } + else if (id == IDC_PARTICLE_TEXTURE) + { + if (layer == nil) + return FALSE; + layer->HandleBitmapSelection(); + UpdateDisplay(map); + return TRUE; + } + else if (id == IDC_PARTICLE_NOFILTER) + { + if (!layer) + return FALSE; + if( pb->GetInt(plParticleMtl::kNoFilter) ) + { + layer->GetParamBlockByID( plLayerTex::kBlkBitmap )->SetValue(kBmpNoFilter, t, 1); + } + else + { + layer->GetParamBlockByID( plLayerTex::kBlkBitmap )->SetValue(kBmpNoFilter, t, 0); + } + return TRUE; + } + break; + } + return FALSE; + } + virtual void DeleteThis() {} +}; +static ParticleBasicDlgProc gParticleBasicDlgProc; #define PL_PARTICLE_MTL_MIN_TILES 1 #define PL_PARTICLE_MTL_MAX_TILES 16 @@ -149,86 +228,3 @@ public: } }; static PartMtlPBAccessor partMtl_accessor; - - -class ParticleBasicDlgProc : public ParamMap2UserDlgProc -{ -public: - ParticleBasicDlgProc() {} - ~ParticleBasicDlgProc() {} - - void UpdateDisplay(IParamMap2 *pmap) - { - HWND hWnd = pmap->GetHWnd(); - IParamBlock2 *pb = pmap->GetParamBlock(); - HWND cbox = GetDlgItem(hWnd, IDC_PARTICLE_NORMAL); - plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plParticleMtl::kTexmap)); - PBBitmap *pbbm; - ICustButton *bmSelectBtn; - - SendMessage(cbox, CB_SETCURSEL, pb->GetInt(plParticleMtl::kNormal), 0); - pbbm = (layer == nil ? nil : layer->GetPBBitmap()); - - bmSelectBtn = GetICustButton(GetDlgItem(hWnd,IDC_PARTICLE_TEXTURE)); - bmSelectBtn->SetText(pbbm ? (TCHAR*)pbbm->bi.Filename() : "(none)"); - ReleaseICustButton(bmSelectBtn); - } - - virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap) { UpdateDisplay(pmap); } - - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - int id = LOWORD(wParam); - int code = HIWORD(wParam); - - IParamBlock2 *pb = map->GetParamBlock(); - HWND cbox = NULL; - plPlasmaMAXLayer *layer = (plPlasmaMAXLayer *)pb->GetTexmap(ParamID(plParticleMtl::kTexmap)); - - switch (msg) - { - case WM_INITDIALOG: - int j; - for (j = 0; j < plParticleMtl::kNumNormalOptions; j++) - { - cbox = GetDlgItem(hWnd, IDC_PARTICLE_NORMAL); - SendMessage(cbox, CB_ADDSTRING, 0, (LPARAM)plParticleMtl::NormalStrings[j]); - } - UpdateDisplay(map); - return TRUE; - - case WM_COMMAND: - if (id == IDC_PARTICLE_NORMAL) - { - pb->SetValue(plParticleMtl::kNormal, t, SendMessage(GetDlgItem(hWnd, id), CB_GETCURSEL, 0, 0)); - return TRUE; - } - else if (id == IDC_PARTICLE_TEXTURE) - { - if (layer == nil) - return FALSE; - layer->HandleBitmapSelection(); - UpdateDisplay(map); - return TRUE; - } - else if (id == IDC_PARTICLE_NOFILTER) - { - if (!layer) - return FALSE; - if( pb->GetInt(plParticleMtl::kNoFilter) ) - { - layer->GetParamBlockByID( plLayerTex::kBlkBitmap )->SetValue(kBmpNoFilter, t, 1); - } - else - { - layer->GetParamBlockByID( plLayerTex::kBlkBitmap )->SetValue(kBmpNoFilter, t, 0); - } - return TRUE; - } - break; - } - return FALSE; - } - void DeleteThis() {} -}; -static ParticleBasicDlgProc gParticleBasicDlgProc; diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassAnimDlgProc.h b/Sources/Tools/MaxPlasmaMtls/Materials/plPassAnimDlgProc.h index a7c6356a..f9488c46 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassAnimDlgProc.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassAnimDlgProc.h @@ -59,9 +59,9 @@ class plPassAnimDlgProc : public ParamMap2UserDlgProc, public plMtlChangeCallbac plPassAnimDlgProc(); virtual ~plPassAnimDlgProc(); - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); - void DeleteThis() {} - void SetThing(ReferenceTarget *m); + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + virtual void DeleteThis() {} + virtual void SetThing(ReferenceTarget *m); virtual void Update(TimeValue t, Interval& valid, IParamMap2* pmap); void SegmentListChanged( void ); diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlAnimPB.h b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlAnimPB.h index 97776538..9e474bc6 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlAnimPB.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlAnimPB.h @@ -42,7 +42,7 @@ protected: } public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { @@ -79,7 +79,7 @@ public: return FALSE; } - void DeleteThis() {} + virtual void DeleteThis() {} }; #endif \ No newline at end of file diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp index 06685796..48dab1cc 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBase.cpp @@ -391,8 +391,10 @@ RefTargetHandle plPassMtlBase::GetReference( int i ) { if( i >= kRefNotetracks && i < kRefNotetracks + fNotetracks.GetCount() ) return fNotetracks[ i - kRefNotetracks ]; + else + hsAssert(false, "shit"); - return NULL; + return nil; } //// SetReference //////////////////////////////////////////////////////////// diff --git a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBasicPBDec.h b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBasicPBDec.h index f7493c3f..fe4c34a3 100644 --- a/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBasicPBDec.h +++ b/Sources/Tools/MaxPlasmaMtls/Materials/plPassMtlBasicPBDec.h @@ -31,8 +31,60 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com class PassBasicPBAccessor; extern PassBasicPBAccessor basicAccessor; -class PassBasicDlgProc; -extern PassBasicDlgProc gPassBasicDlgProc; +class PassBasicDlgProc : public ParamMap2UserDlgProc +{ +protected: + HIMAGELIST hLockButtons; + + void LoadLockButtons() + { + static bool loaded = false; + if (loaded) + return; + loaded = true; + + HINSTANCE hInst = hInstance; + hLockButtons = ImageList_Create(16, 15, TRUE, 2, 0); + HBITMAP hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTTONS)); + HBITMAP hMask = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MASKBUTTONS)); + ImageList_Add(hLockButtons, hBitmap, hMask); + DeleteObject(hBitmap); + DeleteObject(hMask); + } + void ISetLock(HWND hButton) + { + LoadLockButtons(); + + ICustButton *iBut = GetICustButton(hButton); + iBut->SetImage(hLockButtons,0,1,0,1,16,15); + iBut->SetType(CBT_CHECK); + ReleaseICustButton(iBut); + } + + +public: + PassBasicDlgProc() : hLockButtons(NULL) {} + ~PassBasicDlgProc() { if (hLockButtons) ImageList_Destroy(hLockButtons); } + + virtual BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) + { + IParamBlock2 *pb = map->GetParamBlock(); + + switch (msg) + { + case WM_INITDIALOG: + { + ISetLock(GetDlgItem(hWnd, IDC_LOCK_AD)); + ISetLock(GetDlgItem(hWnd, IDC_LOCK_COLORS)); + } + return TRUE; + } + return FALSE; + } + + virtual void DeleteThis() {} +}; +static PassBasicDlgProc gPassBasicDlgProc; static ParamBlockDesc2 gPassBasicPB ( @@ -179,62 +231,3 @@ public: } }; static PassBasicPBAccessor basicAccessor; - -class PassBasicDlgProc : public ParamMap2UserDlgProc -{ -#if 1 -protected: - HIMAGELIST hLockButtons; - - void LoadLockButtons() - { - static bool loaded = false; - if (loaded) - return; - loaded = true; - - HINSTANCE hInst = hInstance; - hLockButtons = ImageList_Create(16, 15, TRUE, 2, 0); - HBITMAP hBitmap = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTTONS)); - HBITMAP hMask = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_MASKBUTTONS)); - ImageList_Add(hLockButtons, hBitmap, hMask); - DeleteObject(hBitmap); - DeleteObject(hMask); - } - void ISetLock(HWND hButton) - { - LoadLockButtons(); - - ICustButton *iBut = GetICustButton(hButton); - iBut->SetImage(hLockButtons,0,1,0,1,16,15); - iBut->SetType(CBT_CHECK); - ReleaseICustButton(iBut); - } - - -public: - PassBasicDlgProc() : hLockButtons(NULL) {} - ~PassBasicDlgProc() { if (hLockButtons) ImageList_Destroy(hLockButtons); } -#endif - -public: - BOOL DlgProc(TimeValue t, IParamMap2 *map, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) - { - IParamBlock2 *pb = map->GetParamBlock(); - - switch (msg) - { - case WM_INITDIALOG: - { - ISetLock(GetDlgItem(hWnd, IDC_LOCK_AD)); - ISetLock(GetDlgItem(hWnd, IDC_LOCK_COLORS)); - } - return TRUE; - } - return FALSE; - } - void DeleteThis() {} -}; -static PassBasicDlgProc gPassBasicDlgProc; - -