mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-29 11:41:20 -06:00
Not handling logical beds in arrange()
This commit is contained in:
parent
9372f1c6ad
commit
df7bb94daf
12 changed files with 256 additions and 272 deletions
|
|
@ -5739,7 +5739,7 @@ const SLAPrint* GLCanvas3D::sla_print() const
|
|||
return (m_process == nullptr) ? nullptr : m_process->sla_print();
|
||||
}
|
||||
|
||||
void GLCanvas3D::WipeTowerInfo::apply_arrange_result(Vec2d offset, double rotation_rads, unsigned /*bed_num*/)
|
||||
void GLCanvas3D::WipeTowerInfo::apply_arrange_result(Vec2d offset, double rotation_rads)
|
||||
{
|
||||
m_pos = offset;
|
||||
m_rotation = rotation_rads;
|
||||
|
|
|
|||
|
|
@ -612,7 +612,7 @@ public:
|
|||
int get_move_volume_id() const { return m_mouse.drag.move_volume_idx; }
|
||||
int get_first_hover_volume_idx() const { return m_hover_volume_idxs.empty() ? -1 : m_hover_volume_idxs.front(); }
|
||||
|
||||
class WipeTowerInfo: public arrangement::Arrangeable {
|
||||
class WipeTowerInfo {
|
||||
Vec2d m_pos = {std::nan(""), std::nan("")};
|
||||
Vec2d m_bb_size;
|
||||
double m_rotation;
|
||||
|
|
@ -624,9 +624,9 @@ public:
|
|||
return !std::isnan(m_pos.x()) && !std::isnan(m_pos.y());
|
||||
}
|
||||
|
||||
virtual void apply_arrange_result(Vec2d offset, double rotation_rads, unsigned /*bed_num*/) override;
|
||||
|
||||
virtual std::tuple<Polygon, Vec2crd, double> get_arrange_polygon() const override
|
||||
void apply_arrange_result(Vec2d offset, double rotation_rads);
|
||||
|
||||
arrangement::ArrangePolygon get_arrange_polygon() const
|
||||
{
|
||||
Polygon p({
|
||||
{coord_t(0), coord_t(0)},
|
||||
|
|
@ -635,8 +635,9 @@ public:
|
|||
{coord_t(0), scaled(m_bb_size(Y))},
|
||||
{coord_t(0), coord_t(0)},
|
||||
});
|
||||
|
||||
return std::make_tuple(p, scaled(m_pos), m_rotation);
|
||||
|
||||
ExPolygon ep; ep.contour = std::move(p);
|
||||
return {ep, scaled(m_pos), m_rotation};
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1217,28 +1217,6 @@ bool PlaterDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &fi
|
|||
return true;
|
||||
}
|
||||
|
||||
namespace {
|
||||
arrangement::ArrangeablePtrs get_arrange_input(Model &model, const Selection &sel) {
|
||||
auto selmap = sel.get_content();
|
||||
|
||||
size_t count = 0;
|
||||
for (auto obj : model.objects) count += obj->instances.size();
|
||||
|
||||
arrangement::ArrangeablePtrs ret; ret.reserve(count);
|
||||
|
||||
if (selmap.empty())
|
||||
for (ModelObject *mo : model.objects)
|
||||
for (ModelInstance *minst : mo->instances)
|
||||
ret.emplace_back(minst);
|
||||
else
|
||||
for (auto &s : selmap)
|
||||
for (auto &instid : s.second)
|
||||
ret.emplace_back(model.objects[s.first]->instances[instid]);
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
// Plater / private
|
||||
struct Plater::priv
|
||||
{
|
||||
|
|
@ -1447,17 +1425,18 @@ struct Plater::priv
|
|||
class ArrangeJob : public Job
|
||||
{
|
||||
GLCanvas3D::WipeTowerInfo m_wti;
|
||||
arrangement::ArrangeablePtrs m_selected, m_unselected;
|
||||
|
||||
static std::array<arrangement::ArrangeablePtrs, 2> collect(
|
||||
arrangement::ArrangePolygons m_selected, m_unselected;
|
||||
|
||||
static std::array<arrangement::ArrangePolygons, 2> collect(
|
||||
Model &model, const Selection &sel)
|
||||
{
|
||||
auto selmap = sel.get_content();
|
||||
|
||||
const Selection::ObjectIdxsToInstanceIdxsMap &selmap =
|
||||
sel.get_content();
|
||||
|
||||
size_t count = 0;
|
||||
for (auto obj : model.objects) count += obj->instances.size();
|
||||
|
||||
arrangement::ArrangeablePtrs selected, unselected;
|
||||
arrangement::ArrangePolygons selected, unselected;
|
||||
selected.reserve(count + 1 /* for optional wti */);
|
||||
unselected.reserve(count + 1 /* for optional wti */);
|
||||
|
||||
|
|
@ -1475,12 +1454,12 @@ struct Plater::priv
|
|||
ModelInstance *inst = model.objects[oidx]
|
||||
->instances[iidx];
|
||||
instit == iids.end() ?
|
||||
unselected.emplace_back(inst) :
|
||||
selected.emplace_back(inst);
|
||||
unselected.emplace_back(inst->get_arrange_polygon()) :
|
||||
selected.emplace_back(inst->get_arrange_polygon());
|
||||
}
|
||||
} else // object not selected, all instances are unselected
|
||||
for (auto inst : model.objects[oidx]->instances)
|
||||
unselected.emplace_back(inst);
|
||||
unselected.emplace_back(inst->get_arrange_polygon());
|
||||
}
|
||||
|
||||
if (selected.empty()) selected.swap(unselected);
|
||||
|
|
@ -1495,14 +1474,15 @@ struct Plater::priv
|
|||
m_wti = plater().view3D->get_canvas3d()->get_wipe_tower_info();
|
||||
|
||||
const Selection& sel = plater().get_selection();
|
||||
BoundingBoxf bedbb(plater().bed.get_shape());
|
||||
auto arrinput = collect(plater().model, sel);
|
||||
m_selected.swap(arrinput[0]);
|
||||
m_unselected.swap(arrinput[1]);
|
||||
|
||||
if (m_wti)
|
||||
sel.is_wipe_tower() ?
|
||||
m_selected.emplace_back(&m_wti) :
|
||||
m_unselected.emplace_back(&m_wti);
|
||||
m_selected.emplace_back(m_wti.get_arrange_polygon()) :
|
||||
m_unselected.emplace_back(m_wti.get_arrange_polygon());
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue