diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2019-07-23 16:14:08 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2019-07-23 16:14:08 +0300 |
commit | 0d10d8aba706ef08cfd8f15c8edcaf0c24ac0b14 (patch) | |
tree | 2bdde426ec1fc82f1361bd8521b33a572fbfce14 /src/slic3r/GUI/Selection.hpp | |
parent | 3fe355509ce2dd4d9e99cbc6b977bee6ceba4699 (diff) |
1st installment for selection's undo/redo snapshots
Diffstat (limited to 'src/slic3r/GUI/Selection.hpp')
-rw-r--r-- | src/slic3r/GUI/Selection.hpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/slic3r/GUI/Selection.hpp b/src/slic3r/GUI/Selection.hpp index 915a8c855..2a96985c3 100644 --- a/src/slic3r/GUI/Selection.hpp +++ b/src/slic3r/GUI/Selection.hpp @@ -235,7 +235,19 @@ public: void add_volume(unsigned int object_idx, unsigned int volume_idx, int instance_idx, bool as_single_selection = true); void remove_volume(unsigned int object_idx, unsigned int volume_idx); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#if ENABLE_SELECTION_UNDO_REDO + void add_volumes(EMode mode, const std::vector<unsigned int>& volume_idxs, bool as_single_selection = true); + void remove_volumes(EMode mode, const std::vector<unsigned int>& volume_idxs); +#endif // ENABLE_SELECTION_UNDO_REDO +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + void add_all(); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#if ENABLE_SELECTION_UNDO_REDO + void remove_all(); +#endif // ENABLE_SELECTION_UNDO_REDO +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // To be called after Undo or Redo once the volumes are updated. void set_deserialized(EMode mode, const std::vector<std::pair<size_t, size_t>> &volumes_and_instances); @@ -265,6 +277,17 @@ public: bool is_sla_compliant() const; bool contains_volume(unsigned int volume_idx) const { return m_list.find(volume_idx) != m_list.end(); } +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#if ENABLE_SELECTION_UNDO_REDO + // returns true if the selection contains all the given indices + bool contains_all_volumes(const std::vector<unsigned int>& volume_idxs) const; + // returns true if the selection contains at least one of the given indices + bool contains_any_volume(const std::vector<unsigned int>& volume_idxs) const; + // returns true if the selection contains all and only the given indices + bool matches(const std::vector<unsigned int>& volume_idxs) const; +#endif // ENABLE_SELECTION_UNDO_REDO +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + bool requires_uniform_scale() const; // Returns the the object id if the selection is from a single object, otherwise is -1 @@ -314,13 +337,36 @@ public: const Clipboard& get_clipboard() const { return m_clipboard; } +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#if ENABLE_SELECTION_UNDO_REDO + // returns the list of idxs of the volumes contained into the object with the given idx + std::vector<unsigned int> get_volume_idxs_from_object(unsigned int object_idx) const; + // returns the list of idxs of the volumes contained into the instance with the given idxs + std::vector<unsigned int> get_volume_idxs_from_instance(unsigned int object_idx, unsigned int instance_idx) const; + // returns the idx of the volume corresponding to the volume with the given idxs + std::vector<unsigned int> get_volume_idxs_from_volume(unsigned int object_idx, unsigned int instance_idx, unsigned int volume_idx) const; + // returns the list of idxs of the volumes contained in the selection but not in the given list + std::vector<unsigned int> get_missing_volume_idxs_from(const std::vector<unsigned int>& volume_idxs) const; + // returns the list of idxs of the volumes contained in the given list but not in the selection + std::vector<unsigned int> get_unselected_volume_idxs_from(const std::vector<unsigned int>& volume_idxs) const; +#endif // ENABLE_SELECTION_UNDO_REDO +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + private: void update_valid(); void update_type(); void set_caches(); void do_add_volume(unsigned int volume_idx); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#if ENABLE_SELECTION_UNDO_REDO + void do_add_volumes(const std::vector<unsigned int>& volume_idxs); +#else +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ void do_add_instance(unsigned int object_idx, unsigned int instance_idx); void do_add_object(unsigned int object_idx); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ +#endif // ENABLE_SELECTION_UNDO_REDO +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ void do_remove_volume(unsigned int volume_idx); void do_remove_instance(unsigned int object_idx, unsigned int instance_idx); void do_remove_object(unsigned int object_idx); |