BIM: fix transparency of windows

This commit is contained in:
Roy-043
2025-09-05 19:17:16 +02:00
committed by Yorik van Havre
parent 218c2c61d2
commit 993a5a6ac9

View File

@@ -877,6 +877,7 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent):
if color is None:
sapp_mat = base_sapp_mat
else:
# color is an RGBA tuple (0.0-1.0)
sapp_mat = FreeCAD.Material() # ShapeAppearance material with default v0.21 properties.
sapp_mat.DiffuseColor = color[:3] + (1.0, )
sapp_mat.Transparency = 1.0 - color[3]
@@ -895,6 +896,8 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent):
def getSolidMaterial(self,obj,arch_mat,name,mtype=None):
"""returns an RGBA tuple of floats (0.0 - 1.0)"""
color = None
if arch_mat is not None and hasattr(arch_mat,"Materials") and arch_mat.Names:
mat = None
@@ -908,7 +911,7 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent):
color = tuple([float(f) for f in mat.Material['DiffuseColor'].strip("()").split(",")])
if color and ('Transparency' in mat.Material):
t = float(mat.Material['Transparency'])/100.0
color = color[:3] + (t, )
color = color[:3] + (1.0-t, )
return color
def getHingeEdgeIndices(self):