diff --git a/src/App/Material.h b/src/App/Material.h index 9a6bcad85e..e3f169c6f5 100644 --- a/src/App/Material.h +++ b/src/App/Material.h @@ -140,16 +140,17 @@ public: bool operator==(const Material& m) const { // clang-format off - return _matType == m._matType - && shininess == m.shininess + if (!uuid.empty() && uuid == m.uuid) { + return true; + } + return shininess == m.shininess && transparency == m.transparency && ambientColor == m.ambientColor && diffuseColor == m.diffuseColor && specularColor == m.specularColor && emissiveColor == m.emissiveColor && image == m.image - && image == m.imagePath - && uuid == m.uuid; + && imagePath == m.imagePath; // clang-format on } bool operator!=(const Material& m) const diff --git a/src/Gui/ViewProviderGeometryObject.cpp b/src/Gui/ViewProviderGeometryObject.cpp index 5ecba8fbd8..1ef6938154 100644 --- a/src/Gui/ViewProviderGeometryObject.cpp +++ b/src/Gui/ViewProviderGeometryObject.cpp @@ -195,8 +195,10 @@ void ViewProviderGeometryObject::updateData(const App::Property* prop) */ App::Material defaultMaterial; auto material = geometry->getMaterialAppearance(); - if ((materialAppearance == defaultMaterial) - || (ShapeAppearance.getSize() == 1 && ShapeAppearance[0] == materialAppearance)) { + if ((ShapeAppearance.getSize() == 1) + && (ShapeAppearance[0] == defaultMaterial + || ShapeAppearance[0] == materialAppearance) + && (material != defaultMaterial)) { ShapeAppearance.setValue(material); } materialAppearance = material;