Merge branch 'tm_arrange_mode_SPE-1733'
This commit is contained in:
commit
89d04c91e6
@ -243,7 +243,7 @@ coord_t get_skirt_offset(const Plater* plater) {
|
|||||||
|
|
||||||
void ArrangeJob::prepare()
|
void ArrangeJob::prepare()
|
||||||
{
|
{
|
||||||
wxGetKeyState(WXK_SHIFT) ? prepare_selected() : prepare_all();
|
m_selection_only ? prepare_selected() : prepare_all();
|
||||||
|
|
||||||
coord_t min_offset = 0;
|
coord_t min_offset = 0;
|
||||||
for (auto &ap : m_selected) {
|
for (auto &ap : m_selected) {
|
||||||
@ -307,7 +307,10 @@ void ArrangeJob::process(Ctl &ctl)
|
|||||||
_u8L("Arranging done."));
|
_u8L("Arranging done."));
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrangeJob::ArrangeJob() : m_plater{wxGetApp().plater()} {}
|
ArrangeJob::ArrangeJob(Mode mode)
|
||||||
|
: m_plater{wxGetApp().plater()},
|
||||||
|
m_selection_only{mode == Mode::SelectionOnly}
|
||||||
|
{}
|
||||||
|
|
||||||
static std::string concat_strings(const std::set<std::string> &strings,
|
static std::string concat_strings(const std::set<std::string> &strings,
|
||||||
const std::string &delim = "\n")
|
const std::string &delim = "\n")
|
||||||
|
@ -24,6 +24,7 @@ class ArrangeJob : public Job
|
|||||||
coord_t m_min_bed_inset = 0.;
|
coord_t m_min_bed_inset = 0.;
|
||||||
|
|
||||||
Plater *m_plater;
|
Plater *m_plater;
|
||||||
|
bool m_selection_only = false;
|
||||||
|
|
||||||
// clear m_selected and m_unselected, reserve space for next usage
|
// clear m_selected and m_unselected, reserve space for next usage
|
||||||
void clear_input();
|
void clear_input();
|
||||||
@ -39,11 +40,13 @@ class ArrangeJob : public Job
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
enum Mode { Full, SelectionOnly };
|
||||||
|
|
||||||
void prepare();
|
void prepare();
|
||||||
|
|
||||||
void process(Ctl &ctl) override;
|
void process(Ctl &ctl) override;
|
||||||
|
|
||||||
ArrangeJob();
|
ArrangeJob(Mode mode = Full);
|
||||||
|
|
||||||
int status_range() const
|
int status_range() const
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "Plater.hpp"
|
#include "Plater.hpp"
|
||||||
|
#include "slic3r/GUI/Jobs/UIThreadWorker.hpp"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -6311,7 +6312,9 @@ void Plater::cut(size_t obj_idx, const ModelObjectPtrs& new_objects)
|
|||||||
for (size_t i = 0; i < new_objects.size(); ++i)
|
for (size_t i = 0; i < new_objects.size(); ++i)
|
||||||
selection.add_object((unsigned int)(last_id - i), i == 0);
|
selection.add_object((unsigned int)(last_id - i), i == 0);
|
||||||
|
|
||||||
arrange();
|
UIThreadWorker w;
|
||||||
|
replace_job(w, std::make_unique<ArrangeJob>(ArrangeJob::SelectionOnly));
|
||||||
|
w.process_events();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::export_gcode(bool prefer_removable)
|
void Plater::export_gcode(bool prefer_removable)
|
||||||
@ -7196,7 +7199,11 @@ void Plater::arrange()
|
|||||||
if (p->can_arrange()) {
|
if (p->can_arrange()) {
|
||||||
auto &w = get_ui_job_worker();
|
auto &w = get_ui_job_worker();
|
||||||
p->take_snapshot(_L("Arrange"));
|
p->take_snapshot(_L("Arrange"));
|
||||||
replace_job(w, std::make_unique<ArrangeJob>());
|
|
||||||
|
auto mode = wxGetKeyState(WXK_SHIFT) ? ArrangeJob::SelectionOnly :
|
||||||
|
ArrangeJob::Full;
|
||||||
|
|
||||||
|
replace_job(w, std::make_unique<ArrangeJob>(mode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user