Gui: avoid unecessary visibility change when update view provider

This patch prevents syncing DocumentObject::Visibility when view
provider hides itself before updating. Some object may have additional
logic based on object visibility change. For example, GroupExtension
monitors its children visibility for exporting, and propgate changes to
upper hierarchy.
This commit is contained in:
Zheng, Lei
2019-10-04 12:17:06 +08:00
committed by wwmayer
parent b19f82255c
commit 000ef1517f
2 changed files with 19 additions and 3 deletions

View File

@@ -145,7 +145,12 @@ void ViewProviderGroupExtension::extensionHide(void) {
// when reading the Visibility property from file then do not hide the
// objects of this group because they have stored their visibility status, too
if (!getExtendedViewProvider()->isRestoring()) {
//
// Property::User1 is used by ViewProviderDocumentObject to mark for
// temporary visibility changes. Do not propagate the change to children.
if (!getExtendedViewProvider()->isRestoring()
&& !getExtendedViewProvider()->Visibility.testStatus(App::Property::User1))
{
auto* group = getExtendedViewProvider()->getObject()->getExtensionByType<App::GroupExtension>();
for(auto obj : group->Group.getValues()) {
if(obj && obj->Visibility.getValue())