Materials: Editor UI enhancements

When creating a new material, assigning the basic
rendering model to the material resulted in an all
black color. This will now be assigned the default
color as specified in the preferences.

The name of the material Properties tab has been
changed to Physical for improved consistency in
the user interface.
This commit is contained in:
David Carter
2024-05-26 14:43:13 +00:00
committed by Chris Hennes
parent a9b0b1f534
commit c5df1b3e55
7 changed files with 38 additions and 129 deletions

View File

@@ -47,6 +47,7 @@
#include <Mod/Material/App/Exceptions.h>
#include <Mod/Material/App/ModelManager.h>
#include <Mod/Material/App/ModelUuids.h>
#include "MaterialDelegate.h"
#include "MaterialSave.h"
@@ -425,6 +426,13 @@ void MaterialsEditor::onAppearanceAdd(bool checked)
if (dialog.exec() == QDialog::Accepted) {
QString selected = dialog.selectedModel();
_material->addAppearance(selected);
auto model = getModelManager().getModel(selected);
if (selected == Materials::ModelUUIDs::ModelUUID_Rendering_Basic
|| model->inherits(Materials::ModelUUIDs::ModelUUID_Rendering_Basic)) {
// Add default appearance properties
*_material = *(getMaterialManager().defaultAppearance());
}
updateMaterial();
}
else {
@@ -1008,6 +1016,7 @@ void MaterialsEditor::updateMaterialAppearance()
auto valueItem = new QStandardItem(_material->getAppearanceValueString(key));
valueItem->setToolTip(itp->second.getDescription());
QVariant variant;
// variant.setValue(_material->getAppearanceValueString(key));
variant.setValue(_material);
valueItem->setData(variant);
items.append(valueItem);