From 395797d018bed1402c3cf005a293b154e16ead3b Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Wed, 7 Feb 2024 10:46:06 +0100 Subject: [PATCH] Avoid overriding ImagePlane size during import When copying&pasting an ImagePlane whose ImageFile property is a PropertyFile we'd get two updateData notifications, one when the property value is restored (which doesn't do much as the file doesn't exist yet) and another when the RestoreDocFile method is invoked. The solution is simple, do not set Xsize and Ysize when importing the object as we expect the properties to already have the correct values. Closes #11036 --- src/Gui/ViewProviderImagePlane.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Gui/ViewProviderImagePlane.cpp b/src/Gui/ViewProviderImagePlane.cpp index bcbe303f1e..0362a73253 100644 --- a/src/Gui/ViewProviderImagePlane.cpp +++ b/src/Gui/ViewProviderImagePlane.cpp @@ -200,7 +200,9 @@ void ViewProviderImagePlane::setPlaneSize(const QSizeF& size, const QImage& img) { if (!img.isNull()) { Image::ImagePlane* imagePlane = static_cast(pcObject); - if (!isRestoring()) { + // When restoring the document or importing a ImagePlane by eg. pasting it + // preserve the X and Y size. + if (!isRestoring() && !pcObject->testStatus(App::ObjectStatus::ObjImporting)) { imagePlane->XSize.setValue(size.width()); imagePlane->YSize.setValue(size.height()); }