Combo in painter gizmos replaced with radios (for cursor type selection)
This commit is contained in:
parent
89e4a78722
commit
6f2ea224b9
@ -50,6 +50,8 @@ bool GLGizmoFdmSupports::on_init()
|
|||||||
m_desc["remove_caption"] = _L("Shift + Left mouse button") + ": ";
|
m_desc["remove_caption"] = _L("Shift + Left mouse button") + ": ";
|
||||||
m_desc["remove"] = _L("Remove selection");
|
m_desc["remove"] = _L("Remove selection");
|
||||||
m_desc["remove_all"] = _L("Remove all selection");
|
m_desc["remove_all"] = _L("Remove all selection");
|
||||||
|
m_desc["circle"] = _L("Circle");
|
||||||
|
m_desc["sphere"] = _L("Sphere");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -86,18 +88,15 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
|
|||||||
if (! m_setting_angle) {
|
if (! m_setting_angle) {
|
||||||
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
|
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
|
||||||
|
|
||||||
std::vector<std::string> cursor_types;
|
|
||||||
cursor_types.push_back(_L("Circle").ToUTF8().data());
|
|
||||||
cursor_types.push_back(_L("Sphere").ToUTF8().data());
|
|
||||||
|
|
||||||
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
|
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
|
||||||
const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x,
|
const float clipping_slider_left = std::max(m_imgui->calc_text_size(m_desc.at("clipping_of_view")).x,
|
||||||
m_imgui->calc_text_size(m_desc.at("reset_direction")).x)
|
m_imgui->calc_text_size(m_desc.at("reset_direction")).x)
|
||||||
+ m_imgui->scaled(1.5f);
|
+ m_imgui->scaled(1.5f);
|
||||||
const float cursor_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.f);
|
const float cursor_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.f);
|
||||||
const float cursor_type_combo_left = m_imgui->calc_text_size(m_desc.at("cursor_type")).x + m_imgui->scaled(1.f);
|
const float cursor_type_radio_left = m_imgui->calc_text_size(m_desc.at("cursor_type")).x + m_imgui->scaled(1.f);
|
||||||
const float cursor_type_combo_width = std::max(m_imgui->calc_text_size(wxString::FromUTF8(cursor_types[0].c_str())).x,
|
const float cursor_type_radio_width1 = m_imgui->calc_text_size(m_desc["circle"]).x
|
||||||
m_imgui->calc_text_size(wxString::FromUTF8(cursor_types[1].c_str())).x)
|
+ m_imgui->scaled(2.5f);
|
||||||
|
const float cursor_type_radio_width2 = m_imgui->calc_text_size(m_desc["sphere"]).x
|
||||||
+ m_imgui->scaled(2.5f);
|
+ m_imgui->scaled(2.5f);
|
||||||
const float button_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.f);
|
const float button_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.f);
|
||||||
const float minimal_slider_width = m_imgui->scaled(4.f);
|
const float minimal_slider_width = m_imgui->scaled(4.f);
|
||||||
@ -114,7 +113,7 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
|
|||||||
float window_width = minimal_slider_width + std::max(cursor_slider_left, clipping_slider_left);
|
float window_width = minimal_slider_width + std::max(cursor_slider_left, clipping_slider_left);
|
||||||
window_width = std::max(window_width, total_text_max);
|
window_width = std::max(window_width, total_text_max);
|
||||||
window_width = std::max(window_width, button_width);
|
window_width = std::max(window_width, button_width);
|
||||||
window_width = std::max(window_width, cursor_type_combo_left + cursor_type_combo_width);
|
window_width = std::max(window_width, cursor_type_radio_left + cursor_type_radio_width1 + cursor_type_radio_width2);
|
||||||
|
|
||||||
auto draw_text_with_caption = [this, &caption_max](const wxString& caption, const wxString& text) {
|
auto draw_text_with_caption = [this, &caption_max](const wxString& caption, const wxString& text) {
|
||||||
m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, caption);
|
m_imgui->text_colored(ImGuiWrapper::COL_ORANGE_LIGHT, caption);
|
||||||
@ -166,20 +165,41 @@ void GLGizmoFdmSupports::on_render_input_window(float x, float y, float bottom_l
|
|||||||
|
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(m_desc.at("cursor_type"));
|
m_imgui->text(m_desc.at("cursor_type"));
|
||||||
ImGui::SameLine(window_width - cursor_type_combo_width - m_imgui->scaled(0.5f));
|
ImGui::SameLine(cursor_type_radio_left + m_imgui->scaled(0.f));
|
||||||
ImGui::PushItemWidth(cursor_type_combo_width);
|
ImGui::PushItemWidth(cursor_type_radio_width1);
|
||||||
int selection = int(m_cursor_type);
|
|
||||||
m_imgui->combo("", cursor_types, selection);
|
bool sphere_sel = m_cursor_type == TriangleSelector::CursorType::SPHERE;
|
||||||
m_cursor_type = TriangleSelector::CursorType(selection);
|
if (m_imgui->radio_button(m_desc["sphere"], sphere_sel))
|
||||||
|
sphere_sel = true;
|
||||||
|
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::PushTextWrapPos(max_tooltip_width);
|
ImGui::PushTextWrapPos(max_tooltip_width);
|
||||||
ImGui::TextUnformatted(_L("Sphere paints all facets inside, regardless of their orientation.\n\n"
|
ImGui::TextUnformatted(_L("Paints all facets inside, regardless of their orientation.").ToUTF8().data());
|
||||||
"Circle ignores facets facing away from the camera.").ToUTF8().data());
|
|
||||||
ImGui::PopTextWrapPos();
|
ImGui::PopTextWrapPos();
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine(cursor_type_radio_left + cursor_type_radio_width2 + m_imgui->scaled(0.f));
|
||||||
|
ImGui::PushItemWidth(cursor_type_radio_width2);
|
||||||
|
|
||||||
|
if (m_imgui->radio_button(m_desc["circle"], ! sphere_sel))
|
||||||
|
sphere_sel = false;
|
||||||
|
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::PushTextWrapPos(max_tooltip_width);
|
||||||
|
ImGui::TextUnformatted(_L("Ignores facets facing away from the camera.").ToUTF8().data());
|
||||||
|
ImGui::PopTextWrapPos();
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_cursor_type = sphere_sel
|
||||||
|
? TriangleSelector::CursorType::SPHERE
|
||||||
|
: TriangleSelector::CursorType::CIRCLE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if (m_c->object_clipper()->get_position() == 0.f) {
|
if (m_c->object_clipper()->get_position() == 0.f) {
|
||||||
|
@ -33,6 +33,8 @@ bool GLGizmoSeam::on_init()
|
|||||||
m_desc["remove_caption"] = _L("Shift + Left mouse button") + ": ";
|
m_desc["remove_caption"] = _L("Shift + Left mouse button") + ": ";
|
||||||
m_desc["remove"] = _L("Remove selection");
|
m_desc["remove"] = _L("Remove selection");
|
||||||
m_desc["remove_all"] = _L("Remove all selection");
|
m_desc["remove_all"] = _L("Remove all selection");
|
||||||
|
m_desc["circle"] = _L("Circle");
|
||||||
|
m_desc["sphere"] = _L("Sphere");
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -71,12 +73,6 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||||||
const float approx_height = m_imgui->scaled(14.0f);
|
const float approx_height = m_imgui->scaled(14.0f);
|
||||||
y = std::min(y, bottom_limit - approx_height);
|
y = std::min(y, bottom_limit - approx_height);
|
||||||
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
|
m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
|
||||||
|
|
||||||
std::vector<std::string> cursor_types;
|
|
||||||
cursor_types.push_back(_L("Circle").ToUTF8().data());
|
|
||||||
cursor_types.push_back(_L("Sphere").ToUTF8().data());
|
|
||||||
|
|
||||||
|
|
||||||
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
|
m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
|
||||||
|
|
||||||
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
|
// First calculate width of all the texts that are could possibly be shown. We will decide set the dialog width based on that:
|
||||||
@ -84,9 +80,10 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||||||
m_imgui->calc_text_size(m_desc.at("reset_direction")).x)
|
m_imgui->calc_text_size(m_desc.at("reset_direction")).x)
|
||||||
+ m_imgui->scaled(1.5f);
|
+ m_imgui->scaled(1.5f);
|
||||||
const float cursor_size_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.f);
|
const float cursor_size_slider_left = m_imgui->calc_text_size(m_desc.at("cursor_size")).x + m_imgui->scaled(1.f);
|
||||||
const float cursor_type_combo_left = m_imgui->calc_text_size(m_desc.at("cursor_type")).x + m_imgui->scaled(1.f);
|
const float cursor_type_radio_left = m_imgui->calc_text_size(m_desc.at("cursor_type")).x + m_imgui->scaled(1.f);
|
||||||
const float cursor_type_combo_width = std::max(m_imgui->calc_text_size(wxString::FromUTF8(cursor_types[0].c_str())).x,
|
const float cursor_type_radio_width1 = m_imgui->calc_text_size(m_desc["circle"]).x
|
||||||
m_imgui->calc_text_size(wxString::FromUTF8(cursor_types[1].c_str())).x)
|
+ m_imgui->scaled(2.5f);
|
||||||
|
const float cursor_type_radio_width2 = m_imgui->calc_text_size(m_desc["sphere"]).x
|
||||||
+ m_imgui->scaled(2.5f);
|
+ m_imgui->scaled(2.5f);
|
||||||
const float button_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.f);
|
const float button_width = m_imgui->calc_text_size(m_desc.at("remove_all")).x + m_imgui->scaled(1.f);
|
||||||
const float minimal_slider_width = m_imgui->scaled(4.f);
|
const float minimal_slider_width = m_imgui->scaled(4.f);
|
||||||
@ -103,7 +100,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||||||
float window_width = minimal_slider_width + std::max(cursor_size_slider_left, clipping_slider_left);
|
float window_width = minimal_slider_width + std::max(cursor_size_slider_left, clipping_slider_left);
|
||||||
window_width = std::max(window_width, total_text_max);
|
window_width = std::max(window_width, total_text_max);
|
||||||
window_width = std::max(window_width, button_width);
|
window_width = std::max(window_width, button_width);
|
||||||
window_width = std::max(window_width, cursor_type_combo_left + cursor_type_combo_width);
|
window_width = std::max(window_width, cursor_type_radio_left + cursor_type_radio_width1 + cursor_type_radio_width2);
|
||||||
|
|
||||||
auto draw_text_with_caption = [this, &caption_max](const wxString& caption, const wxString& text) {
|
auto draw_text_with_caption = [this, &caption_max](const wxString& caption, const wxString& text) {
|
||||||
static const ImVec4 ORANGE(1.0f, 0.49f, 0.22f, 1.0f);
|
static const ImVec4 ORANGE(1.0f, 0.49f, 0.22f, 1.0f);
|
||||||
@ -147,21 +144,41 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(m_desc.at("cursor_type"));
|
m_imgui->text(m_desc.at("cursor_type"));
|
||||||
ImGui::SameLine(window_width - cursor_type_combo_width - m_imgui->scaled(0.5f));
|
ImGui::SameLine(cursor_type_radio_left + m_imgui->scaled(0.f));
|
||||||
ImGui::PushItemWidth(cursor_type_combo_width);
|
ImGui::PushItemWidth(cursor_type_radio_width1);
|
||||||
int selection = int(m_cursor_type);
|
|
||||||
m_imgui->combo("", cursor_types, selection);
|
bool sphere_sel = m_cursor_type == TriangleSelector::CursorType::SPHERE;
|
||||||
m_cursor_type = TriangleSelector::CursorType(selection);
|
if (m_imgui->radio_button(m_desc["sphere"], sphere_sel))
|
||||||
|
sphere_sel = true;
|
||||||
|
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::BeginTooltip();
|
ImGui::BeginTooltip();
|
||||||
ImGui::PushTextWrapPos(max_tooltip_width);
|
ImGui::PushTextWrapPos(max_tooltip_width);
|
||||||
ImGui::TextUnformatted(_L("Sphere paints all facets inside, regardless of their orientation.\n\n"
|
ImGui::TextUnformatted(_L("Paints all facets inside, regardless of their orientation.").ToUTF8().data());
|
||||||
"Circle ignores facets facing away from the camera.").ToUTF8().data());
|
|
||||||
ImGui::PopTextWrapPos();
|
ImGui::PopTextWrapPos();
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::SameLine(cursor_type_radio_left + cursor_type_radio_width2 + m_imgui->scaled(0.f));
|
||||||
|
ImGui::PushItemWidth(cursor_type_radio_width2);
|
||||||
|
|
||||||
|
if (m_imgui->radio_button(m_desc["circle"], ! sphere_sel))
|
||||||
|
sphere_sel = false;
|
||||||
|
|
||||||
|
if (ImGui::IsItemHovered()) {
|
||||||
|
ImGui::BeginTooltip();
|
||||||
|
ImGui::PushTextWrapPos(max_tooltip_width);
|
||||||
|
ImGui::TextUnformatted(_L("Ignores facets facing away from the camera.").ToUTF8().data());
|
||||||
|
ImGui::PopTextWrapPos();
|
||||||
|
ImGui::EndTooltip();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_cursor_type = sphere_sel
|
||||||
|
? TriangleSelector::CursorType::SPHERE
|
||||||
|
: TriangleSelector::CursorType::CIRCLE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
Loading…
Reference in New Issue
Block a user