diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 8c15d0fb62..3e668c4d84 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -2264,12 +2264,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) return; if (m_gizmos.on_char(evt)) - { - // FIXME: Without the following call to render(), the gimgui dialogs are not shown the first time the user tries to open them using the keyboard shortcuts - // (it looks like as if 2 render calls are needed before they show up) - render(); return; - } //#ifdef __APPLE__ // ctrlMask |= wxMOD_RAW_CONTROL; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp index 29e5e5686d..cb18bdb166 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoBase.cpp @@ -145,6 +145,7 @@ GLGizmoBase::GLGizmoBase(GLCanvas3D& parent, const std::string& icon_filename, u , m_hover_id(-1) , m_dragging(false) , m_imgui(wxGetApp().imgui()) + , m_first_input_window_render(true) { ::memcpy((void*)m_base_color, (const void*)DEFAULT_BASE_COLOR, 4 * sizeof(float)); ::memcpy((void*)m_drag_color, (const void*)DEFAULT_DRAG_COLOR, 4 * sizeof(float)); @@ -273,6 +274,18 @@ std::string GLGizmoBase::format(float value, unsigned int decimals) const return Slic3r::string_printf("%.*f", decimals, value); } +void GLGizmoBase::render_input_window(float x, float y, float bottom_limit) +{ + on_render_input_window(x, y, bottom_limit); + if (m_first_input_window_render) + { + // for some reason, the imgui dialogs are not shown on screen in the 1st frame where they are rendered, but show up only with the 2nd rendered frame + // so, we forces another frame rendering the first time the imgui window is shown + m_parent.set_as_dirty(); + m_first_input_window_render = false; + } +} + // Produce an alpha channel checksum for the red green blue components. The alpha channel may then be used to verify, whether the rgb components // were not interpolated by alpha blending or multi sampling. unsigned char picking_checksum_alpha_channel(unsigned char red, unsigned char green, unsigned char blue) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoBase.hpp index 7b73c62c25..18053dcd68 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoBase.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoBase.hpp @@ -99,6 +99,7 @@ protected: float m_highlight_color[4]; mutable std::vector m_grabbers; ImGuiWrapper* m_imgui; + bool m_first_input_window_render; public: GLGizmoBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id); @@ -144,7 +145,7 @@ public: void render() const { on_render(); } void render_for_picking() const { on_render_for_picking(); } - void render_input_window(float x, float y, float bottom_limit) { on_render_input_window(x, y, bottom_limit); } + void render_input_window(float x, float y, float bottom_limit); protected: virtual bool on_init() = 0; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp index 481bec9562..76a9ed6032 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp @@ -141,6 +141,7 @@ void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit) m_imgui->set_next_window_pos(x, y, ImGuiCond_Always); m_imgui->set_next_window_bg_alpha(0.5f); + m_imgui->begin(_(L("Cut")), ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); ImGui::PushItemWidth(m_imgui->scaled(5.0f));