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:
committed by
Chris Hennes
parent
c3f00556d4
commit
c5c937c8bd
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user