diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 29d72687b..2ad9ec851 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -3029,8 +3029,10 @@ void GLCanvas3D::Gizmos::_render_overlay(const GLCanvas3D& canvas, const GLCanva float icon_size = (float)it->second->get_textures_size() * m_overlay_icons_scale * inv_zoom; GLTexture::render_texture(it->second->get_texture_id(), top_x, top_x + icon_size, top_y - icon_size, top_y); #if ENABLE_IMGUI - if (it->second->get_state() == GLGizmoBase::On) - it->second->render_input_window(2.0f * m_overlay_border + icon_size * zoom, 0.5f * cnv_h - top_y * zoom, selection); + if (it->second->get_state() == GLGizmoBase::On) { + float toolbar_top = (float)cnv_h - canvas.m_view_toolbar->get_height(); + it->second->render_input_window(2.0f * m_overlay_border + icon_size * zoom, 0.5f * cnv_h - top_y * zoom, toolbar_top, selection); + } #endif // ENABLE_IMGUI top_y -= (icon_size + scaled_gap_y); } diff --git a/src/slic3r/GUI/GLGizmo.cpp b/src/slic3r/GUI/GLGizmo.cpp index 7a64e5f45..f38f450e2 100644 --- a/src/slic3r/GUI/GLGizmo.cpp +++ b/src/slic3r/GUI/GLGizmo.cpp @@ -769,7 +769,7 @@ void GLGizmoRotate3D::on_render(const GLCanvas3D::Selection& selection) const } #if ENABLE_IMGUI -void GLGizmoRotate3D::on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection) +void GLGizmoRotate3D::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection) { #if !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI Vec3d rotation(Geometry::rad2deg(m_gizmos[0].get_angle()), Geometry::rad2deg(m_gizmos[1].get_angle()), Geometry::rad2deg(m_gizmos[2].get_angle())); @@ -1056,7 +1056,7 @@ void GLGizmoScale3D::on_render_for_picking(const GLCanvas3D::Selection& selectio } #if ENABLE_IMGUI -void GLGizmoScale3D::on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection) +void GLGizmoScale3D::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection) { #if !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI bool single_instance = selection.is_single_full_instance(); @@ -1307,7 +1307,7 @@ void GLGizmoMove3D::on_render_for_picking(const GLCanvas3D::Selection& selection } #if ENABLE_IMGUI -void GLGizmoMove3D::on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection) +void GLGizmoMove3D::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection) { #if !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI bool show_position = selection.is_single_full_instance(); @@ -2272,7 +2272,7 @@ std::vector GLGizmoSlaSupports::get_config_options(const std::vec #if ENABLE_IMGUI -void GLGizmoSlaSupports::on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection) +void GLGizmoSlaSupports::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection) { if (!m_model_object) return; @@ -2281,8 +2281,13 @@ void GLGizmoSlaSupports::on_render_input_window(float x, float y, const GLCanvas // so it is not delayed until the background process finishes. RENDER_AGAIN: m_imgui->set_next_window_pos(x, y, ImGuiCond_Always); + + static const ImVec2 window_size(285.f, 260.f); + ImGui::SetNextWindowPos(ImVec2(x, y - std::max(0.f, y+window_size.y-bottom_limit) )); + ImGui::SetNextWindowSize(ImVec2(window_size)); + m_imgui->set_next_window_bg_alpha(0.5f); - m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove |/* ImGuiWindowFlags_NoResize | */ImGuiWindowFlags_NoCollapse); + m_imgui->begin(on_get_name(), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); ImGui::PushItemWidth(100.0f); @@ -2538,6 +2543,7 @@ void GLGizmoSlaSupports::editing_mode_reload_cache() m_editing_mode_cache.clear(); for (const sla::SupportPoint& point : m_model_object->sla_support_points) m_editing_mode_cache.push_back(std::make_pair(point, false)); + m_unsaved_changes = false; } @@ -2585,7 +2591,9 @@ void GLGizmoSlaSupports::auto_generate() void GLGizmoSlaSupports::switch_to_editing_mode() { - editing_mode_reload_cache(); + if (m_model_object->sla_points_status != sla::PointsStatus::AutoGenerated) + editing_mode_reload_cache(); + m_unsaved_changes = false; m_editing_mode = true; } @@ -2801,7 +2809,7 @@ void GLGizmoCut::on_render_for_picking(const GLCanvas3D::Selection& selection) c } #if ENABLE_IMGUI -void GLGizmoCut::on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection) +void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection) { m_imgui->set_next_window_pos(x, y, ImGuiCond_Always); m_imgui->set_next_window_bg_alpha(0.5f); diff --git a/src/slic3r/GUI/GLGizmo.hpp b/src/slic3r/GUI/GLGizmo.hpp index 18ddbac69..9d7472d21 100644 --- a/src/slic3r/GUI/GLGizmo.hpp +++ b/src/slic3r/GUI/GLGizmo.hpp @@ -144,7 +144,7 @@ public: #endif // not ENABLE_IMGUI #if ENABLE_IMGUI - void render_input_window(float x, float y, const GLCanvas3D::Selection& selection) { on_render_input_window(x, y, selection); } + void render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection) { on_render_input_window(x, y, bottom_limit, selection); } #endif // ENABLE_IMGUI protected: @@ -163,7 +163,7 @@ protected: virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const = 0; #if ENABLE_IMGUI - virtual void on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection) {} + virtual void on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection) {} #endif // ENABLE_IMGUI float picking_color_component(unsigned int id) const; @@ -296,7 +296,7 @@ protected: } #if ENABLE_IMGUI - virtual void on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection); + virtual void on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection); #endif // ENABLE_IMGUI }; @@ -333,7 +333,7 @@ protected: virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const; #if ENABLE_IMGUI - virtual void on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection); + virtual void on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection); #endif // ENABLE_IMGUI private: @@ -380,7 +380,7 @@ protected: virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const; #if ENABLE_IMGUI - virtual void on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection); + virtual void on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection); #endif // ENABLE_IMGUI private: @@ -528,7 +528,7 @@ protected: void on_start_dragging(const GLCanvas3D::Selection& selection) override; #if ENABLE_IMGUI - virtual void on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection) override; + virtual void on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection) override; #endif // ENABLE_IMGUI virtual std::string on_get_name() const; @@ -579,7 +579,7 @@ protected: virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const; #if ENABLE_IMGUI - virtual void on_render_input_window(float x, float y, const GLCanvas3D::Selection& selection); + virtual void on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection); #endif // ENABLE_IMGUI private: void update_max_z(const GLCanvas3D::Selection& selection) const;