diff --git a/src/Mod/BIM/ArchBuildingPart.py b/src/Mod/BIM/ArchBuildingPart.py index 12327dd6d8..6c80064aed 100644 --- a/src/Mod/BIM/ArchBuildingPart.py +++ b/src/Mod/BIM/ArchBuildingPart.py @@ -625,7 +625,7 @@ class ViewProviderBuildingPart: if hasattr(child.ViewObject,"DiffuseColor") and len(child.ViewObject.DiffuseColor) == len(child.Shape.Faces): colors.extend(child.ViewObject.DiffuseColor) else: - c = child.ViewObject.ShapeColor[:3]+(child.ViewObject.Transparency/100.0,) + c = child.ViewObject.ShapeColor[:3]+(1.0 - child.ViewObject.Transparency/100.0,) for i in range(len(child.Shape.Faces)): colors.append(c) return colors diff --git a/src/Mod/BIM/ArchCurtainWall.py b/src/Mod/BIM/ArchCurtainWall.py index 4d07c26e2b..3a0c480ffc 100644 --- a/src/Mod/BIM/ArchCurtainWall.py +++ b/src/Mod/BIM/ArchCurtainWall.py @@ -549,8 +549,8 @@ class ViewProviderCurtainWall(ArchComponent.ViewProviderComponent): if ('DiffuseColor' in mat.Material) and ("(" in mat.Material['DiffuseColor']): panelcolor = tuple([float(f) for f in mat.Material['DiffuseColor'].strip("()").split(",")]) paneltransparency = 0 - basecolor = basecolor[:3]+(basetransparency,) - panelcolor = panelcolor[:3]+(paneltransparency,) + basecolor = basecolor[:3]+(1.0 - basetransparency,) + panelcolor = panelcolor[:3]+(1.0 - paneltransparency,) colors = [] nmullions = obj.VerticalMullionNumber + obj.HorizontalMullionNumber + obj.DiagonalMullionNumber for i,solid in enumerate(obj.Shape.Solids): diff --git a/src/Mod/BIM/ArchPanel.py b/src/Mod/BIM/ArchPanel.py index 971e7ec7c6..1953753467 100644 --- a/src/Mod/BIM/ArchPanel.py +++ b/src/Mod/BIM/ArchPanel.py @@ -473,12 +473,12 @@ class _ViewProviderPanel(ArchComponent.ViewProviderComponent): cols = [] for i,mat in enumerate(activematerials): c = obj.ViewObject.ShapeColor - c = (c[0],c[1],c[2],obj.ViewObject.Transparency/100.0) + c = (c[0],c[1],c[2],1.0-obj.ViewObject.Transparency/100.0) if 'DiffuseColor' in mat.Material: if "(" in mat.Material['DiffuseColor']: c = tuple([float(f) for f in mat.Material['DiffuseColor'].strip("()").split(",")]) if 'Transparency' in mat.Material: - c = (c[0],c[1],c[2],float(mat.Material['Transparency'])) + c = (c[0],c[1],c[2],1.0-float(mat.Material['Transparency'])) cols.extend([c for j in range(len(obj.Shape.Solids[i].Faces))]) if obj.ViewObject.DiffuseColor != cols: obj.ViewObject.DiffuseColor = cols diff --git a/src/Mod/BIM/ArchWall.py b/src/Mod/BIM/ArchWall.py index 79fa33191f..17eb4c24e1 100644 --- a/src/Mod/BIM/ArchWall.py +++ b/src/Mod/BIM/ArchWall.py @@ -1336,12 +1336,12 @@ class _ViewProviderWall(ArchComponent.ViewProviderComponent): cols = [] for i,mat in enumerate(activematerials): c = obj.ViewObject.ShapeColor - c = (c[0],c[1],c[2],obj.ViewObject.Transparency/100.0) + c = (c[0],c[1],c[2],1.0-obj.ViewObject.Transparency/100.0) if 'DiffuseColor' in mat.Material: if "(" in mat.Material['DiffuseColor']: c = tuple([float(f) for f in mat.Material['DiffuseColor'].strip("()").split(",")]) if 'Transparency' in mat.Material: - c = (c[0],c[1],c[2],float(mat.Material['Transparency'])) + c = (c[0],c[1],c[2],1.0-float(mat.Material['Transparency'])) cols.extend([c for j in range(len(obj.Shape.Solids[i].Faces))]) obj.ViewObject.DiffuseColor = cols ArchComponent.ViewProviderComponent.updateData(self,obj,prop) diff --git a/src/Mod/BIM/ArchWindow.py b/src/Mod/BIM/ArchWindow.py index 15dd2317a3..09321c48ea 100644 --- a/src/Mod/BIM/ArchWindow.py +++ b/src/Mod/BIM/ArchWindow.py @@ -741,8 +741,8 @@ class _ViewProviderWindow(ArchComponent.ViewProviderComponent): sapp_mat = base_sapp_mat else: sapp_mat = FreeCAD.Material() # ShapeAppearance material with default v0.21 properties. - sapp_mat.DiffuseColor = color[:3] + (0.0, ) - sapp_mat.Transparency = color[3] + sapp_mat.DiffuseColor = color[:3] + (1.0, ) + sapp_mat.Transparency = 1.0 - color[3] sapp.extend((sapp_mat, ) * len(solids[i].Faces)) if clone is not None: diff --git a/src/Mod/BIM/importers/importIFC.py b/src/Mod/BIM/importers/importIFC.py index e6ad2a94ba..c2550b3c76 100644 --- a/src/Mod/BIM/importers/importIFC.py +++ b/src/Mod/BIM/importers/importIFC.py @@ -878,7 +878,7 @@ def insert(srcfile, docname, skip=[], only=[], root=None, preferences=None): if hasattr(obj.ViewObject,"ShapeColor"): obj.ViewObject.ShapeColor = tuple(colors[pid][0:3]) if hasattr(obj.ViewObject,"Transparency"): - obj.ViewObject.Transparency = colors[pid][3] + obj.ViewObject.Transparency = 1.0 - colors[pid][3] # if preferences['DEBUG'] is on, recompute after each shape if preferences['DEBUG']: doc.recompute() diff --git a/src/Mod/BIM/importers/importIFCHelper.py b/src/Mod/BIM/importers/importIFCHelper.py index 3f69b1be67..8f44fce965 100644 --- a/src/Mod/BIM/importers/importIFCHelper.py +++ b/src/Mod/BIM/importers/importIFCHelper.py @@ -1052,7 +1052,7 @@ def applyColorDict(doc,colordict=None): if hasattr(obj.ViewObject,"ShapeColor"): obj.ViewObject.ShapeColor = tuple(color[0:3]) if hasattr(obj.ViewObject,"Transparency") and (len(color) >= 4): - obj.ViewObject.Transparency = color[3] + obj.ViewObject.Transparency = 1.0 - color[3] else: print("No valid color dict to apply") diff --git a/src/Mod/BIM/nativeifc/ifc_tools.py b/src/Mod/BIM/nativeifc/ifc_tools.py index 00e92de8ef..df157bfb2f 100644 --- a/src/Mod/BIM/nativeifc/ifc_tools.py +++ b/src/Mod/BIM/nativeifc/ifc_tools.py @@ -836,7 +836,7 @@ def set_colors(obj, colors): sapp_mat.DiffuseColor = color + (1.0,) else: sapp_mat.DiffuseColor = color[:3] + (1.0 - color[3],) - sapp_mat.Transparency = color[3] if len(color) > 3 else 0.0 + sapp_mat.Transparency = 1.0 - color[3] if len(color) > 3 else 0.0 sapp.append(sapp_mat) #print(vobj.Object.Label,[[m.DiffuseColor,m.Transparency] for m in sapp]) vobj.ShapeAppearance = sapp diff --git a/src/Mod/Draft/draftutils/gui_utils.py b/src/Mod/Draft/draftutils/gui_utils.py index 4d9a3bce77..32c6ae3a95 100644 --- a/src/Mod/Draft/draftutils/gui_utils.py +++ b/src/Mod/Draft/draftutils/gui_utils.py @@ -405,7 +405,7 @@ def get_diffuse_color(objs): return obj.ViewObject.DiffuseColor else: col = obj.ViewObject.ShapeColor - col = (col[0], col[1], col[2], obj.ViewObject.Transparency / 100.0) + col = (col[0], col[1], col[2], 1.0 - obj.ViewObject.Transparency / 100.0) return [col] * len(obj.Shape.Faces) elif obj.hasExtension("App::GeoFeatureGroupExtension"): cols = []