Fix manual section/elevation annotation placement in non-plan views

Use get_default_annotation_matrix() for manual SECTION annotations so
the object is placed in the camera's annotation plane with the correct
rotation, matching how auto-generated section annotations are created.
Without this, annotations placed in elevation or section camera views
had identity rotation, causing the IFC representation to be in the wrong
coordinate system and failing to tessellate.

Also guard draw_edit_object_interface against non-IFC active objects to
prevent AssertionError during toolbar redraws, and skip IFC item edit
mode for ELEVATION/SECTION annotation types on placement.
This commit is contained in:
Ryan Schultz
2026-03-15 15:03:53 -05:00
parent 63fb5635ee
commit 28219973f6
2 changed files with 6 additions and 2 deletions
@@ -1898,7 +1898,10 @@ class AddAnnotation(bpy.types.Operator, tool.Ifc.Operator):
drawing=drawing, drawing=drawing,
object_type=props.object_type, object_type=props.object_type,
relating_type=tool.Ifc.get().by_id(int(props.relating_type_id)) if props.relating_type_id != "0" else None, relating_type=tool.Ifc.get().by_id(int(props.relating_type_id)) if props.relating_type_id != "0" else None,
enable_editing=True, # ELEVATION/SECTION annotations use simple empty/line geometry that
# cannot be tessellated by the IFC geometry engine, so skip IFC
# item edit mode for these types.
enable_editing=object_type not in ("ELEVATION", "SECTION"),
) )
if props.object_type == "IMAGE": if props.object_type == "IMAGE":
bpy.ops.bim.add_reference_image("INVOKE_DEFAULT", existing_object_by_name=obj.name) bpy.ops.bim.add_reference_image("INVOKE_DEFAULT", existing_object_by_name=obj.name)
@@ -230,7 +230,8 @@ class AnnotationToolUI:
@classmethod @classmethod
def draw_edit_object_interface(cls, context): def draw_edit_object_interface(cls, context):
if DecoratorData.get_text_data(bpy.context.active_object): obj = bpy.context.active_object
if tool.Ifc.get_entity(obj) and DecoratorData.get_text_data(obj):
add_layout_hotkey_operator(cls.layout, "Edit Text", "S_E", "") add_layout_hotkey_operator(cls.layout, "Edit Text", "S_E", "")
if bpy.ops.bim.copy_annotation_to_drawing.poll(): if bpy.ops.bim.copy_annotation_to_drawing.poll():
row = cls.layout.row(align=True) row = cls.layout.row(align=True)