IFC Delete - add logs to system console

In some cases deletion can take ages, so there should be at least some way for user to find out how it's going.
This commit is contained in:
Andrej730
2025-02-19 18:31:27 +05:00
parent 8b92b28dfc
commit 4bb32b252d
@@ -731,6 +731,7 @@ class OverrideDelete(bpy.types.Operator):
if self.is_batch: if self.is_batch:
row = self.layout.row() row = self.layout.row()
row.label(text="Warning: Faster deletion will use more memory.", icon="ERROR") row.label(text="Warning: Faster deletion will use more memory.", icon="ERROR")
row.label(text="See system console for deletion progress.")
def _execute(self, context: bpy.types.Context): def _execute(self, context: bpy.types.Context):
start_time = time() start_time = time()
@@ -740,8 +741,19 @@ class OverrideDelete(bpy.types.Operator):
self.process_arrays(context) self.process_arrays(context)
clear_active_object = True clear_active_object = True
for obj in context.selected_objects: objects_to_remove = context.selectable_objects
if not tool.Blender.is_valid_data_block(obj): for i, obj in enumerate(objects_to_remove):
# Log time.
time_since_start = time() - start_time
is_valid_data_block = tool.Blender.is_valid_data_block(obj)
if time_since_start > 10:
obj_name = f" ({obj.name})" if is_valid_data_block else ""
print(
f"Removing object {i}/{len(objects_to_remove)}{obj_name}. "
f"Time since start: {time_since_start:.2f} seconds."
)
if not is_valid_data_block:
continue continue
element = tool.Ifc.get_entity(obj) element = tool.Ifc.get_entity(obj)
if element: if element: