PartDesign: Fix misplaced preview for patterns

Previous solution did not take into account supporting shape transform
which should now be handled correctly.
This commit is contained in:
Kacper Donat
2025-12-31 17:09:43 +01:00
committed by Chris Hennes
parent c3f00556d4
commit c5c937c8bd

View File

@@ -104,6 +104,19 @@ void ViewProviderTransformed::updatePreview()
try {
if (auto feature = getObject<PartDesign::Transformed>()) {
const Part::Feature* supportFeature = feature->getBaseObject();
const Part::TopoShape& supportShape = supportFeature->Shape.getShape();
if (supportShape.isNull()) {
return;
}
Base::Matrix4D invertedSupportMatrix;
Part::TopoShape::convertToMatrix(
supportShape.getShape().Location().Transformation().Inverted(),
invertedSupportMatrix
);
auto originals = feature->getOriginals();
auto transforms = feature->getTransformations(originals);
@@ -120,7 +133,7 @@ void ViewProviderTransformed::updatePreview()
auto sep = new SoSeparator;
auto transformNode = new SoTransform;
transformNode->setMatrix(convert(transformMatrix));
transformNode->setMatrix(convert(transformMatrix * invertedSupportMatrix));
sep->addChild(transformNode);
sep->addChild(pcPreviewShape);