From 1c8df498f3d508b9be2f1dd0f2f4797e6f672d4a Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Wed, 10 Dec 2025 20:01:06 +0100 Subject: [PATCH] BIM: ArchReference: handle transparency-alpha switch The 'old' DiffuseColor comes in 2 flavors. In v0.21.2 it stores transparency values. In v1.0.2 and v1.1 it stores alpha values. The ArchReference code should handle both. DiffuseColor is still used by BuildingParts in v1.0.2 and v1.1. The solution is a bit hacky: if 100% transparency occurs we assume we are actually dealing with alpha values. --- src/Mod/BIM/ArchReference.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Mod/BIM/ArchReference.py b/src/Mod/BIM/ArchReference.py index 1f1f487ab1..7b08210518 100644 --- a/src/Mod/BIM/ArchReference.py +++ b/src/Mod/BIM/ArchReference.py @@ -511,6 +511,7 @@ class ArchReference: if writemode2: # Old DiffuseColor support: + alpha_to_transparency = False for i in range(1, int(len(buf) / 4)): # ShapeAppearance material with default v0.21 properties: material = FreeCAD.Material() @@ -518,6 +519,13 @@ class ArchReference: material.DiffuseColor = color[:3] + (255,) material.Transparency = color[3] / 255.0 colors.append(material) + if material.Transparency == 1.0: + # Assumption: a face with 100% transparency indicates + # we are actually dealing with alpha values. + alpha_to_transparency = True + if alpha_to_transparency: + for material in colors: + material.Transparency = 1.0 - material.Transparency if writemode3: # File format ShapeAppearance files in FCStd file: