assign_class - reload representation after assignment

Just to make sure user will set what was actually saved to IFC right away. To prevent confusion when they see it only after model was reloaded completely.
This commit is contained in:
Andrej730
2025-04-10 19:11:21 +05:00
parent d8102d848d
commit ffffcc576e
@@ -290,6 +290,7 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator):
should_sync_changes_first=False,
)
else:
# TODO: replace empty geometry meshes with empties.
element = core.assign_class(
tool.Ifc,
tool.Collector,
@@ -301,6 +302,17 @@ class AssignClass(bpy.types.Operator, tool.Ifc.Operator):
context=ifc_context,
ifc_representation_class=self.ifc_representation_class,
)
tool.Geometry.reload_representation(obj)
# TODO: reload representation might lead to the object being replaced by object of the other type.
# We probably should track it somehow and keep the original selection.
# Validation selection.
new_selected_objects = list(filter(tool.Blender.is_valid_data_block, current_selection[2]))
active_object = current_selection[1]
if active_object and not tool.Blender.is_valid_data_block(active_object):
active_object = None
current_selection = (current_selection[0], active_object, new_selected_objects)
tool.Blender.set_objects_selection(*current_selection)