void MagicView::OnTextureMap() { TextureMapDialog dlg(this); if (dlg.DoModal() == IDOK) { MagicDoc* doc = GetDocument(); Solid* solid = doc->GetSolid(); Selection* seln = doc->GetSelection(); Selector* selector = doc->GetSelector(); Editor* editor = doc->GetEditor(); Material* mtl = 0; if (dlg.mMaterialIndex >= 0) { mtl = &solid->GetModel()->GetMaterials()[dlg.mMaterialIndex]; } editor->UseModel(solid->GetModel()); editor->ApplyMaterial(mtl, seln->GetPolys(), dlg.mMapType, 2-dlg.mAxis, (float) dlg.mScaleU, (float) dlg.mScaleV, dlg.mFlip, dlg.mMirror, dlg.mRotate); selector->Reselect(); Invalidate(); doc->SetModifiedFlag(TRUE); doc->UpdateAllViews(this); } }
void MagicView::CloseUVEditor() { if (IsUVEdit()) { MagicDoc* doc = GetDocument(); Editor* editor = doc->GetEditor(); Solid* solid = doc->GetSolid(); if (editor && solid) { editor->UseModel(solid->GetModel()); editor->Resegment(); } } }