From 8d821fe5f018c2a3d95fa38651a2aed1487a6527 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 23 May 2020 21:30:02 +0200 Subject: [PATCH] Sketcher: [skip ci] do not rename object identifier of an expression on undo/redo --- src/Mod/Sketcher/App/PropertyConstraintList.cpp | 10 +++++++--- src/Mod/Sketcher/App/PropertyConstraintList.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Mod/Sketcher/App/PropertyConstraintList.cpp b/src/Mod/Sketcher/App/PropertyConstraintList.cpp index a9663fac9e7b..eb7497252022 100644 --- a/src/Mod/Sketcher/App/PropertyConstraintList.cpp +++ b/src/Mod/Sketcher/App/PropertyConstraintList.cpp @@ -57,7 +57,10 @@ TYPESYSTEM_SOURCE(Sketcher::PropertyConstraintList, App::PropertyLists) // Construction/Destruction -PropertyConstraintList::PropertyConstraintList() : validGeometryKeys(0), invalidGeometry(true) +PropertyConstraintList::PropertyConstraintList() + : validGeometryKeys(0) + , invalidGeometry(true) + , restoreFromTransaction(false) { } @@ -225,11 +228,11 @@ void PropertyConstraintList::applyValues(std::vector&& lValue) valueMap = std::move(newValueMap); /* Signal removes first, in case renamed values below have the same names as some of the removed ones. */ - if (removed.size() > 0) + if (removed.size() > 0 && !restoreFromTransaction) signalConstraintsRemoved(removed); /* Signal renames */ - if (renamed.size() > 0) + if (renamed.size() > 0 && !restoreFromTransaction) signalConstraintsRenamed(renamed); _lValueList = std::move(lValue); @@ -352,6 +355,7 @@ Property *PropertyConstraintList::Copy(void) const void PropertyConstraintList::Paste(const Property &from) { + Base::StateLocker lock(restoreFromTransaction, true); const PropertyConstraintList& FromList = dynamic_cast(from); setValues(FromList._lValueList); } diff --git a/src/Mod/Sketcher/App/PropertyConstraintList.h b/src/Mod/Sketcher/App/PropertyConstraintList.h index c4777bc58229..a4a8eda62eac 100644 --- a/src/Mod/Sketcher/App/PropertyConstraintList.h +++ b/src/Mod/Sketcher/App/PropertyConstraintList.h @@ -161,6 +161,7 @@ class SketcherExport PropertyConstraintList : public App::PropertyLists std::vector validGeometryKeys; bool invalidGeometry; + bool restoreFromTransaction; void applyValues(std::vector&&); void applyValidGeometryKeys(const std::vector &keys);