void mrShaderButtonHandler::OnInitDialog(HWND hDialog) { m_dialogHWnd = hDialog; DbgAssert(m_dialogHWnd != NULL); HWND ctrlHWnd = GetDlgItem(m_dialogHWnd, m_ctrlID); ICustButton* custButton = GetICustButton(ctrlHWnd); if(custButton != NULL) { custButton->SetDADMgr(this); ReleaseICustButton(custButton); } else { DbgAssert(false); } Update(); }
RefResult PFOperatorMaterialStatic::NotifyRefChanged(Interval changeInt, RefTargetHandle hTarget, PartID& partID, RefMessage message) { IParamMap2* map; TSTR dynamicNameSuffix; if ( hTarget == pblock() ) { int lastUpdateID; switch (message) { case REFMSG_CHANGE: lastUpdateID = pblock()->LastNotifyParamID(); if (lastUpdateID == kMaterialStatic_material) { if (updateFromMXSMtl()) { NotifyDependents(FOREVER, PART_MTL, kPFMSG_UpdateMaterial, NOTIFY_ALL, TRUE); NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE); } UpdatePViewUI(lastUpdateID); return REF_STOP; } if (!(theHold.Holding() || theHold.RestoreOrRedoing())) return REF_STOP; switch ( lastUpdateID ) { case kMaterialStatic_assignMaterial: RefreshUI(kMaterialStatic_message_assignMaterial); NotifyDependents(FOREVER, PART_MTL, kPFMSG_UpdateMaterial, NOTIFY_ALL, TRUE); NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE); break; case kMaterialStatic_assignID: RefreshUI(kMaterialStatic_message_assignID); break; case kMaterialStatic_type: RefreshUI(kMaterialStatic_message_type); break; case kMaterialStatic_rateType: RefreshUI(kMaterialStatic_message_rateType); break; } UpdatePViewUI(lastUpdateID); break; case REFMSG_NODE_WSCACHE_UPDATED: updateFromRealMtl(); break; // Initialization of Dialog case kMaterialStatic_RefMsg_InitDlg: // Set ICustButton properties for MaterialStatic DAD button map = (IParamMap2*)partID; if (map != NULL) { HWND hWnd = map->GetHWnd(); if (hWnd) { ICustButton *iBut = GetICustButton(GetDlgItem(hWnd, IDC_MATERIAL)); iBut->SetDADMgr(_dadMgr()); ReleaseICustButton(iBut); } } // Refresh UI RefreshUI(kMaterialStatic_message_assignMaterial); RefreshUI(kMaterialStatic_message_assignID); return REF_STOP; // New Random Seed case kMaterialStatic_RefMsg_NewRand: theHold.Begin(); NewRand(); theHold.Accept(GetString(IDS_NEWRANDOMSEED)); return REF_STOP; } } if ( hTarget == const_cast <Mtl*> (material()) ) { switch (message) { case REFMSG_CHANGE: return REF_STOP; // if (ignoreRefMsgNotify()) return REF_STOP; // if (!(theHold.Holding() || theHold.RestoreOrRedoing())) return REF_STOP; break; case REFMSG_NODE_NAMECHANGE: if (HasDynamicName(dynamicNameSuffix)) { if (lastDynamicName() != dynamicNameSuffix) { _lastDynamicName() = dynamicNameSuffix; NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE); UpdatePViewUI(kMaterialStatic_material); } } return REF_STOP; case REFMSG_TARGET_DELETED: _material() = NULL; if (pblock() != NULL) pblock()->SetValue(kMaterialStatic_material, 0, NULL); if (theHold.Holding()) { if (HasDynamicName(dynamicNameSuffix)) { if (lastDynamicName() != dynamicNameSuffix) { _lastDynamicName() = dynamicNameSuffix; NotifyDependents(FOREVER, 0, kPFMSG_DynamicNameChange, NOTIFY_ALL, TRUE); UpdatePViewUI(kMaterialStatic_material); } } } break; } } return REF_SUCCEED; }