/// <summary> /// Pushes changes made to panel properties in the UI to the panels /// </summary> private void updatePanelProperties(IEnumerable <Element3D> currentSelection) { foreach (Element3D geo in currentSelection) { // get the panel data model cubeDataModel pdm = geo.DataContext as cubeDataModel; // change the panel data model's properties if (selectedPanelMaterial != projectMaterials.None) { pdm.material = selectedPanelMaterial; } } }
/// <summary> /// previews the material of a particular element. /// used within the previewSelectionMaterial function /// </summary> private void previewElementMaterial(MeshGeometryModel3D element) { // get the mesh MeshGeometryModel3D meshSel = element as MeshGeometryModel3D; // get data context if (element.DataContext.GetType() == typeof(cubeDataModel)) { // get the pdm cubeDataModel pdm = element.DataContext as cubeDataModel; // assign the color //pdm.panelMaterial = (selectedPanelMaterial != projectMaterials.None) ? selectedPanelMaterial : pdm.panelMaterial; meshSel.Material = (selectedPanelMaterial != projectMaterials.None) ? projectMatToHelixMatConverter.Convert(selectedPanelMaterial) as Material : projectMatToHelixMatConverter.Convert(pdm.material) as Material; } }
/// <summary> /// Reverts any temporary material previews upon deselection /// </summary> private void revertMaterial(Element3D oldSelection) { // remove any temp preview colors Type objectType = oldSelection?.GetType(); if (objectType == typeof(MeshGeometryModel3D)) { MeshGeometryModel3D meshSel = oldSelection as MeshGeometryModel3D; if (oldSelection.DataContext.GetType() == typeof(cubeDataModel)) { // get the pdm cubeDataModel pdm = oldSelection.DataContext as cubeDataModel; // reset the color meshSel.Material = projectMatToHelixMatConverter.Convert(pdm.material) as Material; } } }