Update ArchMaterial.py

This commit is contained in:
Roy-043
2025-06-19 13:45:02 +02:00
committed by Yorik van Havre
parent b11ebe6e40
commit 3eacde0ba2

View File

@@ -279,12 +279,18 @@ class _ArchMaterial:
def execute(self,obj):
if obj.Material:
if FreeCAD.GuiUp:
c = None
t = None
if "DiffuseColor" in obj.Material:
c = tuple([float(f) for f in obj.Material['DiffuseColor'].strip("()").strip("[]").split(",")])
for p in obj.InList:
if hasattr(p,"Material") and ( (not hasattr(p.ViewObject,"UseMaterialColor")) or p.ViewObject.UseMaterialColor):
if p.Material.Name == obj.Name:
p.ViewObject.ShapeColor = c
c = tuple([float(f) for f in obj.Material["DiffuseColor"].strip("()").strip("[]").split(",")])
if "Transparency" in obj.Material:
t = int(obj.Material["Transparency"])
for p in obj.InList:
if hasattr(p,"Material") \
and p.Material.Name == obj.Name \
and getattr(obj.ViewObject,"UseMaterialColor",True):
if c: p.ViewObject.ShapeColor = c
if t: p.ViewObject.Transparency = t
return
def dumps(self):