mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Minor refactor
This commit is contained in:
parent
6b8c72944d
commit
e3ca95152c
2 changed files with 9 additions and 6 deletions
|
@ -127,7 +127,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A logical bed representing an object not being arranged. Either the arrange
|
/// A logical bed representing an object not being arranged. Either the arrange
|
||||||
/// has not yet succesfully run on this ArrangePolygon or it could not fit the
|
/// has not yet successfully run on this ArrangePolygon or it could not fit the
|
||||||
/// object due to overly large size or invalid geometry.
|
/// object due to overly large size or invalid geometry.
|
||||||
static const constexpr int UNARRANGED = -1;
|
static const constexpr int UNARRANGED = -1;
|
||||||
|
|
||||||
|
@ -152,6 +152,9 @@ struct ArrangePolygon {
|
||||||
|
|
||||||
/// Helper function to call the setter with the arrange data arguments
|
/// Helper function to call the setter with the arrange data arguments
|
||||||
void apply() const { if (setter) setter(*this); }
|
void apply() const { if (setter) setter(*this); }
|
||||||
|
|
||||||
|
/// Test if arrange() was called previously and gave a successful result.
|
||||||
|
bool is_arranged() const { return bed_idx != UNARRANGED; }
|
||||||
};
|
};
|
||||||
|
|
||||||
using ArrangePolygons = std::vector<ArrangePolygon>;
|
using ArrangePolygons = std::vector<ArrangePolygon>;
|
||||||
|
|
|
@ -1345,7 +1345,6 @@ struct Plater::priv
|
||||||
// Cache the wti info
|
// Cache the wti info
|
||||||
class WipeTower: public GLCanvas3D::WipeTowerInfo {
|
class WipeTower: public GLCanvas3D::WipeTowerInfo {
|
||||||
using ArrangePolygon = arrangement::ArrangePolygon;
|
using ArrangePolygon = arrangement::ArrangePolygon;
|
||||||
static const constexpr auto UNARRANGED = arrangement::UNARRANGED;
|
|
||||||
friend priv;
|
friend priv;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -1535,7 +1534,6 @@ struct Plater::priv
|
||||||
// The gap between logical beds in the x axis expressed in ratio of
|
// The gap between logical beds in the x axis expressed in ratio of
|
||||||
// the current bed width.
|
// the current bed width.
|
||||||
static const constexpr double LOGICAL_BED_GAP = 1. / 5.;
|
static const constexpr double LOGICAL_BED_GAP = 1. / 5.;
|
||||||
static const constexpr int UNARRANGED = arrangement::UNARRANGED;
|
|
||||||
|
|
||||||
ArrangePolygons m_selected, m_unselected;
|
ArrangePolygons m_selected, m_unselected;
|
||||||
|
|
||||||
|
@ -1578,7 +1576,7 @@ struct Plater::priv
|
||||||
ap.bed_idx = ap.translation.x() / stride;
|
ap.bed_idx = ap.translation.x() / stride;
|
||||||
|
|
||||||
ap.setter = [mi, stride](const ArrangePolygon &p) {
|
ap.setter = [mi, stride](const ArrangePolygon &p) {
|
||||||
if (p.bed_idx != UNARRANGED) {
|
if (p.is_arranged()) {
|
||||||
auto t = p.translation; t.x() += p.bed_idx * stride;
|
auto t = p.translation; t.x() += p.bed_idx * stride;
|
||||||
mi->apply_arrange_result(t, p.rotation);
|
mi->apply_arrange_result(t, p.rotation);
|
||||||
}
|
}
|
||||||
|
@ -1596,8 +1594,10 @@ struct Plater::priv
|
||||||
ap.bed_idx = ap.translation.x() / stride;
|
ap.bed_idx = ap.translation.x() / stride;
|
||||||
ap.priority = 1; // Wipe tower should be on physical bed
|
ap.priority = 1; // Wipe tower should be on physical bed
|
||||||
ap.setter = [&wti, stride](const ArrangePolygon &p) {
|
ap.setter = [&wti, stride](const ArrangePolygon &p) {
|
||||||
auto t = p.translation; t.x() += p.bed_idx * stride;
|
if (p.is_arranged()) {
|
||||||
wti.apply_arrange_result(t, p.rotation);
|
auto t = p.translation; t.x() += p.bed_idx * stride;
|
||||||
|
wti.apply_arrange_result(t, p.rotation);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
sel.is_wipe_tower() ?
|
sel.is_wipe_tower() ?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue