mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-22 12:38:08 +08:00
Using the new status update interface to refresh scene right after the supports are ready.
This commit is contained in:
parent
87b96f4c09
commit
1a58513717
@ -242,6 +242,8 @@ public:
|
|||||||
std::string text;
|
std::string text;
|
||||||
// Bitmap of flags.
|
// Bitmap of flags.
|
||||||
enum FlagBits {
|
enum FlagBits {
|
||||||
|
DEFAULT,
|
||||||
|
NO_RELOAD_SCENE = 0,
|
||||||
RELOAD_SCENE = 1,
|
RELOAD_SCENE = 1,
|
||||||
};
|
};
|
||||||
// Bitmap of FlagBits
|
// Bitmap of FlagBits
|
||||||
@ -255,7 +257,7 @@ public:
|
|||||||
// Register a custom status callback.
|
// Register a custom status callback.
|
||||||
void set_status_callback(status_callback_type cb) { m_status_callback = cb; }
|
void set_status_callback(status_callback_type cb) { m_status_callback = cb; }
|
||||||
// Calls a registered callback to update the status, or print out the default message.
|
// Calls a registered callback to update the status, or print out the default message.
|
||||||
void set_status(int percent, const std::string &message, unsigned int flags = 0) {
|
void set_status(int percent, const std::string &message, unsigned int flags = SlicingStatus::DEFAULT) {
|
||||||
if (m_status_callback) m_status_callback(SlicingStatus(percent, message, flags));
|
if (m_status_callback) m_status_callback(SlicingStatus(percent, message, flags));
|
||||||
else printf("%d => %s\n", percent, message.c_str());
|
else printf("%d => %s\n", percent, message.c_str());
|
||||||
}
|
}
|
||||||
|
@ -414,12 +414,13 @@ void SLAPrint::process()
|
|||||||
using slaposFn = std::function<void(SLAPrintObject&)>;
|
using slaposFn = std::function<void(SLAPrintObject&)>;
|
||||||
using slapsFn = std::function<void(void)>;
|
using slapsFn = std::function<void(void)>;
|
||||||
|
|
||||||
|
// This is the actual order of steps done on each PrintObject
|
||||||
std::array<SLAPrintObjectStep, slaposCount> objectsteps = {
|
std::array<SLAPrintObjectStep, slaposCount> objectsteps = {
|
||||||
slaposObjectSlice,
|
|
||||||
slaposSupportIslands,
|
slaposSupportIslands,
|
||||||
slaposSupportPoints,
|
slaposSupportPoints,
|
||||||
slaposSupportTree,
|
slaposSupportTree,
|
||||||
slaposBasePool,
|
slaposBasePool,
|
||||||
|
slaposObjectSlice,
|
||||||
slaposSliceSupports
|
slaposSliceSupports
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -445,21 +446,27 @@ void SLAPrint::process()
|
|||||||
const double ostepd = (max_objstatus - min_objstatus) / (objcount * 100.0);
|
const double ostepd = (max_objstatus - min_objstatus) / (objcount * 100.0);
|
||||||
|
|
||||||
for(SLAPrintObject * po : m_objects) {
|
for(SLAPrintObject * po : m_objects) {
|
||||||
for(size_t s = 0; s < pobj_program.size(); ++s) {
|
for(size_t s = 0; s < objectsteps.size(); ++s) {
|
||||||
auto currentstep = objectsteps[s];
|
auto currentstep = objectsteps[s];
|
||||||
|
|
||||||
|
// if the base pool (which means also the support tree) is done,
|
||||||
|
// do a refresh when indicating progress
|
||||||
|
auto flg = currentstep == slaposObjectSlice ?
|
||||||
|
SlicingStatus::RELOAD_SCENE : SlicingStatus::DEFAULT;
|
||||||
|
|
||||||
// Cancellation checking. Each step will check for cancellation
|
// Cancellation checking. Each step will check for cancellation
|
||||||
// on its own and return earlier gracefully. Just after it returns
|
// on its own and return earlier gracefully. Just after it returns
|
||||||
// execution gets to this point and throws the canceled signal.
|
// execution gets to this point and throws the canceled signal.
|
||||||
throw_if_canceled();
|
throw_if_canceled();
|
||||||
|
|
||||||
if(po->m_stepmask[s] && !po->is_step_done(currentstep)) {
|
if(po->m_stepmask[currentstep] && !po->is_step_done(currentstep)) {
|
||||||
|
po->set_started(currentstep);
|
||||||
|
|
||||||
unsigned st = OBJ_STEP_LEVELS[currentstep];
|
unsigned st = OBJ_STEP_LEVELS[currentstep];
|
||||||
st = unsigned(min_objstatus + st * ostepd);
|
st = unsigned(min_objstatus + st * ostepd);
|
||||||
set_status(st, OBJ_STEP_LABELS[currentstep]);
|
set_status(st, OBJ_STEP_LABELS[currentstep], flg);
|
||||||
|
|
||||||
po->set_started(currentstep);
|
pobj_program[currentstep](*po);
|
||||||
pobj_program[s](*po);
|
|
||||||
po->set_done(currentstep);
|
po->set_done(currentstep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -477,12 +484,12 @@ void SLAPrint::process()
|
|||||||
|
|
||||||
throw_if_canceled();
|
throw_if_canceled();
|
||||||
|
|
||||||
if(m_stepmask[s] && !is_step_done(currentstep)) {
|
if(m_stepmask[currentstep] && !is_step_done(currentstep)) {
|
||||||
set_status(PRINT_STEP_LEVELS[currentstep],
|
set_status(PRINT_STEP_LEVELS[currentstep],
|
||||||
PRINT_STEP_LABELS[currentstep]);
|
PRINT_STEP_LABELS[currentstep]);
|
||||||
|
|
||||||
set_started(currentstep);
|
set_started(currentstep);
|
||||||
print_program[s]();
|
print_program[currentstep]();
|
||||||
set_done(currentstep);
|
set_done(currentstep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user