/************* * DESCRIPTION: Load a material and assign it to the selected material * INPUT: - * OUTPUT: - *************/ void CMatView::OnLoadMaterial() { CString file; SURFACE *pSurf; CMaterial *pMaterial; char *szErr; if (!utility.FileRequ((char*)LPCTSTR(file), FILEREQU_MATERIAL, FILEREQU_INITIALFILE)) return; pSurf = sciCreateSurface(NULL); if (!pSurf) return; szErr = pSurf->Load((char*)LPCTSTR(file)); if (szErr) { delete pSurf; utility.Request(szErr); } else { if (nSelectedMaterial != -1) { pMaterial = ((CMaterial*)aMaterials[nSelectedMaterial]); delete pMaterial->pSurface; pMaterial->pSurface = pSurf; pMaterial->Update(); Invalidate(FALSE); } } }
/************* * DESCRIPTION: Rename current material * INPUT: - * OUTPUT: - *************/ void CMatView::OnRename() { CRenameDlg dialog; CMaterial *pMat; if (nSelectedMaterial == -1) return; pMat = ((CMaterial*)aMaterials[nSelectedMaterial]); dialog.m_sName = pMat->pSurface->name; if (dialog.DoModal() == IDOK) { pMat->pSurface->SetName((char*)LPCTSTR(dialog.m_sName)); pMat->Update(); Invalidate(FALSE); } }