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.
This commit is contained in:
Zheng, Lei
2019-12-18 12:14:32 +08:00
committed by wwmayer
parent 864fa1dc55
commit ca48c25ea0

View File

@@ -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<Gui::ViewProviderExtension>();