mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 15:08:51 +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):
|
class MATERIAL_UL_radiance_materials(bpy.types.UIList):
|
||||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
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)
|
row = layout.row(align=True)
|
||||||
|
|
||||||
# Adding color preview or glass icon
|
# Adding color preview or glass icon
|
||||||
if item.category == "Glass":
|
if item.category == "Glass":
|
||||||
row.label(icon='SHADING_TEXTURE')
|
row.label(icon="SHADING_TEXTURE")
|
||||||
else:
|
else:
|
||||||
color_rect = row.row()
|
color_rect = row.row()
|
||||||
color_rect.prop(item, "color", text="")
|
color_rect.prop(item, "color", text="")
|
||||||
color_rect.scale_x = 0.3
|
color_rect.scale_x = 0.3
|
||||||
|
|
||||||
row.prop(item, "name", text="", emboss=False, icon_value=icon)
|
row.prop(item, "name", text="", emboss=False, icon_value=icon)
|
||||||
if item.is_mapped:
|
if item.is_mapped:
|
||||||
row.label(text=f"{item.category} - {item.subcategory}")
|
row.label(text=f"{item.category} - {item.subcategory}")
|
||||||
|
|||||||
@@ -565,7 +565,7 @@ class RefreshIFCMaterials(bpy.types.Operator):
|
|||||||
if render_item.is_a("IfcSurfaceStyleRendering"):
|
if render_item.is_a("IfcSurfaceStyleRendering"):
|
||||||
style_id = f"IfcSurfaceStyleRendering-{render_item.id()}"
|
style_id = f"IfcSurfaceStyleRendering-{render_item.id()}"
|
||||||
style_name = style.Name or f"Unnamed Style {render_item.id()}"
|
style_name = style.Name or f"Unnamed Style {render_item.id()}"
|
||||||
|
|
||||||
# Extract color and transparency
|
# Extract color and transparency
|
||||||
color = (1.0, 1.0, 1.0) # Default white
|
color = (1.0, 1.0, 1.0) # Default white
|
||||||
transparency = 0.0 # Default opaque
|
transparency = 0.0 # Default opaque
|
||||||
@@ -573,15 +573,15 @@ class RefreshIFCMaterials(bpy.types.Operator):
|
|||||||
color = (
|
color = (
|
||||||
render_item.SurfaceColour.Red,
|
render_item.SurfaceColour.Red,
|
||||||
render_item.SurfaceColour.Green,
|
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
|
transparency = render_item.Transparency
|
||||||
|
|
||||||
# Add material with color
|
# Add material with color
|
||||||
material = props.add_material_mapping(style_id, style_name)
|
material = props.add_material_mapping(style_id, style_name)
|
||||||
material.color = color
|
material.color = color
|
||||||
|
|
||||||
# If transparency is high, consider it as glass
|
# If transparency is high, consider it as glass
|
||||||
if transparency > 0.5:
|
if transparency > 0.5:
|
||||||
material.category = "Glass"
|
material.category = "Glass"
|
||||||
|
|||||||
Reference in New Issue
Block a user