@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 = []
|
||||
|
||||
Reference in New Issue
Block a user