/** * Updated the material when an attribute has been changed. */ void MaterialPropTreeView::OnPropertyChangeNotification( NMHDR *nmhdr, LRESULT *lresult ) { NMPROPTREE *nmProp = (NMPROPTREE *)nmhdr; CPropTreeItem *item = nmProp->pItem; internalChange = true; MaterialDef* propItem = FindDefForTreeID(item->GetCtrlID()); if(propItem) { MaterialDoc* materialDoc = materialDocManager->GetCurrentMaterialDoc(); switch(propItem->type) { case MaterialDef::MATERIAL_DEF_TYPE_BOOL: { BOOL val = item->GetItemValue(); materialDoc->SetAttributeBool(currentStage, propItem->dictName, val ? true : false); } break; case MaterialDef::MATERIAL_DEF_TYPE_STRING: { idStr val = (LPCTSTR)item->GetItemValue(); materialDoc->SetAttribute(currentStage, propItem->dictName, val); } break; } } internalChange = false; *lresult = 0; }
/** * Performs the stage name change after the label edit is done. */ void StageView::OnLvnEndlabeledit( NMHDR *pNMHDR, LRESULT *pResult ) { NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO *>( pNMHDR ); if( pDispInfo->item.pszText ) { MaterialDoc *material = materialDocManager->GetCurrentMaterialDoc(); internalChange = true; material->SetAttribute( pDispInfo->item.iItem - 1, "name", pDispInfo->item.pszText ); internalChange = false; *pResult = 1; } else { *pResult = 0; } }
/** * Performs a redo operation of a string attribute change. */ void AttributeMaterialModifierString::Redo() { MaterialDoc *material = manager->CreateMaterialDoc(materialName); material->SetAttribute(stage, key, value, false); }