Renamed 'Seed fill' to 'Smart fill'.
This commit is contained in:
parent
8ad109235b
commit
3b4d10656c
@ -124,13 +124,12 @@ bool GLGizmoMmuSegmentation::on_init()
|
|||||||
m_desc["sphere"] = _L("Sphere");
|
m_desc["sphere"] = _L("Sphere");
|
||||||
m_desc["pointer"] = _L("Pointer");
|
m_desc["pointer"] = _L("Pointer");
|
||||||
|
|
||||||
m_desc["tool_type"] = _L("Tool type");
|
m_desc["tool_type"] = _L("Tool type");
|
||||||
m_desc["tool_brush"] = _L("Brush");
|
m_desc["tool_brush"] = _L("Brush");
|
||||||
m_desc["tool_seed_fill"] = _L("Seed fill");
|
m_desc["tool_smart_fill"] = _L("Smart fill");
|
||||||
m_desc["tool_bucket_fill"] = _L("Bucket fill");
|
m_desc["tool_bucket_fill"] = _L("Bucket fill");
|
||||||
|
|
||||||
m_desc["seed_fill"] = _L("Seed fill");
|
m_desc["smart_fill_angle"] = _L("Smart fill angle");
|
||||||
m_desc["seed_fill_angle"] = _L("Seed fill angle");
|
|
||||||
|
|
||||||
init_extruders_data();
|
init_extruders_data();
|
||||||
|
|
||||||
@ -246,10 +245,10 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||||||
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->scaled(1.5f);
|
m_imgui->calc_text_size(m_desc.at("reset_direction")).x) + 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 seed_fill_slider_left = m_imgui->calc_text_size(m_desc.at("seed_fill_angle")).x + m_imgui->scaled(1.f);
|
const float smart_fill_slider_left = m_imgui->calc_text_size(m_desc.at("smart_fill_angle")).x + m_imgui->scaled(1.f);
|
||||||
|
|
||||||
const float cursor_type_radio_circle = m_imgui->calc_text_size(m_desc["circle"]).x + m_imgui->scaled(2.5f);
|
const float cursor_type_radio_circle = m_imgui->calc_text_size(m_desc["circle"]).x + m_imgui->scaled(2.5f);
|
||||||
const float cursor_type_radio_sphere = m_imgui->calc_text_size(m_desc["sphere"]).x + m_imgui->scaled(2.5f);
|
const float cursor_type_radio_sphere = m_imgui->calc_text_size(m_desc["sphere"]).x + m_imgui->scaled(2.5f);
|
||||||
const float cursor_type_radio_pointer = m_imgui->calc_text_size(m_desc["pointer"]).x + m_imgui->scaled(2.5f);
|
const float cursor_type_radio_pointer = m_imgui->calc_text_size(m_desc["pointer"]).x + 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);
|
||||||
@ -259,9 +258,9 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||||||
const float combo_label_width = std::max(m_imgui->calc_text_size(m_desc.at("first_color")).x,
|
const float combo_label_width = std::max(m_imgui->calc_text_size(m_desc.at("first_color")).x,
|
||||||
m_imgui->calc_text_size(m_desc.at("second_color")).x) + m_imgui->scaled(1.f);
|
m_imgui->calc_text_size(m_desc.at("second_color")).x) + m_imgui->scaled(1.f);
|
||||||
|
|
||||||
const float tool_type_radio_brush = m_imgui->calc_text_size(m_desc["tool_brush"]).x + m_imgui->scaled(2.5f);
|
const float tool_type_radio_brush = m_imgui->calc_text_size(m_desc["tool_brush"]).x + m_imgui->scaled(2.5f);
|
||||||
const float tool_type_radio_bucket_fill = m_imgui->calc_text_size(m_desc["tool_bucket_fill"]).x + m_imgui->scaled(2.5f);
|
const float tool_type_radio_bucket_fill = m_imgui->calc_text_size(m_desc["tool_bucket_fill"]).x + m_imgui->scaled(2.5f);
|
||||||
const float tool_type_radio_seed_fill = m_imgui->calc_text_size(m_desc["tool_seed_fill"]).x + m_imgui->scaled(2.5f);
|
const float tool_type_radio_smart_fill = m_imgui->calc_text_size(m_desc["tool_smart_fill"]).x + m_imgui->scaled(2.5f);
|
||||||
|
|
||||||
float caption_max = 0.f;
|
float caption_max = 0.f;
|
||||||
float total_text_max = 0.;
|
float total_text_max = 0.;
|
||||||
@ -272,12 +271,12 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||||||
caption_max += m_imgui->scaled(1.f);
|
caption_max += m_imgui->scaled(1.f);
|
||||||
total_text_max += m_imgui->scaled(1.f);
|
total_text_max += m_imgui->scaled(1.f);
|
||||||
|
|
||||||
float sliders_width = std::max(seed_fill_slider_left, std::max(cursor_slider_left, clipping_slider_left));
|
float sliders_width = std::max(smart_fill_slider_left, std::max(cursor_slider_left, clipping_slider_left));
|
||||||
float window_width = minimal_slider_width + sliders_width;
|
float window_width = minimal_slider_width + sliders_width;
|
||||||
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_radio_circle + cursor_type_radio_sphere + cursor_type_radio_pointer);
|
window_width = std::max(window_width, cursor_type_radio_circle + cursor_type_radio_sphere + cursor_type_radio_pointer);
|
||||||
window_width = std::max(window_width, tool_type_radio_brush + tool_type_radio_bucket_fill + tool_type_radio_seed_fill);
|
window_width = std::max(window_width, tool_type_radio_brush + tool_type_radio_bucket_fill + tool_type_radio_smart_fill);
|
||||||
window_width = std::max(window_width, 2.f * buttons_width + m_imgui->scaled(1.f));
|
window_width = std::max(window_width, 2.f * buttons_width + m_imgui->scaled(1.f));
|
||||||
|
|
||||||
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) {
|
||||||
@ -321,7 +320,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
m_imgui->text(m_desc.at("tool_type"));
|
m_imgui->text(m_desc.at("tool_type"));
|
||||||
|
|
||||||
float tool_type_offset = (window_width - tool_type_radio_brush - tool_type_radio_bucket_fill - tool_type_radio_seed_fill + m_imgui->scaled(2.f)) / 2.f;
|
float tool_type_offset = (window_width - tool_type_radio_brush - tool_type_radio_bucket_fill - tool_type_radio_smart_fill + m_imgui->scaled(2.f)) / 2.f;
|
||||||
|
|
||||||
ImGui::NewLine();
|
ImGui::NewLine();
|
||||||
|
|
||||||
@ -345,9 +344,9 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine(tool_type_offset + tool_type_radio_brush + m_imgui->scaled(0.f));
|
ImGui::SameLine(tool_type_offset + tool_type_radio_brush + m_imgui->scaled(0.f));
|
||||||
ImGui::PushItemWidth(tool_type_radio_seed_fill);
|
ImGui::PushItemWidth(tool_type_radio_smart_fill);
|
||||||
if (m_imgui->radio_button(m_desc["tool_seed_fill"], m_tool_type == GLGizmoMmuSegmentation::ToolType::SEED_FILL)) {
|
if (m_imgui->radio_button(m_desc["tool_smart_fill"], m_tool_type == GLGizmoMmuSegmentation::ToolType::SMART_FILL)) {
|
||||||
m_tool_type = GLGizmoMmuSegmentation::ToolType::SEED_FILL;
|
m_tool_type = GLGizmoMmuSegmentation::ToolType::SMART_FILL;
|
||||||
for (auto &triangle_selector : m_triangle_selectors) {
|
for (auto &triangle_selector : m_triangle_selectors) {
|
||||||
triangle_selector->seed_fill_unselect_all_triangles();
|
triangle_selector->seed_fill_unselect_all_triangles();
|
||||||
triangle_selector->request_update_render_data();
|
triangle_selector->request_update_render_data();
|
||||||
@ -362,7 +361,7 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine(tool_type_offset + tool_type_radio_brush + tool_type_radio_seed_fill + m_imgui->scaled(0.f));
|
ImGui::SameLine(tool_type_offset + tool_type_radio_brush + tool_type_radio_smart_fill + m_imgui->scaled(0.f));
|
||||||
ImGui::PushItemWidth(tool_type_radio_bucket_fill);
|
ImGui::PushItemWidth(tool_type_radio_bucket_fill);
|
||||||
if (m_imgui->radio_button(m_desc["tool_bucket_fill"], m_tool_type == GLGizmoMmuSegmentation::ToolType::BUCKET_FILL)) {
|
if (m_imgui->radio_button(m_desc["tool_bucket_fill"], m_tool_type == GLGizmoMmuSegmentation::ToolType::BUCKET_FILL)) {
|
||||||
m_tool_type = GLGizmoMmuSegmentation::ToolType::BUCKET_FILL;
|
m_tool_type = GLGizmoMmuSegmentation::ToolType::BUCKET_FILL;
|
||||||
@ -458,14 +457,14 @@ void GLGizmoMmuSegmentation::on_render_input_window(float x, float y, float bott
|
|||||||
m_imgui->disabled_end();
|
m_imgui->disabled_end();
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
} else if(m_tool_type == ToolType::SEED_FILL) {
|
} else if(m_tool_type == ToolType::SMART_FILL) {
|
||||||
m_imgui->text(m_desc["seed_fill_angle"] + ":");
|
m_imgui->text(m_desc["smart_fill_angle"] + ":");
|
||||||
ImGui::AlignTextToFramePadding();
|
ImGui::AlignTextToFramePadding();
|
||||||
std::string format_str = std::string("%.f") + I18N::translate_utf8("°", "Degree sign to use in the respective slider in MMU gizmo,"
|
std::string format_str = std::string("%.f") + I18N::translate_utf8("°", "Degree sign to use in the respective slider in MMU gizmo,"
|
||||||
"placed after the number with no whitespace in between.");
|
"placed after the number with no whitespace in between.");
|
||||||
ImGui::SameLine(sliders_width);
|
ImGui::SameLine(sliders_width);
|
||||||
ImGui::PushItemWidth(window_width - sliders_width);
|
ImGui::PushItemWidth(window_width - sliders_width);
|
||||||
if(m_imgui->slider_float("##seed_fill_angle", &m_seed_fill_angle, SeedFillAngleMin, SeedFillAngleMax, format_str.data()))
|
if(m_imgui->slider_float("##smart_fill_angle", &m_smart_fill_angle, SmartFillAngleMin, SmartFillAngleMax, format_str.data()))
|
||||||
for (auto &triangle_selector : m_triangle_selectors) {
|
for (auto &triangle_selector : m_triangle_selectors) {
|
||||||
triangle_selector->seed_fill_unselect_all_triangles();
|
triangle_selector->seed_fill_unselect_all_triangles();
|
||||||
triangle_selector->request_update_render_data();
|
triangle_selector->request_update_render_data();
|
||||||
|
@ -282,12 +282,12 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
|||||||
: std::min(m_cursor_radius + CursorRadiusStep, CursorRadiusMax);
|
: std::min(m_cursor_radius + CursorRadiusStep, CursorRadiusMax);
|
||||||
m_parent.set_as_dirty();
|
m_parent.set_as_dirty();
|
||||||
return true;
|
return true;
|
||||||
} else if (m_tool_type == ToolType::SEED_FILL) {
|
} else if (m_tool_type == ToolType::SMART_FILL) {
|
||||||
m_seed_fill_angle = action == SLAGizmoEventType::MouseWheelDown ? std::max(m_seed_fill_angle - SeedFillAngleStep, SeedFillAngleMin)
|
m_smart_fill_angle = action == SLAGizmoEventType::MouseWheelDown ? std::max(m_smart_fill_angle - SmartFillAngleStep, SmartFillAngleMin)
|
||||||
: std::min(m_seed_fill_angle + SeedFillAngleStep, SeedFillAngleMax);
|
: std::min(m_smart_fill_angle + SmartFillAngleStep, SmartFillAngleMax);
|
||||||
m_parent.set_as_dirty();
|
m_parent.set_as_dirty();
|
||||||
if (m_rr.mesh_id != -1) {
|
if (m_rr.mesh_id != -1) {
|
||||||
m_triangle_selectors[m_rr.mesh_id]->seed_fill_select_triangles(m_rr.hit, int(m_rr.facet), m_seed_fill_angle, true);
|
m_triangle_selectors[m_rr.mesh_id]->seed_fill_select_triangles(m_rr.hit, int(m_rr.facet), m_smart_fill_angle, true);
|
||||||
m_triangle_selectors[m_rr.mesh_id]->request_update_render_data();
|
m_triangle_selectors[m_rr.mesh_id]->request_update_render_data();
|
||||||
m_seed_fill_last_mesh_id = m_rr.mesh_id;
|
m_seed_fill_last_mesh_id = m_rr.mesh_id;
|
||||||
}
|
}
|
||||||
@ -379,10 +379,10 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
|||||||
Vec3f camera_pos = (trafo_matrix.inverse() * camera.get_position()).cast<float>();
|
Vec3f camera_pos = (trafo_matrix.inverse() * camera.get_position()).cast<float>();
|
||||||
|
|
||||||
assert(m_rr.mesh_id < int(m_triangle_selectors.size()));
|
assert(m_rr.mesh_id < int(m_triangle_selectors.size()));
|
||||||
if (m_tool_type == ToolType::SEED_FILL || m_tool_type == ToolType::BUCKET_FILL || (m_tool_type == ToolType::BRUSH && m_cursor_type == TriangleSelector::CursorType::POINTER)) {
|
if (m_tool_type == ToolType::SMART_FILL || m_tool_type == ToolType::BUCKET_FILL || (m_tool_type == ToolType::BRUSH && m_cursor_type == TriangleSelector::CursorType::POINTER)) {
|
||||||
m_triangle_selectors[m_rr.mesh_id]->seed_fill_apply_on_triangles(new_state);
|
m_triangle_selectors[m_rr.mesh_id]->seed_fill_apply_on_triangles(new_state);
|
||||||
if (m_tool_type == ToolType::SEED_FILL)
|
if (m_tool_type == ToolType::SMART_FILL)
|
||||||
m_triangle_selectors[m_rr.mesh_id]->seed_fill_select_triangles(m_rr.hit, int(m_rr.facet), m_seed_fill_angle, true);
|
m_triangle_selectors[m_rr.mesh_id]->seed_fill_select_triangles(m_rr.hit, int(m_rr.facet), m_smart_fill_angle, true);
|
||||||
else if (m_tool_type == ToolType::BRUSH && m_cursor_type == TriangleSelector::CursorType::POINTER)
|
else if (m_tool_type == ToolType::BRUSH && m_cursor_type == TriangleSelector::CursorType::POINTER)
|
||||||
m_triangle_selectors[m_rr.mesh_id]->bucket_fill_select_triangles(m_rr.hit, int(m_rr.facet), false, true);
|
m_triangle_selectors[m_rr.mesh_id]->bucket_fill_select_triangles(m_rr.hit, int(m_rr.facet), false, true);
|
||||||
else if (m_tool_type == ToolType::BUCKET_FILL)
|
else if (m_tool_type == ToolType::BUCKET_FILL)
|
||||||
@ -400,7 +400,7 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action == SLAGizmoEventType::Moving && (m_tool_type == ToolType::SEED_FILL || m_tool_type == ToolType::BUCKET_FILL || (m_tool_type == ToolType::BRUSH && m_cursor_type == TriangleSelector::CursorType::POINTER))) {
|
if (action == SLAGizmoEventType::Moving && (m_tool_type == ToolType::SMART_FILL || m_tool_type == ToolType::BUCKET_FILL || (m_tool_type == ToolType::BRUSH && m_cursor_type == TriangleSelector::CursorType::POINTER))) {
|
||||||
if (m_triangle_selectors.empty())
|
if (m_triangle_selectors.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -440,8 +440,8 @@ bool GLGizmoPainterBase::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
|
|||||||
seed_fill_unselect_all();
|
seed_fill_unselect_all();
|
||||||
|
|
||||||
assert(m_rr.mesh_id < int(m_triangle_selectors.size()));
|
assert(m_rr.mesh_id < int(m_triangle_selectors.size()));
|
||||||
if (m_tool_type == ToolType::SEED_FILL)
|
if (m_tool_type == ToolType::SMART_FILL)
|
||||||
m_triangle_selectors[m_rr.mesh_id]->seed_fill_select_triangles(m_rr.hit, int(m_rr.facet), m_seed_fill_angle);
|
m_triangle_selectors[m_rr.mesh_id]->seed_fill_select_triangles(m_rr.hit, int(m_rr.facet), m_smart_fill_angle);
|
||||||
else if (m_tool_type == ToolType::BRUSH && m_cursor_type == TriangleSelector::CursorType::POINTER)
|
else if (m_tool_type == ToolType::BRUSH && m_cursor_type == TriangleSelector::CursorType::POINTER)
|
||||||
m_triangle_selectors[m_rr.mesh_id]->bucket_fill_select_triangles(m_rr.hit, int(m_rr.facet), false);
|
m_triangle_selectors[m_rr.mesh_id]->bucket_fill_select_triangles(m_rr.hit, int(m_rr.facet), false);
|
||||||
else if (m_tool_type == ToolType::BUCKET_FILL)
|
else if (m_tool_type == ToolType::BUCKET_FILL)
|
||||||
|
@ -109,16 +109,16 @@ protected:
|
|||||||
enum class ToolType {
|
enum class ToolType {
|
||||||
BRUSH,
|
BRUSH,
|
||||||
BUCKET_FILL,
|
BUCKET_FILL,
|
||||||
SEED_FILL
|
SMART_FILL
|
||||||
};
|
};
|
||||||
|
|
||||||
bool m_triangle_splitting_enabled = true;
|
bool m_triangle_splitting_enabled = true;
|
||||||
ToolType m_tool_type = ToolType::BRUSH;
|
ToolType m_tool_type = ToolType::BRUSH;
|
||||||
float m_seed_fill_angle = 30.f;
|
float m_smart_fill_angle = 30.f;
|
||||||
|
|
||||||
static constexpr float SeedFillAngleMin = 0.0f;
|
static constexpr float SmartFillAngleMin = 0.0f;
|
||||||
static constexpr float SeedFillAngleMax = 90.f;
|
static constexpr float SmartFillAngleMax = 90.f;
|
||||||
static constexpr float SeedFillAngleStep = 1.f;
|
static constexpr float SmartFillAngleStep = 1.f;
|
||||||
|
|
||||||
// It stores the value of the previous mesh_id to which the seed fill was applied.
|
// It stores the value of the previous mesh_id to which the seed fill was applied.
|
||||||
// It is used to detect when the mouse has moved from one volume to another one.
|
// It is used to detect when the mouse has moved from one volume to another one.
|
||||||
|
Loading…
Reference in New Issue
Block a user