diff --git a/resources/images/toolbar_tooltip_hover.svg b/resources/images/toolbar_tooltip_hover.svg
index ffdd0ee34c..dfcd2d3851 100644
--- a/resources/images/toolbar_tooltip_hover.svg
+++ b/resources/images/toolbar_tooltip_hover.svg
@@ -1,14 +1,14 @@
diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp
index 53fb765db4..80cbf8e25d 100644
--- a/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp
+++ b/src/slic3r/GUI/Gizmos/GLGizmoSeam.cpp
@@ -45,6 +45,11 @@ bool GLGizmoSeam::on_init()
return true;
}
+GLGizmoSeam::GLGizmoSeam(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
+ : GLGizmoPainterBase(parent, icon_filename, sprite_id), m_current_tool(ImGui::CircleButtonIcon)
+{
+
+}
std::string GLGizmoSeam::on_get_name() const
@@ -114,6 +119,48 @@ void GLGizmoSeam::render_triangles(const Selection& selection) const
}
}
+void GLGizmoSeam::show_tooltip_information(float caption_max, float x, float y)
+{
+ ImTextureID normal_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP);
+ ImTextureID hover_id = m_parent.get_gizmos_manager().get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_TOOLBAR_TOOLTIP_HOVER);
+
+ float font_size = ImGui::GetFontSize();
+ ImVec2 button_size = ImVec2(font_size * 1.8, font_size * 1.3);
+ ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
+ ImGui::ImageButton3(normal_id, hover_id, button_size);
+
+ if (ImGui::IsItemHovered()) {
+ ImGui::BeginTooltip2(ImVec2(x, y));
+ auto draw_text_with_caption = [this, &caption_max](const wxString &caption, const wxString &text) {
+ m_imgui->text_colored(ImGuiWrapper::COL_ACTIVE, caption);
+ ImGui::SameLine(caption_max);
+ m_imgui->text_colored(ImGuiWrapper::COL_WINDOW_BG, text);
+ };
+
+ for (const auto &t : std::array{"enforce", "block", "remove"}) draw_text_with_caption(m_desc.at(t + "_caption"), m_desc.at(t));
+ ImGui::EndTooltip();
+ }
+ ImGui::PopStyleVar(1);
+}
+
+void GLGizmoSeam::tool_changed(wchar_t old_tool, wchar_t new_tool)
+{
+ if ((old_tool == ImGui::GapFillIcon && new_tool == ImGui::GapFillIcon) ||
+ (old_tool != ImGui::GapFillIcon && new_tool != ImGui::GapFillIcon))
+ return;
+
+ for (auto& selector_ptr : m_triangle_selectors) {
+ TriangleSelectorPatch* tsp = dynamic_cast(selector_ptr.get());
+ tsp->set_filter_state(new_tool == ImGui::GapFillIcon);
+ }
+}
+
+static std::string into_u8(const wxString& str)
+{
+ auto buffer_utf8 = str.utf8_str();
+ return std::string(buffer_utf8.data());
+}
+
void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
{
if (! m_c->selection_info()->model_object())
@@ -123,16 +170,17 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
y = std::min(y, bottom_limit - approx_height);
//BBS: GUI refactor: move gizmo to the right
#if BBS_TOOLBAR_ON_TOP
- m_imgui->set_next_window_pos(x, y, ImGuiCond_Always, 0.0f, 0.0f);
+ GizmoImguiSetNextWIndowPos(x, y, ImGuiCond_Always, 0.0f, 0.0f);
#else
- m_imgui->set_next_window_pos(x, y, ImGuiCond_Always, 1.0f, 0.0f);
+ GizmoImguiSetNextWIndowPos(x, y, ImGuiCond_Always, 1.0f, 0.0f);
#endif
//m_imgui->set_next_window_pos(x, y, ImGuiCond_Always);
+ wchar_t old_tool = m_current_tool;
//BBS
ImGuiWrapper::push_toolbar_style();
- m_imgui->begin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse);
+ GizmoImguiBegin(get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
// 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,
@@ -146,6 +194,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
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 empty_button_width = m_imgui->calc_button_size("").x;
float caption_max = 0.f;
float total_text_max = 0.f;
@@ -155,7 +204,7 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
}
total_text_max += caption_max + m_imgui->scaled(1.f);
caption_max += m_imgui->scaled(1.f);
-
+ float slider_width_times = 1.5;
const float sliders_left_width = std::max(cursor_size_slider_left, clipping_slider_left);
#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
const float slider_icon_width = m_imgui->get_slider_icon_size().x;
@@ -167,82 +216,89 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
window_width = std::max(window_width, button_width);
window_width = std::max(window_width, cursor_type_radio_left + cursor_type_radio_sphere + cursor_type_radio_circle);
- auto draw_text_with_caption = [this, &caption_max](const wxString& caption, const wxString& text) {
- //BBS set text colored to BLUE_LIGHT
- m_imgui->text_colored(ImGuiWrapper::COL_BLUE_LIGHT, caption);
- ImGui::SameLine(caption_max);
- m_imgui->text(text);
- };
-
- for (const auto &t : std::array{"enforce", "block", "remove"})
- draw_text_with_caption(m_desc.at(t + "_caption"), m_desc.at(t));
-
- ImGui::Separator();
-
const float max_tooltip_width = ImGui::GetFontSize() * 20.0f;
+ ImGui::AlignTextToFramePadding();
+ m_imgui->text(m_desc.at("cursor_type"));
+ std::array tool_icons = { ImGui::CircleButtonIcon, ImGui::SphereButtonIcon};
+ std::array tool_tips = { _L("Circle"), _L("Sphere")};
+ for (int i = 0; i < tool_icons.size(); i++) {
+ std::string str_label = std::string("##");
+ std::wstring btn_name = tool_icons[i] + boost::nowide::widen(str_label);
+
+ if (i != 0) ImGui::SameLine((empty_button_width + m_imgui->scaled(1.75f)) * i + m_imgui->scaled(1.3f));
+
+ if (m_current_tool == tool_icons[i]) {
+ ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.81f, 0.81f, 0.81f, 1.0f)); // r, g, b, a
+ ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.81f, 0.81f, 0.81f, 1.0f));
+ ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.81f, 0.81f, 0.81f, 1.0f));
+ }
+ ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0);
+ bool btn_clicked = ImGui::Button(into_u8(btn_name).c_str());
+ ImGui::PopStyleVar(1);
+ if (m_current_tool == tool_icons[i])ImGui::PopStyleColor(3);
+
+ if (btn_clicked && m_current_tool != tool_icons[i]) {
+ m_current_tool = tool_icons[i];
+ for (auto& triangle_selector : m_triangle_selectors) {
+ triangle_selector->seed_fill_unselect_all_triangles();
+ triangle_selector->request_update_render_data();
+ }
+ }
+
+ if (ImGui::IsItemHovered()) {
+ m_imgui->tooltip(tool_tips[i], max_tooltip_width);
+ }
+ }
+
+ if (m_current_tool != old_tool)
+ this->tool_changed(old_tool, m_current_tool);
+
+ ImGui::Dummy(ImVec2(0.0f, ImGui::GetFontSize() * 0.1));
+
+ if (m_current_tool == ImGui::CircleButtonIcon) {
+ m_cursor_type = TriangleSelector::CursorType::CIRCLE;
+ m_tool_type = ToolType::BRUSH;
+ } else if (m_current_tool == ImGui::SphereButtonIcon) {
+ m_cursor_type = TriangleSelector::CursorType::SPHERE;
+ m_tool_type = ToolType::BRUSH;
+ }
+
ImGui::AlignTextToFramePadding();
m_imgui->text(m_desc.at("cursor_size"));
ImGui::SameLine(sliders_left_width);
-#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
- ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width);
- m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true, _L("Alt + Mouse wheel"));
-#else
- ImGui::PushItemWidth(window_width - sliders_left_width);
- m_imgui->slider_float("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f");
- if (ImGui::IsItemHovered())
- m_imgui->tooltip(_L("Alt + Mouse wheel"), max_tooltip_width);
-#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
+
+ ImGui::PushItemWidth(window_width - sliders_left_width - slider_width_times * slider_icon_width);
+ m_imgui->bbl_slider_float_style("##cursor_radius", &m_cursor_radius, CursorRadiusMin, CursorRadiusMax, "%.2f", 1.0f, true);
+ ImGui::SameLine(window_width - slider_icon_width);
+ ImGui::PushItemWidth(1.5 * slider_icon_width);
+ ImGui::BBLDragFloat("##cursor_radius_input", &m_cursor_radius, 0.05f, 0.0f, 0.0f, "%.2f");
ImGui::AlignTextToFramePadding();
- m_imgui->text(m_desc.at("cursor_type"));
-
- float cursor_type_offset = cursor_type_radio_left + (window_width - cursor_type_radio_left - cursor_type_radio_sphere - cursor_type_radio_circle + m_imgui->scaled(0.5f)) / 2.f;
- ImGui::SameLine(cursor_type_offset);
- ImGui::PushItemWidth(cursor_type_radio_sphere);
- if (m_imgui->radio_button(m_desc["sphere"], m_cursor_type == TriangleSelector::CursorType::SPHERE))
- m_cursor_type = TriangleSelector::CursorType::SPHERE;
-
- if (ImGui::IsItemHovered())
- m_imgui->tooltip(_L("Paints all facets inside, regardless of their orientation."), max_tooltip_width);
-
- ImGui::SameLine(cursor_type_offset + cursor_type_radio_sphere);
- ImGui::PushItemWidth(cursor_type_radio_circle);
- if (m_imgui->radio_button(m_desc["circle"], m_cursor_type == TriangleSelector::CursorType::CIRCLE))
- m_cursor_type = TriangleSelector::CursorType::CIRCLE;
-
- if (ImGui::IsItemHovered())
- m_imgui->tooltip(_L("Ignores facets facing away from the camera."), max_tooltip_width);
-
- ImGui::Separator();
- if (m_c->object_clipper()->get_position() == 0.f) {
- ImGui::AlignTextToFramePadding();
- m_imgui->text(m_desc.at("clipping_of_view"));
- }
- else {
- if (m_imgui->button(m_desc.at("reset_direction"))) {
- wxGetApp().CallAfter([this](){
- m_c->object_clipper()->set_position(-1., false);
- });
- }
- }
+ m_imgui->text(m_desc.at("clipping_of_view"));
auto clp_dist = float(m_c->object_clipper()->get_position());
ImGui::SameLine(sliders_left_width);
-#if ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
- ImGui::PushItemWidth(window_width - sliders_left_width - slider_icon_width);
- if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true, _L("Ctrl + Mouse wheel")))
- m_c->object_clipper()->set_position(clp_dist, true);
-#else
- ImGui::PushItemWidth(window_width - sliders_left_width);
- if (m_imgui->slider_float("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f"))
- m_c->object_clipper()->set_position(clp_dist, true);
- if (ImGui::IsItemHovered())
- m_imgui->tooltip(_L("Ctrl + Mouse wheel"), max_tooltip_width);
-#endif // ENABLE_ENHANCED_IMGUI_SLIDER_FLOAT
+ ImGui::PushItemWidth(window_width - sliders_left_width - slider_width_times * slider_icon_width);
+ bool slider_clp_dist = m_imgui->bbl_slider_float_style("##clp_dist", &clp_dist, 0.f, 1.f, "%.2f", 1.0f, true);
+
+ ImGui::SameLine(window_width - slider_icon_width);
+ ImGui::PushItemWidth(1.5 * slider_icon_width);
+ bool b_clp_dist_input = ImGui::BBLDragFloat("##clp_dist_input", &clp_dist, 0.05f, 0.0f, 0.0f, "%.2f");
+ if (slider_clp_dist || b_clp_dist_input) { m_c->object_clipper()->set_position(clp_dist, true); }
ImGui::Separator();
+
+ ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(6.0f, 10.0f));
+ float get_cur_y = ImGui::GetContentRegionMax().y + ImGui::GetFrameHeight() + y;
+ show_tooltip_information(caption_max, x, get_cur_y);
+
+ float f_scale =m_parent.get_gizmos_manager().get_layout_scale();
+ ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6.0f, 4.0f * f_scale));
+
+ ImGui::SameLine();
+
if (m_imgui->button(m_desc.at("remove_all"))) {
Plater::TakeSnapshot snapshot(wxGetApp().plater(), "Reset selection", UndoRedo::SnapshotType::GizmoAction);
ModelObject *mo = m_c->selection_info()->model_object();
@@ -257,14 +313,13 @@ void GLGizmoSeam::on_render_input_window(float x, float y, float bottom_limit)
update_model_object();
m_parent.set_as_dirty();
}
-
- m_imgui->end();
+ ImGui::PopStyleVar(2);
+ GizmoImguiEnd();
//BBS
ImGuiWrapper::pop_toolbar_style();
}
-
//BBS: remove const
void GLGizmoSeam::update_model_object()
{
diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSeam.hpp b/src/slic3r/GUI/Gizmos/GLGizmoSeam.hpp
index 5f2e094954..791b23082f 100644
--- a/src/slic3r/GUI/Gizmos/GLGizmoSeam.hpp
+++ b/src/slic3r/GUI/Gizmos/GLGizmoSeam.hpp
@@ -8,17 +8,21 @@ namespace Slic3r::GUI {
class GLGizmoSeam : public GLGizmoPainterBase
{
public:
- GLGizmoSeam(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id)
- : GLGizmoPainterBase(parent, icon_filename, sprite_id) {}
+ GLGizmoSeam(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
void render_painter_gizmo() const override;
protected:
+ wchar_t m_current_tool = 0;
void on_render_input_window(float x, float y, float bottom_limit) override;
std::string on_get_name() const override;
PainterGizmoType get_painter_type() const override;
- void render_triangles(const Selection& selection) const override;
+ void render_triangles(const Selection &selection) const override;
+
+ void show_tooltip_information(float caption_max, float x, float y);
+
+ void tool_changed(wchar_t old_tool, wchar_t new_tool);
wxString handle_snapshot_action_name(bool shift_down, Button button_down) const override;