Removed technology ENABLE_IMGUI

This commit is contained in:
Lukas Matena 2019-03-15 16:31:54 +01:00
parent d3c8e3166e
commit e813a562a1
19 changed files with 3 additions and 236 deletions

View File

@ -20,9 +20,8 @@
// Disable synchronization of unselected instances // Disable synchronization of unselected instances
#define DISABLE_INSTANCES_SYNCH (0 && ENABLE_1_42_0_ALPHA1) #define DISABLE_INSTANCES_SYNCH (0 && ENABLE_1_42_0_ALPHA1)
// Scene's GUI made using imgui library // Disable imgui dialog for move, rotate and scale gizmos
#define ENABLE_IMGUI (1 && ENABLE_1_42_0_ALPHA1) #define DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI (1 && ENABLE_1_42_0_ALPHA1)
#define DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI (1 && ENABLE_IMGUI)
// Use wxDataViewRender instead of wxDataViewCustomRenderer // Use wxDataViewRender instead of wxDataViewCustomRenderer
#define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING (0 && ENABLE_1_42_0_ALPHA1) #define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING (0 && ENABLE_1_42_0_ALPHA1)

View File

@ -3005,14 +3005,6 @@ void GLCanvas3D::Gizmos::render_overlay(const GLCanvas3D& canvas, const GLCanvas
::glPopMatrix(); ::glPopMatrix();
} }
#if !ENABLE_IMGUI
void GLCanvas3D::Gizmos::create_external_gizmo_widgets(wxWindow *parent)
{
for (auto &entry : m_gizmos) {
entry.second->create_external_gizmo_widgets(parent);
}
}
#endif // not ENABLE_IMGUI
void GLCanvas3D::Gizmos::reset() void GLCanvas3D::Gizmos::reset()
{ {
@ -3031,9 +3023,7 @@ void GLCanvas3D::Gizmos::do_render_overlay(const GLCanvas3D& canvas, const GLCan
return; return;
float cnv_w = (float)canvas.get_canvas_size().get_width(); float cnv_w = (float)canvas.get_canvas_size().get_width();
#if ENABLE_IMGUI
float cnv_h = (float)canvas.get_canvas_size().get_height(); float cnv_h = (float)canvas.get_canvas_size().get_height();
#endif // ENABLE_IMGUI
float zoom = canvas.get_camera_zoom(); float zoom = canvas.get_camera_zoom();
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f; float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
@ -3171,7 +3161,6 @@ void GLCanvas3D::Gizmos::do_render_overlay(const GLCanvas3D& canvas, const GLCan
#endif // ENABLE_SVG_ICONS #endif // ENABLE_SVG_ICONS
GLTexture::render_sub_texture(icons_texture_id, top_x, top_x + scaled_icons_size, top_y - scaled_icons_size, top_y, { { u_left, v_bottom }, { u_right, v_bottom }, { u_right, v_top }, { u_left, v_top } }); GLTexture::render_sub_texture(icons_texture_id, top_x, top_x + scaled_icons_size, top_y - scaled_icons_size, top_y, { { u_left, v_bottom }, { u_right, v_bottom }, { u_right, v_top }, { u_left, v_top } });
#if ENABLE_IMGUI
if (it->second->get_state() == GLGizmoBase::On) { if (it->second->get_state() == GLGizmoBase::On) {
float toolbar_top = (float)cnv_h - canvas.m_view_toolbar.get_height(); float toolbar_top = (float)cnv_h - canvas.m_view_toolbar.get_height();
#if ENABLE_SVG_ICONS #if ENABLE_SVG_ICONS
@ -3180,7 +3169,6 @@ void GLCanvas3D::Gizmos::do_render_overlay(const GLCanvas3D& canvas, const GLCan
it->second->render_input_window(2.0f * m_overlay_border + icon_size * zoom, 0.5f * cnv_h - top_y * zoom, toolbar_top, selection); 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_SVG_ICONS #endif // ENABLE_SVG_ICONS
} }
#endif // ENABLE_IMGUI
#if ENABLE_SVG_ICONS #if ENABLE_SVG_ICONS
top_y -= scaled_stride_y; top_y -= scaled_stride_y;
#else #else
@ -3739,9 +3727,6 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar
, m_color_by("volume") , m_color_by("volume")
, m_reload_delayed(false) , m_reload_delayed(false)
, m_render_sla_auxiliaries(true) , m_render_sla_auxiliaries(true)
#if !ENABLE_IMGUI
, m_external_gizmo_widgets_parent(nullptr)
#endif // not ENABLE_IMGUI
{ {
if (m_canvas != nullptr) { if (m_canvas != nullptr) {
m_timer.SetOwner(m_canvas); m_timer.SetOwner(m_canvas);
@ -3834,13 +3819,6 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl)
std::cout << "Unable to initialize gizmos: please, check that all the required textures are available" << std::endl; std::cout << "Unable to initialize gizmos: please, check that all the required textures are available" << std::endl;
return false; return false;
} }
#if !ENABLE_IMGUI
if (m_external_gizmo_widgets_parent != nullptr) {
m_gizmos.create_external_gizmo_widgets(m_external_gizmo_widgets_parent);
m_canvas->GetParent()->Layout();
}
#endif // not ENABLE_IMGUI
} }
if (!_init_toolbar()) if (!_init_toolbar())
@ -4115,27 +4093,6 @@ void GLCanvas3D::update_toolbar_items_visibility()
m_dirty = true; m_dirty = true;
} }
// Returns a Rect object denoting size and position of the Reset button used by a gizmo.
// Returns in either screen or viewport coords.
#if !ENABLE_IMGUI
Rect GLCanvas3D::get_gizmo_reset_rect(const GLCanvas3D& canvas, bool viewport) const
{
const Size& cnv_size = canvas.get_canvas_size();
float w = (viewport ? -0.5f : 0.f) * (float)cnv_size.get_width();
float h = (viewport ? 0.5f : 1.f) * (float)cnv_size.get_height();
float zoom = canvas.get_camera_zoom();
float inv_zoom = viewport ? ((zoom != 0.0f) ? 1.0f / zoom : 0.0f) : 1.f;
const float gap = 30.f;
return Rect((w + gap + 80.f) * inv_zoom, (viewport ? -1.f : 1.f) * (h - GIZMO_RESET_BUTTON_HEIGHT) * inv_zoom,
(w + gap + 80.f + GIZMO_RESET_BUTTON_WIDTH) * inv_zoom, (viewport ? -1.f : 1.f) * (h * inv_zoom));
}
bool GLCanvas3D::gizmo_reset_rect_contains(const GLCanvas3D& canvas, float x, float y) const
{
const Rect& rect = get_gizmo_reset_rect(canvas, false);
return (rect.get_left() <= x) && (x <= rect.get_right()) && (rect.get_top() <= y) && (y <= rect.get_bottom());
}
#endif // not ENABLE_IMGUI
void GLCanvas3D::render() void GLCanvas3D::render()
{ {
@ -4184,9 +4141,7 @@ void GLCanvas3D::render()
// absolute value of the rotation // absolute value of the rotation
theta = 360.f - theta; theta = 360.f - theta;
#if ENABLE_IMGUI
wxGetApp().imgui()->new_frame(); wxGetApp().imgui()->new_frame();
#endif // ENABLE_IMGUI
// picking pass // picking pass
_picking_pass(); _picking_pass();
@ -4237,9 +4192,7 @@ void GLCanvas3D::render()
if (m_layers_editing.last_object_id >= 0) if (m_layers_editing.last_object_id >= 0)
m_layers_editing.render_overlay(*this); m_layers_editing.render_overlay(*this);
#if ENABLE_IMGUI
wxGetApp().imgui()->render(); wxGetApp().imgui()->render();
#endif // ENABLE_IMGUI
m_canvas->SwapBuffers(); m_canvas->SwapBuffers();
} }
@ -4805,13 +4758,11 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
int keyCode = evt.GetKeyCode(); int keyCode = evt.GetKeyCode();
int ctrlMask = wxMOD_CONTROL; int ctrlMask = wxMOD_CONTROL;
#if ENABLE_IMGUI
auto imgui = wxGetApp().imgui(); auto imgui = wxGetApp().imgui();
if (imgui->update_key_data(evt)) { if (imgui->update_key_data(evt)) {
render(); render();
return; return;
} }
#endif // ENABLE_IMGUI
//#ifdef __APPLE__ //#ifdef __APPLE__
// ctrlMask |= wxMOD_RAW_CONTROL; // ctrlMask |= wxMOD_RAW_CONTROL;
@ -4919,12 +4870,10 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
{ {
const int keyCode = evt.GetKeyCode(); const int keyCode = evt.GetKeyCode();
#if ENABLE_IMGUI
auto imgui = wxGetApp().imgui(); auto imgui = wxGetApp().imgui();
if (imgui->update_key_data(evt)) { if (imgui->update_key_data(evt)) {
render(); render();
} else } else
#endif // ENABLE_IMGUI
if (evt.GetEventType() == wxEVT_KEY_UP) { if (evt.GetEventType() == wxEVT_KEY_UP) {
if (m_tab_down && keyCode == WXK_TAB && !evt.HasAnyModifiers()) { if (m_tab_down && keyCode == WXK_TAB && !evt.HasAnyModifiers()) {
// Enable switching between 3D and Preview with Tab // Enable switching between 3D and Preview with Tab
@ -5047,7 +4996,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
Point pos(evt.GetX(), evt.GetY()); Point pos(evt.GetX(), evt.GetY());
#if ENABLE_IMGUI
ImGuiWrapper *imgui = wxGetApp().imgui(); ImGuiWrapper *imgui = wxGetApp().imgui();
if (imgui->update_mouse_data(evt)) { if (imgui->update_mouse_data(evt)) {
m_mouse.position = evt.Leaving() ? Vec2d(-1.0, -1.0) : pos.cast<double>(); m_mouse.position = evt.Leaving() ? Vec2d(-1.0, -1.0) : pos.cast<double>();
@ -5057,7 +5005,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
#endif /* SLIC3R_DEBUG_MOUSE_EVENTS */ #endif /* SLIC3R_DEBUG_MOUSE_EVENTS */
return; return;
} }
#endif // ENABLE_IMGUI
#ifdef __WXMSW__ #ifdef __WXMSW__
bool on_enter_workaround = false; bool on_enter_workaround = false;
@ -5628,12 +5575,6 @@ void GLCanvas3D::set_tooltip(const std::string& tooltip) const
} }
} }
#if !ENABLE_IMGUI
void GLCanvas3D::set_external_gizmo_widgets_parent(wxWindow *parent)
{
m_external_gizmo_widgets_parent = parent;
}
#endif // not ENABLE_IMGUI
void GLCanvas3D::do_move() void GLCanvas3D::do_move()
{ {
@ -6066,14 +6007,12 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
if ((m_canvas == nullptr) && (m_context == nullptr)) if ((m_canvas == nullptr) && (m_context == nullptr))
return; return;
#if ENABLE_IMGUI
wxGetApp().imgui()->set_display_size((float)w, (float)h); wxGetApp().imgui()->set_display_size((float)w, (float)h);
#if ENABLE_RETINA_GL #if ENABLE_RETINA_GL
wxGetApp().imgui()->set_style_scaling(m_retina_helper->get_scale_factor()); wxGetApp().imgui()->set_style_scaling(m_retina_helper->get_scale_factor());
#else #else
wxGetApp().imgui()->set_style_scaling(m_canvas->GetContentScaleFactor()); wxGetApp().imgui()->set_style_scaling(m_canvas->GetContentScaleFactor());
#endif #endif
#endif // ENABLE_IMGUI
// ensures that this canvas is current // ensures that this canvas is current
_set_current(); _set_current();

View File

@ -750,10 +750,6 @@ private:
void render_overlay(const GLCanvas3D& canvas, const Selection& selection) const; void render_overlay(const GLCanvas3D& canvas, const Selection& selection) const;
#if !ENABLE_IMGUI
void create_external_gizmo_widgets(wxWindow *parent);
#endif // not ENABLE_IMGUI
private: private:
void reset(); void reset();
@ -894,10 +890,6 @@ private:
GCodePreviewVolumeIndex m_gcode_preview_volume_index; GCodePreviewVolumeIndex m_gcode_preview_volume_index;
#if !ENABLE_IMGUI
wxWindow *m_external_gizmo_widgets_parent;
#endif // not ENABLE_IMGUI
public: public:
GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar); GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar);
~GLCanvas3D(); ~GLCanvas3D();
@ -971,11 +963,6 @@ public:
void update_toolbar_items_visibility(); void update_toolbar_items_visibility();
#if !ENABLE_IMGUI
Rect get_gizmo_reset_rect(const GLCanvas3D& canvas, bool viewport) const;
bool gizmo_reset_rect_contains(const GLCanvas3D& canvas, float x, float y) const;
#endif // not ENABLE_IMGUI
bool is_dragging() const { return m_gizmos.is_dragging() || m_moving; } bool is_dragging() const { return m_gizmos.is_dragging() || m_moving; }
void render(); void render();
@ -1016,10 +1003,6 @@ public:
void set_tooltip(const std::string& tooltip) const; void set_tooltip(const std::string& tooltip) const;
#if !ENABLE_IMGUI
void set_external_gizmo_widgets_parent(wxWindow *parent);
#endif // not ENABLE_IMGUI
void do_move(); void do_move();
void do_rotate(); void do_rotate();
void do_scale(); void do_scale();

View File

@ -79,9 +79,7 @@ IMPLEMENT_APP(GUI_App)
GUI_App::GUI_App() GUI_App::GUI_App()
: wxApp() : wxApp()
, m_em_unit(10) , m_em_unit(10)
#if ENABLE_IMGUI
, m_imgui(new ImGuiWrapper()) , m_imgui(new ImGuiWrapper())
#endif // ENABLE_IMGUI
{} {}
bool GUI_App::OnInit() bool GUI_App::OnInit()
@ -90,10 +88,7 @@ bool GUI_App::OnInit()
const wxString resources_dir = from_u8(Slic3r::resources_dir()); const wxString resources_dir = from_u8(Slic3r::resources_dir());
wxCHECK_MSG(wxDirExists(resources_dir), false, wxCHECK_MSG(wxDirExists(resources_dir), false,
wxString::Format("Resources path does not exist or is not a directory: %s", resources_dir)); wxString::Format("Resources path does not exist or is not a directory: %s", resources_dir));
#if ENABLE_IMGUI
wxCHECK_MSG(m_imgui->init(), false, "Failed to initialize ImGui"); wxCHECK_MSG(m_imgui->init(), false, "Failed to initialize ImGui");
#endif // ENABLE_IMGUI
SetAppName("Slic3rPE-beta"); SetAppName("Slic3rPE-beta");
SetAppDisplayName("Slic3r Prusa Edition"); SetAppDisplayName("Slic3r Prusa Edition");

View File

@ -5,9 +5,7 @@
#include <string> #include <string>
#include "libslic3r/PrintConfig.hpp" #include "libslic3r/PrintConfig.hpp"
#include "MainFrame.hpp" #include "MainFrame.hpp"
#if ENABLE_IMGUI
#include "ImGuiWrapper.hpp" #include "ImGuiWrapper.hpp"
#endif // ENABLE_IMGUI
#include <wx/app.h> #include <wx/app.h>
#include <wx/colour.h> #include <wx/colour.h>
@ -86,10 +84,7 @@ class GUI_App : public wxApp
wxLocale* m_wxLocale{ nullptr }; wxLocale* m_wxLocale{ nullptr };
#if ENABLE_IMGUI
std::unique_ptr<ImGuiWrapper> m_imgui; std::unique_ptr<ImGuiWrapper> m_imgui;
#endif // ENABLE_IMGUI
std::unique_ptr<PrintHostJobQueue> m_printhost_job_queue; std::unique_ptr<PrintHostJobQueue> m_printhost_job_queue;
public: public:
@ -166,9 +161,7 @@ public:
std::vector<Tab *> tabs_list; std::vector<Tab *> tabs_list;
#if ENABLE_IMGUI
ImGuiWrapper* imgui() { return m_imgui.get(); } ImGuiWrapper* imgui() { return m_imgui.get(); }
#endif // ENABLE_IMGUI
PrintHostJobQueue& printhost_job_queue() { return *m_printhost_job_queue.get(); } PrintHostJobQueue& printhost_job_queue() { return *m_printhost_job_queue.get(); }

View File

@ -30,9 +30,6 @@ namespace GUI {
View3D::View3D(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process) View3D::View3D(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process)
: m_canvas_widget(nullptr) : m_canvas_widget(nullptr)
, m_canvas(nullptr) , m_canvas(nullptr)
#if !ENABLE_IMGUI
, m_gizmo_widget(nullptr)
#endif // !ENABLE_IMGUI
{ {
init(parent, bed, camera, view_toolbar, model, config, process); init(parent, bed, camera, view_toolbar, model, config, process);
} }
@ -67,17 +64,8 @@ bool View3D::init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_
m_canvas->enable_gizmos(true); m_canvas->enable_gizmos(true);
m_canvas->enable_toolbar(true); m_canvas->enable_toolbar(true);
#if !ENABLE_IMGUI
m_gizmo_widget = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
m_gizmo_widget->SetSizer(new wxBoxSizer(wxVERTICAL));
m_canvas->set_external_gizmo_widgets_parent(m_gizmo_widget);
#endif // !ENABLE_IMGUI
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
main_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0); main_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0);
#if !ENABLE_IMGUI
main_sizer->Add(m_gizmo_widget, 0, wxALL | wxEXPAND, 0);
#endif // !ENABLE_IMGUI
SetSizer(main_sizer); SetSizer(main_sizer);
SetMinSize(GetSize()); SetMinSize(GetSize());

View File

@ -35,10 +35,6 @@ class View3D : public wxPanel
wxGLCanvas* m_canvas_widget; wxGLCanvas* m_canvas_widget;
GLCanvas3D* m_canvas; GLCanvas3D* m_canvas;
#if !ENABLE_IMGUI
wxPanel* m_gizmo_widget;
#endif // !ENABLE_IMGUI
public: public:
View3D(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process); View3D(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar, Model* model, DynamicPrintConfig* config, BackgroundSlicingProcess* process);
virtual ~View3D(); virtual ~View3D();

View File

@ -146,9 +146,7 @@ GLGizmoBase::GLGizmoBase(GLCanvas3D& parent, unsigned int sprite_id)
, m_sprite_id(sprite_id) , m_sprite_id(sprite_id)
, m_hover_id(-1) , m_hover_id(-1)
, m_dragging(false) , m_dragging(false)
#if ENABLE_IMGUI
, m_imgui(wxGetApp().imgui()) , m_imgui(wxGetApp().imgui())
#endif // ENABLE_IMGUI
{ {
::memcpy((void*)m_base_color, (const void*)DEFAULT_BASE_COLOR, 3 * sizeof(float)); ::memcpy((void*)m_base_color, (const void*)DEFAULT_BASE_COLOR, 3 * sizeof(float));
::memcpy((void*)m_drag_color, (const void*)DEFAULT_DRAG_COLOR, 3 * sizeof(float)); ::memcpy((void*)m_drag_color, (const void*)DEFAULT_DRAG_COLOR, 3 * sizeof(float));
@ -268,9 +266,6 @@ void GLGizmoBase::render_grabbers_for_picking(const BoundingBoxf3& box) const
} }
} }
#if !ENABLE_IMGUI
void GLGizmoBase::create_external_gizmo_widgets(wxWindow *parent) {}
#endif // not ENABLE_IMGUI
void GLGizmoBase::set_tooltip(const std::string& tooltip) const void GLGizmoBase::set_tooltip(const std::string& tooltip) const
{ {

View File

@ -27,9 +27,7 @@ static const float AXES_COLOR[3][3] = { { 1.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f
#if ENABLE_IMGUI
class ImGuiWrapper; class ImGuiWrapper;
#endif // ENABLE_IMGUI
class GLGizmoBase class GLGizmoBase
@ -101,9 +99,7 @@ protected:
float m_drag_color[3]; float m_drag_color[3];
float m_highlight_color[3]; float m_highlight_color[3];
mutable std::vector<Grabber> m_grabbers; mutable std::vector<Grabber> m_grabbers;
#if ENABLE_IMGUI
ImGuiWrapper* m_imgui; ImGuiWrapper* m_imgui;
#endif // ENABLE_IMGUI
public: public:
#if ENABLE_SVG_ICONS #if ENABLE_SVG_ICONS
@ -151,14 +147,7 @@ public:
void render(const GLCanvas3D::Selection& selection) const { on_render(selection); } void render(const GLCanvas3D::Selection& selection) const { on_render(selection); }
void render_for_picking(const GLCanvas3D::Selection& selection) const { on_render_for_picking(selection); } void render_for_picking(const GLCanvas3D::Selection& selection) const { on_render_for_picking(selection); }
#if !ENABLE_IMGUI
virtual void create_external_gizmo_widgets(wxWindow *parent);
#endif // not ENABLE_IMGUI
#if ENABLE_IMGUI
void render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection) { on_render_input_window(x, y, bottom_limit, 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: protected:
virtual bool on_init() = 0; virtual bool on_init() = 0;
@ -174,10 +163,7 @@ protected:
virtual void on_update(const UpdateData& data, const GLCanvas3D::Selection& selection) = 0; virtual void on_update(const UpdateData& data, const GLCanvas3D::Selection& selection) = 0;
virtual void on_render(const GLCanvas3D::Selection& selection) const = 0; virtual void on_render(const GLCanvas3D::Selection& selection) const = 0;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const = 0; 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, float bottom_limit, const GLCanvas3D::Selection& selection) {} virtual void on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection) {}
#endif // ENABLE_IMGUI
// Returns the picking color for the given id, based on the BASE_ID constant // Returns the picking color for the given id, based on the BASE_ID constant
// No check is made for clashing with other picking color (i.e. GLVolumes) // No check is made for clashing with other picking color (i.e. GLVolumes)

View File

@ -75,33 +75,11 @@ GLGizmoCut::GLGizmoCut(GLCanvas3D& parent, unsigned int sprite_id)
#endif // ENABLE_SVG_ICONS #endif // ENABLE_SVG_ICONS
, m_cut_z(0.0) , m_cut_z(0.0)
, m_max_z(0.0) , m_max_z(0.0)
#if !ENABLE_IMGUI
, m_panel(nullptr)
#endif // not ENABLE_IMGUI
, m_keep_upper(true) , m_keep_upper(true)
, m_keep_lower(true) , m_keep_lower(true)
, m_rotate_lower(false) , m_rotate_lower(false)
{} {}
#if !ENABLE_IMGUI
void GLGizmoCut::create_external_gizmo_widgets(wxWindow *parent)
{
wxASSERT(m_panel == nullptr);
m_panel = new GLGizmoCutPanel(parent);
parent->GetSizer()->Add(m_panel, 0, wxEXPAND);
parent->Layout();
parent->Fit();
auto prev_heigh = parent->GetMinSize().GetHeight();
parent->SetMinSize(wxSize(-1, std::max(prev_heigh, m_panel->GetSize().GetHeight())));
m_panel->Hide();
m_panel->Bind(wxEVT_BUTTON, [this](wxCommandEvent&) {
perform_cut(m_parent.get_selection());
}, wxID_OK);
}
#endif // not ENABLE_IMGUI
bool GLGizmoCut::on_init() bool GLGizmoCut::on_init()
{ {
@ -121,13 +99,6 @@ void GLGizmoCut::on_set_state()
if (get_state() == On) { if (get_state() == On) {
m_cut_z = m_parent.get_selection().get_bounding_box().size()(2) / 2.0; m_cut_z = m_parent.get_selection().get_bounding_box().size()(2) / 2.0;
} }
#if !ENABLE_IMGUI
// Display or hide the extra panel
if (m_panel != nullptr) {
m_panel->display(get_state() == On);
}
#endif // not ENABLE_IMGUI
} }
bool GLGizmoCut::on_is_activable(const GLCanvas3D::Selection& selection) const bool GLGizmoCut::on_is_activable(const GLCanvas3D::Selection& selection) const
@ -212,7 +183,6 @@ void GLGizmoCut::on_render_for_picking(const GLCanvas3D::Selection& selection) c
render_grabbers_for_picking(selection.get_bounding_box()); render_grabbers_for_picking(selection.get_bounding_box());
} }
#if ENABLE_IMGUI
void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit, 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_pos(x, y, ImGuiCond_Always);
@ -236,7 +206,6 @@ void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit, co
perform_cut(selection); perform_cut(selection);
} }
} }
#endif // ENABLE_IMGUI
void GLGizmoCut::update_max_z(const GLCanvas3D::Selection& selection) const void GLGizmoCut::update_max_z(const GLCanvas3D::Selection& selection) const
{ {

View File

@ -7,10 +7,6 @@
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
#if !ENABLE_IMGUI
class GLGizmoCutPanel;
#endif // not ENABLE_IMGUI
class GLGizmoCut : public GLGizmoBase class GLGizmoCut : public GLGizmoBase
{ {
static const double Offset; static const double Offset;
@ -25,9 +21,6 @@ class GLGizmoCut : public GLGizmoBase
bool m_keep_upper; bool m_keep_upper;
bool m_keep_lower; bool m_keep_lower;
bool m_rotate_lower; bool m_rotate_lower;
#if !ENABLE_IMGUI
GLGizmoCutPanel *m_panel;
#endif // not ENABLE_IMGUI
public: public:
#if ENABLE_SVG_ICONS #if ENABLE_SVG_ICONS
@ -36,12 +29,6 @@ public:
GLGizmoCut(GLCanvas3D& parent, unsigned int sprite_id); GLGizmoCut(GLCanvas3D& parent, unsigned int sprite_id);
#endif // ENABLE_SVG_ICONS #endif // ENABLE_SVG_ICONS
#if !ENABLE_IMGUI
virtual void create_external_gizmo_widgets(wxWindow *parent);
#endif // not ENABLE_IMGUI
#if !ENABLE_IMGUI
#endif // not ENABLE_IMGUI
protected: protected:
virtual bool on_init(); virtual bool on_init();
virtual std::string on_get_name() const; virtual std::string on_get_name() const;
@ -51,10 +38,8 @@ protected:
virtual void on_update(const UpdateData& data, const GLCanvas3D::Selection& selection); virtual void on_update(const UpdateData& data, const GLCanvas3D::Selection& selection);
virtual void on_render(const GLCanvas3D::Selection& selection) const; virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const; virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;
#if ENABLE_IMGUI
virtual void on_render_input_window(float x, float y, float bottom_limit, 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: private:
void update_max_z(const GLCanvas3D::Selection& selection) const; void update_max_z(const GLCanvas3D::Selection& selection) const;
void set_cut_z(double cut_z) const; void set_cut_z(double cut_z) const;

View File

@ -166,7 +166,6 @@ void GLGizmoMove3D::on_render_for_picking(const GLCanvas3D::Selection& selection
render_grabber_extension(Z, box, true); render_grabber_extension(Z, box, true);
} }
#if ENABLE_IMGUI
void GLGizmoMove3D::on_render_input_window(float x, float y, float bottom_limit, 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 #if !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
@ -184,7 +183,6 @@ void GLGizmoMove3D::on_render_input_window(float x, float y, float bottom_limit,
m_imgui->end(); m_imgui->end();
#endif // !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI #endif // !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
} }
#endif // ENABLE_IMGUI
double GLGizmoMove3D::calc_projection(const UpdateData& data) const double GLGizmoMove3D::calc_projection(const UpdateData& data) const
{ {

View File

@ -42,10 +42,7 @@ protected:
virtual void on_update(const UpdateData& data, const GLCanvas3D::Selection& selection); virtual void on_update(const UpdateData& data, const GLCanvas3D::Selection& selection);
virtual void on_render(const GLCanvas3D::Selection& selection) const; virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const; virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;
#if ENABLE_IMGUI
virtual void on_render_input_window(float x, float y, float bottom_limit, 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: private:
double calc_projection(const UpdateData& data) const; double calc_projection(const UpdateData& data) const;

View File

@ -483,7 +483,6 @@ void GLGizmoRotate3D::on_render(const GLCanvas3D::Selection& selection) const
m_gizmos[Z].render(selection); m_gizmos[Z].render(selection);
} }
#if ENABLE_IMGUI
void GLGizmoRotate3D::on_render_input_window(float x, float y, float bottom_limit, 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 #if !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
@ -497,7 +496,6 @@ void GLGizmoRotate3D::on_render_input_window(float x, float y, float bottom_limi
m_imgui->end(); m_imgui->end();
#endif // !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI #endif // !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
} }
#endif // ENABLE_IMGUI

View File

@ -131,9 +131,7 @@ protected:
} }
} }
#if ENABLE_IMGUI
virtual void on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection); virtual void on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection);
#endif // ENABLE_IMGUI
}; };

