mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-21 13:47:59 -06:00
Add live preview on open gizmo
Add delay 250ms before process for live move with slider Add short cut for unmodified mesh in processing
This commit is contained in:
parent
79dd007ec7
commit
ee7d5db31c
2 changed files with 22 additions and 9 deletions
|
@ -91,7 +91,7 @@ void GLGizmoSimplify::on_render_input_window(float x, float y, float bottom_limi
|
||||||
m_is_valid_result = false;
|
m_is_valid_result = false;
|
||||||
m_exist_preview = false;
|
m_exist_preview = false;
|
||||||
init_wireframe();
|
init_wireframe();
|
||||||
|
live_preview();
|
||||||
if (change_window_position) {
|
if (change_window_position) {
|
||||||
ImVec2 pos = ImGui::GetMousePos();
|
ImVec2 pos = ImGui::GetMousePos();
|
||||||
pos.x -= m_gui_cfg->window_offset_x;
|
pos.x -= m_gui_cfg->window_offset_x;
|
||||||
|
@ -308,9 +308,23 @@ void GLGizmoSimplify::process()
|
||||||
if (m_volume == nullptr) return;
|
if (m_volume == nullptr) return;
|
||||||
if (m_volume->mesh().its.indices.empty()) return;
|
if (m_volume->mesh().its.indices.empty()) return;
|
||||||
size_t count_triangles = m_volume->mesh().its.indices.size();
|
size_t count_triangles = m_volume->mesh().its.indices.size();
|
||||||
if (m_configuration.use_count &&
|
// Is neccessary simplification
|
||||||
m_configuration.wanted_count >= count_triangles)
|
if ((m_configuration.use_count && m_configuration.wanted_count >= count_triangles) ||
|
||||||
|
(!m_configuration.use_count && m_configuration.max_error <= 0.f)) {
|
||||||
|
|
||||||
|
// Exist different original volume?
|
||||||
|
if (m_original_its.has_value() &&
|
||||||
|
m_original_its->indices.size() != count_triangles) {
|
||||||
|
indexed_triangle_set its = *m_original_its; // copy
|
||||||
|
set_its(its);
|
||||||
|
}
|
||||||
|
m_is_valid_result = true;
|
||||||
|
|
||||||
|
// re-render bargraph
|
||||||
|
set_dirty();
|
||||||
|
m_parent.schedule_extra_frame(0);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// when not store original volume store it for cancelation
|
// when not store original volume store it for cancelation
|
||||||
if (!m_original_its.has_value()) {
|
if (!m_original_its.has_value()) {
|
||||||
|
|
|
@ -95,14 +95,13 @@ private:
|
||||||
|
|
||||||
void fix_count_by_ratio(size_t triangle_count)
|
void fix_count_by_ratio(size_t triangle_count)
|
||||||
{
|
{
|
||||||
if (decimate_ratio <= 0.f) {
|
if (decimate_ratio <= 0.f)
|
||||||
wanted_count = static_cast<uint32_t>(triangle_count);
|
wanted_count = static_cast<uint32_t>(triangle_count);
|
||||||
return;
|
else if (decimate_ratio >= 100.f)
|
||||||
} else if (decimate_ratio >= 1.f) {
|
|
||||||
wanted_count = 0;
|
wanted_count = 0;
|
||||||
return;
|
else
|
||||||
}
|
wanted_count = static_cast<uint32_t>(std::round(
|
||||||
wanted_count = static_cast<uint32_t>(std::round(triangle_count * (100.f-decimate_ratio) / 100.f));
|
triangle_count * (100.f - decimate_ratio) / 100.f));
|
||||||
}
|
}
|
||||||
} m_configuration;
|
} m_configuration;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue