Skip to content

Commit

Permalink
BIM: Fixes appearance defects coming from recent transparency and Fre…
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Dec 12, 2024
1 parent 7f456d8 commit 2cc8c3e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src/Mod/BIM/nativeifc/ifc_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/BIM/nativeifc/ifc_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 2cc8c3e

Please sign in to comment.