FIX: [STUDIO-3068] optimize loading into object list

Change-Id: I8367b41ee0c3149f62372c285237cbc736a690cd
This commit is contained in:
chunmao.guo 2023-06-06 09:15:00 +08:00 committed by Lane.Wei
parent 42bde27302
commit 2f2c131599
3 changed files with 20 additions and 3 deletions

View file

@ -3565,6 +3565,18 @@ void ObjectList::update_info_items(size_t obj_idx, wxDataViewItemArray* selectio
} }
void ObjectList::add_objects_to_list(std::vector<size_t> obj_idxs, bool call_selection_changed, bool notify_partplate, bool do_info_update)
{
#ifdef __WXOSX__
AssociateModel(nullptr);
#endif
for (const size_t idx : obj_idxs) {
add_object_to_list(idx, call_selection_changed, notify_partplate, do_info_update);
}
#ifdef __WXOSX__
AssociateModel(m_objects_model);
#endif
}
void ObjectList::add_object_to_list(size_t obj_idx, bool call_selection_changed, bool notify_partplate, bool do_info_update) void ObjectList::add_object_to_list(size_t obj_idx, bool call_selection_changed, bool notify_partplate, bool do_info_update)
{ {
@ -3807,10 +3819,16 @@ void ObjectList::update_lock_icons_for_model()
void ObjectList::delete_all_objects_from_list() void ObjectList::delete_all_objects_from_list()
{ {
#ifdef __WXOSX__
AssociateModel(nullptr);
#endif
m_prevent_list_events = true; m_prevent_list_events = true;
reload_all_plates(); reload_all_plates();
m_prevent_list_events = false; m_prevent_list_events = false;
part_selection_changed(); part_selection_changed();
#ifdef __WXOSX__
AssociateModel(m_objects_model);
#endif
} }
void ObjectList::increase_object_instances(const size_t obj_idx, const size_t num) void ObjectList::increase_object_instances(const size_t obj_idx, const size_t num)

View file

@ -326,6 +326,7 @@ public:
// Add object to the list // Add object to the list
// @param do_info_update: [Arthur] this function becomes slow as more functions are added, but I only need a fast version in FillBedJob, and I don't care about any info updates, so I pass a do_info_update param to skip all the uneccessary steps. // @param do_info_update: [Arthur] this function becomes slow as more functions are added, but I only need a fast version in FillBedJob, and I don't care about any info updates, so I pass a do_info_update param to skip all the uneccessary steps.
void add_objects_to_list(std::vector<size_t> obj_idxs, bool call_selection_changed = true, bool notify_partplate = true, bool do_info_update = true);
void add_object_to_list(size_t obj_idx, bool call_selection_changed = true, bool notify_partplate = true, bool do_info_update = true); void add_object_to_list(size_t obj_idx, bool call_selection_changed = true, bool notify_partplate = true, bool do_info_update = true);
// Add object's volumes to the list // Add object's volumes to the list
// Return selected items, if add_to_selection is defined // Return selected items, if add_to_selection is defined

View file

@ -3863,9 +3863,7 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs& mode
//} //}
notification_manager->close_notification_of_type(NotificationType::UpdatedItemsInfo); notification_manager->close_notification_of_type(NotificationType::UpdatedItemsInfo);
for (const size_t idx : obj_idxs) { wxGetApp().obj_list()->add_objects_to_list(obj_idxs);
wxGetApp().obj_list()->add_object_to_list(idx);
}
update(); update();
// Update InfoItems in ObjectList after update() to use of a correct value of the GLCanvas3D::is_sinking(), // Update InfoItems in ObjectList after update() to use of a correct value of the GLCanvas3D::is_sinking(),