diff --git a/src/libslic3r/Preset.hpp b/src/libslic3r/Preset.hpp index d0e7561db..d19cb0aac 100644 --- a/src/libslic3r/Preset.hpp +++ b/src/libslic3r/Preset.hpp @@ -371,7 +371,7 @@ public: const Preset& get_edited_preset() const { return m_edited_preset; } // Return the last saved preset. - const Preset& get_saved_preset() const { return m_saved_preset; } +// const Preset& get_saved_preset() const { return m_saved_preset; } // Return vendor of the first parent profile, for which the vendor is defined, or null if such profile does not exist. PresetWithVendorProfile get_preset_with_vendor_profile(const Preset &preset) const; @@ -474,7 +474,7 @@ public: // Compare the content of get_saved_preset() with get_edited_preset() configs, return true if they differ. bool saved_is_dirty() const - { return is_dirty(&this->get_edited_preset(), &this->get_saved_preset()); } + { return is_dirty(&this->get_edited_preset(), &m_saved_preset); } // Compare the content of get_saved_preset() with get_edited_preset() configs, return the list of keys where they differ. // std::vector saved_dirty_options() const // { return dirty_options(&this->get_edited_preset(), &this->get_saved_preset(), /* deep_compare */ false); } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 5f1563526..fa53522d1 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -4703,10 +4703,8 @@ void Plater::load_project(const wxString& filename) std::vector input_paths; input_paths.push_back(into_path(filename)); - std::vector res = load_files(input_paths); - - // if res is empty no data has been loaded - if (!res.empty()) { + if (! load_files(input_paths).empty()) { + // At least one file was loaded. p->set_project_filename(filename); reset_project_dirty_initial_presets(); update_project_dirty_from_presets(); @@ -4741,8 +4739,7 @@ void Plater::add_model(bool imperial_units/* = false*/) } Plater::TakeSnapshot snapshot(this, snapshot_label); - std::vector res = load_files(paths, true, false, imperial_units); - if (!res.empty()) + if (! load_files(paths, true, false, imperial_units).empty()) wxGetApp().mainframe->update_title(); } diff --git a/src/slic3r/GUI/ProjectDirtyStateManager.cpp b/src/slic3r/GUI/ProjectDirtyStateManager.cpp index 9efc1dd90..3ca764e91 100644 --- a/src/slic3r/GUI/ProjectDirtyStateManager.cpp +++ b/src/slic3r/GUI/ProjectDirtyStateManager.cpp @@ -28,7 +28,7 @@ static const UndoRedo::Snapshot* get_active_snapshot(const UndoRedo::Stack& stac const size_t active_snapshot_time = stack.active_snapshot_time(); const auto it = std::lower_bound(snapshots.begin(), snapshots.end(), UndoRedo::Snapshot(active_snapshot_time)); const int idx = it - snapshots.begin() - 1; - const Slic3r::UndoRedo::Snapshot* ret = (0 <= idx && (size_t)idx < snapshots.size() - 1) ? + const Slic3r::UndoRedo::Snapshot* ret = (0 <= idx && idx < int(snapshots.size()) - 1) ? &snapshots[idx] : nullptr; assert(ret != nullptr); @@ -195,8 +195,7 @@ void ProjectDirtyStateManager::update_from_undo_redo_stack(UpdateType type) void ProjectDirtyStateManager::update_from_presets() { m_state.presets = false; - std::vector> selected_presets = wxGetApp().get_selected_presets(); - for (const auto& [type, name] : selected_presets) { + for (const auto& [type, name] : wxGetApp().get_selected_presets()) { m_state.presets |= !m_initial_presets[type].empty() && m_initial_presets[type] != name; } m_state.presets |= wxGetApp().has_unsaved_preset_changes(); @@ -214,6 +213,7 @@ void ProjectDirtyStateManager::reset_after_save() m_last_save.main = (saveable_snapshot != nullptr) ? saveable_snapshot->timestamp : 0; } else { + // Gizmo is active with its own Undo / Redo stack (for example the SLA support point editing gizmo). const UndoRedo::Snapshot* main_active_snapshot = get_active_snapshot(main_stack); if (boost::starts_with(main_active_snapshot->name, _utf8("Entering"))) { if (m_state.gizmos.current) @@ -231,8 +231,7 @@ void ProjectDirtyStateManager::reset_after_save() void ProjectDirtyStateManager::reset_initial_presets() { m_initial_presets = std::array(); - std::vector> selected_presets = wxGetApp().get_selected_presets(); - for (const auto& [type, name] : selected_presets) { + for (const auto& [type, name] : wxGetApp().get_selected_presets()) { m_initial_presets[type] = name; } }