Skip to content

Commit

Permalink
Gui: fix ViewProviderDocumentObject display mode restore
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
realthunder authored and wwmayer committed Dec 31, 2019
1 parent 36d158a commit 6562946
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Gui/ViewProviderDocumentObject.cpp
Expand Up @@ -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>();
Expand Down

0 comments on commit 6562946

Please sign in to comment.