Assembly: Minor refactor in ViewProviderAssembly::findDragMode

Co-Developed-by: PaddleStroke <pierrelouis.boyer@gmail.com>
This commit is contained in:
wmayer
2025-03-10 11:23:47 +01:00
committed by Max Wilfinger
parent 6dac011b1b
commit 0302b3de5f

View File

@@ -861,24 +861,27 @@ ViewProviderAssembly::DragMode ViewProviderAssembly::findDragMode()
{
auto addPartsToMove = [&](const std::vector<Assembly::ObjRef>& refs) {
for (auto& partRef : refs) {
if (!partRef.obj) {
auto obj = partRef.obj;
auto ref = partRef.ref;
if (!obj || !ref) {
continue;
}
auto* pPlc = dynamic_cast<App::PropertyPlacement*>(
partRef.obj->getPropertyByName("Placement")
);
if (pPlc) {
App::DocumentObject* selRoot = partRef.ref->getValue();
if (!selRoot) {
continue;
}
std::vector<std::string> subs = partRef.ref->getSubValues();
if (subs.empty()) {
continue;
}
docsToMove.emplace_back(partRef.obj, pPlc->getValue(), selRoot, subs[0]);
auto pPlc = dynamic_cast<App::PropertyPlacement*>(obj->getPropertyByName("Placement"));
if (!pPlc) {
continue;
}
App::DocumentObject* selRoot = ref->getValue();
if (!selRoot) {
continue;
}
std::vector<std::string> subs = ref->getSubValues();
if (subs.empty()) {
continue;
}
docsToMove.emplace_back(obj, pPlc->getValue(), selRoot, subs[0]);
}
};