mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-04 06:54:04 +08:00
ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE set as default
This commit is contained in:
parent
ccb126a5f4
commit
4eee702984
@ -300,26 +300,14 @@ std::vector<double> layer_height_profile_adaptive(const SlicingParameters& slici
|
|||||||
layer_height_profile.push_back(print_z);
|
layer_height_profile.push_back(print_z);
|
||||||
layer_height_profile.push_back(height);
|
layer_height_profile.push_back(height);
|
||||||
print_z += height;
|
print_z += height;
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
layer_height_profile.push_back(print_z);
|
|
||||||
layer_height_profile.push_back(height);
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
double z_gap = slicing_params.object_print_z_height() - layer_height_profile[layer_height_profile.size() - 2];
|
double z_gap = slicing_params.object_print_z_height() - layer_height_profile[layer_height_profile.size() - 2];
|
||||||
if (z_gap > 0.0)
|
if (z_gap > 0.0)
|
||||||
{
|
{
|
||||||
layer_height_profile.push_back(slicing_params.object_print_z_height());
|
layer_height_profile.push_back(slicing_params.object_print_z_height());
|
||||||
layer_height_profile.push_back(clamp(slicing_params.min_layer_height, slicing_params.max_layer_height, z_gap));
|
layer_height_profile.push_back(clamp(slicing_params.min_layer_height, slicing_params.max_layer_height, z_gap));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
double last = std::max(slicing_params.first_object_layer_height, layer_height_profile[layer_height_profile.size() - 2]);
|
|
||||||
layer_height_profile.push_back(last);
|
|
||||||
layer_height_profile.push_back(slicing_params.first_object_layer_height);
|
|
||||||
layer_height_profile.push_back(slicing_params.object_print_z_height());
|
|
||||||
layer_height_profile.push_back(slicing_params.first_object_layer_height);
|
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
return layer_height_profile;
|
return layer_height_profile;
|
||||||
}
|
}
|
||||||
|
@ -41,9 +41,6 @@
|
|||||||
#define ENABLE_THUMBNAIL_GENERATOR (1 && ENABLE_2_2_0_ALPHA1)
|
#define ENABLE_THUMBNAIL_GENERATOR (1 && ENABLE_2_2_0_ALPHA1)
|
||||||
#define ENABLE_THUMBNAIL_GENERATOR_DEBUG (0 && ENABLE_THUMBNAIL_GENERATOR)
|
#define ENABLE_THUMBNAIL_GENERATOR_DEBUG (0 && ENABLE_THUMBNAIL_GENERATOR)
|
||||||
|
|
||||||
// Enable adaptive layer height profile
|
|
||||||
#define ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE (1 && ENABLE_2_2_0_ALPHA1)
|
|
||||||
|
|
||||||
// Enable closing 3Dconnextion imgui settings dialog by clicking on [X] and [Close] buttons
|
// Enable closing 3Dconnextion imgui settings dialog by clicking on [X] and [Close] buttons
|
||||||
#define ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG (1 && ENABLE_2_2_0_ALPHA1)
|
#define ENABLE_3DCONNEXION_DEVICES_CLOSE_SETTING_DIALOG (1 && ENABLE_2_2_0_ALPHA1)
|
||||||
|
|
||||||
|
@ -132,9 +132,7 @@ GLCanvas3D::LayersEditing::LayersEditing()
|
|||||||
, m_object_max_z(0.f)
|
, m_object_max_z(0.f)
|
||||||
, m_slicing_parameters(nullptr)
|
, m_slicing_parameters(nullptr)
|
||||||
, m_layer_height_profile_modified(false)
|
, m_layer_height_profile_modified(false)
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
, m_adaptive_quality(0.5f)
|
, m_adaptive_quality(0.5f)
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
, state(Unknown)
|
, state(Unknown)
|
||||||
, band_width(2.0f)
|
, band_width(2.0f)
|
||||||
, strength(0.005f)
|
, strength(0.005f)
|
||||||
@ -155,9 +153,6 @@ GLCanvas3D::LayersEditing::~LayersEditing()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const float GLCanvas3D::LayersEditing::THICKNESS_BAR_WIDTH = 70.0f;
|
const float GLCanvas3D::LayersEditing::THICKNESS_BAR_WIDTH = 70.0f;
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
const float GLCanvas3D::LayersEditing::THICKNESS_RESET_BUTTON_HEIGHT = 22.0f;
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
bool GLCanvas3D::LayersEditing::init(const std::string& vertex_shader_filename, const std::string& fragment_shader_filename)
|
bool GLCanvas3D::LayersEditing::init(const std::string& vertex_shader_filename, const std::string& fragment_shader_filename)
|
||||||
{
|
{
|
||||||
@ -224,7 +219,6 @@ void GLCanvas3D::LayersEditing::render_overlay(const GLCanvas3D& canvas) const
|
|||||||
if (!m_enabled)
|
if (!m_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
static const ImVec4 ORANGE(1.0f, 0.49f, 0.22f, 1.0f);
|
static const ImVec4 ORANGE(1.0f, 0.49f, 0.22f, 1.0f);
|
||||||
|
|
||||||
const Size& cnv_size = canvas.get_canvas_size();
|
const Size& cnv_size = canvas.get_canvas_size();
|
||||||
@ -319,13 +313,6 @@ void GLCanvas3D::LayersEditing::render_overlay(const GLCanvas3D& canvas) const
|
|||||||
imgui.end();
|
imgui.end();
|
||||||
|
|
||||||
const Rect& bar_rect = get_bar_rect_viewport(canvas);
|
const Rect& bar_rect = get_bar_rect_viewport(canvas);
|
||||||
#else
|
|
||||||
const Rect& bar_rect = get_bar_rect_viewport(canvas);
|
|
||||||
const Rect& reset_rect = get_reset_rect_viewport(canvas);
|
|
||||||
|
|
||||||
_render_tooltip_texture(canvas, bar_rect, reset_rect);
|
|
||||||
_render_reset_texture(reset_rect);
|
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
render_active_object_annotations(canvas, bar_rect);
|
render_active_object_annotations(canvas, bar_rect);
|
||||||
render_profile(bar_rect);
|
render_profile(bar_rect);
|
||||||
}
|
}
|
||||||
@ -352,38 +339,15 @@ bool GLCanvas3D::LayersEditing::bar_rect_contains(const GLCanvas3D& canvas, floa
|
|||||||
return (rect.get_left() <= x) && (x <= rect.get_right()) && (rect.get_top() <= y) && (y <= rect.get_bottom());
|
return (rect.get_left() <= x) && (x <= rect.get_right()) && (rect.get_top() <= y) && (y <= rect.get_bottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
bool GLCanvas3D::LayersEditing::reset_rect_contains(const GLCanvas3D& canvas, float x, float y)
|
|
||||||
{
|
|
||||||
const Rect& rect = get_reset_rect_screen(canvas);
|
|
||||||
return (rect.get_left() <= x) && (x <= rect.get_right()) && (rect.get_top() <= y) && (y <= rect.get_bottom());
|
|
||||||
}
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
Rect GLCanvas3D::LayersEditing::get_bar_rect_screen(const GLCanvas3D& canvas)
|
Rect GLCanvas3D::LayersEditing::get_bar_rect_screen(const GLCanvas3D& canvas)
|
||||||
{
|
{
|
||||||
const Size& cnv_size = canvas.get_canvas_size();
|
const Size& cnv_size = canvas.get_canvas_size();
|
||||||
float w = (float)cnv_size.get_width();
|
float w = (float)cnv_size.get_width();
|
||||||
float h = (float)cnv_size.get_height();
|
float h = (float)cnv_size.get_height();
|
||||||
|
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
return Rect(w - thickness_bar_width(canvas), 0.0f, w, h);
|
return Rect(w - thickness_bar_width(canvas), 0.0f, w, h);
|
||||||
#else
|
|
||||||
return Rect(w - thickness_bar_width(canvas), 0.0f, w, h - reset_button_height(canvas));
|
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
Rect GLCanvas3D::LayersEditing::get_reset_rect_screen(const GLCanvas3D& canvas)
|
|
||||||
{
|
|
||||||
const Size& cnv_size = canvas.get_canvas_size();
|
|
||||||
float w = (float)cnv_size.get_width();
|
|
||||||
float h = (float)cnv_size.get_height();
|
|
||||||
|
|
||||||
return Rect(w - thickness_bar_width(canvas), h - reset_button_height(canvas), w, h);
|
|
||||||
}
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
Rect GLCanvas3D::LayersEditing::get_bar_rect_viewport(const GLCanvas3D& canvas)
|
Rect GLCanvas3D::LayersEditing::get_bar_rect_viewport(const GLCanvas3D& canvas)
|
||||||
{
|
{
|
||||||
const Size& cnv_size = canvas.get_canvas_size();
|
const Size& cnv_size = canvas.get_canvas_size();
|
||||||
@ -393,27 +357,9 @@ Rect GLCanvas3D::LayersEditing::get_bar_rect_viewport(const GLCanvas3D& canvas)
|
|||||||
float zoom = (float)canvas.get_camera().get_zoom();
|
float zoom = (float)canvas.get_camera().get_zoom();
|
||||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
||||||
|
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
return Rect((half_w - thickness_bar_width(canvas)) * inv_zoom, half_h * inv_zoom, half_w * inv_zoom, -half_h * inv_zoom);
|
return Rect((half_w - thickness_bar_width(canvas)) * inv_zoom, half_h * inv_zoom, half_w * inv_zoom, -half_h * inv_zoom);
|
||||||
#else
|
|
||||||
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);
|
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
Rect GLCanvas3D::LayersEditing::get_reset_rect_viewport(const GLCanvas3D& canvas)
|
|
||||||
{
|
|
||||||
const Size& cnv_size = canvas.get_canvas_size();
|
|
||||||
float half_w = 0.5f * (float)cnv_size.get_width();
|
|
||||||
float half_h = 0.5f * (float)cnv_size.get_height();
|
|
||||||
|
|
||||||
float zoom = (float)canvas.get_camera().get_zoom();
|
|
||||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
bool GLCanvas3D::LayersEditing::is_initialized() const
|
bool GLCanvas3D::LayersEditing::is_initialized() const
|
||||||
{
|
{
|
||||||
return m_shader.is_initialized();
|
return m_shader.is_initialized();
|
||||||
@ -448,54 +394,6 @@ std::string GLCanvas3D::LayersEditing::get_tooltip(const GLCanvas3D& canvas) con
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
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";
|
|
||||||
if (!m_tooltip_texture.load_from_file(filename, false, GLTexture::SingleThreaded, false))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ENABLE_RETINA_GL
|
|
||||||
const float scale = canvas.get_canvas_size().get_scale_factor();
|
|
||||||
#else
|
|
||||||
const float scale = canvas.get_wxglcanvas()->GetContentScaleFactor();
|
|
||||||
#endif
|
|
||||||
const float width = (float)m_tooltip_texture.get_width() * scale;
|
|
||||||
const float height = (float)m_tooltip_texture.get_height() * scale;
|
|
||||||
|
|
||||||
float zoom = (float)canvas.get_camera().get_zoom();
|
|
||||||
float inv_zoom = (zoom != 0.0f) ? 1.0f / zoom : 0.0f;
|
|
||||||
float gap = 10.0f * inv_zoom;
|
|
||||||
|
|
||||||
float bar_left = bar_rect.get_left();
|
|
||||||
float reset_bottom = reset_rect.get_bottom();
|
|
||||||
|
|
||||||
float l = bar_left - width * inv_zoom - gap;
|
|
||||||
float r = bar_left - 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLCanvas3D::LayersEditing::_render_reset_texture(const Rect& reset_rect) const
|
|
||||||
{
|
|
||||||
if (m_reset_texture.get_id() == 0)
|
|
||||||
{
|
|
||||||
std::string filename = resources_dir() + "/icons/variable_layer_height_reset.png";
|
|
||||||
if (!m_reset_texture.load_from_file(filename, false, GLTexture::SingleThreaded, false))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLTexture::render_texture(m_reset_texture.get_id(), reset_rect.get_left(), reset_rect.get_right(), reset_rect.get_bottom(), reset_rect.get_top());
|
|
||||||
}
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
void GLCanvas3D::LayersEditing::render_active_object_annotations(const GLCanvas3D& canvas, const Rect& bar_rect) const
|
void GLCanvas3D::LayersEditing::render_active_object_annotations(const GLCanvas3D& canvas, const Rect& bar_rect) const
|
||||||
{
|
{
|
||||||
m_shader.start_using();
|
m_shader.start_using();
|
||||||
@ -644,7 +542,6 @@ void GLCanvas3D::LayersEditing::reset_layer_height_profile(GLCanvas3D& canvas)
|
|||||||
canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
void GLCanvas3D::LayersEditing::adaptive_layer_height_profile(GLCanvas3D& canvas, float quality_factor)
|
void GLCanvas3D::LayersEditing::adaptive_layer_height_profile(GLCanvas3D& canvas, float quality_factor)
|
||||||
{
|
{
|
||||||
this->update_slicing_parameters();
|
this->update_slicing_parameters();
|
||||||
@ -662,7 +559,6 @@ void GLCanvas3D::LayersEditing::smooth_layer_height_profile(GLCanvas3D& canvas,
|
|||||||
m_layers_texture.valid = false;
|
m_layers_texture.valid = false;
|
||||||
canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
canvas.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
||||||
}
|
}
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
void GLCanvas3D::LayersEditing::generate_layer_height_texture()
|
void GLCanvas3D::LayersEditing::generate_layer_height_texture()
|
||||||
{
|
{
|
||||||
@ -725,19 +621,6 @@ float GLCanvas3D::LayersEditing::thickness_bar_width(const GLCanvas3D &canvas)
|
|||||||
* THICKNESS_BAR_WIDTH;
|
* THICKNESS_BAR_WIDTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
float GLCanvas3D::LayersEditing::reset_button_height(const GLCanvas3D &canvas)
|
|
||||||
{
|
|
||||||
return
|
|
||||||
#if ENABLE_RETINA_GL
|
|
||||||
canvas.get_canvas_size().get_scale_factor()
|
|
||||||
#else
|
|
||||||
canvas.get_wxglcanvas()->GetContentScaleFactor()
|
|
||||||
#endif
|
|
||||||
* THICKNESS_RESET_BUTTON_HEIGHT;
|
|
||||||
}
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
|
|
||||||
const Point GLCanvas3D::Mouse::Drag::Invalid_2D_Point(INT_MAX, INT_MAX);
|
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);
|
const Vec3d GLCanvas3D::Mouse::Drag::Invalid_3D_Point(DBL_MAX, DBL_MAX, DBL_MAX);
|
||||||
@ -1372,11 +1255,9 @@ wxDEFINE_EVENT(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, wxKeyEvent);
|
|||||||
wxDEFINE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, SimpleEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, SimpleEvent);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, Event<float>);
|
wxDEFINE_EVENT(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, Event<float>);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, HeightProfileSmoothEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, HeightProfileSmoothEvent);
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
#if ENABLE_THUMBNAIL_GENERATOR
|
#if ENABLE_THUMBNAIL_GENERATOR
|
||||||
const double GLCanvas3D::DefaultCameraZoomToBoxMarginFactor = 1.25;
|
const double GLCanvas3D::DefaultCameraZoomToBoxMarginFactor = 1.25;
|
||||||
@ -1674,7 +1555,6 @@ bool GLCanvas3D::is_layers_editing_allowed() const
|
|||||||
return m_layers_editing.is_allowed();
|
return m_layers_editing.is_allowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
void GLCanvas3D::reset_layer_height_profile()
|
void GLCanvas3D::reset_layer_height_profile()
|
||||||
{
|
{
|
||||||
wxGetApp().plater()->take_snapshot(_(L("Variable layer height - Reset")));
|
wxGetApp().plater()->take_snapshot(_(L("Variable layer height - Reset")));
|
||||||
@ -1698,7 +1578,6 @@ void GLCanvas3D::smooth_layer_height_profile(const HeightProfileSmoothingParams&
|
|||||||
m_layers_editing.state = LayersEditing::Completed;
|
m_layers_editing.state = LayersEditing::Completed;
|
||||||
m_dirty = true;
|
m_dirty = true;
|
||||||
}
|
}
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
bool GLCanvas3D::is_reload_delayed() const
|
bool GLCanvas3D::is_reload_delayed() const
|
||||||
{
|
{
|
||||||
@ -3110,20 +2989,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||||||
m_layers_editing.state = LayersEditing::Editing;
|
m_layers_editing.state = LayersEditing::Editing;
|
||||||
_perform_layer_editing_action(&evt);
|
_perform_layer_editing_action(&evt);
|
||||||
}
|
}
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
else if ((layer_editing_object_idx != -1) && m_layers_editing.reset_rect_contains(*this, pos(0), pos(1)))
|
|
||||||
{
|
|
||||||
if (evt.LeftDown())
|
|
||||||
{
|
|
||||||
// A volume is selected and the mouse is inside the reset button. Reset the ModelObject's layer height profile.
|
|
||||||
m_layers_editing.reset_layer_height_profile(*this);
|
|
||||||
// Index 2 means no editing, just wait for mouse up event.
|
|
||||||
m_layers_editing.state = LayersEditing::Completed;
|
|
||||||
|
|
||||||
m_dirty = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
else if (evt.LeftDown() && (evt.ShiftDown() || evt.AltDown()) && m_picking_enabled)
|
else if (evt.LeftDown() && (evt.ShiftDown() || evt.AltDown()) && m_picking_enabled)
|
||||||
{
|
{
|
||||||
if (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports)
|
if (m_gizmos.get_current_type() != GLGizmosManager::SlaSupports)
|
||||||
|
@ -105,11 +105,9 @@ wxDECLARE_EVENT(EVT_GLCANVAS_MOVE_DOUBLE_SLIDER, wxKeyEvent);
|
|||||||
wxDECLARE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_EDIT_COLOR_CHANGE, wxKeyEvent);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_UNDO, SimpleEvent);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, SimpleEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, SimpleEvent);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, Event<float>);
|
wxDECLARE_EVENT(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, Event<float>);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, HeightProfileSmoothEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, HeightProfileSmoothEvent);
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
class GLCanvas3D
|
class GLCanvas3D
|
||||||
{
|
{
|
||||||
@ -159,17 +157,10 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static const float THICKNESS_BAR_WIDTH;
|
static const float THICKNESS_BAR_WIDTH;
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
static const float THICKNESS_RESET_BUTTON_HEIGHT;
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
bool m_enabled;
|
bool m_enabled;
|
||||||
Shader m_shader;
|
Shader m_shader;
|
||||||
unsigned int m_z_texture_id;
|
unsigned int m_z_texture_id;
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
mutable GLTexture m_tooltip_texture;
|
|
||||||
mutable GLTexture m_reset_texture;
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
// Not owned by LayersEditing.
|
// Not owned by LayersEditing.
|
||||||
const DynamicPrintConfig *m_config;
|
const DynamicPrintConfig *m_config;
|
||||||
// ModelObject for the currently selected object (Model::objects[last_object_id]).
|
// ModelObject for the currently selected object (Model::objects[last_object_id]).
|
||||||
@ -181,10 +172,8 @@ private:
|
|||||||
std::vector<double> m_layer_height_profile;
|
std::vector<double> m_layer_height_profile;
|
||||||
bool m_layer_height_profile_modified;
|
bool m_layer_height_profile_modified;
|
||||||
|
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
mutable float m_adaptive_quality;
|
mutable float m_adaptive_quality;
|
||||||
mutable HeightProfileSmoothingParams m_smooth_params;
|
mutable HeightProfileSmoothingParams m_smooth_params;
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
class LayersTexture
|
class LayersTexture
|
||||||
{
|
{
|
||||||
@ -232,24 +221,13 @@ private:
|
|||||||
void adjust_layer_height_profile();
|
void adjust_layer_height_profile();
|
||||||
void accept_changes(GLCanvas3D& canvas);
|
void accept_changes(GLCanvas3D& canvas);
|
||||||
void reset_layer_height_profile(GLCanvas3D& canvas);
|
void reset_layer_height_profile(GLCanvas3D& canvas);
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
void adaptive_layer_height_profile(GLCanvas3D& canvas, float quality_factor);
|
void adaptive_layer_height_profile(GLCanvas3D& canvas, float quality_factor);
|
||||||
void smooth_layer_height_profile(GLCanvas3D& canvas, const HeightProfileSmoothingParams& smoothing_params);
|
void smooth_layer_height_profile(GLCanvas3D& canvas, const HeightProfileSmoothingParams& smoothing_params);
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
static float get_cursor_z_relative(const GLCanvas3D& canvas);
|
static float get_cursor_z_relative(const GLCanvas3D& canvas);
|
||||||
static bool bar_rect_contains(const GLCanvas3D& canvas, float x, float y);
|
static bool bar_rect_contains(const GLCanvas3D& canvas, float x, float y);
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
static bool reset_rect_contains(const GLCanvas3D& canvas, float x, float y);
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
static Rect get_bar_rect_screen(const GLCanvas3D& canvas);
|
static Rect get_bar_rect_screen(const GLCanvas3D& canvas);
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
static Rect get_reset_rect_screen(const GLCanvas3D& canvas);
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
static Rect get_bar_rect_viewport(const GLCanvas3D& canvas);
|
static Rect get_bar_rect_viewport(const GLCanvas3D& canvas);
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
static Rect get_reset_rect_viewport(const GLCanvas3D& canvas);
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
float object_max_z() const { return m_object_max_z; }
|
float object_max_z() const { return m_object_max_z; }
|
||||||
|
|
||||||
@ -258,18 +236,11 @@ private:
|
|||||||
private:
|
private:
|
||||||
bool is_initialized() const;
|
bool is_initialized() const;
|
||||||
void generate_layer_height_texture();
|
void generate_layer_height_texture();
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
void _render_tooltip_texture(const GLCanvas3D& canvas, const Rect& bar_rect, const Rect& reset_rect) const;
|
|
||||||
void _render_reset_texture(const Rect& reset_rect) const;
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
void render_active_object_annotations(const GLCanvas3D& canvas, const Rect& bar_rect) const;
|
void render_active_object_annotations(const GLCanvas3D& canvas, const Rect& bar_rect) const;
|
||||||
void render_profile(const Rect& bar_rect) const;
|
void render_profile(const Rect& bar_rect) const;
|
||||||
void update_slicing_parameters();
|
void update_slicing_parameters();
|
||||||
|
|
||||||
static float thickness_bar_width(const GLCanvas3D &canvas);
|
static float thickness_bar_width(const GLCanvas3D &canvas);
|
||||||
#if !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
static float reset_button_height(const GLCanvas3D &canvas);
|
|
||||||
#endif // !ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Mouse
|
struct Mouse
|
||||||
@ -536,11 +507,9 @@ public:
|
|||||||
bool is_layers_editing_enabled() const;
|
bool is_layers_editing_enabled() const;
|
||||||
bool is_layers_editing_allowed() const;
|
bool is_layers_editing_allowed() const;
|
||||||
|
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
void reset_layer_height_profile();
|
void reset_layer_height_profile();
|
||||||
void adaptive_layer_height_profile(float quality_factor);
|
void adaptive_layer_height_profile(float quality_factor);
|
||||||
void smooth_layer_height_profile(const HeightProfileSmoothingParams& smoothing_params);
|
void smooth_layer_height_profile(const HeightProfileSmoothingParams& smoothing_params);
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
bool is_reload_delayed() const;
|
bool is_reload_delayed() const;
|
||||||
|
|
||||||
|
@ -2137,11 +2137,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
view3D_canvas->Bind(EVT_GLCANVAS_RESETGIZMOS, [this](SimpleEvent&) { reset_all_gizmos(); });
|
view3D_canvas->Bind(EVT_GLCANVAS_RESETGIZMOS, [this](SimpleEvent&) { reset_all_gizmos(); });
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_UNDO, [this](SimpleEvent&) { this->undo(); });
|
view3D_canvas->Bind(EVT_GLCANVAS_UNDO, [this](SimpleEvent&) { this->undo(); });
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_REDO, [this](SimpleEvent&) { this->redo(); });
|
view3D_canvas->Bind(EVT_GLCANVAS_REDO, [this](SimpleEvent&) { this->redo(); });
|
||||||
#if ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, [this](SimpleEvent&) { this->view3D->get_canvas3d()->reset_layer_height_profile(); });
|
view3D_canvas->Bind(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, [this](SimpleEvent&) { this->view3D->get_canvas3d()->reset_layer_height_profile(); });
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, [this](Event<float>& evt) { this->view3D->get_canvas3d()->adaptive_layer_height_profile(evt.data); });
|
view3D_canvas->Bind(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, [this](Event<float>& evt) { this->view3D->get_canvas3d()->adaptive_layer_height_profile(evt.data); });
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, [this](HeightProfileSmoothEvent& evt) { this->view3D->get_canvas3d()->smooth_layer_height_profile(evt.data); });
|
view3D_canvas->Bind(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, [this](HeightProfileSmoothEvent& evt) { this->view3D->get_canvas3d()->smooth_layer_height_profile(evt.data); });
|
||||||
#endif // ENABLE_ADAPTIVE_LAYER_HEIGHT_PROFILE
|
|
||||||
|
|
||||||
// 3DScene/Toolbar:
|
// 3DScene/Toolbar:
|
||||||
view3D_canvas->Bind(EVT_GLTOOLBAR_ADD, &priv::on_action_add, this);
|
view3D_canvas->Bind(EVT_GLTOOLBAR_ADD, &priv::on_action_add, this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user