mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Ran black formatting
This commit is contained in:
@@ -27,17 +27,17 @@ with open(os.path.join(os.path.dirname(__file__), "spectraldb.json"), "r") as f:
|
||||
|
||||
class MATERIAL_UL_radiance_materials(bpy.types.UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
if self.layout_type in {"DEFAULT", "COMPACT"}:
|
||||
row = layout.row(align=True)
|
||||
|
||||
|
||||
# Adding color preview or glass icon
|
||||
if item.category == "Glass":
|
||||
row.label(icon='SHADING_TEXTURE')
|
||||
row.label(icon="SHADING_TEXTURE")
|
||||
else:
|
||||
color_rect = row.row()
|
||||
color_rect.prop(item, "color", text="")
|
||||
color_rect.scale_x = 0.3
|
||||
|
||||
|
||||
row.prop(item, "name", text="", emboss=False, icon_value=icon)
|
||||
if item.is_mapped:
|
||||
row.label(text=f"{item.category} - {item.subcategory}")
|
||||
|
||||
@@ -565,7 +565,7 @@ class RefreshIFCMaterials(bpy.types.Operator):
|
||||
if render_item.is_a("IfcSurfaceStyleRendering"):
|
||||
style_id = f"IfcSurfaceStyleRendering-{render_item.id()}"
|
||||
style_name = style.Name or f"Unnamed Style {render_item.id()}"
|
||||
|
||||
|
||||
# Extract color and transparency
|
||||
color = (1.0, 1.0, 1.0) # Default white
|
||||
transparency = 0.0 # Default opaque
|
||||
@@ -573,15 +573,15 @@ class RefreshIFCMaterials(bpy.types.Operator):
|
||||
color = (
|
||||
render_item.SurfaceColour.Red,
|
||||
render_item.SurfaceColour.Green,
|
||||
render_item.SurfaceColour.Blue
|
||||
render_item.SurfaceColour.Blue,
|
||||
)
|
||||
if hasattr(render_item, 'Transparency') and render_item.Transparency is not None:
|
||||
if hasattr(render_item, "Transparency") and render_item.Transparency is not None:
|
||||
transparency = render_item.Transparency
|
||||
|
||||
|
||||
# Add material with color
|
||||
material = props.add_material_mapping(style_id, style_name)
|
||||
material.color = color
|
||||
|
||||
|
||||
# If transparency is high, consider it as glass
|
||||
if transparency > 0.5:
|
||||
material.category = "Glass"
|
||||
|
||||
Reference in New Issue
Block a user