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
#define DISABLE_INSTANCES_SYNCH (0 && ENABLE_1_42_0_ALPHA1)
// Scene's GUI made using imgui library
#define ENABLE_IMGUI (1 && ENABLE_1_42_0_ALPHA1)
#define DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI (1 && ENABLE_IMGUI)
// Disable imgui dialog for move, rotate and scale gizmos
#define DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI (1 && ENABLE_1_42_0_ALPHA1)
// Use wxDataViewRender instead of wxDataViewCustomRenderer
#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();
}
#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()
{
@ -3031,9 +3023,7 @@ void GLCanvas3D::Gizmos::do_render_overlay(const GLCanvas3D& canvas, const GLCan
return;
float cnv_w = (float)canvas.get_canvas_size().get_width();
#if ENABLE_IMGUI
float cnv_h = (float)canvas.get_canvas_size().get_height();
#endif // ENABLE_IMGUI
float zoom = canvas.get_camera_zoom();
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
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) {
float toolbar_top = (float)cnv_h - canvas.m_view_toolbar.get_height();
#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);
#endif // ENABLE_SVG_ICONS
}
#endif // ENABLE_IMGUI
#if ENABLE_SVG_ICONS
top_y -= scaled_stride_y;
#else
@ -3739,9 +3727,6 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar
, m_color_by("volume")
, m_reload_delayed(false)
, m_render_sla_auxiliaries(true)
#if !ENABLE_IMGUI
, m_external_gizmo_widgets_parent(nullptr)
#endif // not ENABLE_IMGUI
{
if (m_canvas != nullptr) {
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;
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())
@ -4115,27 +4093,6 @@ void GLCanvas3D::update_toolbar_items_visibility()
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()
{
@ -4184,9 +4141,7 @@ void GLCanvas3D::render()
// absolute value of the rotation
theta = 360.f - theta;
#if ENABLE_IMGUI
wxGetApp().imgui()->new_frame();
#endif // ENABLE_IMGUI
// picking pass
_picking_pass();
@ -4237,9 +4192,7 @@ void GLCanvas3D::render()
if (m_layers_editing.last_object_id >= 0)
m_layers_editing.render_overlay(*this);
#if ENABLE_IMGUI
wxGetApp().imgui()->render();
#endif // ENABLE_IMGUI
m_canvas->SwapBuffers();
}
@ -4805,13 +4758,11 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
int keyCode = evt.GetKeyCode();
int ctrlMask = wxMOD_CONTROL;
#if ENABLE_IMGUI
auto imgui = wxGetApp().imgui();
if (imgui->update_key_data(evt)) {
render();
return;
}
#endif // ENABLE_IMGUI
//#ifdef __APPLE__
// ctrlMask |= wxMOD_RAW_CONTROL;
@ -4919,12 +4870,10 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
{
const int keyCode = evt.GetKeyCode();
#if ENABLE_IMGUI
auto imgui = wxGetApp().imgui();
if (imgui->update_key_data(evt)) {
render();
} else
#endif // ENABLE_IMGUI
if (evt.GetEventType() == wxEVT_KEY_UP) {
if (m_tab_down && keyCode == WXK_TAB && !evt.HasAnyModifiers()) {
// Enable switching between 3D and Preview with Tab
@ -5047,7 +4996,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
Point pos(evt.GetX(), evt.GetY());
#if ENABLE_IMGUI
ImGuiWrapper *imgui = wxGetApp().imgui();
if (imgui->update_mouse_data(evt)) {
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 */
return;
}
#endif // ENABLE_IMGUI
#ifdef __WXMSW__
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()
{
@ -6066,14 +6007,12 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
if ((m_canvas == nullptr) && (m_context == nullptr))
return;
#if ENABLE_IMGUI
wxGetApp().imgui()->set_display_size((float)w, (float)h);
#if ENABLE_RETINA_GL
wxGetApp().imgui()->set_style_scaling(m_retina_helper->get_scale_factor());
#else
wxGetApp().imgui()->set_style_scaling(m_canvas->GetContentScaleFactor());
#endif
#endif // ENABLE_IMGUI
// ensures that this canvas is current
_set_current();

View File

@ -750,10 +750,6 @@ private:
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:
void reset();
@ -894,10 +890,6 @@ private:
GCodePreviewVolumeIndex m_gcode_preview_volume_index;
#if !ENABLE_IMGUI
wxWindow *m_external_gizmo_widgets_parent;
#endif // not ENABLE_IMGUI
public:
GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar);
~GLCanvas3D();
@ -971,11 +963,6 @@ public:
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; }
void render();
@ -1016,10 +1003,6 @@ public:
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_rotate();
void do_scale();

View File

@ -79,9 +79,7 @@ IMPLEMENT_APP(GUI_App)
GUI_App::GUI_App()
: wxApp()
, m_em_unit(10)
#if ENABLE_IMGUI
, m_imgui(new ImGuiWrapper())
#endif // ENABLE_IMGUI
{}
bool GUI_App::OnInit()
@ -90,10 +88,7 @@ bool GUI_App::OnInit()
const wxString resources_dir = from_u8(Slic3r::resources_dir());
wxCHECK_MSG(wxDirExists(resources_dir), false,
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");
#endif // ENABLE_IMGUI
SetAppName("Slic3rPE-beta");
SetAppDisplayName("Slic3r Prusa Edition");

View File

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

View File

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

View File

@ -146,9 +146,7 @@ GLGizmoBase::GLGizmoBase(GLCanvas3D& parent, unsigned int sprite_id)
, m_sprite_id(sprite_id)
, m_hover_id(-1)
, m_dragging(false)
#if ENABLE_IMGUI
, m_imgui(wxGetApp().imgui())
#endif // ENABLE_IMGUI
{
::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));
@ -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
{

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;
#endif // ENABLE_IMGUI
class GLGizmoBase
@ -101,9 +99,7 @@ protected:
float m_drag_color[3];
float m_highlight_color[3];
mutable std::vector<Grabber> m_grabbers;
#if ENABLE_IMGUI
ImGuiWrapper* m_imgui;
#endif // ENABLE_IMGUI
public:
#if ENABLE_SVG_ICONS
@ -151,14 +147,7 @@ public:
void render(const GLCanvas3D::Selection& selection) const { on_render(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); }
#endif // ENABLE_IMGUI
protected:
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_render(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) {}
#endif // ENABLE_IMGUI
// 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)

View File

@ -75,33 +75,11 @@ GLGizmoCut::GLGizmoCut(GLCanvas3D& parent, unsigned int sprite_id)
#endif // ENABLE_SVG_ICONS
, m_cut_z(0.0)
, m_max_z(0.0)
#if !ENABLE_IMGUI
, m_panel(nullptr)
#endif // not ENABLE_IMGUI
, m_keep_upper(true)
, m_keep_lower(true)
, 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()
{
@ -121,13 +99,6 @@ void GLGizmoCut::on_set_state()
if (get_state() == On) {
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
@ -212,7 +183,6 @@ void GLGizmoCut::on_render_for_picking(const GLCanvas3D::Selection& selection) c
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)
{
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);
}
}
#endif // ENABLE_IMGUI
void GLGizmoCut::update_max_z(const GLCanvas3D::Selection& selection) const
{

View File

@ -7,10 +7,6 @@
namespace Slic3r {
namespace GUI {
#if !ENABLE_IMGUI
class GLGizmoCutPanel;
#endif // not ENABLE_IMGUI
class GLGizmoCut : public GLGizmoBase
{
static const double Offset;
@ -25,9 +21,6 @@ class GLGizmoCut : public GLGizmoBase
bool m_keep_upper;
bool m_keep_lower;
bool m_rotate_lower;
#if !ENABLE_IMGUI
GLGizmoCutPanel *m_panel;
#endif // not ENABLE_IMGUI
public:
#if ENABLE_SVG_ICONS
@ -36,12 +29,6 @@ public:
GLGizmoCut(GLCanvas3D& parent, unsigned int sprite_id);
#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:
virtual bool on_init();
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_render(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);
#endif // ENABLE_IMGUI
private:
void update_max_z(const GLCanvas3D::Selection& selection) 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);
}
#if ENABLE_IMGUI
void GLGizmoMove3D::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection)
{
#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();
#endif // !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
}
#endif // ENABLE_IMGUI
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_render(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);
#endif // ENABLE_IMGUI
private:
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);
}
#if ENABLE_IMGUI
void GLGizmoRotate3D::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection)
{
#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();
#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);
#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());
}
#if ENABLE_IMGUI
void GLGizmoScale3D::on_render_input_window(float x, float y, float bottom_limit, const GLCanvas3D::Selection& selection)
{
#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();
#endif // !DISABLE_MOVE_ROTATE_SCALE_GIZMOS_IMGUI
}
#endif // ENABLE_IMGUI
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_render(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);
#endif // ENABLE_IMGUI
private:
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_selection_rectangle();
#if !ENABLE_IMGUI
render_tooltip_texture();
#endif // not ENABLE_IMGUI
::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*> 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)
{
if (!m_model_object)
@ -722,7 +685,6 @@ RENDER_AGAIN:
if (force_refresh)
m_parent.set_as_dirty();
}
#endif // ENABLE_IMGUI
bool GLGizmoSlaSupports::on_is_activable(const GLCanvas3D::Selection& selection) const
{

View File

@ -75,12 +75,6 @@ private:
void update_mesh();
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_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).
@ -120,10 +114,7 @@ private:
protected:
void on_set_state() 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;
#endif // ENABLE_IMGUI
virtual std::string on_get_name() const;
virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const;