mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-05-17 02:42:47 -07:00
WIP: Undo / Redo memory limiting by releasing the least recently
used snapshots. Memory limit set to 10% of physical system memory.
This commit is contained in:
@@ -71,9 +71,6 @@ static void take_snapshot(const wxString& snapshot_name)
|
||||
wxGetApp().plater()->take_snapshot(snapshot_name);
|
||||
}
|
||||
|
||||
static void suppress_snapshots(){ wxGetApp().plater()->suppress_snapshots(); }
|
||||
static void allow_snapshots() { wxGetApp().plater()->allow_snapshots(); }
|
||||
|
||||
ObjectList::ObjectList(wxWindow* parent) :
|
||||
wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE),
|
||||
m_parent(parent)
|
||||
@@ -2406,8 +2403,7 @@ void ObjectList::remove()
|
||||
|
||||
wxDataViewItem parent = wxDataViewItem(0);
|
||||
|
||||
take_snapshot(_(L("Delete Selected")));
|
||||
suppress_snapshots();
|
||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("Delete Selected")));
|
||||
|
||||
for (auto& item : sels)
|
||||
{
|
||||
@@ -2429,8 +2425,6 @@ void ObjectList::remove()
|
||||
|
||||
if (parent)
|
||||
select_item(parent);
|
||||
|
||||
allow_snapshots();
|
||||
}
|
||||
|
||||
void ObjectList::del_layer_range(const t_layer_height_range& range)
|
||||
@@ -2505,8 +2499,7 @@ void ObjectList::add_layer_range_after_current(const t_layer_height_range& curre
|
||||
|
||||
t_layer_height_range new_range = { midl_layer, next_range.second };
|
||||
|
||||
take_snapshot(_(L("Add New Layers Range")));
|
||||
suppress_snapshots();
|
||||
Plater::TakeSnapshot snapshot(wxGetApp().plater(), _(L("Add New Layers Range")));
|
||||
|
||||
// create new 2 layers instead of deleted one
|
||||
|
||||
@@ -2521,7 +2514,6 @@ void ObjectList::add_layer_range_after_current(const t_layer_height_range& curre
|
||||
new_range = { current_range.second, midl_layer };
|
||||
ranges[new_range] = get_default_layer_config(obj_idx);
|
||||
add_layer_item(new_range, layers_item, layer_idx);
|
||||
allow_snapshots();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3531,7 +3523,7 @@ void ObjectList::update_after_undo_redo()
|
||||
m_prevent_list_events = true;
|
||||
m_prevent_canvas_selection_update = true;
|
||||
|
||||
suppress_snapshots();
|
||||
Plater::SuppressSnapshots suppress(wxGetApp().plater());
|
||||
|
||||
// Unselect all objects before deleting them, so that no change of selection is emitted during deletion.
|
||||
this->UnselectAll();
|
||||
@@ -3543,8 +3535,6 @@ void ObjectList::update_after_undo_redo()
|
||||
++obj_idx;
|
||||
}
|
||||
|
||||
allow_snapshots();
|
||||
|
||||
#ifndef __WXOSX__
|
||||
selection_changed();
|
||||
#endif /* __WXOSX__ */
|
||||
|
||||
Reference in New Issue
Block a user