mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Merge branch 'master' of https://github.com/prusa3d/Slic3r into objects_centering
This commit is contained in:
commit
c2d34cea89
46 changed files with 1724 additions and 451 deletions
|
@ -59,6 +59,11 @@ void AppConfig::set_defaults()
|
|||
if (get("use_legacy_opengl").empty())
|
||||
set("use_legacy_opengl", "0");
|
||||
|
||||
#if __APPLE__
|
||||
if (get("use_retina_opengl").empty())
|
||||
set("use_retina_opengl", "1");
|
||||
#endif
|
||||
|
||||
if (get("remember_output_path").empty())
|
||||
set("remember_output_path", "1");
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "libslic3r/GCode/PreviewData.hpp"
|
||||
#include "libslic3r/Geometry.hpp"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
#include "libslic3r/Technologies.hpp"
|
||||
#include "slic3r/GUI/3DScene.hpp"
|
||||
#include "slic3r/GUI/BackgroundSlicingProcess.hpp"
|
||||
#include "slic3r/GUI/GLShader.hpp"
|
||||
|
@ -20,6 +21,10 @@
|
|||
#include "GUI_ObjectManipulation.hpp"
|
||||
#include "I18N.hpp"
|
||||
|
||||
#if ENABLE_RETINA_GL
|
||||
#include "slic3r/Utils/RetinaHelper.hpp"
|
||||
#endif
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include <wx/glcanvas.h>
|
||||
|
@ -45,6 +50,7 @@
|
|||
#include <iostream>
|
||||
#include <float.h>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
static const float TRACKBALLSIZE = 0.8f;
|
||||
static const float GIMBALL_LOCK_THETA_MAX = 180.0f;
|
||||
|
@ -59,8 +65,6 @@ static const float VIEW_BOTTOM[2] = { 0.0f, 180.0f };
|
|||
static const float VIEW_FRONT[2] = { 0.0f, 90.0f };
|
||||
static const float VIEW_REAR[2] = { 180.0f, 90.0f };
|
||||
|
||||
static const float VARIABLE_LAYER_THICKNESS_BAR_WIDTH = 70.0f;
|
||||
static const float VARIABLE_LAYER_THICKNESS_RESET_BUTTON_HEIGHT = 22.0f;
|
||||
static const float GIZMO_RESET_BUTTON_HEIGHT = 22.0f;
|
||||
static const float GIZMO_RESET_BUTTON_WIDTH = 70.f;
|
||||
|
||||
|
@ -191,9 +195,10 @@ Size::Size()
|
|||
{
|
||||
}
|
||||
|
||||
Size::Size(int width, int height)
|
||||
Size::Size(int width, int height, float scale_factor)
|
||||
: m_width(width)
|
||||
, m_height(height)
|
||||
, m_scale_factor(scale_factor)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -217,6 +222,16 @@ void Size::set_height(int height)
|
|||
m_height = height;
|
||||
}
|
||||
|
||||
int Size::get_scale_factor() const
|
||||
{
|
||||
return m_scale_factor;
|
||||
}
|
||||
|
||||
void Size::set_scale_factor(int scale_factor)
|
||||
{
|
||||
m_scale_factor = scale_factor;
|
||||
}
|
||||
|
||||
Rect::Rect()
|
||||
: m_left(0.0f)
|
||||
, m_top(0.0f)
|
||||
|
@ -330,6 +345,7 @@ void GLCanvas3D::Camera::set_scene_box(const BoundingBoxf3& box, GLCanvas3D& can
|
|||
|
||||
GLCanvas3D::Bed::Bed()
|
||||
: m_type(Custom)
|
||||
, m_scale_factor(1.0f)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -392,8 +408,10 @@ Point GLCanvas3D::Bed::point_projection(const Point& point) const
|
|||
}
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
void GLCanvas3D::Bed::render(float theta, bool useVBOs) const
|
||||
void GLCanvas3D::Bed::render(float theta, bool useVBOs, float scale_factor) const
|
||||
{
|
||||
m_scale_factor = scale_factor;
|
||||
|
||||
switch (m_type)
|
||||
{
|
||||
case MK2:
|
||||
|
@ -420,8 +438,10 @@ void GLCanvas3D::Bed::render(float theta, bool useVBOs) const
|
|||
}
|
||||
}
|
||||
#else
|
||||
void GLCanvas3D::Bed::render(float theta) const
|
||||
void GLCanvas3D::Bed::render(float theta, float scale_factor) const
|
||||
{
|
||||
m_scale_factor = scale_factor;
|
||||
|
||||
switch (m_type)
|
||||
{
|
||||
case MK2:
|
||||
|
@ -675,7 +695,7 @@ void GLCanvas3D::Bed::_render_custom() const
|
|||
|
||||
// we need depth test for grid, otherwise it would disappear when looking the object from below
|
||||
::glEnable(GL_DEPTH_TEST);
|
||||
::glLineWidth(3.0f);
|
||||
::glLineWidth(3.0f * m_scale_factor);
|
||||
::glColor4f(0.2f, 0.2f, 0.2f, 0.4f);
|
||||
::glVertexPointer(3, GL_FLOAT, 0, (GLvoid*)m_gridlines.get_vertices());
|
||||
::glDrawArrays(GL_LINES, 0, (GLsizei)gridlines_vcount);
|
||||
|
@ -873,6 +893,9 @@ GLCanvas3D::LayersEditing::~LayersEditing()
|
|||
delete m_slicing_parameters;
|
||||
}
|
||||
|
||||
const float GLCanvas3D::LayersEditing::THICKNESS_BAR_WIDTH = 70.0f;
|
||||
const float GLCanvas3D::LayersEditing::THICKNESS_RESET_BUTTON_HEIGHT = 22.0f;
|
||||
|
||||
bool GLCanvas3D::LayersEditing::init(const std::string& vertex_shader_filename, const std::string& fragment_shader_filename)
|
||||
{
|
||||
if (!m_shader.init(vertex_shader_filename, fragment_shader_filename))
|
||||
|
@ -993,7 +1016,7 @@ Rect GLCanvas3D::LayersEditing::get_bar_rect_screen(const GLCanvas3D& canvas)
|
|||
float w = (float)cnv_size.get_width();
|
||||
float h = (float)cnv_size.get_height();
|
||||
|
||||
return Rect(w - VARIABLE_LAYER_THICKNESS_BAR_WIDTH, 0.0f, w, h - VARIABLE_LAYER_THICKNESS_RESET_BUTTON_HEIGHT);
|
||||
return Rect(w - thickness_bar_width(canvas), 0.0f, w, h - reset_button_height(canvas));
|
||||
}
|
||||
|
||||
Rect GLCanvas3D::LayersEditing::get_reset_rect_screen(const GLCanvas3D& canvas)
|
||||
|
@ -1002,7 +1025,7 @@ Rect GLCanvas3D::LayersEditing::get_reset_rect_screen(const GLCanvas3D& canvas)
|
|||
float w = (float)cnv_size.get_width();
|
||||
float h = (float)cnv_size.get_height();
|
||||
|
||||
return Rect(w - VARIABLE_LAYER_THICKNESS_BAR_WIDTH, h - VARIABLE_LAYER_THICKNESS_RESET_BUTTON_HEIGHT, w, h);
|
||||
return Rect(w - thickness_bar_width(canvas), h - reset_button_height(canvas), w, h);
|
||||
}
|
||||
|
||||
Rect GLCanvas3D::LayersEditing::get_bar_rect_viewport(const GLCanvas3D& canvas)
|
||||
|
@ -1014,7 +1037,7 @@ Rect GLCanvas3D::LayersEditing::get_bar_rect_viewport(const GLCanvas3D& canvas)
|
|||
float zoom = canvas.get_camera_zoom();
|
||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
|
||||
return Rect((half_w - VARIABLE_LAYER_THICKNESS_BAR_WIDTH) * inv_zoom, half_h * inv_zoom, half_w * inv_zoom, (-half_h + VARIABLE_LAYER_THICKNESS_RESET_BUTTON_HEIGHT) * inv_zoom);
|
||||
return Rect((half_w - thickness_bar_width(canvas)) * inv_zoom, half_h * inv_zoom, half_w * inv_zoom, (-half_h + reset_button_height(canvas)) * inv_zoom);
|
||||
}
|
||||
|
||||
Rect GLCanvas3D::LayersEditing::get_reset_rect_viewport(const GLCanvas3D& canvas)
|
||||
|
@ -1026,7 +1049,7 @@ Rect GLCanvas3D::LayersEditing::get_reset_rect_viewport(const GLCanvas3D& canvas
|
|||
float zoom = canvas.get_camera_zoom();
|
||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
|
||||
return Rect((half_w - VARIABLE_LAYER_THICKNESS_BAR_WIDTH) * inv_zoom, (-half_h + VARIABLE_LAYER_THICKNESS_RESET_BUTTON_HEIGHT) * inv_zoom, half_w * inv_zoom, -half_h * inv_zoom);
|
||||
return Rect((half_w - thickness_bar_width(canvas)) * inv_zoom, (-half_h + reset_button_height(canvas)) * inv_zoom, half_w * inv_zoom, -half_h * inv_zoom);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1037,6 +1060,8 @@ bool GLCanvas3D::LayersEditing::_is_initialized() const
|
|||
|
||||
void GLCanvas3D::LayersEditing::_render_tooltip_texture(const GLCanvas3D& canvas, const Rect& bar_rect, const Rect& reset_rect) const
|
||||
{
|
||||
// TODO: do this with ImGui
|
||||
|
||||
if (m_tooltip_texture.get_id() == 0)
|
||||
{
|
||||
std::string filename = resources_dir() + "/icons/variable_layer_height_tooltip.png";
|
||||
|
@ -1044,6 +1069,15 @@ void GLCanvas3D::LayersEditing::_render_tooltip_texture(const GLCanvas3D& canvas
|
|||
return;
|
||||
}
|
||||
|
||||
#if ENABLE_RETINA_GL
|
||||
const float scale = canvas.get_canvas_size().get_scale_factor();
|
||||
const float width = (float)m_tooltip_texture.get_width() * scale;
|
||||
const float height = (float)m_tooltip_texture.get_height() * scale;
|
||||
#else
|
||||
const float width = (float)m_tooltip_texture.get_width();
|
||||
const float height = (float)m_tooltip_texture.get_height();
|
||||
#endif
|
||||
|
||||
float zoom = canvas.get_camera_zoom();
|
||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
float gap = 10.0f * inv_zoom;
|
||||
|
@ -1051,9 +1085,9 @@ void GLCanvas3D::LayersEditing::_render_tooltip_texture(const GLCanvas3D& canvas
|
|||
float bar_left = bar_rect.get_left();
|
||||
float reset_bottom = reset_rect.get_bottom();
|
||||
|
||||
float l = bar_left - (float)m_tooltip_texture.get_width() * inv_zoom - gap;
|
||||
float l = bar_left - width * inv_zoom - gap;
|
||||
float r = bar_left - gap;
|
||||
float t = reset_bottom + (float)m_tooltip_texture.get_height() * inv_zoom + gap;
|
||||
float t = reset_bottom + height * inv_zoom + gap;
|
||||
float b = reset_bottom + gap;
|
||||
|
||||
GLTexture::render_texture(m_tooltip_texture.get_id(), l, r, b, t);
|
||||
|
@ -1082,11 +1116,6 @@ void GLCanvas3D::LayersEditing::_render_active_object_annotations(const GLCanvas
|
|||
// The shader requires the original model coordinates when rendering to the texture, so we pass it the unit matrix
|
||||
m_shader.set_uniform("volume_world_matrix", UNIT_MATRIX);
|
||||
|
||||
GLsizei w = (GLsizei)m_layers_texture.width;
|
||||
GLsizei h = (GLsizei)m_layers_texture.height;
|
||||
GLsizei half_w = w / 2;
|
||||
GLsizei half_h = h / 2;
|
||||
|
||||
::glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
::glBindTexture(GL_TEXTURE_2D, m_z_texture_id);
|
||||
|
||||
|
@ -1267,6 +1296,25 @@ void GLCanvas3D::LayersEditing::update_slicing_parameters()
|
|||
}
|
||||
}
|
||||
|
||||
float GLCanvas3D::LayersEditing::thickness_bar_width(const GLCanvas3D &canvas)
|
||||
{
|
||||
#if ENABLE_RETINA_GL
|
||||
return canvas.get_canvas_size().get_scale_factor() * THICKNESS_BAR_WIDTH;
|
||||
#else
|
||||
return THICKNESS_BAR_WIDTH;
|
||||
#endif
|
||||
}
|
||||
|
||||
float GLCanvas3D::LayersEditing::reset_button_height(const GLCanvas3D &canvas)
|
||||
{
|
||||
#if ENABLE_RETINA_GL
|
||||
return canvas.get_canvas_size().get_scale_factor() * THICKNESS_RESET_BUTTON_HEIGHT;
|
||||
#else
|
||||
return THICKNESS_RESET_BUTTON_HEIGHT;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
const Point GLCanvas3D::Mouse::Drag::Invalid_2D_Point(INT_MAX, INT_MAX);
|
||||
const Vec3d GLCanvas3D::Mouse::Drag::Invalid_3D_Point(DBL_MAX, DBL_MAX, DBL_MAX);
|
||||
#if ENABLE_MOVE_MIN_THRESHOLD
|
||||
|
@ -1329,6 +1377,7 @@ GLCanvas3D::Selection::Selection()
|
|||
, m_valid(false)
|
||||
, m_bounding_box_dirty(true)
|
||||
, m_curved_arrow(16)
|
||||
, m_scale_factor(1.0f)
|
||||
{
|
||||
#if ENABLE_RENDER_SELECTION_CENTER
|
||||
m_quadric = ::gluNewQuadric();
|
||||
|
@ -2124,11 +2173,13 @@ void GLCanvas3D::Selection::erase()
|
|||
}
|
||||
}
|
||||
|
||||
void GLCanvas3D::Selection::render() const
|
||||
void GLCanvas3D::Selection::render(float scale_factor) const
|
||||
{
|
||||
if (!m_valid || is_empty())
|
||||
return;
|
||||
|
||||
m_scale_factor = scale_factor;
|
||||
|
||||
// render cumulative bounding box of selected volumes
|
||||
_render_selected_volumes();
|
||||
_render_synchronized_volumes();
|
||||
|
@ -2573,7 +2624,7 @@ void GLCanvas3D::Selection::_render_bounding_box(const BoundingBoxf3& box, float
|
|||
::glEnable(GL_DEPTH_TEST);
|
||||
|
||||
::glColor3fv(color);
|
||||
::glLineWidth(2.0f);
|
||||
::glLineWidth(2.0f * m_scale_factor);
|
||||
|
||||
::glBegin(GL_LINES);
|
||||
|
||||
|
@ -2866,14 +2917,11 @@ void GLCanvas3D::Selection::_ensure_on_bed()
|
|||
}
|
||||
}
|
||||
|
||||
const float GLCanvas3D::Gizmos::OverlayIconsScale = 1.0f;
|
||||
const float GLCanvas3D::Gizmos::OverlayBorder = 5.0f;
|
||||
const float GLCanvas3D::Gizmos::OverlayGapY = 5.0f * OverlayIconsScale;
|
||||
|
||||
GLCanvas3D::Gizmos::Gizmos()
|
||||
: m_enabled(false)
|
||||
, m_current(Undefined)
|
||||
{
|
||||
set_overlay_scale(1.0);
|
||||
}
|
||||
|
||||
GLCanvas3D::Gizmos::~Gizmos()
|
||||
|
@ -2977,6 +3025,13 @@ void GLCanvas3D::Gizmos::set_enabled(bool enable)
|
|||
m_enabled = enable;
|
||||
}
|
||||
|
||||
void GLCanvas3D::Gizmos::set_overlay_scale(float scale)
|
||||
{
|
||||
m_overlay_icons_scale = scale;
|
||||
m_overlay_border = 5.0f * scale;
|
||||
m_overlay_gap_y = 5.0f * scale;
|
||||
}
|
||||
|
||||
std::string GLCanvas3D::Gizmos::update_hover_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos, const GLCanvas3D::Selection& selection)
|
||||
{
|
||||
std::string name = "";
|
||||
|
@ -2986,22 +3041,22 @@ std::string GLCanvas3D::Gizmos::update_hover_state(const GLCanvas3D& canvas, con
|
|||
|
||||
float cnv_h = (float)canvas.get_canvas_size().get_height();
|
||||
float height = _get_total_overlay_height();
|
||||
float top_y = 0.5f * (cnv_h - height) + OverlayBorder;
|
||||
float top_y = 0.5f * (cnv_h - height) + m_overlay_border;
|
||||
for (GizmosMap::iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
|
||||
{
|
||||
if ((it->second == nullptr) || !it->second->is_selectable())
|
||||
continue;
|
||||
|
||||
float icon_size = (float)it->second->get_textures_size() * OverlayIconsScale;
|
||||
float icon_size = (float)it->second->get_textures_size() * m_overlay_icons_scale;
|
||||
|
||||
bool inside = (OverlayBorder <= (float)mouse_pos(0)) && ((float)mouse_pos(0) <= OverlayBorder + icon_size) && (top_y <= (float)mouse_pos(1)) && ((float)mouse_pos(1) <= top_y + icon_size);
|
||||
bool inside = (m_overlay_border <= (float)mouse_pos(0)) && ((float)mouse_pos(0) <= m_overlay_border + icon_size) && (top_y <= (float)mouse_pos(1)) && ((float)mouse_pos(1) <= top_y + icon_size);
|
||||
if (inside)
|
||||
name = it->second->get_name();
|
||||
|
||||
if (it->second->is_activable(selection) && (it->second->get_state() != GLGizmoBase::On))
|
||||
it->second->set_state(inside ? GLGizmoBase::Hover : GLGizmoBase::Off);
|
||||
|
||||
top_y += (icon_size + OverlayGapY);
|
||||
top_y += (icon_size + m_overlay_gap_y);
|
||||
}
|
||||
|
||||
return name;
|
||||
|
@ -3014,15 +3069,15 @@ void GLCanvas3D::Gizmos::update_on_off_state(const GLCanvas3D& canvas, const Vec
|
|||
|
||||
float cnv_h = (float)canvas.get_canvas_size().get_height();
|
||||
float height = _get_total_overlay_height();
|
||||
float top_y = 0.5f * (cnv_h - height) + OverlayBorder;
|
||||
float top_y = 0.5f * (cnv_h - height) + m_overlay_border;
|
||||
for (GizmosMap::iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
|
||||
{
|
||||
if ((it->second == nullptr) || !it->second->is_selectable())
|
||||
continue;
|
||||
|
||||
float icon_size = (float)it->second->get_textures_size() * OverlayIconsScale;
|
||||
float icon_size = (float)it->second->get_textures_size() * m_overlay_icons_scale;
|
||||
|
||||
bool inside = (OverlayBorder <= (float)mouse_pos(0)) && ((float)mouse_pos(0) <= OverlayBorder + icon_size) && (top_y <= (float)mouse_pos(1)) && ((float)mouse_pos(1) <= top_y + icon_size);
|
||||
bool inside = (m_overlay_border <= (float)mouse_pos(0)) && ((float)mouse_pos(0) <= m_overlay_border + icon_size) && (top_y <= (float)mouse_pos(1)) && ((float)mouse_pos(1) <= top_y + icon_size);
|
||||
if (it->second->is_activable(selection) && inside)
|
||||
{
|
||||
if ((it->second->get_state() == GLGizmoBase::On))
|
||||
|
@ -3039,7 +3094,7 @@ void GLCanvas3D::Gizmos::update_on_off_state(const GLCanvas3D& canvas, const Vec
|
|||
else
|
||||
it->second->set_state(GLGizmoBase::Off);
|
||||
|
||||
top_y += (icon_size + OverlayGapY);
|
||||
top_y += (icon_size + m_overlay_gap_y);
|
||||
}
|
||||
|
||||
GizmosMap::iterator it = m_gizmos.find(m_current);
|
||||
|
@ -3111,18 +3166,18 @@ bool GLCanvas3D::Gizmos::overlay_contains_mouse(const GLCanvas3D& canvas, const
|
|||
|
||||
float cnv_h = (float)canvas.get_canvas_size().get_height();
|
||||
float height = _get_total_overlay_height();
|
||||
float top_y = 0.5f * (cnv_h - height) + OverlayBorder;
|
||||
float top_y = 0.5f * (cnv_h - height) + m_overlay_border;
|
||||
for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
|
||||
{
|
||||
if ((it->second == nullptr) || !it->second->is_selectable())
|
||||
continue;
|
||||
|
||||
float icon_size = (float)it->second->get_textures_size() * OverlayIconsScale;
|
||||
float icon_size = (float)it->second->get_textures_size() * m_overlay_icons_scale;
|
||||
|
||||
if ((OverlayBorder <= (float)mouse_pos(0)) && ((float)mouse_pos(0) <= OverlayBorder + icon_size) && (top_y <= (float)mouse_pos(1)) && ((float)mouse_pos(1) <= top_y + icon_size))
|
||||
if ((m_overlay_border <= (float)mouse_pos(0)) && ((float)mouse_pos(0) <= m_overlay_border + icon_size) && (top_y <= (float)mouse_pos(1)) && ((float)mouse_pos(1) <= top_y + icon_size))
|
||||
return true;
|
||||
|
||||
top_y += (icon_size + OverlayGapY);
|
||||
top_y += (icon_size + m_overlay_gap_y);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -3395,7 +3450,7 @@ void GLCanvas3D::Gizmos::_render_overlay(const GLCanvas3D& canvas, const GLCanva
|
|||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
|
||||
float height = _get_total_overlay_height();
|
||||
float scaled_border = OverlayBorder * inv_zoom;
|
||||
float scaled_border = m_overlay_border * inv_zoom;
|
||||
|
||||
float top_x = (-0.5f * cnv_w) * inv_zoom;
|
||||
float top_y = (0.5f * height) * inv_zoom;
|
||||
|
@ -3440,7 +3495,7 @@ void GLCanvas3D::Gizmos::_render_overlay(const GLCanvas3D& canvas, const GLCanva
|
|||
bg_uv_left = bg_uv_i_left;
|
||||
bg_i_left = bg_left;
|
||||
|
||||
if ((OverlayBorder > 0) && (bg_uv_top != bg_uv_i_top))
|
||||
if ((m_overlay_border > 0) && (bg_uv_top != bg_uv_i_top))
|
||||
{
|
||||
if (bg_uv_left != bg_uv_i_left)
|
||||
GLTexture::render_sub_texture(bg_tex_id, bg_left, bg_i_left, bg_i_top, bg_top, { { bg_uv_left, bg_uv_i_top }, { bg_uv_i_left, bg_uv_i_top }, { bg_uv_i_left, bg_uv_top }, { bg_uv_left, bg_uv_top } });
|
||||
|
@ -3451,15 +3506,15 @@ void GLCanvas3D::Gizmos::_render_overlay(const GLCanvas3D& canvas, const GLCanva
|
|||
GLTexture::render_sub_texture(bg_tex_id, bg_i_right, bg_right, bg_i_top, bg_top, { { bg_uv_i_right, bg_uv_i_top }, { bg_uv_right, bg_uv_i_top }, { bg_uv_right, bg_uv_top }, { bg_uv_i_right, bg_uv_top } });
|
||||
}
|
||||
|
||||
if ((OverlayBorder > 0) && (bg_uv_left != bg_uv_i_left))
|
||||
if ((m_overlay_border > 0) && (bg_uv_left != bg_uv_i_left))
|
||||
GLTexture::render_sub_texture(bg_tex_id, bg_left, bg_i_left, bg_i_bottom, bg_i_top, { { bg_uv_left, bg_uv_i_bottom }, { bg_uv_i_left, bg_uv_i_bottom }, { bg_uv_i_left, bg_uv_i_top }, { bg_uv_left, bg_uv_i_top } });
|
||||
|
||||
GLTexture::render_sub_texture(bg_tex_id, bg_i_left, bg_i_right, bg_i_bottom, bg_i_top, { { bg_uv_i_left, bg_uv_i_bottom }, { bg_uv_i_right, bg_uv_i_bottom }, { bg_uv_i_right, bg_uv_i_top }, { bg_uv_i_left, bg_uv_i_top } });
|
||||
|
||||
if ((OverlayBorder > 0) && (bg_uv_right != bg_uv_i_right))
|
||||
if ((m_overlay_border > 0) && (bg_uv_right != bg_uv_i_right))
|
||||
GLTexture::render_sub_texture(bg_tex_id, bg_i_right, bg_right, bg_i_bottom, bg_i_top, { { bg_uv_i_right, bg_uv_i_bottom }, { bg_uv_right, bg_uv_i_bottom }, { bg_uv_right, bg_uv_i_top }, { bg_uv_i_right, bg_uv_i_top } });
|
||||
|
||||
if ((OverlayBorder > 0) && (bg_uv_bottom != bg_uv_i_bottom))
|
||||
if ((m_overlay_border > 0) && (bg_uv_bottom != bg_uv_i_bottom))
|
||||
{
|
||||
if (bg_uv_left != bg_uv_i_left)
|
||||
GLTexture::render_sub_texture(bg_tex_id, bg_left, bg_i_left, bg_bottom, bg_i_bottom, { { bg_uv_left, bg_uv_bottom }, { bg_uv_i_left, bg_uv_bottom }, { bg_uv_i_left, bg_uv_i_bottom }, { bg_uv_left, bg_uv_i_bottom } });
|
||||
|
@ -3471,19 +3526,19 @@ void GLCanvas3D::Gizmos::_render_overlay(const GLCanvas3D& canvas, const GLCanva
|
|||
}
|
||||
}
|
||||
|
||||
top_x += OverlayBorder * inv_zoom;
|
||||
top_y -= OverlayBorder * inv_zoom;
|
||||
float scaled_gap_y = OverlayGapY * inv_zoom;
|
||||
top_x += m_overlay_border * inv_zoom;
|
||||
top_y -= m_overlay_border * inv_zoom;
|
||||
float scaled_gap_y = m_overlay_gap_y * inv_zoom;
|
||||
for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
|
||||
{
|
||||
if ((it->second == nullptr) || !it->second->is_selectable())
|
||||
continue;
|
||||
|
||||
float icon_size = (float)it->second->get_textures_size() * OverlayIconsScale * inv_zoom;
|
||||
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 * OverlayBorder + icon_size * zoom, 0.5f * cnv_h - top_y * zoom, selection);
|
||||
it->second->render_input_window(2.0f * m_overlay_border + icon_size * zoom, 0.5f * cnv_h - top_y * zoom, selection);
|
||||
#endif // ENABLE_IMGUI
|
||||
top_y -= (icon_size + scaled_gap_y);
|
||||
}
|
||||
|
@ -3498,17 +3553,17 @@ void GLCanvas3D::Gizmos::_render_current_gizmo(const GLCanvas3D::Selection& sele
|
|||
|
||||
float GLCanvas3D::Gizmos::_get_total_overlay_height() const
|
||||
{
|
||||
float height = 2.0f * OverlayBorder;
|
||||
float height = 2.0f * m_overlay_border;
|
||||
|
||||
for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
|
||||
{
|
||||
if ((it->second == nullptr) || !it->second->is_selectable())
|
||||
continue;
|
||||
|
||||
height += (float)it->second->get_textures_size() * OverlayIconsScale + OverlayGapY;
|
||||
height += (float)it->second->get_textures_size() * m_overlay_icons_scale + m_overlay_gap_y;
|
||||
}
|
||||
|
||||
return height - OverlayGapY;
|
||||
return height - m_overlay_gap_y;
|
||||
}
|
||||
|
||||
float GLCanvas3D::Gizmos::_get_total_overlay_width() const
|
||||
|
@ -3519,10 +3574,10 @@ float GLCanvas3D::Gizmos::_get_total_overlay_width() const
|
|||
if ((it->second == nullptr) || !it->second->is_selectable())
|
||||
continue;
|
||||
|
||||
max_icon_width = std::max(max_icon_width, (float)it->second->get_textures_size() * OverlayIconsScale);
|
||||
max_icon_width = std::max(max_icon_width, (float)it->second->get_textures_size() * m_overlay_icons_scale);
|
||||
}
|
||||
|
||||
return max_icon_width + 2.0f * OverlayBorder;
|
||||
return max_icon_width + 2.0f * m_overlay_border;
|
||||
}
|
||||
|
||||
GLGizmoBase* GLCanvas3D::Gizmos::_get_current() const
|
||||
|
@ -3541,7 +3596,7 @@ GLCanvas3D::WarningTexture::WarningTexture()
|
|||
{
|
||||
}
|
||||
|
||||
bool GLCanvas3D::WarningTexture::generate(const std::string& msg)
|
||||
bool GLCanvas3D::WarningTexture::generate(const std::string& msg, const GLCanvas3D& canvas)
|
||||
{
|
||||
reset();
|
||||
|
||||
|
@ -3550,7 +3605,8 @@ bool GLCanvas3D::WarningTexture::generate(const std::string& msg)
|
|||
|
||||
wxMemoryDC memDC;
|
||||
// select default font
|
||||
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
|
||||
const float scale = canvas.get_canvas_size().get_scale_factor();
|
||||
wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale);
|
||||
font.MakeLarger();
|
||||
font.MakeBold();
|
||||
memDC.SetFont(font);
|
||||
|
@ -3698,9 +3754,18 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c
|
|||
wxMemoryDC memDC;
|
||||
wxMemoryDC mask_memDC;
|
||||
|
||||
// calculate scaling
|
||||
const float scale = canvas.get_canvas_size().get_scale_factor();
|
||||
const int scaled_square = std::floor((float)Px_Square * scale);
|
||||
const int scaled_title_offset = Px_Title_Offset * scale;
|
||||
const int scaled_text_offset = Px_Text_Offset * scale;
|
||||
const int scaled_square_contour = Px_Square_Contour * scale;
|
||||
const int scaled_border = Px_Border * scale;
|
||||
|
||||
// select default font
|
||||
memDC.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
||||
mask_memDC.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
|
||||
const wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Scale(scale);
|
||||
memDC.SetFont(font);
|
||||
mask_memDC.SetFont(font);
|
||||
|
||||
// calculates texture size
|
||||
wxCoord w, h;
|
||||
|
@ -3717,10 +3782,10 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c
|
|||
max_text_height = std::max(max_text_height, (int)h);
|
||||
}
|
||||
|
||||
m_original_width = std::max(2 * Px_Border + title_width, 2 * (Px_Border + Px_Square_Contour) + Px_Square + Px_Text_Offset + max_text_width);
|
||||
m_original_height = 2 * (Px_Border + Px_Square_Contour) + title_height + Px_Title_Offset + items_count * Px_Square;
|
||||
m_original_width = std::max(2 * scaled_border + title_width, 2 * (scaled_border + scaled_square_contour) + scaled_square + scaled_text_offset + max_text_width);
|
||||
m_original_height = 2 * (scaled_border + scaled_square_contour) + title_height + scaled_title_offset + items_count * scaled_square;
|
||||
if (items_count > 1)
|
||||
m_original_height += (items_count - 1) * Px_Square_Contour;
|
||||
m_original_height += (items_count - 1) * scaled_square_contour;
|
||||
|
||||
int pow_of_two_size = (int)next_highest_power_of_2(std::max<uint32_t>(m_original_width, m_original_height));
|
||||
|
||||
|
@ -3744,8 +3809,8 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c
|
|||
memDC.SetTextForeground(use_error_colors ? *wxWHITE : *wxBLACK);
|
||||
mask_memDC.SetTextForeground(*wxWHITE);
|
||||
|
||||
int title_x = Px_Border;
|
||||
int title_y = Px_Border;
|
||||
int title_x = scaled_border;
|
||||
int title_y = scaled_border;
|
||||
memDC.DrawText(title, title_x, title_y);
|
||||
mask_memDC.DrawText(title, title_x, title_y);
|
||||
|
||||
|
@ -3753,12 +3818,12 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c
|
|||
mask_memDC.SetBrush(wxBrush(*wxWHITE));
|
||||
|
||||
// draw icons contours as background
|
||||
int squares_contour_x = Px_Border;
|
||||
int squares_contour_y = Px_Border + title_height + Px_Title_Offset;
|
||||
int squares_contour_width = Px_Square + 2 * Px_Square_Contour;
|
||||
int squares_contour_height = items_count * Px_Square + 2 * Px_Square_Contour;
|
||||
int squares_contour_x = scaled_border;
|
||||
int squares_contour_y = scaled_border + title_height + scaled_title_offset;
|
||||
int squares_contour_width = scaled_square + 2 * scaled_square_contour;
|
||||
int squares_contour_height = items_count * scaled_square + 2 * scaled_square_contour;
|
||||
if (items_count > 1)
|
||||
squares_contour_height += (items_count - 1) * Px_Square_Contour;
|
||||
squares_contour_height += (items_count - 1) * scaled_square_contour;
|
||||
|
||||
wxColour color(Squares_Border_Color[0], Squares_Border_Color[1], Squares_Border_Color[2]);
|
||||
wxPen pen(color);
|
||||
|
@ -3769,15 +3834,15 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c
|
|||
mask_memDC.DrawRectangle(wxRect(squares_contour_x, squares_contour_y, squares_contour_width, squares_contour_height));
|
||||
|
||||
// draw items (colored icon + text)
|
||||
int icon_x = squares_contour_x + Px_Square_Contour;
|
||||
int icon_x = squares_contour_x + scaled_square_contour;
|
||||
int icon_x_inner = icon_x + 1;
|
||||
int icon_y = squares_contour_y + Px_Square_Contour;
|
||||
int icon_y_step = Px_Square + Px_Square_Contour;
|
||||
int icon_y = squares_contour_y + scaled_square_contour;
|
||||
int icon_y_step = scaled_square + scaled_square_contour;
|
||||
|
||||
int text_x = icon_x + Px_Square + Px_Text_Offset;
|
||||
int text_y_offset = (Px_Square - max_text_height) / 2;
|
||||
int text_x = icon_x + scaled_square + scaled_text_offset;
|
||||
int text_y_offset = (scaled_square - max_text_height) / 2;
|
||||
|
||||
int px_inner_square = Px_Square - 2;
|
||||
int px_inner_square = scaled_square - 2;
|
||||
|
||||
for (const GCodePreviewData::LegendItem& item : items)
|
||||
{
|
||||
|
@ -3791,7 +3856,7 @@ bool GLCanvas3D::LegendTexture::generate(const GCodePreviewData& preview_data, c
|
|||
brush.SetColour(color);
|
||||
memDC.SetPen(pen);
|
||||
memDC.SetBrush(brush);
|
||||
memDC.DrawRectangle(wxRect(icon_x, icon_y, Px_Square, Px_Square));
|
||||
memDC.DrawRectangle(wxRect(icon_x, icon_y, scaled_square, scaled_square));
|
||||
|
||||
// draw icon interior
|
||||
color.Set(item_color_bytes[0], item_color_bytes[1], item_color_bytes[2], item_color_bytes[3]);
|
||||
|
@ -3900,6 +3965,9 @@ wxDEFINE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent);
|
|||
GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
|
||||
: m_canvas(canvas)
|
||||
, m_context(nullptr)
|
||||
#if ENABLE_RETINA_GL
|
||||
, m_retina_helper(nullptr)
|
||||
#endif
|
||||
, m_in_render(false)
|
||||
, m_toolbar(GLToolbar::Normal)
|
||||
, m_view_toolbar(nullptr)
|
||||
|
@ -3933,8 +4001,12 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas)
|
|||
, m_external_gizmo_widgets_parent(nullptr)
|
||||
#endif // not ENABLE_IMGUI
|
||||
{
|
||||
if (m_canvas != nullptr)
|
||||
if (m_canvas != nullptr) {
|
||||
m_timer.SetOwner(m_canvas);
|
||||
#if ENABLE_RETINA_GL
|
||||
m_retina_helper.reset(new RetinaHelper(canvas));
|
||||
#endif
|
||||
}
|
||||
|
||||
m_selection.set_volumes(&m_volumes.volumes);
|
||||
}
|
||||
|
@ -5061,6 +5133,12 @@ void GLCanvas3D::on_timer(wxTimerEvent& evt)
|
|||
|
||||
void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
||||
{
|
||||
#if ENABLE_RETINA_GL
|
||||
const float scale = m_retina_helper->get_scale_factor();
|
||||
evt.SetX(evt.GetX() * scale);
|
||||
evt.SetY(evt.GetY() * scale);
|
||||
#endif
|
||||
|
||||
#if ENABLE_IMGUI
|
||||
auto imgui = wxGetApp().imgui();
|
||||
if (imgui->update_mouse_data(evt)) {
|
||||
|
@ -5283,7 +5361,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
wxGetApp().obj_manipul()->update_settings_value(m_selection);
|
||||
// forces a frame render to update the view before the context menu is shown
|
||||
render();
|
||||
post_event(Vec2dEvent(EVT_GLCANVAS_RIGHT_CLICK, pos.cast<double>()));
|
||||
|
||||
Vec2d logical_pos = pos.cast<double>();
|
||||
#if ENABLE_RETINA_GL
|
||||
const float factor = m_retina_helper->get_scale_factor();
|
||||
logical_pos = logical_pos.cwiseQuotient(Vec2d(factor, factor));
|
||||
#endif
|
||||
post_event(Vec2dEvent(EVT_GLCANVAS_RIGHT_CLICK, logical_pos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5549,7 +5633,15 @@ Size GLCanvas3D::get_canvas_size() const
|
|||
if (m_canvas != nullptr)
|
||||
m_canvas->GetSize(&w, &h);
|
||||
|
||||
return Size(w, h);
|
||||
#if ENABLE_RETINA_GL
|
||||
const float factor = m_retina_helper->get_scale_factor();
|
||||
w *= factor;
|
||||
h *= factor;
|
||||
#else
|
||||
const float factor = 1.0;
|
||||
#endif
|
||||
|
||||
return Size(w, h, factor);
|
||||
}
|
||||
|
||||
Point GLCanvas3D::get_local_mouse_position() const
|
||||
|
@ -5856,6 +5948,26 @@ void GLCanvas3D::handle_sidebar_focus_event(const std::string& opt_key, bool foc
|
|||
}
|
||||
}
|
||||
|
||||
void GLCanvas3D::update_ui_from_settings()
|
||||
{
|
||||
#if ENABLE_RETINA_GL
|
||||
const float orig_scaling = m_retina_helper->get_scale_factor();
|
||||
|
||||
const bool use_retina = wxGetApp().app_config->get("use_retina_opengl") == "1";
|
||||
BOOST_LOG_TRIVIAL(debug) << "GLCanvas3D: Use Retina OpenGL: " << use_retina;
|
||||
m_retina_helper->set_use_retina(use_retina);
|
||||
const float new_scaling = m_retina_helper->get_scale_factor();
|
||||
|
||||
if (new_scaling != orig_scaling) {
|
||||
BOOST_LOG_TRIVIAL(debug) << "GLCanvas3D: Scaling factor: " << new_scaling;
|
||||
|
||||
m_camera.zoom /= orig_scaling;
|
||||
m_camera.zoom *= new_scaling;
|
||||
_refresh_if_shown_on_screen();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool GLCanvas3D::_is_shown_on_screen() const
|
||||
{
|
||||
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;
|
||||
|
@ -6009,6 +6121,9 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h)
|
|||
|
||||
#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());
|
||||
#endif // ENABLE_RETINA_GL
|
||||
#endif // ENABLE_IMGUI
|
||||
|
||||
// ensures that this canvas is current
|
||||
|
@ -6289,10 +6404,15 @@ void GLCanvas3D::_render_background() const
|
|||
|
||||
void GLCanvas3D::_render_bed(float theta) const
|
||||
{
|
||||
float scale_factor = 1.0;
|
||||
#if ENABLE_RETINA_GL
|
||||
scale_factor = m_retina_helper->get_scale_factor();
|
||||
#endif
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
m_bed.render(theta, m_use_VBOs);
|
||||
m_bed.render(theta, m_use_VBOs, scale_factor);
|
||||
#else
|
||||
m_bed.render(theta);
|
||||
m_bed.render(theta, scale_factor);
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
}
|
||||
|
||||
|
@ -6371,8 +6491,13 @@ void GLCanvas3D::_render_objects() const
|
|||
|
||||
void GLCanvas3D::_render_selection() const
|
||||
{
|
||||
float scale_factor = 1.0;
|
||||
#if ENABLE_RETINA_GL
|
||||
scale_factor = m_retina_helper->get_scale_factor();
|
||||
#endif
|
||||
|
||||
if (!m_gizmos.is_running())
|
||||
m_selection.render();
|
||||
m_selection.render(scale_factor);
|
||||
}
|
||||
|
||||
#if ENABLE_RENDER_SELECTION_CENTER
|
||||
|
@ -6455,18 +6580,28 @@ void GLCanvas3D::_render_current_gizmo() const
|
|||
|
||||
void GLCanvas3D::_render_gizmos_overlay() const
|
||||
{
|
||||
#if ENABLE_RETINA_GL
|
||||
m_gizmos.set_overlay_scale(m_retina_helper->get_scale_factor());
|
||||
#endif
|
||||
m_gizmos.render_overlay(*this, m_selection);
|
||||
}
|
||||
|
||||
void GLCanvas3D::_render_toolbar() const
|
||||
{
|
||||
#if ENABLE_RETINA_GL
|
||||
m_toolbar.set_icons_scale(m_retina_helper->get_scale_factor());
|
||||
#endif
|
||||
m_toolbar.render(*this);
|
||||
}
|
||||
|
||||
void GLCanvas3D::_render_view_toolbar() const
|
||||
{
|
||||
if (m_view_toolbar != nullptr)
|
||||
if (m_view_toolbar != nullptr) {
|
||||
#if ENABLE_RETINA_GL
|
||||
m_view_toolbar->set_icons_scale(m_retina_helper->get_scale_factor());
|
||||
#endif
|
||||
m_view_toolbar->render(*this);
|
||||
}
|
||||
}
|
||||
|
||||
#if ENABLE_SHOW_CAMERA_TARGET
|
||||
|
@ -8167,7 +8302,7 @@ void GLCanvas3D::_generate_legend_texture(const GCodePreviewData& preview_data,
|
|||
|
||||
void GLCanvas3D::_generate_warning_texture(const std::string& msg)
|
||||
{
|
||||
m_warning_texture.generate(msg);
|
||||
m_warning_texture.generate(msg, *this);
|
||||
}
|
||||
|
||||
void GLCanvas3D::_reset_warning_texture()
|
||||
|
@ -8192,6 +8327,10 @@ void GLCanvas3D::_resize_toolbars() const
|
|||
float zoom = get_camera_zoom();
|
||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
|
||||
#if ENABLE_RETINA_GL
|
||||
m_toolbar.set_icons_scale(m_retina_helper->get_scale_factor());
|
||||
#endif
|
||||
|
||||
GLToolbar::Layout::EOrientation orientation = m_toolbar.get_layout_orientation();
|
||||
|
||||
switch (m_toolbar.get_layout_type())
|
||||
|
@ -8235,6 +8374,10 @@ void GLCanvas3D::_resize_toolbars() const
|
|||
|
||||
if (m_view_toolbar != nullptr)
|
||||
{
|
||||
#if ENABLE_RETINA_GL
|
||||
m_view_toolbar->set_icons_scale(m_retina_helper->get_scale_factor());
|
||||
#endif
|
||||
|
||||
// places the toolbar on the bottom-left corner of the 3d scene
|
||||
float top = (-0.5f * (float)cnv_size.get_height() + m_view_toolbar->get_height()) * inv_zoom;
|
||||
float left = -0.5f * (float)cnv_size.get_width() * inv_zoom;
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
#define slic3r_GLCanvas3D_hpp_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <memory>
|
||||
|
||||
#include "libslic3r/Technologies.hpp"
|
||||
#include "3DScene.hpp"
|
||||
#include "GLToolbar.hpp"
|
||||
#include "Event.hpp"
|
||||
|
@ -20,6 +22,9 @@ class wxTimerEvent;
|
|||
class wxPaintEvent;
|
||||
class wxGLCanvas;
|
||||
|
||||
// Support for Retina OpenGL on Mac OS
|
||||
#define ENABLE_RETINA_GL __APPLE__
|
||||
|
||||
class GLUquadric;
|
||||
typedef class GLUquadric GLUquadricObj;
|
||||
|
||||
|
@ -36,6 +41,10 @@ namespace GUI {
|
|||
|
||||
class GLGizmoBase;
|
||||
|
||||
#if ENABLE_RETINA_GL
|
||||
class RetinaHelper;
|
||||
#endif
|
||||
|
||||
class GeometryBuffer
|
||||
{
|
||||
std::vector<float> m_vertices;
|
||||
|
@ -55,16 +64,20 @@ class Size
|
|||
{
|
||||
int m_width;
|
||||
int m_height;
|
||||
float m_scale_factor;
|
||||
|
||||
public:
|
||||
Size();
|
||||
Size(int width, int height);
|
||||
Size(int width, int height, float scale_factor = 1.0);
|
||||
|
||||
int get_width() const;
|
||||
void set_width(int width);
|
||||
|
||||
int get_height() const;
|
||||
void set_height(int height);
|
||||
|
||||
int get_scale_factor() const;
|
||||
void set_scale_factor(int height);
|
||||
};
|
||||
|
||||
class Rect
|
||||
|
@ -209,6 +222,8 @@ class GLCanvas3D
|
|||
mutable GLBed m_model;
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
mutable float m_scale_factor;
|
||||
|
||||
public:
|
||||
Bed();
|
||||
|
||||
|
@ -224,9 +239,9 @@ class GLCanvas3D
|
|||
Point point_projection(const Point& point) const;
|
||||
|
||||
#if ENABLE_PRINT_BED_MODELS
|
||||
void render(float theta, bool useVBOs) const;
|
||||
void render(float theta, bool useVBOs, float scale_factor) const;
|
||||
#else
|
||||
void render(float theta) const;
|
||||
void render(float theta, float scale_factor) const;
|
||||
#endif // ENABLE_PRINT_BED_MODELS
|
||||
|
||||
private:
|
||||
|
@ -297,6 +312,9 @@ class GLCanvas3D
|
|||
};
|
||||
|
||||
private:
|
||||
static const float THICKNESS_BAR_WIDTH;
|
||||
static const float THICKNESS_RESET_BUTTON_HEIGHT;
|
||||
|
||||
bool m_use_legacy_opengl;
|
||||
bool m_enabled;
|
||||
Shader m_shader;
|
||||
|
@ -380,6 +398,9 @@ class GLCanvas3D
|
|||
void _render_active_object_annotations(const GLCanvas3D& canvas, const Rect& bar_rect) const;
|
||||
void _render_profile(const Rect& bar_rect) const;
|
||||
void update_slicing_parameters();
|
||||
|
||||
static float thickness_bar_width(const GLCanvas3D &canvas);
|
||||
static float reset_button_height(const GLCanvas3D &canvas);
|
||||
};
|
||||
|
||||
struct Mouse
|
||||
|
@ -536,6 +557,8 @@ public:
|
|||
mutable GLArrow m_arrow;
|
||||
mutable GLCurvedArrow m_curved_arrow;
|
||||
|
||||
mutable float m_scale_factor;
|
||||
|
||||
public:
|
||||
Selection();
|
||||
#if ENABLE_RENDER_SELECTION_CENTER
|
||||
|
@ -617,7 +640,7 @@ public:
|
|||
|
||||
void erase();
|
||||
|
||||
void render() const;
|
||||
void render(float scale_factor = 1.0) const;
|
||||
#if ENABLE_RENDER_SELECTION_CENTER
|
||||
void render_center() const;
|
||||
#endif // ENABLE_RENDER_SELECTION_CENTER
|
||||
|
@ -680,10 +703,6 @@ public:
|
|||
private:
|
||||
class Gizmos
|
||||
{
|
||||
static const float OverlayIconsScale;
|
||||
static const float OverlayBorder;
|
||||
static const float OverlayGapY;
|
||||
|
||||
public:
|
||||
enum EType : unsigned char
|
||||
{
|
||||
|
@ -704,6 +723,10 @@ private:
|
|||
BackgroundTexture m_background_texture;
|
||||
EType m_current;
|
||||
|
||||
float m_overlay_icons_scale;
|
||||
float m_overlay_border;
|
||||
float m_overlay_gap_y;
|
||||
|
||||
public:
|
||||
Gizmos();
|
||||
~Gizmos();
|
||||
|
@ -713,6 +736,8 @@ private:
|
|||
bool is_enabled() const;
|
||||
void set_enabled(bool enable);
|
||||
|
||||
void set_overlay_scale(float scale);
|
||||
|
||||
std::string update_hover_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos, const Selection& selection);
|
||||
void update_on_off_state(const GLCanvas3D& canvas, const Vec2d& mouse_pos, const Selection& selection);
|
||||
void update_on_off_state(const Selection& selection);
|
||||
|
@ -802,7 +827,7 @@ private:
|
|||
public:
|
||||
WarningTexture();
|
||||
|
||||
bool generate(const std::string& msg);
|
||||
bool generate(const std::string& msg, const GLCanvas3D& canvas);
|
||||
|
||||
void render(const GLCanvas3D& canvas) const;
|
||||
};
|
||||
|
@ -832,6 +857,9 @@ private:
|
|||
|
||||
wxGLCanvas* m_canvas;
|
||||
wxGLContext* m_context;
|
||||
#if ENABLE_RETINA_GL
|
||||
std::unique_ptr<RetinaHelper> m_retina_helper;
|
||||
#endif
|
||||
bool m_in_render;
|
||||
LegendTexture m_legend_texture;
|
||||
WarningTexture m_warning_texture;
|
||||
|
@ -1030,6 +1058,8 @@ public:
|
|||
|
||||
void handle_sidebar_focus_event(const std::string& opt_key, bool focus_on);
|
||||
|
||||
void update_ui_from_settings();
|
||||
|
||||
private:
|
||||
bool _is_shown_on_screen() const;
|
||||
#if !ENABLE_REWORKED_BED_SHAPE_CHANGE
|
||||
|
|
|
@ -1428,6 +1428,7 @@ void GLGizmoFlatten::on_start_dragging(const GLCanvas3D::Selection& selection)
|
|||
{
|
||||
if (m_hover_id != -1)
|
||||
{
|
||||
assert(m_planes_valid);
|
||||
m_normal = m_planes[m_hover_id].normal;
|
||||
m_starting_center = selection.get_bounding_box().center();
|
||||
}
|
||||
|
@ -1446,6 +1447,8 @@ void GLGizmoFlatten::on_render(const GLCanvas3D::Selection& selection) const
|
|||
::glPushMatrix();
|
||||
::glMultMatrixd(m.data());
|
||||
::glTranslatef(0.f, 0.f, selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z());
|
||||
if (this->is_plane_update_necessary())
|
||||
const_cast<GLGizmoFlatten*>(this)->update_planes();
|
||||
for (int i = 0; i < (int)m_planes.size(); ++i)
|
||||
{
|
||||
if (i == m_hover_id)
|
||||
|
@ -1478,6 +1481,8 @@ void GLGizmoFlatten::on_render_for_picking(const GLCanvas3D::Selection& selectio
|
|||
::glPushMatrix();
|
||||
::glMultMatrixd(m.data());
|
||||
::glTranslatef(0.f, 0.f, selection.get_volume(*selection.get_volume_idxs().begin())->get_sla_shift_z());
|
||||
if (this->is_plane_update_necessary())
|
||||
const_cast<GLGizmoFlatten*>(this)->update_planes();
|
||||
for (int i = 0; i < (int)m_planes.size(); ++i)
|
||||
{
|
||||
::glColor3f(1.0f, 1.0f, picking_color_component(i));
|
||||
|
@ -1497,11 +1502,11 @@ void GLGizmoFlatten::on_render_for_picking(const GLCanvas3D::Selection& selectio
|
|||
void GLGizmoFlatten::set_flattening_data(const ModelObject* model_object)
|
||||
{
|
||||
m_starting_center = Vec3d::Zero();
|
||||
bool object_changed = m_model_object != model_object;
|
||||
if (m_model_object != model_object) {
|
||||
m_planes.clear();
|
||||
m_planes_valid = false;
|
||||
}
|
||||
m_model_object = model_object;
|
||||
|
||||
if (model_object && (object_changed || is_plane_update_necessary()))
|
||||
update_planes();
|
||||
}
|
||||
|
||||
void GLGizmoFlatten::update_planes()
|
||||
|
@ -1701,6 +1706,8 @@ void GLGizmoFlatten::update_planes()
|
|||
}
|
||||
m_first_instance_scale = m_model_object->instances.front()->get_scaling_factor();
|
||||
m_first_instance_mirror = m_model_object->instances.front()->get_mirror();
|
||||
|
||||
m_planes_valid = true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1709,7 +1716,7 @@ bool GLGizmoFlatten::is_plane_update_necessary() const
|
|||
if (m_state != On || !m_model_object || m_model_object->instances.empty())
|
||||
return false;
|
||||
|
||||
if (m_model_object->volumes.size() != m_volumes_matrices.size())
|
||||
if (! m_planes_valid || m_model_object->volumes.size() != m_volumes_matrices.size())
|
||||
return true;
|
||||
|
||||
// We want to recalculate when the scale changes - some planes could (dis)appear.
|
||||
|
|
|
@ -408,6 +408,7 @@ private:
|
|||
Vec3d m_first_instance_mirror;
|
||||
|
||||
std::vector<PlaneData> m_planes;
|
||||
bool m_planes_valid = false;
|
||||
mutable Vec3d m_starting_center;
|
||||
const ModelObject* m_model_object = nullptr;
|
||||
std::vector<const Transform3d*> instances_matrices;
|
||||
|
|
|
@ -468,12 +468,12 @@ float GLToolbar::get_width_horizontal() const
|
|||
|
||||
float GLToolbar::get_width_vertical() const
|
||||
{
|
||||
return 2.0f * m_layout.border + m_icons_texture.metadata.icon_size * m_layout.icons_scale;
|
||||
return 2.0f * m_layout.border * m_layout.icons_scale + m_icons_texture.metadata.icon_size * m_layout.icons_scale;
|
||||
}
|
||||
|
||||
float GLToolbar::get_height_horizontal() const
|
||||
{
|
||||
return 2.0f * m_layout.border + m_icons_texture.metadata.icon_size * m_layout.icons_scale;
|
||||
return 2.0f * m_layout.border * m_layout.icons_scale + m_icons_texture.metadata.icon_size * m_layout.icons_scale;
|
||||
}
|
||||
|
||||
float GLToolbar::get_height_vertical() const
|
||||
|
@ -483,33 +483,36 @@ float GLToolbar::get_height_vertical() const
|
|||
|
||||
float GLToolbar::get_main_size() const
|
||||
{
|
||||
float size = 2.0f * m_layout.border;
|
||||
float size = 2.0f * m_layout.border * m_layout.icons_scale;
|
||||
for (unsigned int i = 0; i < (unsigned int)m_items.size(); ++i)
|
||||
{
|
||||
if (m_items[i]->is_separator())
|
||||
size += m_layout.separator_size;
|
||||
size += m_layout.separator_size * m_layout.icons_scale;
|
||||
else
|
||||
size += (float)m_icons_texture.metadata.icon_size * m_layout.icons_scale;
|
||||
}
|
||||
|
||||
if (m_items.size() > 1)
|
||||
size += ((float)m_items.size() - 1.0f) * m_layout.gap_size;
|
||||
size += ((float)m_items.size() - 1.0f) * m_layout.gap_size * m_layout.icons_scale;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLCanvas3D& parent)
|
||||
{
|
||||
// NB: mouse_pos is already scaled appropriately
|
||||
|
||||
float zoom = parent.get_camera_zoom();
|
||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
float factor = m_layout.icons_scale * inv_zoom;
|
||||
|
||||
Size cnv_size = parent.get_canvas_size();
|
||||
Vec2d scaled_mouse_pos((mouse_pos(0) - 0.5 * (double)cnv_size.get_width()) * inv_zoom, (0.5 * (double)cnv_size.get_height() - mouse_pos(1)) * inv_zoom);
|
||||
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * m_layout.icons_scale * inv_zoom;
|
||||
float scaled_separator_size = m_layout.separator_size * inv_zoom;
|
||||
float scaled_gap_size = m_layout.gap_size * inv_zoom;
|
||||
float scaled_border = m_layout.border * inv_zoom;
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * factor;
|
||||
float scaled_separator_size = m_layout.separator_size * factor;
|
||||
float scaled_gap_size = m_layout.gap_size * factor;
|
||||
float scaled_border = m_layout.border * factor;
|
||||
|
||||
float separator_stride = scaled_separator_size + scaled_gap_size;
|
||||
float icon_stride = scaled_icons_size + scaled_gap_size;
|
||||
|
@ -591,16 +594,19 @@ std::string GLToolbar::update_hover_state_horizontal(const Vec2d& mouse_pos, GLC
|
|||
|
||||
std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCanvas3D& parent)
|
||||
{
|
||||
// NB: mouse_pos is already scaled appropriately
|
||||
|
||||
float zoom = parent.get_camera_zoom();
|
||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
float factor = m_layout.icons_scale * inv_zoom;
|
||||
|
||||
Size cnv_size = parent.get_canvas_size();
|
||||
Vec2d scaled_mouse_pos((mouse_pos(0) - 0.5 * (double)cnv_size.get_width()) * inv_zoom, (0.5 * (double)cnv_size.get_height() - mouse_pos(1)) * inv_zoom);
|
||||
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * m_layout.icons_scale * inv_zoom;
|
||||
float scaled_separator_size = m_layout.separator_size * inv_zoom;
|
||||
float scaled_gap_size = m_layout.gap_size * inv_zoom;
|
||||
float scaled_border = m_layout.border * inv_zoom;
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * factor;
|
||||
float scaled_separator_size = m_layout.separator_size * factor;
|
||||
float scaled_gap_size = m_layout.gap_size * factor;
|
||||
float scaled_border = m_layout.border * factor;
|
||||
|
||||
float separator_stride = scaled_separator_size + scaled_gap_size;
|
||||
float icon_stride = scaled_icons_size + scaled_gap_size;
|
||||
|
@ -682,16 +688,19 @@ std::string GLToolbar::update_hover_state_vertical(const Vec2d& mouse_pos, GLCan
|
|||
|
||||
int GLToolbar::contains_mouse_horizontal(const Vec2d& mouse_pos, const GLCanvas3D& parent) const
|
||||
{
|
||||
// NB: mouse_pos is already scaled appropriately
|
||||
|
||||
float zoom = parent.get_camera_zoom();
|
||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
float factor = m_layout.icons_scale * inv_zoom;
|
||||
|
||||
Size cnv_size = parent.get_canvas_size();
|
||||
Vec2d scaled_mouse_pos((mouse_pos(0) - 0.5 * (double)cnv_size.get_width()) * inv_zoom, (0.5 * (double)cnv_size.get_height() - mouse_pos(1)) * inv_zoom);
|
||||
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * m_layout.icons_scale * inv_zoom;
|
||||
float scaled_separator_size = m_layout.separator_size * inv_zoom;
|
||||
float scaled_gap_size = m_layout.gap_size * inv_zoom;
|
||||
float scaled_border = m_layout.border * inv_zoom;
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * factor;
|
||||
float scaled_separator_size = m_layout.separator_size * factor;
|
||||
float scaled_gap_size = m_layout.gap_size * factor;
|
||||
float scaled_border = m_layout.border * factor;
|
||||
|
||||
float separator_stride = scaled_separator_size + scaled_gap_size;
|
||||
float icon_stride = scaled_icons_size + scaled_gap_size;
|
||||
|
@ -724,16 +733,19 @@ int GLToolbar::contains_mouse_horizontal(const Vec2d& mouse_pos, const GLCanvas3
|
|||
|
||||
int GLToolbar::contains_mouse_vertical(const Vec2d& mouse_pos, const GLCanvas3D& parent) const
|
||||
{
|
||||
// NB: mouse_pos is already scaled appropriately
|
||||
|
||||
float zoom = parent.get_camera_zoom();
|
||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
float factor = m_layout.icons_scale * inv_zoom;
|
||||
|
||||
Size cnv_size = parent.get_canvas_size();
|
||||
Vec2d scaled_mouse_pos((mouse_pos(0) - 0.5 * (double)cnv_size.get_width()) * inv_zoom, (0.5 * (double)cnv_size.get_height() - mouse_pos(1)) * inv_zoom);
|
||||
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * m_layout.icons_scale * inv_zoom;
|
||||
float scaled_separator_size = m_layout.separator_size * inv_zoom;
|
||||
float scaled_gap_size = m_layout.gap_size * inv_zoom;
|
||||
float scaled_border = m_layout.border * inv_zoom;
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * factor;
|
||||
float scaled_separator_size = m_layout.separator_size * factor;
|
||||
float scaled_gap_size = m_layout.gap_size * factor;
|
||||
float scaled_border = m_layout.border * factor;
|
||||
|
||||
float separator_stride = scaled_separator_size + scaled_gap_size;
|
||||
float icon_stride = scaled_icons_size + scaled_gap_size;
|
||||
|
@ -774,11 +786,12 @@ void GLToolbar::render_horizontal(const GLCanvas3D& parent) const
|
|||
|
||||
float zoom = parent.get_camera_zoom();
|
||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
float factor = inv_zoom * m_layout.icons_scale;
|
||||
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * m_layout.icons_scale * inv_zoom;
|
||||
float scaled_separator_size = m_layout.separator_size * inv_zoom;
|
||||
float scaled_gap_size = m_layout.gap_size * inv_zoom;
|
||||
float scaled_border = m_layout.border * inv_zoom;
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * factor;
|
||||
float scaled_separator_size = m_layout.separator_size * factor;
|
||||
float scaled_gap_size = m_layout.gap_size * factor;
|
||||
float scaled_border = m_layout.border * factor;
|
||||
float scaled_width = get_width() * inv_zoom;
|
||||
float scaled_height = get_height() * inv_zoom;
|
||||
|
||||
|
@ -899,11 +912,12 @@ void GLToolbar::render_vertical(const GLCanvas3D& parent) const
|
|||
|
||||
float zoom = parent.get_camera_zoom();
|
||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||
float factor = inv_zoom * m_layout.icons_scale;
|
||||
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * m_layout.icons_scale * inv_zoom;
|
||||
float scaled_separator_size = m_layout.separator_size * inv_zoom;
|
||||
float scaled_gap_size = m_layout.gap_size * inv_zoom;
|
||||
float scaled_border = m_layout.border * inv_zoom;
|
||||
float scaled_icons_size = (float)m_icons_texture.metadata.icon_size * m_layout.icons_scale * factor;
|
||||
float scaled_separator_size = m_layout.separator_size * factor;
|
||||
float scaled_gap_size = m_layout.gap_size * factor;
|
||||
float scaled_border = m_layout.border * factor;
|
||||
float scaled_width = get_width() * inv_zoom;
|
||||
float scaled_height = get_height() * inv_zoom;
|
||||
|
||||
|
|
|
@ -539,6 +539,7 @@ void GUI_App::update_mode()
|
|||
obj_list()->get_sizer()->Show(mode > comSimple);
|
||||
sidebar().set_mode_value(mode);
|
||||
// sidebar().show_buttons(mode == comExpert);
|
||||
obj_list()->unselect_objects();
|
||||
obj_list()->update_selections();
|
||||
obj_list()->update_object_menu();
|
||||
|
||||
|
|
|
@ -21,6 +21,25 @@ namespace GUI
|
|||
|
||||
wxDEFINE_EVENT(EVT_OBJ_LIST_OBJECT_SELECT, SimpleEvent);
|
||||
|
||||
typedef std::map<std::string, std::vector<std::string>> FreqSettingsBundle;
|
||||
|
||||
// pt_FFF
|
||||
FreqSettingsBundle FREQ_SETTINGS_BUNDLE_FFF =
|
||||
{
|
||||
{ L("Layers and Perimeters"), { "layer_height" , "perimeters", "top_solid_layers", "bottom_solid_layers" } },
|
||||
{ L("Infill") , { "fill_density", "fill_pattern" } },
|
||||
{ L("Support material") , { "support_material", "support_material_auto", "support_material_threshold",
|
||||
"support_material_pattern", "support_material_buildplate_only",
|
||||
"support_material_spacing" } },
|
||||
{ L("Extruders") , { "wipe_into_infill", "wipe_into_objects" } }
|
||||
};
|
||||
|
||||
// pt_SLA
|
||||
FreqSettingsBundle FREQ_SETTINGS_BUNDLE_SLA =
|
||||
{
|
||||
{ L("Pad and Support") , { "supports_enable", "pad_enable" } }
|
||||
};
|
||||
|
||||
ObjectList::ObjectList(wxWindow* parent) :
|
||||
wxDataViewCtrl(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_MULTIPLE),
|
||||
m_parent(parent)
|
||||
|
@ -591,6 +610,20 @@ std::vector<std::string> get_options(const bool is_part)
|
|||
{
|
||||
return get_options(is_part, wxGetApp().plater()->printer_technology() == ptSLA);
|
||||
}
|
||||
|
||||
const std::vector<std::string>& get_options_for_bundle(const wxString& bundle_name)
|
||||
{
|
||||
const FreqSettingsBundle& bundle = wxGetApp().plater()->printer_technology() == ptSLA ?
|
||||
FREQ_SETTINGS_BUNDLE_SLA : FREQ_SETTINGS_BUNDLE_FFF;
|
||||
|
||||
for (auto& it : bundle)
|
||||
{
|
||||
if (bundle_name == _(it.first))
|
||||
return it.second;
|
||||
}
|
||||
static std::vector<std::string> empty;
|
||||
return empty;
|
||||
}
|
||||
|
||||
// category -> vector ( option ; label )
|
||||
typedef std::map< std::string, std::vector< std::pair<std::string, std::string> > > settings_menu_hierarchy;
|
||||
|
@ -677,6 +710,27 @@ void ObjectList::get_settings_choice(const wxString& category_name)
|
|||
|
||||
|
||||
// Add settings item for object
|
||||
update_settings_item();
|
||||
}
|
||||
|
||||
void ObjectList::get_freq_settings_choice(const wxString& bundle_name)
|
||||
{
|
||||
const std::vector<std::string>& options = get_options_for_bundle(bundle_name);
|
||||
|
||||
auto opt_keys = m_config->keys();
|
||||
|
||||
for (auto& opt_key : options)
|
||||
{
|
||||
if ( find(opt_keys.begin(), opt_keys.end(), opt_key) == opt_keys.end() )
|
||||
m_config->set_key_value(opt_key, m_default_config->option(opt_key)->clone());
|
||||
}
|
||||
|
||||
// Add settings item for object
|
||||
update_settings_item();
|
||||
}
|
||||
|
||||
void ObjectList::update_settings_item()
|
||||
{
|
||||
auto item = GetSelection();
|
||||
if (item) {
|
||||
if (m_objects_model->GetItemType(item) == itInstance)
|
||||
|
@ -688,7 +742,7 @@ void ObjectList::get_settings_choice(const wxString& category_name)
|
|||
else {
|
||||
auto panel = wxGetApp().sidebar().scrolled_panel();
|
||||
panel->Freeze();
|
||||
wxGetApp().obj_settings()->UpdateAndShow(true);//obj_manipul()->update_settings_list();
|
||||
wxGetApp().obj_settings()->UpdateAndShow(true);
|
||||
panel->Thaw();
|
||||
}
|
||||
}
|
||||
|
@ -711,7 +765,7 @@ void ObjectList::append_menu_item_add_generic(wxMenuItem* menu, const int type)
|
|||
menu->SetSubMenu(sub_menu);
|
||||
}
|
||||
|
||||
void ObjectList::append_menu_items_add_volume(wxMenu* menu, wxMenuItem* *item_separator)
|
||||
void ObjectList::append_menu_items_add_volume(wxMenu* menu)
|
||||
{
|
||||
// Note: id accords to type of the sub-object, so sequence of the menu items is important
|
||||
std::vector<std::string> menu_object_types_items = {L("Add part"), // ~ModelVolume::MODEL_PART
|
||||
|
@ -725,8 +779,6 @@ void ObjectList::append_menu_items_add_volume(wxMenu* menu, wxMenuItem* *item_se
|
|||
if (settings_id != wxNOT_FOUND)
|
||||
menu->Destroy(settings_id);
|
||||
}
|
||||
if (*item_separator)
|
||||
menu->Destroy(*item_separator);
|
||||
|
||||
const ConfigOptionMode mode = wxGetApp().get_mode();
|
||||
|
||||
|
@ -743,8 +795,6 @@ void ObjectList::append_menu_items_add_volume(wxMenu* menu, wxMenuItem* *item_se
|
|||
[this](wxCommandEvent&) { load_generic_subobject(_(L("Box")).ToUTF8().data(), ModelVolume::SUPPORT_BLOCKER); },
|
||||
*m_bmp_vector[ModelVolume::SUPPORT_BLOCKER]);
|
||||
|
||||
*item_separator = nullptr;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -758,8 +808,6 @@ void ObjectList::append_menu_items_add_volume(wxMenu* menu, wxMenuItem* *item_se
|
|||
|
||||
menu->Append(menu_item);
|
||||
}
|
||||
|
||||
*item_separator = menu->AppendSeparator();
|
||||
}
|
||||
|
||||
wxMenuItem* ObjectList::append_menu_item_split(wxMenu* menu)
|
||||
|
@ -768,23 +816,57 @@ wxMenuItem* ObjectList::append_menu_item_split(wxMenu* menu)
|
|||
[this](wxCommandEvent&) { split(); }, m_bmp_split, menu);
|
||||
}
|
||||
|
||||
wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu)
|
||||
wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu_)
|
||||
{
|
||||
// Update (delete old & create new) settings popupmenu
|
||||
const auto settings_id = menu->FindItem(_("Add settings"));
|
||||
PrusaMenu* menu = dynamic_cast<PrusaMenu*>(menu_);
|
||||
// Delete old items from settings popupmenu
|
||||
auto settings_id = menu->FindItem(_("Add settings"));
|
||||
if (settings_id != wxNOT_FOUND)
|
||||
menu->Destroy(settings_id);
|
||||
|
||||
if (wxGetApp().get_mode() == comSimple)
|
||||
return nullptr;
|
||||
for (auto& it : FREQ_SETTINGS_BUNDLE_FFF)
|
||||
{
|
||||
settings_id = menu->FindItem(_(it.first));
|
||||
if (settings_id != wxNOT_FOUND)
|
||||
menu->Destroy(settings_id);
|
||||
}
|
||||
for (auto& it : FREQ_SETTINGS_BUNDLE_SLA)
|
||||
{
|
||||
settings_id = menu->FindItem(_(it.first));
|
||||
if (settings_id != wxNOT_FOUND)
|
||||
menu->Destroy(settings_id);
|
||||
}
|
||||
|
||||
auto menu_item = new wxMenuItem(menu, wxID_ANY, _(L("Add settings")));
|
||||
menu_item->SetBitmap(m_bmp_cog);
|
||||
menu->DestroySeparators(); // delete old separators
|
||||
|
||||
const auto sel_vol = get_selected_model_volume();
|
||||
if (sel_vol && sel_vol->type() >= ModelVolume::SUPPORT_ENFORCER)
|
||||
menu_item->Enable(false);
|
||||
else
|
||||
return nullptr;
|
||||
|
||||
const ConfigOptionMode mode = wxGetApp().get_mode();
|
||||
if (mode == comSimple)
|
||||
return nullptr;
|
||||
|
||||
// Create new items for settings popupmenu
|
||||
|
||||
menu->m_separator_frst = menu->AppendSeparator();
|
||||
|
||||
// Add frequently settings
|
||||
create_freq_settings_popupmenu(menu);
|
||||
|
||||
if (mode == comAdvanced)
|
||||
return nullptr;
|
||||
|
||||
menu->m_separator_scnd = menu->AppendSeparator();
|
||||
|
||||
// Add full settings list
|
||||
auto menu_item = new wxMenuItem(menu, wxID_ANY, _(L("Add settings")));
|
||||
menu_item->SetBitmap(m_bmp_cog);
|
||||
|
||||
// const auto sel_vol = get_selected_model_volume();
|
||||
// if (sel_vol && sel_vol->type() >= ModelVolume::SUPPORT_ENFORCER)
|
||||
// menu_item->Enable(false);
|
||||
// else
|
||||
menu_item->SetSubMenu(create_settings_popupmenu(menu));
|
||||
|
||||
return menu->Append(menu_item);
|
||||
|
@ -828,8 +910,8 @@ void ObjectList::create_part_popupmenu(wxMenu *menu)
|
|||
menu->AppendSeparator();
|
||||
append_menu_item_change_type(menu);
|
||||
|
||||
// Append settings popupmenu
|
||||
menu->AppendSeparator();
|
||||
// rest of a object_sla_menu will be added later in:
|
||||
// - append_menu_item_settings() -> for "Add (settings)"
|
||||
}
|
||||
|
||||
void ObjectList::create_instance_popupmenu(wxMenu*menu)
|
||||
|
@ -854,6 +936,24 @@ wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu)
|
|||
return menu;
|
||||
}
|
||||
|
||||
void ObjectList::create_freq_settings_popupmenu(wxMenu *menu)
|
||||
{
|
||||
const FreqSettingsBundle& bundle = wxGetApp().plater()->printer_technology() == ptFFF ?
|
||||
FREQ_SETTINGS_BUNDLE_FFF : FREQ_SETTINGS_BUNDLE_SLA;
|
||||
|
||||
auto extruders_cnt = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA ? 1 :
|
||||
wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
|
||||
|
||||
for (auto& it : bundle) {
|
||||
if (it.first.empty() || it.first == "Extruders" && extruders_cnt == 1)
|
||||
continue;
|
||||
|
||||
append_menu_item(menu, wxID_ANY, _(it.first), "",
|
||||
[menu, this](wxCommandEvent& event) { get_freq_settings_choice(menu->GetLabel(event.GetId())); },
|
||||
CATEGORY_ICON.find(it.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(it.first), menu);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectList::update_opt_keys(t_config_option_keys& opt_keys)
|
||||
{
|
||||
auto full_current_opts = get_options(false);
|
||||
|
@ -1177,15 +1277,12 @@ bool ObjectList::is_splittable()
|
|||
if (!get_volume_by_item(item, volume) || !volume)
|
||||
return false;
|
||||
|
||||
if (volume->is_splittable() != -1) // if is_splittable value is already known
|
||||
return volume->is_splittable() == 0 ? false : true;
|
||||
|
||||
TriangleMeshPtrs meshptrs = volume->mesh.split();
|
||||
bool splittable = meshptrs.size() > 1;
|
||||
for (TriangleMesh* m : meshptrs) { delete m; }
|
||||
|
||||
volume->set_splittable(splittable ? 1 : 0);
|
||||
return splittable;
|
||||
int splittable = volume->is_splittable();
|
||||
if (splittable == -1) {
|
||||
splittable = (int)volume->mesh.has_multiple_patches();
|
||||
volume->set_splittable(splittable);
|
||||
}
|
||||
return splittable != 0;
|
||||
}
|
||||
|
||||
bool ObjectList::selected_instances_of_same_object()
|
||||
|
@ -1824,7 +1921,7 @@ void ObjectList::update_settings_items()
|
|||
|
||||
void ObjectList::update_object_menu()
|
||||
{
|
||||
append_menu_items_add_volume(&m_menu_object, &m_mi_volumes_settings_separator);
|
||||
append_menu_items_add_volume(&m_menu_object);
|
||||
}
|
||||
|
||||
void ObjectList::instances_to_separated_object(const int obj_idx, const std::set<int>& inst_idxs)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
class wxBoxSizer;
|
||||
class wxMenuItem;
|
||||
class PrusaObjectDataViewModel;
|
||||
class PrusaMenu;
|
||||
|
||||
namespace Slic3r {
|
||||
class ConfigOptionsGroup;
|
||||
|
@ -104,15 +105,14 @@ class ObjectList : public wxDataViewCtrl
|
|||
wxBitmap m_bmp_cog;
|
||||
wxBitmap m_bmp_split;
|
||||
|
||||
wxMenu m_menu_object;
|
||||
wxMenu m_menu_part;
|
||||
wxMenu m_menu_sla_object;
|
||||
wxMenu m_menu_instance;
|
||||
PrusaMenu m_menu_object;
|
||||
PrusaMenu m_menu_part;
|
||||
PrusaMenu m_menu_sla_object;
|
||||
PrusaMenu m_menu_instance;
|
||||
wxMenuItem* m_menu_item_split { nullptr };
|
||||
wxMenuItem* m_menu_item_split_part { nullptr };
|
||||
wxMenuItem* m_menu_item_settings { nullptr };
|
||||
wxMenuItem* m_menu_item_split_instances { nullptr };
|
||||
wxMenuItem* m_mi_volumes_settings_separator { nullptr };
|
||||
|
||||
std::vector<wxBitmap*> m_bmp_vector;
|
||||
|
||||
|
@ -162,8 +162,11 @@ public:
|
|||
void key_event(wxKeyEvent& event);
|
||||
|
||||
void get_settings_choice(const wxString& category_name);
|
||||
void get_freq_settings_choice(const wxString& bundle_name);
|
||||
void update_settings_item();
|
||||
|
||||
void append_menu_item_add_generic(wxMenuItem* menu, const int type);
|
||||
void append_menu_items_add_volume(wxMenu* menu, wxMenuItem* *item_separator);
|
||||
void append_menu_items_add_volume(wxMenu* menu);
|
||||
wxMenuItem* append_menu_item_split(wxMenu* menu);
|
||||
wxMenuItem* append_menu_item_settings(wxMenu* menu);
|
||||
wxMenuItem* append_menu_item_change_type(wxMenu* menu);
|
||||
|
@ -173,6 +176,7 @@ public:
|
|||
void create_part_popupmenu(wxMenu*menu);
|
||||
void create_instance_popupmenu(wxMenu*menu);
|
||||
wxMenu* create_settings_popupmenu(wxMenu *parent_menu);
|
||||
void create_freq_settings_popupmenu(wxMenu *parent_menu);
|
||||
|
||||
void update_opt_keys(t_config_option_keys& t_optopt_keys);
|
||||
|
||||
|
|
|
@ -267,7 +267,7 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
|
|||
bool changed_box = false;
|
||||
if (!m_cache.instance.matches_object(obj_idx))
|
||||
{
|
||||
m_cache.instance.set(obj_idx, instance_idx, (*wxGetApp().model_objects())[obj_idx]->raw_mesh().bounding_box().size());
|
||||
m_cache.instance.set(obj_idx, instance_idx, (*wxGetApp().model_objects())[obj_idx]->raw_mesh_bounding_box().size());
|
||||
changed_box = true;
|
||||
}
|
||||
if (changed_box || !m_cache.instance.matches_instance(instance_idx) || !m_cache.scale.isApprox(100.0 * m_new_scale))
|
||||
|
@ -278,7 +278,7 @@ void ObjectManipulation::update_settings_value(const GLCanvas3D::Selection& sele
|
|||
m_new_size = Vec3d::Zero();
|
||||
#else
|
||||
if ((0 <= obj_idx) && (obj_idx < (int)wxGetApp().model_objects()->size()))
|
||||
m_new_size = volume->get_instance_transformation().get_matrix(true, true) * (*wxGetApp().model_objects())[obj_idx]->raw_mesh().bounding_box().size();
|
||||
m_new_size = volume->get_instance_transformation().get_matrix(true, true) * (*wxGetApp().model_objects())[obj_idx]->raw_mesh_bounding_box().size();
|
||||
else
|
||||
// this should never happen
|
||||
m_new_size = Vec3d::Zero();
|
||||
|
|
|
@ -109,6 +109,7 @@ public:
|
|||
virtual ~Preview();
|
||||
|
||||
wxGLCanvas* get_wxglcanvas() { return m_canvas_widget; }
|
||||
GLCanvas3D* get_canvas3d() { return m_canvas; }
|
||||
|
||||
void set_view_toolbar(GLToolbar* toolbar);
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <cstdio>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
@ -24,6 +26,7 @@ namespace GUI {
|
|||
|
||||
ImGuiWrapper::ImGuiWrapper()
|
||||
: m_font_texture(0)
|
||||
, m_style_scaling(1.0)
|
||||
, m_mouse_buttons(0)
|
||||
, m_disabled(false)
|
||||
{
|
||||
|
@ -39,18 +42,9 @@ bool ImGuiWrapper::init()
|
|||
{
|
||||
ImGui::CreateContext();
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImFont* font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSans-Regular.ttf").c_str(), 18.0f);
|
||||
if (font == nullptr) {
|
||||
font = io.Fonts->AddFontDefault();
|
||||
if (font == nullptr)
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
m_fonts.insert(FontsMap::value_type("Noto Sans Regular 18", font));
|
||||
}
|
||||
init_default_font(m_style_scaling);
|
||||
|
||||
io.IniFilename = nullptr;
|
||||
ImGui::GetIO().IniFilename = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -62,6 +56,15 @@ void ImGuiWrapper::set_display_size(float w, float h)
|
|||
io.DisplayFramebufferScale = ImVec2(1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void ImGuiWrapper::set_style_scaling(float scaling)
|
||||
{
|
||||
if (!std::isnan(scaling) && !std::isinf(scaling) && scaling != m_style_scaling) {
|
||||
ImGui::GetStyle().ScaleAllSizes(scaling / m_style_scaling);
|
||||
init_default_font(scaling);
|
||||
m_style_scaling = scaling;
|
||||
}
|
||||
}
|
||||
|
||||
bool ImGuiWrapper::update_mouse_data(wxMouseEvent& evt)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
@ -93,6 +96,7 @@ void ImGuiWrapper::render()
|
|||
void ImGuiWrapper::set_next_window_pos(float x, float y, int flag)
|
||||
{
|
||||
ImGui::SetNextWindowPos(ImVec2(x, y), (ImGuiCond)flag);
|
||||
ImGui::SetNextWindowSize(ImVec2(0.0, 0.0));
|
||||
}
|
||||
|
||||
void ImGuiWrapper::set_next_window_bg_alpha(float alpha)
|
||||
|
@ -198,6 +202,23 @@ bool ImGuiWrapper::want_any_input() const
|
|||
return io.WantCaptureMouse || io.WantCaptureKeyboard || io.WantTextInput;
|
||||
}
|
||||
|
||||
void ImGuiWrapper::init_default_font(float scaling)
|
||||
{
|
||||
static const float font_size = 18.0f;
|
||||
|
||||
destroy_fonts_texture();
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
io.Fonts->Clear();
|
||||
ImFont* font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSans-Regular.ttf").c_str(), font_size * scaling);
|
||||
if (font == nullptr) {
|
||||
font = io.Fonts->AddFontDefault();
|
||||
if (font == nullptr) {
|
||||
throw std::runtime_error("ImGui: Could not load deafult font");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ImGuiWrapper::create_device_objects()
|
||||
{
|
||||
create_fonts_texture();
|
||||
|
|
|
@ -21,6 +21,7 @@ class ImGuiWrapper
|
|||
|
||||
FontsMap m_fonts;
|
||||
unsigned m_font_texture;
|
||||
float m_style_scaling;
|
||||
unsigned m_mouse_buttons;
|
||||
bool m_disabled;
|
||||
|
||||
|
@ -32,6 +33,7 @@ public:
|
|||
void read_glsl_version();
|
||||
|
||||
void set_display_size(float w, float h);
|
||||
void set_style_scaling(float scaling);
|
||||
bool update_mouse_data(wxMouseEvent &evt);
|
||||
|
||||
void new_frame();
|
||||
|
@ -58,6 +60,7 @@ public:
|
|||
bool want_text_input() const;
|
||||
bool want_any_input() const;
|
||||
private:
|
||||
void init_default_font(float scaling);
|
||||
void create_device_objects();
|
||||
void create_fonts_texture();
|
||||
void render_draw_data(ImDrawData *draw_data);
|
||||
|
|
|
@ -94,6 +94,16 @@ wxFrame(NULL, wxID_ANY, SLIC3R_BUILD, wxDefaultPosition, wxDefaultSize, wxDEFAUL
|
|||
// m_plater->print = undef;
|
||||
_3DScene::remove_all_canvases();
|
||||
// Slic3r::GUI::deregister_on_request_update_callback();
|
||||
|
||||
// destroy and set to null tabs and a platter
|
||||
// to avoid any manipulations with them from App->wxEVT_IDLE after of the mainframe closing
|
||||
wxGetApp().clear_tabs_list();
|
||||
if (wxGetApp().plater_) {
|
||||
// before creating a new plater let's delete old one
|
||||
wxGetApp().plater_->Destroy();
|
||||
wxGetApp().plater_ = nullptr;
|
||||
}
|
||||
|
||||
// propagate event
|
||||
event.Skip();
|
||||
});
|
||||
|
|
|
@ -934,13 +934,11 @@ struct Plater::priv
|
|||
MainFrame *main_frame;
|
||||
|
||||
// Object popup menu
|
||||
wxMenu object_menu;
|
||||
PrusaMenu object_menu;
|
||||
// Part popup menu
|
||||
wxMenu part_menu;
|
||||
PrusaMenu part_menu;
|
||||
// SLA-Object popup menu
|
||||
wxMenu sla_object_menu;
|
||||
|
||||
wxMenuItem* separator_volumes_settings{ nullptr };
|
||||
PrusaMenu sla_object_menu;
|
||||
|
||||
// Data
|
||||
Slic3r::DynamicPrintConfig *config; // FIXME: leak?
|
||||
|
@ -1274,6 +1272,11 @@ void Plater::priv::update_ui_from_settings()
|
|||
// $self->{buttons_sizer}->Show($self->{btn_reslice}, ! wxTheApp->{app_config}->get("background_processing"));
|
||||
// $self->{buttons_sizer}->Layout;
|
||||
// }
|
||||
|
||||
#if ENABLE_RETINA_GL
|
||||
view3D->get_canvas3d()->update_ui_from_settings();
|
||||
preview->get_canvas3d()->update_ui_from_settings();
|
||||
#endif
|
||||
}
|
||||
|
||||
ProgressStatusBar* Plater::priv::statusbar()
|
||||
|
@ -1470,24 +1473,19 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
|
|||
const BoundingBoxf bed_shape = bed_shape_bb();
|
||||
const Vec3d bed_size = Slic3r::to_3d(bed_shape.size().cast<double>(), 1.0) - 2.0 * Vec3d::Ones();
|
||||
|
||||
bool need_arrange = false;
|
||||
bool scaled_down = false;
|
||||
std::vector<size_t> obj_idxs;
|
||||
unsigned int obj_count = model.objects.size();
|
||||
|
||||
ModelInstancePtrs new_instances;
|
||||
for (ModelObject *model_object : model_objects) {
|
||||
auto *object = model.add_object(*model_object);
|
||||
std::string object_name = object->name.empty() ? fs::path(object->input_file).filename().string() : object->name;
|
||||
obj_idxs.push_back(obj_count++);
|
||||
|
||||
if (model_object->instances.empty()) {
|
||||
// if object has no defined position(s) we need to rearrange everything after loading
|
||||
need_arrange = true;
|
||||
|
||||
// add a default instance and center object around origin
|
||||
object->center_around_origin(); // also aligns object to Z = 0
|
||||
ModelInstance* instance = object->add_instance();
|
||||
instance->set_offset(Slic3r::to_3d(bed_shape.center().cast<double>(), -object->origin_translation(2)));
|
||||
object->center_around_origin();
|
||||
new_instances.emplace_back(object->add_instance());
|
||||
}
|
||||
|
||||
const Vec3d size = object->bounding_box().size();
|
||||
|
@ -1515,6 +1513,17 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
|
|||
// print.add_model_object(object);
|
||||
}
|
||||
|
||||
// FIXME distance should be a config value /////////////////////////////////
|
||||
auto min_obj_distance = static_cast<coord_t>(6/SCALING_FACTOR);
|
||||
const auto *bed_shape_opt = config->opt<ConfigOptionPoints>("bed_shape");
|
||||
assert(bed_shape_opt);
|
||||
auto& bedpoints = bed_shape_opt->values;
|
||||
Polyline bed; bed.points.reserve(bedpoints.size());
|
||||
for(auto& v : bedpoints) bed.append(Point::new_scale(v(0), v(1)));
|
||||
|
||||
arr::find_new_position(model, new_instances, min_obj_distance, bed);
|
||||
// /////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (scaled_down) {
|
||||
GUI::show_info(q,
|
||||
_(L("Your object appears to be too large, so it was automatically scaled down to fit your print bed.")),
|
||||
|
@ -2096,7 +2105,7 @@ void Plater::priv::fix_through_netfabb(const int obj_idx)
|
|||
o->clear_instances();
|
||||
for (auto instance: model_object->instances)
|
||||
o->add_instance(*instance);
|
||||
// o->invalidate_bounding_box();
|
||||
o->invalidate_bounding_box();
|
||||
|
||||
if (o->volumes.size() == model_object->volumes.size()) {
|
||||
for (int i = 0; i < o->volumes.size(); i++) {
|
||||
|
@ -2472,8 +2481,6 @@ bool Plater::priv::complit_init_sla_object_menu()
|
|||
append_menu_item(&sla_object_menu, wxID_ANY, _(L("Optimize orientation")), _(L("Optimize the rotation of the object for better print results.")),
|
||||
[this](wxCommandEvent&) { sla_optimize_rotation(); });
|
||||
|
||||
sla_object_menu.AppendSeparator();
|
||||
|
||||
// ui updates needs to be binded to the parent panel
|
||||
if (q != nullptr)
|
||||
{
|
||||
|
@ -2493,8 +2500,6 @@ bool Plater::priv::complit_init_part_menu()
|
|||
auto obj_list = sidebar->obj_list();
|
||||
obj_list->append_menu_item_change_type(&part_menu);
|
||||
|
||||
part_menu.AppendSeparator();
|
||||
|
||||
// ui updates needs to be binded to the parent panel
|
||||
if (q != nullptr)
|
||||
{
|
||||
|
@ -2621,7 +2626,7 @@ bool Plater::priv::can_mirror() const
|
|||
|
||||
void Plater::priv::update_object_menu()
|
||||
{
|
||||
sidebar->obj_list()->append_menu_items_add_volume(&object_menu, &separator_volumes_settings);
|
||||
sidebar->obj_list()->append_menu_items_add_volume(&object_menu);
|
||||
}
|
||||
|
||||
// Plater / Public
|
||||
|
|
|
@ -87,6 +87,7 @@ void PreferencesDialog::build()
|
|||
option = Option (def,"show_incompatible_presets");
|
||||
m_optgroup->append_single_option_line(option);
|
||||
|
||||
// TODO: remove?
|
||||
def.label = L("Use legacy OpenGL 1.1 rendering");
|
||||
def.type = coBool;
|
||||
def.tooltip = L("If you have rendering issues caused by a buggy OpenGL 2.0 driver, "
|
||||
|
@ -96,6 +97,16 @@ void PreferencesDialog::build()
|
|||
option = Option (def,"use_legacy_opengl");
|
||||
m_optgroup->append_single_option_line(option);
|
||||
|
||||
#if __APPLE__
|
||||
def.label = L("Use Retina resolution for the 3D scene");
|
||||
def.type = coBool;
|
||||
def.tooltip = L("If enabled, the 3D scene will be rendered in Retina resolution. "
|
||||
"If you are experiencing 3D performance problems, disabling this option may help.");
|
||||
def.default_value = new ConfigOptionBool{ app_config->get("use_retina_opengl") == "1" };
|
||||
option = Option (def, "use_retina_opengl");
|
||||
m_optgroup->append_single_option_line(option);
|
||||
#endif
|
||||
|
||||
auto sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->Add(m_optgroup->sizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 10);
|
||||
|
||||
|
@ -110,8 +121,8 @@ void PreferencesDialog::build()
|
|||
|
||||
void PreferencesDialog::accept()
|
||||
{
|
||||
if (m_values.find("no_defaults") != m_values.end()||
|
||||
m_values.find("use_legacy_opengl")!= m_values.end()) {
|
||||
if (m_values.find("no_defaults") != m_values.end() ||
|
||||
m_values.find("use_legacy_opengl") != m_values.end()) {
|
||||
warning_catcher(this, _(L("You need to restart Slic3r to make the changes effective.")));
|
||||
}
|
||||
|
||||
|
|
|
@ -2393,6 +2393,25 @@ void PrusaModeSizer::SetMode(const int mode)
|
|||
mode_btns[m]->SetState(m == mode);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PrusaMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void PrusaMenu::DestroySeparators()
|
||||
{
|
||||
if (m_separator_frst) {
|
||||
Destroy(m_separator_frst);
|
||||
m_separator_frst = nullptr;
|
||||
}
|
||||
|
||||
if (m_separator_scnd) {
|
||||
Destroy(m_separator_scnd);
|
||||
m_separator_scnd = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************** EXPERIMENTS ***************************************
|
||||
|
||||
// *****************************************************************************
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/menu.h>
|
||||
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
@ -920,6 +921,29 @@ private:
|
|||
};
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// PrusaMenu
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class PrusaMenu : public wxMenu
|
||||
{
|
||||
public:
|
||||
PrusaMenu(const wxString& title, long style = 0)
|
||||
: wxMenu(title, style) {}
|
||||
|
||||
PrusaMenu(long style = 0)
|
||||
: wxMenu(style) {}
|
||||
|
||||
~PrusaMenu() {}
|
||||
|
||||
void DestroySeparators();
|
||||
|
||||
wxMenuItem* m_separator_frst { nullptr }; // use like separator before settings item
|
||||
wxMenuItem* m_separator_scnd { nullptr }; // use like separator between settings items
|
||||
};
|
||||
|
||||
|
||||
// ******************************* EXPERIMENTS **********************************************
|
||||
// ******************************************************************************************
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue