mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 21:45:58 +08:00
Fix excessive uptates to UI in sla rotation optimization
This commit is contained in:
parent
4326e083eb
commit
78124689c5
@ -288,7 +288,7 @@ template<unsigned MAX_ITER>
|
|||||||
struct RotfinderBoilerplate {
|
struct RotfinderBoilerplate {
|
||||||
static constexpr unsigned MAX_TRIES = MAX_ITER;
|
static constexpr unsigned MAX_TRIES = MAX_ITER;
|
||||||
|
|
||||||
int status = 0;
|
int status = 0, prev_status = 0;
|
||||||
TriangleMesh mesh;
|
TriangleMesh mesh;
|
||||||
unsigned max_tries;
|
unsigned max_tries;
|
||||||
const RotOptimizeParams ¶ms;
|
const RotOptimizeParams ¶ms;
|
||||||
@ -314,13 +314,20 @@ struct RotfinderBoilerplate {
|
|||||||
|
|
||||||
RotfinderBoilerplate(const ModelObject &mo, const RotOptimizeParams &p)
|
RotfinderBoilerplate(const ModelObject &mo, const RotOptimizeParams &p)
|
||||||
: mesh{get_mesh_to_rotate(mo)}
|
: mesh{get_mesh_to_rotate(mo)}
|
||||||
, params{p}
|
|
||||||
, max_tries(p.accuracy() * MAX_TRIES)
|
, max_tries(p.accuracy() * MAX_TRIES)
|
||||||
{
|
, params{p}
|
||||||
|
{}
|
||||||
|
|
||||||
|
void statusfn() {
|
||||||
|
int s = status * 100 / max_tries;
|
||||||
|
if (s != prev_status) {
|
||||||
|
params.statuscb()(s);
|
||||||
|
prev_status = s;
|
||||||
|
}
|
||||||
|
|
||||||
|
++status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void statusfn() { params.statuscb()(++status * 100.0 / max_tries); }
|
|
||||||
bool stopcond() { return ! params.statuscb()(-1); }
|
bool stopcond() { return ! params.statuscb()(-1); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user