diff --git a/src/blenderbim/blenderbim/bim/__init__.py b/src/blenderbim/blenderbim/bim/__init__.py index f6532798c6..20bb0a00fd 100644 --- a/src/blenderbim/blenderbim/bim/__init__.py +++ b/src/blenderbim/blenderbim/bim/__init__.py @@ -159,7 +159,8 @@ def register(): bpy.types.Camera.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties) bpy.types.PointLight.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties) bpy.types.SCENE_PT_unit.append(ui.ifc_units) - bpy.types.UI_MT_button_context_menu.append(ui.draw_custom_context_menu) + if hasattr(bpy.types, "UI_MT_button_context_menu"): + bpy.types.UI_MT_button_context_menu.append(ui.draw_custom_context_menu) for mod in modules.values(): mod.register() diff --git a/src/blenderbim/blenderbim/bim/ui.py b/src/blenderbim/blenderbim/bim/ui.py index 0594604bce..adbc4a8e4c 100644 --- a/src/blenderbim/blenderbim/bim/ui.py +++ b/src/blenderbim/blenderbim/bim/ui.py @@ -386,6 +386,12 @@ class BIM_PT_misc_object(Panel): def draw_custom_context_menu(self, context): # https://blender.stackexchange.com/a/275555/86891 + if ( + not hasattr(context, "button_pointer") + or not hasattr(context, "button_prop") + or not hasattr(context.button_prop, "identifier") + ): + return prop = context.button_pointer prop_name = context.button_prop.identifier prop_value = getattr(prop, prop_name, None)