mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 06:04:01 -06:00
Project dirty state manager -> Improvements to management of gizmos dirty state
This commit is contained in:
parent
8c3d098ff6
commit
ce73671f47
2 changed files with 56 additions and 3 deletions
|
@ -32,6 +32,42 @@ GLGizmoPainterBase::GLGizmoPainterBase(GLCanvas3D& parent, const std::string& ic
|
|||
|
||||
|
||||
|
||||
#if ENABLE_PROJECT_DIRTY_STATE
|
||||
// port of 948bc382655993721d93d3b9fce9b0186fcfb211
|
||||
void GLGizmoPainterBase::activate_internal_undo_redo_stack(bool activate)
|
||||
{
|
||||
Plater* plater = wxGetApp().plater();
|
||||
|
||||
// Following is needed to prevent taking an extra snapshot when the activation of
|
||||
// the internal stack happens when the gizmo is already active (such as open gizmo,
|
||||
// close gizmo, undo, start painting). The internal stack does not activate on the
|
||||
// undo, because that would obliterate all future of the main stack (user would
|
||||
// have to close the gizmo himself, he has no access to main undo/redo after the
|
||||
// internal stack opens). We don't want the "entering" snapshot taken in this case,
|
||||
// because there already is one.
|
||||
std::string last_snapshot_name;
|
||||
plater->undo_redo_topmost_string_getter(plater->can_undo(), last_snapshot_name);
|
||||
|
||||
if (activate && !m_internal_stack_active) {
|
||||
std::string str = get_painter_type() == PainterGizmoType::FDM_SUPPORTS
|
||||
? _u8L("Entering Paint-on supports")
|
||||
: _u8L("Entering Seam painting");
|
||||
if (last_snapshot_name != str)
|
||||
Plater::TakeSnapshot(plater, str);
|
||||
plater->enter_gizmos_stack();
|
||||
m_internal_stack_active = true;
|
||||
}
|
||||
if (!activate && m_internal_stack_active) {
|
||||
plater->leave_gizmos_stack();
|
||||
std::string str = get_painter_type() == PainterGizmoType::SEAM
|
||||
? _u8L("Leaving Seam painting")
|
||||
: _u8L("Leaving Paint-on supports");
|
||||
if (last_snapshot_name != str)
|
||||
Plater::TakeSnapshot(plater, str);
|
||||
m_internal_stack_active = false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
void GLGizmoPainterBase::activate_internal_undo_redo_stack(bool activate)
|
||||
{
|
||||
if (activate && ! m_internal_stack_active) {
|
||||
|
@ -51,6 +87,7 @@ void GLGizmoPainterBase::activate_internal_undo_redo_stack(bool activate)
|
|||
m_internal_stack_active = false;
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_PROJECT_DIRTY_STATE
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue