mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 12:47:50 -06:00
refactor and improve layer time display
This commit is contained in:
parent
1eb54c49a6
commit
41078e6555
3 changed files with 39 additions and 16 deletions
|
@ -1424,6 +1424,10 @@ void GCodeProcessor::finalize(bool post_process)
|
|||
m_used_filaments.process_caches(this);
|
||||
|
||||
update_estimated_times_stats();
|
||||
auto time_mode = m_result.print_statistics.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)];
|
||||
|
||||
auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [](const std::pair<ExtrusionRole, float>& item) { return erCustom == item.first; });
|
||||
auto prepare_time = (it != time_mode.roles_times.end()) ? it->second : 0.0f;
|
||||
|
||||
//update times for results
|
||||
for (size_t i = 0; i < m_result.moves.size(); i++) {
|
||||
|
@ -1431,7 +1435,7 @@ void GCodeProcessor::finalize(bool post_process)
|
|||
size_t layer_id = size_t(m_result.moves[i].layer_duration);
|
||||
std::vector<float>& layer_times = m_result.print_statistics.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].layers_times;
|
||||
if (layer_times.size() > layer_id - 1 && layer_id > 0)
|
||||
m_result.moves[i].layer_duration = layer_times[layer_id - 1];
|
||||
m_result.moves[i].layer_duration = layer_id == 1 ? std::max(0.f,layer_times[layer_id - 1] - prepare_time) : layer_times[layer_id - 1];
|
||||
else
|
||||
m_result.moves[i].layer_duration = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue