mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-14 11:24:19 +00:00
Show in UI if representation item has UV mapping / colour map
Example - https://i.imgur.com/bWV4dRj.png
This commit is contained in:
@@ -1831,6 +1831,11 @@ class EnableEditingRepresentationItems(bpy.types.Operator, tool.Ifc.Operator):
|
||||
|
||||
props.items.clear()
|
||||
|
||||
def add_tag(item, tag: str) -> None:
|
||||
if item.tags:
|
||||
item.tags += ","
|
||||
item.tags += tag
|
||||
|
||||
if bpy.context.active_object.data and hasattr(bpy.context.active_object.data, "BIMMeshProperties"):
|
||||
active_representation_id = bpy.context.active_object.data.BIMMeshProperties.ifc_definition_id
|
||||
element = tool.Ifc.get().by_id(active_representation_id)
|
||||
@@ -1862,6 +1867,10 @@ class EnableEditingRepresentationItems(bpy.types.Operator, tool.Ifc.Operator):
|
||||
shape_aspect = inverse.OfShapeAspect[0]
|
||||
new.shape_aspect = shape_aspect.Name
|
||||
new.shape_aspect_id = shape_aspect.id()
|
||||
elif inverse.is_a("IfcIndexedTextureMap"):
|
||||
add_tag(new, "UV")
|
||||
elif inverse.is_a("IfcIndexedColourMap"):
|
||||
add_tag(new, "Colour")
|
||||
|
||||
# sort created items
|
||||
sorted_items = sorted(props.items[:], key=lambda i: (not i.shape_aspect, i.shape_aspect))
|
||||
|
||||
@@ -97,6 +97,7 @@ class RepresentationItem(PropertyGroup):
|
||||
ifc_definition_id: IntProperty(name="IFC Definition ID")
|
||||
shape_aspect: StringProperty(name="Shape Aspect")
|
||||
shape_aspect_id: IntProperty(name="Shape Aspect IFC ID")
|
||||
tags: StringProperty(name="Tags")
|
||||
|
||||
|
||||
class ShapeAspect(PropertyGroup):
|
||||
|
||||
@@ -192,6 +192,7 @@ class BIM_PT_representation_items(Panel):
|
||||
RepresentationItemsData.load()
|
||||
|
||||
props = context.active_object.BIMGeometryProperties
|
||||
layout = self.layout
|
||||
|
||||
row = self.layout.row(align=True)
|
||||
row.label(text=f"{RepresentationItemsData.data['total_items']} Items Found")
|
||||
@@ -231,6 +232,19 @@ class BIM_PT_representation_items(Panel):
|
||||
row = self.layout.row()
|
||||
row.label(text=active_item.layer or "No Presentation Layer", icon="STICKY_UVS_LOC")
|
||||
|
||||
if active_item.name.endswith("FaceSet"):
|
||||
if "UV" in active_item.tags:
|
||||
text = "Has UV mapping"
|
||||
else:
|
||||
text = "Has no UV mapping"
|
||||
layout.label(text=text, icon="UV")
|
||||
|
||||
if "Colour" in active_item.tags:
|
||||
text = "Has colour mapping"
|
||||
else:
|
||||
text = "Has no colour mapping"
|
||||
layout.label(text=text, icon="COLOR")
|
||||
|
||||
row = self.layout.row(align=True)
|
||||
if props.is_editing_item_shape_aspect:
|
||||
row.prop(props, "representation_item_shape_aspect", icon="SHAPEKEY_DATA", text="")
|
||||
|
||||
Reference in New Issue
Block a user