Fix of the Undo / Redo for Cut.

Added some more operations (for example Rotation) to the Undo / Redo.
This commit is contained in:
bubnikv 2019-07-05 19:46:48 +02:00
parent 4e2fda3315
commit 270fec84d3
4 changed files with 8 additions and 3 deletions

View File

@ -132,7 +132,7 @@ struct HashTableEdges {
~HashTableEdges() {
#ifndef NDEBUG
for (int i = 0; i < this->M; ++ i)
for (HashEdge *temp = this->heads[i]; this->heads[i] != this->tail; temp = this->heads[i])
for (HashEdge *temp = this->heads[i]; temp != this->tail; temp = temp->next)
++ this->freed;
this->tail = nullptr;
#endif /* NDEBUG */

View File

@ -302,6 +302,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
selection.synchronize_unselected_instances(Selection::SYNC_ROTATION_GENERAL);
selection.synchronize_unselected_volumes();
// Copy rotation values from GLVolumes into Model (ModelInstance / ModelVolume), trigger background processing.
wxGetApp().plater()->take_snapshot(_(L("Set Rotation")));
canvas->do_rotate();
UpdateAndShow(true);
@ -687,6 +688,7 @@ void ObjectManipulation::change_rotation_value(int axis, double value)
selection.rotate(
(M_PI / 180.0) * (transformation_type.absolute() ? rotation : rotation - m_cache.rotation),
transformation_type);
wxGetApp().plater()->take_snapshot(_(L("Set Orientation")));
canvas->do_rotate();
m_cache.rotation = rotation;

View File

@ -600,6 +600,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt, GLCanvas3D& canvas)
if (m_current == Flatten)
{
// Rotate the object so the normal points downward:
wxGetApp().plater()->take_snapshot(_(L("Place on Face")));
selection.flattening_rotate(get_flattening_normal());
canvas.do_flatten();
wxGetApp().obj_manipul()->set_dirty();
@ -685,6 +686,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt, GLCanvas3D& canvas)
}
case Rotate:
{
wxGetApp().plater()->take_snapshot(_(L("Rotate Object")));
canvas.do_rotate();
break;
}

View File

@ -2389,7 +2389,6 @@ void Plater::priv::deselect_all()
void Plater::priv::remove(size_t obj_idx)
{
this->take_snapshot(_(L("Remove Object")));
// Prevent toolpaths preview from rendering while we modify the Print object
preview->set_enabled(false);
@ -2406,7 +2405,7 @@ void Plater::priv::remove(size_t obj_idx)
void Plater::priv::delete_object_from_model(size_t obj_idx)
{
// this->take_snapshot(_(L("Delete Object"))); // ys_FIXME What is the difference with "Remove Object"?
this->take_snapshot(_(L("Delete Object")));
model.delete_object(obj_idx);
update();
object_list_changed();
@ -2850,6 +2849,8 @@ void Plater::priv::update_sla_scene()
void Plater::priv::reload_from_disk()
{
this->take_snapshot(_(L("Reload from Disk")));
const auto &selection = get_selection();
const auto obj_orig_idx = selection.get_object_idx();
if (selection.is_wipe_tower() || obj_orig_idx == -1) { return; }