From 35eca42fd2ebaf3322a4c00c4396e0c19887fbb7 Mon Sep 17 00:00:00 2001 From: furti Date: Thu, 14 Feb 2019 18:19:08 +0100 Subject: [PATCH] Set window visibility based on wall Previously windows attached to walls were not hidden or shown when the visibility of the wall changed. This commit searches for all windows that are based on the wall and hides or unhides them. https://forum.freecadweb.org/viewtopic.php?f=23&t=34166 fixes 3833 --- src/Mod/Arch/ArchComponent.py | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index beee92c681..4f75711722 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -821,6 +821,11 @@ class ViewProviderComponent: if len(vobj.DiffuseColor) > 1: d = vobj.DiffuseColor vobj.DiffuseColor = d + elif prop == "Visibility": + for host in self.getHosts(): + if hasattr(host, 'ViewObject'): + host.ViewObject.Visibility = vobj.Visibility + return def attach(self,vobj): @@ -917,15 +922,9 @@ class ViewProviderComponent: objlink = getattr(self.Object,link) if objlink: c.append(objlink) - for link in self.Object.InList: - if hasattr(link,"Host"): - if link.Host: - if link.Host == self.Object: - c.append(link) - elif hasattr(link,"Hosts"): - for host in link.Hosts: - if host == self.Object: - c.append(link) + for link in self.getHosts(): + c.append(link) + return c return [] @@ -969,6 +968,22 @@ class ViewProviderComponent: if obj.CloneOf: if self.areDifferentColors(obj.ViewObject.DiffuseColor,obj.CloneOf.ViewObject.DiffuseColor) or force: obj.ViewObject.DiffuseColor = obj.CloneOf.ViewObject.DiffuseColor + + def getHosts(self): + hosts = [] + + if hasattr(self,"Object"): + for link in self.Object.InList: + if hasattr(link,"Host"): + if link.Host: + if link.Host == self.Object: + hosts.append(link) + elif hasattr(link,"Hosts"): + for host in link.Hosts: + if host == self.Object: + hosts.append(link) + + return hosts class ArchSelectionObserver: