Remove document menu for UI consistency

Although it is a very cool trick, I feel this essentially duplicates the
UI in two spots, and is an outlier in UX. I'd prefer for all IFC data
and relationships to be in one location only (the panels). I think there
are a better unified solutions (e.g. favourite bookmark panels) for
quick access for things like this.
This commit is contained in:
Dion Moult
2026-01-16 20:11:43 +11:00
parent 242f1aab35
commit 233ad63bca
2 changed files with 0 additions and 68 deletions
@@ -42,15 +42,12 @@ classes = (
ui.BIM_PT_object_documents,
ui.BIM_UL_documents,
ui.BIM_UL_document_objects,
ui.BIM_MT_object_documents_context_menu,
)
def register():
bpy.types.Scene.BIMDocumentProperties = bpy.props.PointerProperty(type=prop.BIMDocumentProperties)
bpy.types.VIEW3D_MT_object_context_menu.append(ui.add_object_documents_context_menu)
def unregister():
del bpy.types.Scene.BIMDocumentProperties
bpy.types.VIEW3D_MT_object_context_menu.remove(ui.add_object_documents_context_menu)
@@ -265,68 +265,3 @@ class BIM_UL_document_objects(UIList):
op = row.operator("bim.unassign_document", text="", icon="X")
op.document = document.ifc_definition_id
op.obj = item.name
def add_object_documents_context_menu(self, context):
if not context.active_object:
return
if not tool.Blender.get_ifc_definition_id(context.active_object):
return
self.layout.separator()
self.layout.menu("BIM_MT_object_documents_context_menu", icon="FILE")
class BIM_MT_object_documents_context_menu(bpy.types.Menu):
bl_idname = "BIM_MT_object_documents_context_menu"
bl_label = "Documents"
def draw(self, context):
layout = self.layout
if not context.selected_objects:
layout.label(text="No documents", icon="INFO")
return
if len(context.selected_objects) > 1:
layout.label(text="Select a single object to see its referenced documents", icon="INFO")
return
obj = context.active_object
if not obj or not tool.Blender.get_ifc_definition_id(obj):
layout.label(text="No documents", icon="INFO")
return
if not ObjectDocumentData.is_loaded:
ObjectDocumentData.load()
if not ObjectDocumentData.data["documents"]:
layout.label(text="No Documents", icon="FILE")
else:
for document in ObjectDocumentData.data["documents"]:
row = layout.row(align=True)
with_ifc_icon = document["location"] and document["location"].lower().endswith(".ifc")
with_url_icon = bool(document["location"])
if with_ifc_icon:
row.operator("bim.open_ifc_document", icon="HIDE_OFF", text="").uri = document["location"]
else:
row.label(text="", icon="BLANK1")
if with_url_icon:
row.operator("bim.open_uri", icon="URL", text="").uri = document["location"]
else:
row.label(text="", icon="BLANK1")
doc_entity = None
if "id" in document:
doc_entity = tool.Ifc.get().by_id(document["id"])
if doc_entity and doc_entity.is_a("IfcDocumentReference"):
display_text = document.get("description") or ""
else:
display_text = document.get("name") or ""
row.label(text=f"{document['identification'] or ''}: {display_text}")