mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 00:45:57 +08:00
Reduce amount of Undo/Redo snapshots
This commit is contained in:
parent
6181b166a4
commit
8f9887acdb
@ -13,6 +13,7 @@
|
|||||||
#include "slic3r/GUI/Jobs/NotificationProgressIndicator.hpp"
|
#include "slic3r/GUI/Jobs/NotificationProgressIndicator.hpp"
|
||||||
#include "slic3r/Utils/WxFontUtils.hpp"
|
#include "slic3r/Utils/WxFontUtils.hpp"
|
||||||
#include "slic3r/Utils/FontListSerializable.hpp"
|
#include "slic3r/Utils/FontListSerializable.hpp"
|
||||||
|
#include "slic3r/Utils/UndoRedo.hpp"
|
||||||
|
|
||||||
// TODO: remove include
|
// TODO: remove include
|
||||||
#include "libslic3r/SVG.hpp" // debug store
|
#include "libslic3r/SVG.hpp" // debug store
|
||||||
@ -979,7 +980,7 @@ void GLGizmoEmboss::draw_model_type()
|
|||||||
if (m_volume != nullptr && new_type.has_value() && !is_last_solid_part) {
|
if (m_volume != nullptr && new_type.has_value() && !is_last_solid_part) {
|
||||||
GUI_App &app = wxGetApp();
|
GUI_App &app = wxGetApp();
|
||||||
Plater * plater = app.plater();
|
Plater * plater = app.plater();
|
||||||
plater->take_snapshot(_L("Change Part Type"));
|
Plater::TakeSnapshot snapshot(plater, _L("Change Part Type"), UndoRedo::SnapshotType::GizmoAction);
|
||||||
m_volume->set_type(*new_type);
|
m_volume->set_type(*new_type);
|
||||||
|
|
||||||
// inspiration in ObjectList::change_part_type()
|
// inspiration in ObjectList::change_part_type()
|
||||||
|
@ -72,10 +72,10 @@ protected:
|
|||||||
void on_start_dragging() override;
|
void on_start_dragging() override;
|
||||||
void on_stop_dragging() override;
|
void on_stop_dragging() override;
|
||||||
|
|
||||||
//bool wants_enter_leave_snapshots() const override { return true; }
|
bool wants_enter_leave_snapshots() const override { return true; }
|
||||||
//std::string get_gizmo_entering_text() const override { return _u8L("Enter emboss gizmo"); }
|
std::string get_gizmo_entering_text() const override { return _u8L("Enter emboss gizmo"); }
|
||||||
//std::string get_gizmo_leaving_text() const override { return _u8L("Leave emboss gizmo"); }
|
std::string get_gizmo_leaving_text() const override { return _u8L("Leave emboss gizmo"); }
|
||||||
//std::string get_action_snapshot_name() override { return _u8L("Emboss action"); }
|
std::string get_action_snapshot_name() override { return _u8L("Embossing actions"); }
|
||||||
private:
|
private:
|
||||||
void initialize();
|
void initialize();
|
||||||
static FontList create_default_font_list();
|
static FontList create_default_font_list();
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "slic3r/GUI/GUI_ObjectManipulation.hpp"
|
#include "slic3r/GUI/GUI_ObjectManipulation.hpp"
|
||||||
#include "slic3r/GUI/Gizmos/GLGizmoEmboss.hpp"
|
#include "slic3r/GUI/Gizmos/GLGizmoEmboss.hpp"
|
||||||
#include "slic3r/GUI/CameraUtils.hpp"
|
#include "slic3r/GUI/CameraUtils.hpp"
|
||||||
|
#include "slic3r/Utils/UndoRedo.hpp"
|
||||||
|
|
||||||
using namespace Slic3r;
|
using namespace Slic3r;
|
||||||
using namespace GUI;
|
using namespace GUI;
|
||||||
@ -49,7 +50,10 @@ void EmbossUpdateJob::finalize(bool canceled, std::exception_ptr &)
|
|||||||
// Check emboss gizmo is still open
|
// Check emboss gizmo is still open
|
||||||
if (manager.get_current_type() != GLGizmosManager::Emboss) return;
|
if (manager.get_current_type() != GLGizmosManager::Emboss) return;
|
||||||
|
|
||||||
plater->take_snapshot(_L("Emboss text") + ": " + m_input->volume_name);
|
Plater::TakeSnapshot snapshot(plater,
|
||||||
|
GUI::format(_L("Text: %1%"),
|
||||||
|
m_input->text_configuration.text),
|
||||||
|
UndoRedo::SnapshotType::GizmoAction);
|
||||||
|
|
||||||
ModelVolume *volume = m_input->volume;
|
ModelVolume *volume = m_input->volume;
|
||||||
// find volume by object id - NOT WORK
|
// find volume by object id - NOT WORK
|
||||||
@ -162,7 +166,7 @@ void EmbossCreateJob::finalize(bool canceled, std::exception_ptr &)
|
|||||||
// decide if create object or volume
|
// decide if create object or volume
|
||||||
bool create_object = !m_input->object_idx.has_value();
|
bool create_object = !m_input->object_idx.has_value();
|
||||||
if (create_object) {
|
if (create_object) {
|
||||||
plater->take_snapshot(_L("Add Emboss text object"));
|
Plater::TakeSnapshot snapshot(plater, _L("Add Emboss text object"));
|
||||||
// Create new object and change selection
|
// Create new object and change selection
|
||||||
bool center = false;
|
bool center = false;
|
||||||
obj_list->load_mesh_object(std::move(m_result), m_input->volume_name, center,
|
obj_list->load_mesh_object(std::move(m_result), m_input->volume_name, center,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user