From 6562946e362f73f848b6a6f86a0c30c83095d0b1 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Wed, 18 Dec 2019 12:14:32 +0800 Subject: [PATCH] Gui: fix ViewProviderDocumentObject display mode restore C++ view provider will get the call of attach() before restoring properties. However, python view object will delay the call until Proxy is restored. The reason why this problem did not show up eariler is because ViewProviderPythonFeature::getDefaultDisplayMode() did not fallback to its parent implementation if there is no Python override. This can be considered as a bug, which is fixed during the merge. And the display mode restore problem is the side effect of the fix. --- src/Gui/ViewProviderDocumentObject.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Gui/ViewProviderDocumentObject.cpp b/src/Gui/ViewProviderDocumentObject.cpp index 08af98ee77dd..8965c7ca5753 100644 --- a/src/Gui/ViewProviderDocumentObject.cpp +++ b/src/Gui/ViewProviderDocumentObject.cpp @@ -281,10 +281,12 @@ void ViewProviderDocumentObject::attach(App::DocumentObject *pcObj) aDisplayEnumsArray.push_back(0); // null termination DisplayMode.setEnums(&(aDisplayEnumsArray[0])); - // set the active mode - const char* defmode = this->getDefaultDisplayMode(); - if (defmode) - DisplayMode.setValue(defmode); + if(!isRestoring()) { + // set the active mode + const char* defmode = this->getDefaultDisplayMode(); + if (defmode) + DisplayMode.setValue(defmode); + } //attach the extensions auto vector = getExtensionsDerivedFromType();