mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-29 11:46:33 +00:00
Add support for normalised ratio diffuse colours. See #2509.
This commit is contained in:
@@ -1473,13 +1473,21 @@ class IfcImporter:
|
|||||||
if surface_style.ReflectanceMethod in ["PHYSICAL", "NOTDEFINED"]:
|
if surface_style.ReflectanceMethod in ["PHYSICAL", "NOTDEFINED"]:
|
||||||
blender_material.use_nodes = True
|
blender_material.use_nodes = True
|
||||||
bsdf = blender_material.node_tree.nodes["Principled BSDF"]
|
bsdf = blender_material.node_tree.nodes["Principled BSDF"]
|
||||||
if surface_style.DiffuseColour and surface_style.DiffuseColour.is_a("IfcColourRgb"):
|
if surface_style.DiffuseColour:
|
||||||
bsdf.inputs["Base Color"].default_value = (
|
if surface_style.DiffuseColour.is_a("IfcColourRgb"):
|
||||||
surface_style.DiffuseColour.Red,
|
bsdf.inputs["Base Color"].default_value = (
|
||||||
surface_style.DiffuseColour.Green,
|
surface_style.DiffuseColour.Red,
|
||||||
surface_style.DiffuseColour.Blue,
|
surface_style.DiffuseColour.Green,
|
||||||
1,
|
surface_style.DiffuseColour.Blue,
|
||||||
)
|
1,
|
||||||
|
)
|
||||||
|
elif surface_style.DiffuseColour.is_a("IfcNormalisedRatioMeasure"):
|
||||||
|
bsdf.inputs["Base Color"].default_value = (
|
||||||
|
surface_style.SurfaceColour.Red * surface_style.DiffuseColour.wrappedValue,
|
||||||
|
surface_style.SurfaceColour.Green * surface_style.DiffuseColour.wrappedValue,
|
||||||
|
surface_style.SurfaceColour.Blue * surface_style.DiffuseColour.wrappedValue,
|
||||||
|
1,
|
||||||
|
)
|
||||||
if surface_style.SpecularColour and surface_style.SpecularColour.is_a("IfcNormalisedRatioMeasure"):
|
if surface_style.SpecularColour and surface_style.SpecularColour.is_a("IfcNormalisedRatioMeasure"):
|
||||||
bsdf.inputs["Metallic"].default_value = surface_style.SpecularColour.wrappedValue
|
bsdf.inputs["Metallic"].default_value = surface_style.SpecularColour.wrappedValue
|
||||||
if surface_style.SpecularHighlight and surface_style.SpecularHighlight.is_a("IfcSpecularRoughness"):
|
if surface_style.SpecularHighlight and surface_style.SpecularHighlight.is_a("IfcSpecularRoughness"):
|
||||||
|
|||||||
Reference in New Issue
Block a user