mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-19 22:50:21 +00:00
Reapply 06f1477 to fix not appearing IFC Description button
Not that skipping non-string properties was a bad idea, but inserting it right at the beginning was - non-string IFC properties were missing IFC descriptions because of it. Moved it past `Attribute` check to avoid this issue. For anyone hearing about this feature for the first time - https://imgur.com/a/dNRao3R I assume this was also the issue that was encountered in #5892
This commit is contained in:
@@ -1209,8 +1209,10 @@ def draw_custom_context_menu(self: bpy.types.Menu, context: bpy.types.Context) -
|
|||||||
prop: bpy.types.Property = context.button_prop
|
prop: bpy.types.Property = context.button_prop
|
||||||
prop_name = prop.identifier
|
prop_name = prop.identifier
|
||||||
# TODO: when `prop_struct` doesn't have `prop_name`?
|
# TODO: when `prop_struct` doesn't have `prop_name`?
|
||||||
prop_value = getattr(prop_struct, prop_name, None)
|
if not hasattr(prop_struct, prop_name):
|
||||||
if not isinstance(prop_value, str):
|
return
|
||||||
|
prop_value = getattr(prop_struct, prop_name, ...)
|
||||||
|
if prop_value is ...:
|
||||||
return
|
return
|
||||||
version = tool.Ifc.get_schema()
|
version = tool.Ifc.get_schema()
|
||||||
assert self.layout
|
assert self.layout
|
||||||
@@ -1240,6 +1242,13 @@ def draw_custom_context_menu(self: bpy.types.Menu, context: bpy.types.Context) -
|
|||||||
op = layout.operator("bim.copy_text_to_clipboard", text="Copy Attribute Name", icon="COPYDOWN")
|
op = layout.operator("bim.copy_text_to_clipboard", text="Copy Attribute Name", icon="COPYDOWN")
|
||||||
op.text = attr_name
|
op.text = attr_name
|
||||||
else:
|
else:
|
||||||
|
# Basically context menu for any Blender property will end up here,
|
||||||
|
# and will check 3 types of docs.
|
||||||
|
# So at least we're skipping all non-string properties.
|
||||||
|
if not isinstance(prop_value, str):
|
||||||
|
return
|
||||||
|
|
||||||
|
docs = None
|
||||||
# Ugly but we can't know which type of data is under the cursor so we test everything until it clicks
|
# Ugly but we can't know which type of data is under the cursor so we test everything until it clicks
|
||||||
try:
|
try:
|
||||||
docs = get_entity_doc(version, prop_value)
|
docs = get_entity_doc(version, prop_value)
|
||||||
|
|||||||
Reference in New Issue
Block a user