mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-09-26 11:43:16 +08:00
Arrange: Fix local arrange in SLA mode
This commit is contained in:
parent
e588d80e23
commit
4f7366045e
@ -497,12 +497,14 @@ class ArrangeableSLAPrintObject : public Arrangeable
|
|||||||
const SLAPrintObject *m_po;
|
const SLAPrintObject *m_po;
|
||||||
Arrangeable *m_arrbl;
|
Arrangeable *m_arrbl;
|
||||||
Transform3d m_inst_trafo;
|
Transform3d m_inst_trafo;
|
||||||
|
std::optional<int> m_bed_constraint;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ArrangeableSLAPrintObject(const SLAPrintObject *po,
|
ArrangeableSLAPrintObject(const SLAPrintObject *po,
|
||||||
Arrangeable *arrbl,
|
Arrangeable *arrbl,
|
||||||
|
const std::optional<int> bed_constraint,
|
||||||
const Transform3d &inst_tr = Transform3d::Identity())
|
const Transform3d &inst_tr = Transform3d::Identity())
|
||||||
: m_po{po}, m_arrbl{arrbl}, m_inst_trafo{inst_tr}
|
: m_po{po}, m_arrbl{arrbl}, m_inst_trafo{inst_tr}, m_bed_constraint(bed_constraint)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ObjectID id() const override { return m_arrbl->id(); }
|
ObjectID id() const override { return m_arrbl->id(); }
|
||||||
@ -524,6 +526,8 @@ public:
|
|||||||
return m_arrbl->assign_bed(bedidx);
|
return m_arrbl->assign_bed(bedidx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::optional<int> bed_constraint() const override { return m_bed_constraint; }
|
||||||
|
|
||||||
bool is_printable() const override { return m_arrbl->is_printable(); }
|
bool is_printable() const override { return m_arrbl->is_printable(); }
|
||||||
bool is_selected() const override { return m_arrbl->is_selected(); }
|
bool is_selected() const override { return m_arrbl->is_selected(); }
|
||||||
int priority() const override { return m_arrbl->priority(); }
|
int priority() const override { return m_arrbl->priority(); }
|
||||||
|
@ -623,8 +623,9 @@ void ArrangeableSLAPrint::for_each_arrangeable_(Self &&self, Fn &&fn)
|
|||||||
InstPos pos;
|
InstPos pos;
|
||||||
for (auto *obj : self.m_model->objects) {
|
for (auto *obj : self.m_model->objects) {
|
||||||
for (auto *inst : obj->instances) {
|
for (auto *inst : obj->instances) {
|
||||||
|
if (!self.m_considered_instances || should_include_instance(inst->id(), *self.m_considered_instances)) {
|
||||||
ArrangeableModelInstance ainst{inst, self.m_vbed_handler.get(),
|
ArrangeableModelInstance ainst{inst, self.m_vbed_handler.get(),
|
||||||
self.m_selmask.get(), pos, std::nullopt};
|
self.m_selmask.get(), pos, get_bed_constraint(inst->id(), self.m_bed_constraints)};
|
||||||
|
|
||||||
auto obj_id = inst->get_object()->id();
|
auto obj_id = inst->get_object()->id();
|
||||||
const SLAPrintObject *po =
|
const SLAPrintObject *po =
|
||||||
@ -633,12 +634,17 @@ void ArrangeableSLAPrint::for_each_arrangeable_(Self &&self, Fn &&fn)
|
|||||||
if (po) {
|
if (po) {
|
||||||
auto &vbh = self.m_vbed_handler;
|
auto &vbh = self.m_vbed_handler;
|
||||||
auto phtr = vbh->get_physical_bed_trafo(vbh->get_bed_index(VBedPlaceableMI{*inst}));
|
auto phtr = vbh->get_physical_bed_trafo(vbh->get_bed_index(VBedPlaceableMI{*inst}));
|
||||||
ArrangeableSLAPrintObject ainst_po{po, &ainst, phtr * inst->get_matrix()};
|
ArrangeableSLAPrintObject ainst_po{
|
||||||
|
po,
|
||||||
|
&ainst,
|
||||||
|
get_bed_constraint(inst->id(), self.m_bed_constraints),
|
||||||
|
phtr * inst->get_matrix()
|
||||||
|
};
|
||||||
fn(ainst_po);
|
fn(ainst_po);
|
||||||
} else {
|
} else {
|
||||||
fn(ainst);
|
fn(ainst);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
++pos.inst_idx;
|
++pos.inst_idx;
|
||||||
}
|
}
|
||||||
pos.inst_idx = 0;
|
pos.inst_idx = 0;
|
||||||
@ -682,7 +688,12 @@ void ArrangeableSLAPrint::visit_arrangeable_(Self &&self, const ObjectID &id, Fn
|
|||||||
if (po) {
|
if (po) {
|
||||||
auto &vbh = self.m_vbed_handler;
|
auto &vbh = self.m_vbed_handler;
|
||||||
auto phtr = vbh->get_physical_bed_trafo(vbh->get_bed_index(VBedPlaceableMI{*inst}));
|
auto phtr = vbh->get_physical_bed_trafo(vbh->get_bed_index(VBedPlaceableMI{*inst}));
|
||||||
ArrangeableSLAPrintObject ainst_po{po, &ainst, phtr * inst->get_matrix()};
|
ArrangeableSLAPrintObject ainst_po{
|
||||||
|
po,
|
||||||
|
&ainst,
|
||||||
|
get_bed_constraint(inst->id(), self.m_bed_constraints),
|
||||||
|
phtr * inst->get_matrix()
|
||||||
|
};
|
||||||
fn(ainst_po);
|
fn(ainst_po);
|
||||||
} else {
|
} else {
|
||||||
fn(ainst);
|
fn(ainst);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user