mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 10:59:17 +00:00
Fix bug where diffuse colour was not correctly extracted from nodes
This commit is contained in:
@@ -51,11 +51,11 @@ class Style(blenderbim.core.tool.Style):
|
||||
@classmethod
|
||||
def get_surface_rendering_attributes(cls, obj):
|
||||
transparency = obj.diffuse_color[3]
|
||||
diffuse_colour = obj.diffuse_color
|
||||
diffuse_color = obj.diffuse_color
|
||||
if obj.use_nodes and hasattr(obj.node_tree, "nodes") and "Principled BSDF" in obj.node_tree.nodes:
|
||||
bsdf = obj.node_tree.nodes["Principled BSDF"]
|
||||
transparency = bsdf.inputs["Alpha"].default_value
|
||||
diffuse_colour = bsdf.inputs["Base Color"].default_value
|
||||
diffuse_color = bsdf.inputs["Base Color"].default_value
|
||||
transparency = 1 - transparency
|
||||
return {
|
||||
"SurfaceColour": {
|
||||
@@ -67,9 +67,9 @@ class Style(blenderbim.core.tool.Style):
|
||||
"Transparency": transparency,
|
||||
"DiffuseColour": {
|
||||
"Name": None,
|
||||
"Red": obj.diffuse_color[0],
|
||||
"Green": obj.diffuse_color[1],
|
||||
"Blue": obj.diffuse_color[2],
|
||||
"Red": diffuse_color[0],
|
||||
"Green": diffuse_color[1],
|
||||
"Blue": diffuse_color[2],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -112,9 +112,9 @@ class TestGetSurfaceRenderingAttributes(NewFile):
|
||||
"Transparency": 1 - node.inputs["Alpha"].default_value,
|
||||
"DiffuseColour": {
|
||||
"Name": None,
|
||||
"Red": 1,
|
||||
"Green": 1,
|
||||
"Blue": 1,
|
||||
"Red": 0.5,
|
||||
"Green": 0.5,
|
||||
"Blue": 0.5,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user