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

@ -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;