BIM: Fixes appearance defects coming from recent transparency and #18298
This commit is contained in:
committed by
Yorik van Havre
parent
7f456d854f
commit
2cc8c3e4c5
@@ -464,13 +464,23 @@ def set_cache(ifcfile, cache):
|
||||
def set_representation(vobj, node):
|
||||
"""Sets the correct coin nodes for the given Part object"""
|
||||
|
||||
def find_node(parent, nodetype):
|
||||
for i in range(parent.getNumChildren()):
|
||||
if isinstance(parent.getChild(i), nodetype):
|
||||
return parent.getChild(i)
|
||||
return None
|
||||
|
||||
# node = [colors, verts, faces, edges, parts]
|
||||
if not vobj.RootNode:
|
||||
return
|
||||
if vobj.RootNode.getNumChildren() < 3:
|
||||
return
|
||||
coords = vobj.RootNode.getChild(1) # SoCoordinate3
|
||||
switch = vobj.RootNode.getChild(2)
|
||||
coords = find_node(vobj.RootNode, coin.SoCoordinate3)
|
||||
if not coords:
|
||||
return
|
||||
switch = find_node(vobj.RootNode, coin.SoSwitch)
|
||||
if not switch:
|
||||
return
|
||||
num_modes = switch.getNumChildren()
|
||||
if num_modes < 3:
|
||||
return
|
||||
|
||||
@@ -942,7 +942,7 @@ def set_colors(obj, colors):
|
||||
if len(colors) > 1:
|
||||
#colors[0] = colors[0][:3] + (0.0,)
|
||||
# TEMP HACK: if multiple colors, set everything to opaque because it looks wrong
|
||||
colors = [color[:3] + (0.0,) for color in colors]
|
||||
colors = [color[:3] + (1.0,) for color in colors]
|
||||
sapp = []
|
||||
for color in colors:
|
||||
sapp_mat = FreeCAD.Material()
|
||||
|
||||
Reference in New Issue
Block a user