Materials: Child ignoring parent material

Inherit the material from the parent object when creating a new object,
such as during a boolean operation, or when extruding a sketch.

fixes #15503
This commit is contained in:
David Carter
2024-10-21 10:04:55 -04:00
committed by Yorik van Havre
parent d67bb37bc7
commit e4bf988db2
14 changed files with 96 additions and 22 deletions

View File

@@ -471,6 +471,20 @@ void Body::onChanged(const App::Property* prop) {
}
}
else if (prop == &ShapeMaterial) {
std::vector<App::DocumentObject*> features = Group.getValues();
if (!features.empty()) {
for (auto it : features) {
auto feature = dynamic_cast<Part::Feature*>(it);
if (feature) {
if (feature->ShapeMaterial.getValue().getUUID()
!= ShapeMaterial.getValue().getUUID()) {
feature->ShapeMaterial.setValue(ShapeMaterial.getValue());
}
}
}
}
}
}
Part::BodyBase::onChanged(prop);