Assembly: Fix Iisolate issue when obj and link both in assembly (#24781)

* Assembly: Fix Iisolate issue when obj and link both in assembly

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update src/Mod/Assembly/Gui/ViewProviderAssembly.cpp

Co-authored-by: Kacper Donat <kadet1090@gmail.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Kacper Donat <kadet1090@gmail.com>
This commit is contained in:
PaddleStroke
2025-10-23 12:04:46 +02:00
committed by GitHub
parent 70a7480601
commit fce385dd73

View File

@@ -1383,6 +1383,22 @@ void ViewProviderAssembly::applyIsolationRecursively(App::DocumentObject* curren
vpg->Selectable.setValue(isolate);
if (!isolate) {
vpg->ShapeAppearance.setValue(mat);
// Note, this geometric object could have a link linking to it in the assembly
// and this link may be in isolate set! If so it will inherit the isolation
// from 'current'! So we need to manually handle it to visible.
const std::vector<App::DocumentObject*> inList = current->getInList();
for (auto* child : inList) {
if (child->isDerivedFrom<App::Link>() && child->getLinkedObject() == current) {
// In this case we need to reverse isolate this!
auto* childVp = freecad_cast<Gui::ViewProviderLink*>(
Gui::Application::Instance->getViewProvider(child));
// we give the child the color the current had before we changed it
childVp->OverrideMaterial.setValue(true);
childVp->ShapeMaterial.setValue(state.shapeMaterial);
}
}
}
}
}