Hollowing 'accuracy' and 'closing distance' are only shown in the hollowing gizmo when the respective mode is active

This commit is contained in:
Lukas Matena 2020-02-13 15:55:36 +01:00
parent 1cdde90971
commit f8c5855d55

View File

@ -676,6 +676,7 @@ void GLGizmoHollow::on_render_input_window(float x, float y, float bottom_limit)
bool first_run = true; // This is a hack to redraw the button when all points are removed, bool first_run = true; // This is a hack to redraw the button when all points are removed,
// so it is not delayed until the background process finishes. // so it is not delayed until the background process finishes.
ConfigOptionMode current_mode = wxGetApp().get_mode();
std::vector<std::string> opts_keys = {"hollowing_min_thickness", "hollowing_quality", "hollowing_closing_distance"}; std::vector<std::string> opts_keys = {"hollowing_min_thickness", "hollowing_quality", "hollowing_closing_distance"};
auto opts = get_config_options(opts_keys); auto opts = get_config_options(opts_keys);
@ -688,11 +689,13 @@ void GLGizmoHollow::on_render_input_window(float x, float y, float bottom_limit)
float quality = quality_cfg->value; float quality = quality_cfg->value;
double quality_min = opts[1].second->min; double quality_min = opts[1].second->min;
double quality_max = opts[1].second->max; double quality_max = opts[1].second->max;
ConfigOptionMode quality_mode = opts[1].second->mode;
auto* closing_d_cfg = static_cast<const ConfigOptionFloat*>(opts[2].first); auto* closing_d_cfg = static_cast<const ConfigOptionFloat*>(opts[2].first);
float closing_d = closing_d_cfg->value; float closing_d = closing_d_cfg->value;
double closing_d_min = opts[2].second->min; double closing_d_min = opts[2].second->min;
double closing_d_max = opts[2].second->max; double closing_d_max = opts[2].second->max;
ConfigOptionMode closing_d_mode = opts[2].second->mode;
m_desc["offset"] = _(opts[0].second->label).ToUTF8() + wxString(":"); m_desc["offset"] = _(opts[0].second->label).ToUTF8() + wxString(":");
m_desc["quality"] = _(opts[1].second->label).ToUTF8() + wxString(":"); m_desc["quality"] = _(opts[1].second->label).ToUTF8() + wxString(":");
@ -754,29 +757,33 @@ RENDER_AGAIN:
bool slider_edited = ImGui::IsItemEdited(); // someone is dragging the slider bool slider_edited = ImGui::IsItemEdited(); // someone is dragging the slider
bool slider_released = ImGui::IsItemDeactivatedAfterEdit(); // someone has just released the slider bool slider_released = ImGui::IsItemDeactivatedAfterEdit(); // someone has just released the slider
m_imgui->text(m_desc.at("quality")); if (current_mode >= quality_mode) {
ImGui::SameLine(settings_sliders_left); m_imgui->text(m_desc.at("quality"));
ImGui::SliderFloat(" ", &quality, quality_min, quality_max, "%.1f"); ImGui::SameLine(settings_sliders_left);
if (ImGui::IsItemHovered()) { ImGui::SliderFloat(" ", &quality, quality_min, quality_max, "%.1f");
ImGui::BeginTooltip(); if (ImGui::IsItemHovered()) {
ImGui::TextUnformatted(_(opts[1].second->tooltip).ToUTF8()); ImGui::BeginTooltip();
ImGui::EndTooltip(); ImGui::TextUnformatted(_(opts[1].second->tooltip).ToUTF8());
ImGui::EndTooltip();
}
slider_clicked |= ImGui::IsItemClicked();
slider_edited |= ImGui::IsItemEdited();
slider_released |= ImGui::IsItemDeactivatedAfterEdit();
} }
slider_clicked |= ImGui::IsItemClicked();
slider_edited |= ImGui::IsItemEdited();
slider_released |= ImGui::IsItemDeactivatedAfterEdit();
m_imgui->text(m_desc.at("closing_distance")); if (current_mode >= closing_d_mode) {
ImGui::SameLine(settings_sliders_left); m_imgui->text(m_desc.at("closing_distance"));
ImGui::SliderFloat(" ", &closing_d, closing_d_min, closing_d_max, "%.1f"); ImGui::SameLine(settings_sliders_left);
if (ImGui::IsItemHovered()) { ImGui::SliderFloat(" ", &closing_d, closing_d_min, closing_d_max, "%.1f");
ImGui::BeginTooltip(); if (ImGui::IsItemHovered()) {
ImGui::TextUnformatted(_(opts[2].second->tooltip).ToUTF8()); ImGui::BeginTooltip();
ImGui::EndTooltip(); ImGui::TextUnformatted(_(opts[2].second->tooltip).ToUTF8());
ImGui::EndTooltip();
}
slider_clicked |= ImGui::IsItemClicked();
slider_edited |= ImGui::IsItemEdited();
slider_released |= ImGui::IsItemDeactivatedAfterEdit();
} }
slider_clicked |= ImGui::IsItemClicked();
slider_edited |= ImGui::IsItemEdited();
slider_released |= ImGui::IsItemDeactivatedAfterEdit();
if (slider_clicked) { if (slider_clicked) {
m_offset_stash = offset; m_offset_stash = offset;