Fix for #8710 - Changing colors doesn't qualify as a change to save project
This commit is contained in:
parent
e9f5551450
commit
eac1191b25
@ -66,6 +66,8 @@ struct Info
|
|||||||
|
|
||||||
bool operator==(const Info& rhs) const
|
bool operator==(const Info& rhs) const
|
||||||
{
|
{
|
||||||
|
if (rhs.gcodes.empty() && this->gcodes.empty())
|
||||||
|
return true; // don't respect to the comparison of the mode, when g_codes are empty
|
||||||
return (rhs.mode == this->mode ) &&
|
return (rhs.mode == this->mode ) &&
|
||||||
(rhs.gcodes == this->gcodes );
|
(rhs.gcodes == this->gcodes );
|
||||||
}
|
}
|
||||||
|
@ -3317,6 +3317,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
|||||||
|
|
||||||
sidebar->set_btn_label(ActionButtonType::abExport, _(label_btn_export));
|
sidebar->set_btn_label(ActionButtonType::abExport, _(label_btn_export));
|
||||||
sidebar->set_btn_label(ActionButtonType::abSendGCode, _(label_btn_send));
|
sidebar->set_btn_label(ActionButtonType::abSendGCode, _(label_btn_send));
|
||||||
|
dirty_state.update_from_preview();
|
||||||
|
|
||||||
const wxString slice_string = background_process.running() && wxGetApp().get_mode() == comSimple ?
|
const wxString slice_string = background_process.running() && wxGetApp().get_mode() == comSimple ?
|
||||||
_L("Slicing") + dots : _L("Slice now");
|
_L("Slicing") + dots : _L("Slice now");
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
#include "Plater.hpp"
|
#include "Plater.hpp"
|
||||||
|
|
||||||
|
#include "libslic3r/Model.hpp"
|
||||||
|
|
||||||
#include <boost/algorithm/string/predicate.hpp>
|
#include <boost/algorithm/string/predicate.hpp>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -38,12 +40,18 @@ void ProjectDirtyStateManager::update_from_presets()
|
|||||||
app.mainframe->update_title();
|
app.mainframe->update_title();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProjectDirtyStateManager::update_from_preview()
|
||||||
|
{
|
||||||
|
m_custom_gcode_per_print_z_dirty = m_initial_custom_gcode_per_print_z != wxGetApp().model().custom_gcode_per_print_z;
|
||||||
|
}
|
||||||
|
|
||||||
void ProjectDirtyStateManager::reset_after_save()
|
void ProjectDirtyStateManager::reset_after_save()
|
||||||
{
|
{
|
||||||
this->reset_initial_presets();
|
this->reset_initial_presets();
|
||||||
m_plater_dirty = false;
|
m_plater_dirty = false;
|
||||||
m_presets_dirty = false;
|
m_presets_dirty = false;
|
||||||
m_project_config_dirty = false;
|
m_project_config_dirty = false;
|
||||||
|
m_custom_gcode_per_print_z_dirty = false;
|
||||||
wxGetApp().mainframe->update_title();
|
wxGetApp().mainframe->update_title();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +62,7 @@ void ProjectDirtyStateManager::reset_initial_presets()
|
|||||||
for (const PresetCollection *preset_collection : app.get_active_preset_collections())
|
for (const PresetCollection *preset_collection : app.get_active_preset_collections())
|
||||||
m_initial_presets[preset_collection->type()] = preset_collection->get_selected_preset_name();
|
m_initial_presets[preset_collection->type()] = preset_collection->get_selected_preset_name();
|
||||||
m_initial_project_config = app.preset_bundle->project_config;
|
m_initial_project_config = app.preset_bundle->project_config;
|
||||||
|
m_initial_custom_gcode_per_print_z = app.model().custom_gcode_per_print_z;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW
|
#if ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define slic3r_ProjectDirtyStateManager_hpp_
|
#define slic3r_ProjectDirtyStateManager_hpp_
|
||||||
|
|
||||||
#include "libslic3r/Preset.hpp"
|
#include "libslic3r/Preset.hpp"
|
||||||
|
#include "libslic3r/CustomGCode.hpp"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
@ -11,10 +12,11 @@ class ProjectDirtyStateManager
|
|||||||
public:
|
public:
|
||||||
void update_from_undo_redo_stack(bool dirty);
|
void update_from_undo_redo_stack(bool dirty);
|
||||||
void update_from_presets();
|
void update_from_presets();
|
||||||
|
void update_from_preview();
|
||||||
void reset_after_save();
|
void reset_after_save();
|
||||||
void reset_initial_presets();
|
void reset_initial_presets();
|
||||||
|
|
||||||
bool is_dirty() const { return m_plater_dirty || m_project_config_dirty || m_presets_dirty; }
|
bool is_dirty() const { return m_plater_dirty || m_project_config_dirty || m_presets_dirty || m_custom_gcode_per_print_z_dirty; }
|
||||||
bool is_presets_dirty() const { return m_presets_dirty; }
|
bool is_presets_dirty() const { return m_presets_dirty; }
|
||||||
|
|
||||||
#if ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW
|
#if ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW
|
||||||
@ -28,9 +30,12 @@ private:
|
|||||||
bool m_presets_dirty { false };
|
bool m_presets_dirty { false };
|
||||||
// Is the project config dirty?
|
// Is the project config dirty?
|
||||||
bool m_project_config_dirty { false };
|
bool m_project_config_dirty { false };
|
||||||
|
// Is the custom_gcode_per_print_z dirty?
|
||||||
|
bool m_custom_gcode_per_print_z_dirty { false };
|
||||||
// Keeps track of preset names selected at the time of last project save.
|
// Keeps track of preset names selected at the time of last project save.
|
||||||
std::array<std::string, Preset::TYPE_COUNT> m_initial_presets;
|
std::array<std::string, Preset::TYPE_COUNT> m_initial_presets;
|
||||||
DynamicPrintConfig m_initial_project_config;
|
DynamicPrintConfig m_initial_project_config;
|
||||||
|
CustomGCode::Info m_initial_custom_gcode_per_print_z;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace GUI
|
} // namespace GUI
|
||||||
|
Loading…
Reference in New Issue
Block a user