void customizeMaterial_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { int index = (sender as CustomizeMaterial).Index; Material oldMaterial = (sender as CustomizeMaterial).GetCurrentMaterial(); GenericMaterial genericMaterial = new GenericMaterial(materials, index, false); genericMaterial.StatusUpdated += genericMaterial_StatusUpdated; genericMaterial.ShowDialog(); Material currentMaterial = genericMaterial.GetCurrentMaterial(); if (GenericCategory.GetMaterialByImagePath(materials, currentMaterial.FullPath) != null) { int i = GetIndexOfMaterial(oldMaterial); if (i == -1) { i = currentObjectMaterials.Count; currentObjectMaterials.Add(new WorldObjectMaterial(currentMaterial, currentObject.GetTotalAreaPerTextureByPath(currentMaterial.FullPath))); } else { currentObjectMaterials[i] = new WorldObjectMaterial(currentMaterial, currentObjectMaterials[i].SurfaceNeeded); } } currentObject.SetMaterials(currentObjectMaterials); //importedObject.Materials[ //importedObject.Materials.Add(currentMaterial); InitializeMaterials(); }
void customizeMaterial_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { int index = (sender as CustomizeMaterial).Index; Material oldMaterial = (sender as CustomizeMaterial).GetCurrentMaterial(); GenericMaterial genericMaterial = new GenericMaterial(materials, index, true); genericMaterial.StatusUpdated += genericMaterial_StatusUpdated; genericMaterial.ShowDialog(); Material currentMaterial = genericMaterial.GetCurrentMaterial(); int i = GetIndexOfMaterial(oldMaterial); selectedObjectMaterials[i] = new WorldObjectMaterial(currentMaterial, selectedObjectMaterials[i].SurfaceNeeded); InitializeMaterials(); InitializePrices(); }