Fix ifc2x3 errors editing IfcSurfaceStyleShading #6624

This commit is contained in:
Andrej730
2025-05-02 12:27:27 +05:00
parent 1b38b03532
commit 4aaaf6e8f5
2 changed files with 10 additions and 10 deletions
@@ -815,10 +815,7 @@ class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
"style.edit_surface_style",
tool.Ifc.get(),
style=self.surface_style,
attributes={
"SurfaceColour": self.color_to_dict(self.props.surface_colour),
"Transparency": self.props.transparency or None,
},
attributes=self.get_shading_attributes(),
)
tool.Loader.create_surface_style_shading(material, self.surface_style)
elif self.surface_style.is_a() == "IfcSurfaceStyleRendering":
@@ -912,10 +909,11 @@ class EditSurfaceStyle(bpy.types.Operator, tool.Ifc.Operator):
)
def get_shading_attributes(self) -> dict[str, Any]:
return {
"SurfaceColour": self.color_to_dict(self.props.surface_colour),
"Transparency": self.props.transparency or None,
}
attributes = {}
attributes["SurfaceColour"] = self.color_to_dict(self.props.surface_colour)
if tool.Ifc.get_schema() != "IFC2X3":
attributes["Transparency"] = self.props.transparency or None
return attributes
def get_rendering_attributes(self) -> dict[str, Any]:
if self.props.is_diffuse_colour_null:
+4 -2
View File
@@ -55,6 +55,7 @@ class BIM_PT_styles(Panel):
row.operator("bim.load_styles", text="", icon="IMPORT").style_type = style_type
return
self.is_ifc2x3 = tool.Ifc.get_schema() == "IFC2X3"
active_style = self.props.active_style
row = self.layout.row(align=True)
row.label(text="{} {}s".format(len(self.props.styles), self.props.style_type), icon="SHADING_RENDERED")
@@ -158,8 +159,9 @@ class BIM_PT_styles(Panel):
def draw_surface_style_shading(self):
row = self.layout.row()
row.prop(self.props, "surface_colour")
row = self.layout.row()
row.prop(self.props, "transparency")
if not self.is_ifc2x3:
row = self.layout.row()
row.prop(self.props, "transparency")
def draw_surface_style_rendering(self):
row = self.layout.row()