From 5e309d5c7d3a7a0e1298abd735f385fa6653e829 Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 16 Feb 2015 16:46:42 +0300 Subject: [PATCH] Issue #394 Undo-ing a Sketch element Check the value on initialized and do not set new value if it was initialized. --- src/ModuleBase/ModuleBase_ModelWidget.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/ModuleBase/ModuleBase_ModelWidget.cpp b/src/ModuleBase/ModuleBase_ModelWidget.cpp index d332eedc7..6351c4f78 100644 --- a/src/ModuleBase/ModuleBase_ModelWidget.cpp +++ b/src/ModuleBase/ModuleBase_ModelWidget.cpp @@ -99,14 +99,17 @@ void ModuleBase_ModelWidget::activate() // the control value is stored to the mode by the focus in on the widget // we need the value is initialized in order to enable the apply button in the property panel. // It should happens in the creation mode only because all fields are filled in the edition mode - if (!isEditingMode()/* && !myFeature->data()->attribute(myAttributeID)->isInitialized()*/) { - if (isComputedDefault()) { - if (myFeature->compute(myAttributeID)) { - restoreValue(); - } - } - else { - storeValue(); + if (!isEditingMode()) { + AttributePtr anAttribute = myFeature->data()->attribute(myAttributeID); + if (anAttribute.get() != NULL && !anAttribute->isInitialized()) { + if (isComputedDefault()) { + if (myFeature->compute(myAttributeID)) { + restoreValue(); + } + } + else { + storeValue(); + } } } activateCustom(); -- 2.39.2