mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-25 17:51:10 -06:00
Arranging with new structure.
This commit is contained in:
parent
19e6bf58dd
commit
299e4f74c7
11 changed files with 189 additions and 479 deletions
|
|
@ -5739,10 +5739,10 @@ const SLAPrint* GLCanvas3D::sla_print() const
|
|||
return (m_process == nullptr) ? nullptr : m_process->sla_print();
|
||||
}
|
||||
|
||||
void GLCanvas3D::WipeTowerInfo::set_arrange_result(Vec2d offset, double rotation_rads)
|
||||
void GLCanvas3D::WipeTowerInfo::apply_arrange_result(Vec2d offset, double rotation_rads)
|
||||
{
|
||||
m_pos += offset;
|
||||
m_rotation += rotation_rads;
|
||||
m_pos = offset;
|
||||
m_rotation = rotation_rads;
|
||||
DynamicPrintConfig cfg;
|
||||
cfg.opt<ConfigOptionFloat>("wipe_tower_x", true)->value = m_pos(X);
|
||||
cfg.opt<ConfigOptionFloat>("wipe_tower_y", true)->value = m_pos(Y);
|
||||
|
|
|
|||
|
|
@ -613,7 +613,7 @@ public:
|
|||
int get_first_hover_volume_idx() const { return m_hover_volume_idxs.empty() ? -1 : m_hover_volume_idxs.front(); }
|
||||
|
||||
class WipeTowerInfo: public arr::Arrangeable {
|
||||
Vec2d m_pos = {std::nan(""), std::nan("")};
|
||||
Vec2d m_pos = {std::nan(""), std::nan("")};
|
||||
Vec2d m_bb_size;
|
||||
double m_rotation;
|
||||
friend class GLCanvas3D;
|
||||
|
|
@ -621,12 +621,12 @@ public:
|
|||
|
||||
inline operator bool() const
|
||||
{
|
||||
return std::isnan(m_pos.x()) || std::isnan(m_pos.y());
|
||||
return !std::isnan(m_pos.x()) && !std::isnan(m_pos.y());
|
||||
}
|
||||
|
||||
virtual void set_arrange_result(Vec2d offset, double rotation_rads) final;
|
||||
virtual void apply_arrange_result(Vec2d offset, double rotation_rads) final;
|
||||
|
||||
virtual Polygon get_arrange_polygon() const final
|
||||
virtual std::tuple<Polygon, Vec2crd, double> get_arrange_polygon() const final
|
||||
{
|
||||
Polygon p({
|
||||
{coord_t(0), coord_t(0)},
|
||||
|
|
@ -636,9 +636,7 @@ public:
|
|||
{coord_t(0), coord_t(0)},
|
||||
});
|
||||
|
||||
p.rotate(m_rotation);
|
||||
p.translate(scaled(m_pos));
|
||||
return p;
|
||||
return std::make_tuple(p, scaled(m_pos), m_rotation);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2357,7 +2357,7 @@ void Plater::priv::remove(size_t obj_idx)
|
|||
|
||||
|
||||
void Plater::priv::delete_object_from_model(size_t obj_idx)
|
||||
{
|
||||
{
|
||||
model.delete_object(obj_idx);
|
||||
update();
|
||||
object_list_changed();
|
||||
|
|
@ -2422,11 +2422,15 @@ arr::BedShapeHint Plater::priv::get_bed_shape_hint() const {
|
|||
|
||||
void Plater::priv::ExclusiveJobGroup::ArrangeJob::process() {
|
||||
static const auto arrangestr = _(L("Arranging"));
|
||||
|
||||
arr::ArrangeableRefs arrangeinput; arrangeinput.reserve(m_count);
|
||||
|
||||
// Collect the model instances and place them into the input vector
|
||||
arr::Arrangeables arrangeinput; arrangeinput.reserve(m_count);
|
||||
for(ModelObject *mo : plater().model.objects)
|
||||
for(ModelInstance *minst : mo->instances)
|
||||
arrangeinput.emplace_back(std::ref(*minst));
|
||||
arrangeinput.emplace_back(minst);
|
||||
|
||||
// Place back the wipe tower if that's available.
|
||||
if (m_wti) arrangeinput.emplace_back(&m_wti);
|
||||
|
||||
// FIXME: I don't know how to obtain the minimum distance, it depends
|
||||
// on printer technology. I guess the following should work but it crashes.
|
||||
|
|
@ -3456,7 +3460,7 @@ void Plater::priv::set_bed_shape(const Pointfs& shape)
|
|||
|
||||
bool Plater::priv::can_delete() const
|
||||
{
|
||||
return !get_selection().is_empty() && !get_selection().is_wipe_tower();
|
||||
return !get_selection().is_empty() && !get_selection().is_wipe_tower() && !m_ui_jobs.is_any_running();
|
||||
}
|
||||
|
||||
bool Plater::priv::can_delete_all() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue