Assembly: Change Joint References to remove cyclic dependency. (#25513)
* Assembly: Change Joint References to remove cyclic dependency. * Update JointObject.py * Update TestCore.py * Update JointObject.py * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update AssemblyUtils.cpp * Update UtilsAssembly.py * Update JointObject.py * small fix for link groups --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -199,10 +199,10 @@ bool ViewProviderAssembly::canDragObjectToTarget(App::DocumentObject* obj, App::
|
||||
|
||||
for (auto joint : allJoints) {
|
||||
// getLinkObjFromProp returns nullptr if the property doesn't exist.
|
||||
App::DocumentObject* part1 = getMovingPartFromRef(assemblyPart, joint, "Reference1");
|
||||
App::DocumentObject* part2 = getMovingPartFromRef(assemblyPart, joint, "Reference2");
|
||||
App::DocumentObject* obj1 = getObjFromRef(joint, "Reference1");
|
||||
App::DocumentObject* obj2 = getObjFromRef(joint, "Reference2");
|
||||
App::DocumentObject* part1 = getMovingPartFromRef(joint, "Reference1");
|
||||
App::DocumentObject* part2 = getMovingPartFromRef(joint, "Reference2");
|
||||
App::DocumentObject* obj1 = getObjFromJointRef(joint, "Reference1");
|
||||
App::DocumentObject* obj2 = getObjFromJointRef(joint, "Reference2");
|
||||
App::DocumentObject* obj3 = getObjFromProp(joint, "ObjectToGround");
|
||||
if (obj == obj1 || obj == obj2 || obj == part1 || obj == part2 || obj == obj3) {
|
||||
if (!prompted) {
|
||||
@@ -782,7 +782,7 @@ bool ViewProviderAssembly::getSelectedObjectsWithinAssembly(bool addPreselection
|
||||
App::DocumentObject* selRoot = Gui::Selection().getPreselection().Object.getObject();
|
||||
std::string sub = Gui::Selection().getPreselection().pSubName;
|
||||
|
||||
App::DocumentObject* obj = getMovingPartFromRef(assemblyPart, selRoot, sub);
|
||||
App::DocumentObject* obj = getMovingPartFromSel(assemblyPart, selRoot, sub);
|
||||
if (canDragObjectIn3d(obj)) {
|
||||
|
||||
bool alreadyIn = false;
|
||||
@@ -850,7 +850,7 @@ void ViewProviderAssembly::collectMovableObjects(
|
||||
return;
|
||||
}
|
||||
|
||||
App::DocumentObject* part = getMovingPartFromRef(assemblyPart, selRoot, subNamePrefix);
|
||||
App::DocumentObject* part = getMovingPartFromSel(assemblyPart, selRoot, subNamePrefix);
|
||||
|
||||
if (onlySolids && assemblyPart->isPartConnected(part)) {
|
||||
return; // No dragger for connected parts.
|
||||
@@ -955,7 +955,7 @@ ViewProviderAssembly::DragMode ViewProviderAssembly::findDragMode()
|
||||
if (!ref) {
|
||||
return DragMode::Translation;
|
||||
}
|
||||
auto* obj = getObjFromRef(movingJoint, pName.c_str());
|
||||
auto* obj = getObjFromJointRef(movingJoint, pName.c_str());
|
||||
Base::Placement global_plc = App::GeoFeature::getGlobalPlacement(obj, ref);
|
||||
jcsGlobalPlc = global_plc * jcsPlc;
|
||||
|
||||
@@ -1022,6 +1022,7 @@ void ViewProviderAssembly::tryInitMove(const SbVec2s& cursorPos, Gui::View3DInve
|
||||
else if (visible) {
|
||||
joint->Visibility.setValue(false);
|
||||
}
|
||||
joint->purgeTouched();
|
||||
}
|
||||
|
||||
SbVec3f vec;
|
||||
@@ -1100,6 +1101,7 @@ void ViewProviderAssembly::endMove()
|
||||
bool visible = pair.first->Visibility.getValue();
|
||||
if (visible != pair.second) {
|
||||
pair.first->Visibility.setValue(pair.second);
|
||||
pair.first->purgeTouched();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1468,10 +1470,8 @@ void ViewProviderAssembly::isolateJointReferences(App::DocumentObject* joint, Is
|
||||
return;
|
||||
}
|
||||
|
||||
AssemblyObject* assembly = getObject<AssemblyObject>();
|
||||
|
||||
App::DocumentObject* part1 = getMovingPartFromRef(assembly, joint, "Reference1");
|
||||
App::DocumentObject* part2 = getMovingPartFromRef(assembly, joint, "Reference2");
|
||||
App::DocumentObject* part1 = getMovingPartFromRef(joint, "Reference1");
|
||||
App::DocumentObject* part2 = getMovingPartFromRef(joint, "Reference2");
|
||||
if (!part1 || !part2) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user