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
This commit is contained in:
furti
2019-02-14 18:19:08 +01:00
committed by Yorik van Havre
parent 86b4272971
commit 35eca42fd2

View File

@@ -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: