mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-11 22:31:55 +00:00
draw_custom_context_menu - small refactor to improve readibility
This commit is contained in:
@@ -1203,16 +1203,21 @@ def draw_custom_context_menu(self: bpy.types.Menu, context: bpy.types.Context) -
|
|||||||
or not hasattr(context.button_prop, "identifier")
|
or not hasattr(context.button_prop, "identifier")
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
prop = context.button_pointer
|
# E.g. `bim.props.Attribute`.
|
||||||
prop_name = context.button_prop.identifier
|
prop_struct: bpy.types.bpy_struct = context.button_pointer
|
||||||
prop_value = getattr(prop, prop_name, None)
|
# E.g. `IntProperty("int_value")`
|
||||||
|
prop: bpy.types.Property = context.button_prop
|
||||||
|
prop_name = prop.identifier
|
||||||
|
# TODO: when `prop_struct` doesn't have `prop_name`?
|
||||||
|
prop_value = getattr(prop_struct, prop_name, None)
|
||||||
if not isinstance(prop_value, str):
|
if not isinstance(prop_value, str):
|
||||||
return
|
return
|
||||||
version = tool.Ifc.get_schema()
|
version = tool.Ifc.get_schema()
|
||||||
|
assert self.layout
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
||||||
if isinstance(context.button_pointer, Attribute):
|
if isinstance(prop_struct, Attribute):
|
||||||
attr = context.button_pointer
|
attr = prop_struct
|
||||||
description = attr.description
|
description = attr.description
|
||||||
ifc_class = attr.ifc_class
|
ifc_class = attr.ifc_class
|
||||||
if ifc_class:
|
if ifc_class:
|
||||||
|
|||||||
Reference in New Issue
Block a user