View File

@ -274,7 +274,6 @@ void GLGizmoScale3D::on_render_for_picking(const GLCanvas3D::Selection& selectio
render_grabbers_for_picking(selection.get_bounding_box()); render_grabbers_for_picking(selection.get_bounding_box());
} }
#if ENABLE_IMGUI
void GLGizmoScale3D::on_render_input_window(float x, float y, float bottom_limit, 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 #if !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
@ -288,7 +287,6 @@ void GLGizmoScale3D::on_render_input_window(float x, float y, float bottom_limit
m_imgui->end(); m_imgui->end();
#endif // !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI #endif // !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
} }
#endif // ENABLE_IMGUI
void GLGizmoScale3D::render_grabbers_connection(unsigned int id_1, unsigned int id_2) const void GLGizmoScale3D::render_grabbers_connection(unsigned int id_1, unsigned int id_2) const
{ {

View File

@ -42,10 +42,7 @@ protected:
virtual void on_update(const UpdateData& data, const GLCanvas3D::Selection& selection); virtual void on_update(const UpdateData& data, const GLCanvas3D::Selection& selection);
virtual void on_render(const GLCanvas3D::Selection& selection) const; virtual void on_render(const GLCanvas3D::Selection& selection) const;
virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const; virtual void on_render_for_picking(const GLCanvas3D::Selection& selection) const;
#if ENABLE_IMGUI
virtual void on_render_input_window(float x, float y, float bottom_limit, 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: private:
void render_grabbers_connection(unsigned int id_1, unsigned int id_2) const; void render_grabbers_connection(unsigned int id_1, unsigned int id_2) const;

View File

@ -80,10 +80,6 @@ void GLGizmoSlaSupports::on_render(const GLCanvas3D::Selection& selection) const
render_points(selection, false); render_points(selection, false);
render_selection_rectangle(); render_selection_rectangle();
#if !ENABLE_IMGUI
render_tooltip_texture();
#endif // not ENABLE_IMGUI
::glDisable(GL_BLEND); ::glDisable(GL_BLEND);
} }
@ -505,38 +501,6 @@ void GLGizmoSlaSupports::on_update(const UpdateData& data, const GLCanvas3D::Sel
} }
} }
#if !ENABLE_IMGUI
void GLGizmoSlaSupports::render_tooltip_texture() const {
if (m_tooltip_texture.get_id() == 0)
if (!m_tooltip_texture.load_from_file(resources_dir() + "/icons/sla_support_points_tooltip.png", false))
return;
if (m_reset_texture.get_id() == 0)
if (!m_reset_texture.load_from_file(resources_dir() + "/icons/sla_support_points_reset.png", false))
return;
float zoom = m_parent.get_camera_zoom();
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
float gap = 30.0f * inv_zoom;
const Size& cnv_size = m_parent.get_canvas_size();
float l = gap - cnv_size.get_width()/2.f * inv_zoom;
float r = l + (float)m_tooltip_texture.get_width() * inv_zoom;
float b = gap - cnv_size.get_height()/2.f * inv_zoom;
float t = b + (float)m_tooltip_texture.get_height() * inv_zoom;
Rect reset_rect = m_parent.get_gizmo_reset_rect(m_parent, true);
::glDisable(GL_DEPTH_TEST);
::glPushMatrix();
::glLoadIdentity();
GLTexture::render_texture(m_tooltip_texture.get_id(), l, r, b, t);
GLTexture::render_texture(m_reset_texture.get_id(), reset_rect.get_left(), reset_rect.get_right(), reset_rect.get_bottom(), reset_rect.get_top());
::glPopMatrix();
::glEnable(GL_DEPTH_TEST);
}
#endif // not ENABLE_IMGUI
std::vector<const ConfigOption*> GLGizmoSlaSupports::get_config_options(const std::vector<std::string>& keys) const std::vector<const ConfigOption*> GLGizmoSlaSupports::get_config_options(const std::vector<std::string>& keys) const
{ {
std::vector<const ConfigOption*> out; std::vector<const ConfigOption*> out;
@ -578,7 +542,6 @@ void GLGizmoSlaSupports::update_cache_entry_normal(unsigned int i) const
#if ENABLE_IMGUI
void GLGizmoSlaSupports::on_render_input_window(float x, float y, float bottom_limit, 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) if (!m_model_object)
@ -722,7 +685,6 @@ RENDER_AGAIN:
if (force_refresh) if (force_refresh)
m_parent.set_as_dirty(); m_parent.set_as_dirty();
} }
#endif // ENABLE_IMGUI
bool GLGizmoSlaSupports::on_is_activable(const GLCanvas3D::Selection& selection) const bool GLGizmoSlaSupports::on_is_activable(const GLCanvas3D::Selection& selection) const
{ {

View File

@ -75,12 +75,6 @@ private:
void update_mesh(); void update_mesh();
void update_cache_entry_normal(unsigned int i) const; void update_cache_entry_normal(unsigned int i) const;
#if !ENABLE_IMGUI
void render_tooltip_texture() const;
mutable GLTexture m_tooltip_texture;
mutable GLTexture m_reset_texture;
#endif // not ENABLE_IMGUI
bool m_lock_unique_islands = false; bool m_lock_unique_islands = false;
bool m_editing_mode = false; // Is editing mode active? bool m_editing_mode = false; // Is editing mode active?
bool m_old_editing_state = false; // To keep track of whether the user toggled between the modes (needed for imgui refreshes). bool m_old_editing_state = false; // To keep track of whether the user toggled between the modes (needed for imgui refreshes).
@ -120,10 +114,7 @@ private:
protected: protected:
void on_set_state() override; void on_set_state() override;
void on_start_dragging(const GLCanvas3D::Selection& selection) override; void on_start_dragging(const GLCanvas3D::Selection& selection) override;
#if ENABLE_IMGUI
virtual void on_render_input_window(float x, float y, float bottom_limit, 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; virtual std::string on_get_name() const;
virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const; virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const;