Tech ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS set as default

This commit is contained in:
enricoturri1966 2021-11-16 12:39:54 +01:00
parent 58c93196d5
commit 9af9b9b35d
20 changed files with 2 additions and 119 deletions

View file

@ -719,9 +719,7 @@ void GCodeProcessor::UsedFilaments::process_caches(GCodeProcessor* processor)
void GCodeProcessorResult::reset() { void GCodeProcessorResult::reset() {
moves = std::vector<GCodeProcessorResult::MoveVertex>(); moves = std::vector<GCodeProcessorResult::MoveVertex>();
bed_shape = Pointfs(); bed_shape = Pointfs();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
max_print_height = 0.0f; max_print_height = 0.0f;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
settings_ids.reset(); settings_ids.reset();
extruders_count = 0; extruders_count = 0;
extruder_colors = std::vector<std::string>(); extruder_colors = std::vector<std::string>();
@ -736,9 +734,7 @@ void GCodeProcessorResult::reset() {
moves.clear(); moves.clear();
lines_ends.clear(); lines_ends.clear();
bed_shape = Pointfs(); bed_shape = Pointfs();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
max_print_height = 0.0f; max_print_height = 0.0f;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
settings_ids.reset(); settings_ids.reset();
extruders_count = 0; extruders_count = 0;
extruder_colors = std::vector<std::string>(); extruder_colors = std::vector<std::string>();
@ -889,9 +885,7 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
if (first_layer_height != nullptr) if (first_layer_height != nullptr)
m_first_layer_height = std::abs(first_layer_height->value); m_first_layer_height = std::abs(first_layer_height->value);
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_result.max_print_height = config.max_print_height; m_result.max_print_height = config.max_print_height;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
} }
void GCodeProcessor::apply_config(const DynamicPrintConfig& config) void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
@ -1122,11 +1116,9 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
if (first_layer_height != nullptr) if (first_layer_height != nullptr)
m_first_layer_height = std::abs(first_layer_height->value); m_first_layer_height = std::abs(first_layer_height->value);
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
const ConfigOptionFloat* max_print_height = config.option<ConfigOptionFloat>("max_print_height"); const ConfigOptionFloat* max_print_height = config.option<ConfigOptionFloat>("max_print_height");
if (max_print_height != nullptr) if (max_print_height != nullptr)
m_result.max_print_height = max_print_height->value; m_result.max_print_height = max_print_height->value;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
} }
void GCodeProcessor::enable_stealth_time_estimator(bool enabled) void GCodeProcessor::enable_stealth_time_estimator(bool enabled)

View file

@ -117,9 +117,7 @@ namespace Slic3r {
// Positions of ends of lines of the final G-code this->filename after TimeProcessor::post_process() finalizes the G-code. // Positions of ends of lines of the final G-code this->filename after TimeProcessor::post_process() finalizes the G-code.
std::vector<size_t> lines_ends; std::vector<size_t> lines_ends;
Pointfs bed_shape; Pointfs bed_shape;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
float max_print_height; float max_print_height;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
SettingsIds settings_ids; SettingsIds settings_ids;
size_t extruders_count; size_t extruders_count;
std::vector<std::string> extruder_colors; std::vector<std::string> extruder_colors;

View file

@ -33,14 +33,12 @@ bool directions_parallel(double angle1, double angle2, double max_diff)
return diff < max_diff || fabs(diff - PI) < max_diff; return diff < max_diff || fabs(diff - PI) < max_diff;
} }
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
bool directions_perpendicular(double angle1, double angle2, double max_diff) bool directions_perpendicular(double angle1, double angle2, double max_diff)
{ {
double diff = fabs(angle1 - angle2); double diff = fabs(angle1 - angle2);
max_diff += EPSILON; max_diff += EPSILON;
return fabs(diff - 0.5 * PI) < max_diff || fabs(diff - 1.5 * PI) < max_diff; return fabs(diff - 0.5 * PI) < max_diff || fabs(diff - 1.5 * PI) < max_diff;
} }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
template<class T> template<class T>
bool contains(const std::vector<T> &vector, const Point &point) bool contains(const std::vector<T> &vector, const Point &point)

View file

@ -288,9 +288,7 @@ bool liang_barsky_line_clipping(
} }
bool directions_parallel(double angle1, double angle2, double max_diff = 0); bool directions_parallel(double angle1, double angle2, double max_diff = 0);
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
bool directions_perpendicular(double angle1, double angle2, double max_diff = 0); bool directions_perpendicular(double angle1, double angle2, double max_diff = 0);
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
template<class T> bool contains(const std::vector<T> &vector, const Point &point); template<class T> bool contains(const std::vector<T> &vector, const Point &point);
template<typename T> T rad2deg(T angle) { return T(180.0) * angle / T(PI); } template<typename T> T rad2deg(T angle) { return T(180.0) * angle / T(PI); }
double rad2deg_dir(double angle); double rad2deg_dir(double angle);

View file

@ -70,7 +70,6 @@ bool Line::parallel_to(const Line& line) const
return sqr(cross2(v1, v2)) < sqr(EPSILON) * v1.squaredNorm() * v2.squaredNorm(); return sqr(cross2(v1, v2)) < sqr(EPSILON) * v1.squaredNorm() * v2.squaredNorm();
} }
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
bool Line::perpendicular_to(double angle) const bool Line::perpendicular_to(double angle) const
{ {
return Slic3r::Geometry::directions_perpendicular(this->direction(), angle); return Slic3r::Geometry::directions_perpendicular(this->direction(), angle);
@ -82,7 +81,6 @@ bool Line::perpendicular_to(const Line& line) const
const Vec2d v2 = (line.b - line.a).cast<double>(); const Vec2d v2 = (line.b - line.a).cast<double>();
return sqr(v1.dot(v2)) < sqr(EPSILON) * v1.squaredNorm() * v2.squaredNorm(); return sqr(v1.dot(v2)) < sqr(EPSILON) * v1.squaredNorm() * v2.squaredNorm();
} }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
bool Line::intersection(const Line &l2, Point *intersection) const bool Line::intersection(const Line &l2, Point *intersection) const
{ {

View file

@ -105,10 +105,8 @@ public:
double perp_distance_to(const Point &point) const; double perp_distance_to(const Point &point) const;
bool parallel_to(double angle) const; bool parallel_to(double angle) const;
bool parallel_to(const Line& line) const; bool parallel_to(const Line& line) const;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
bool perpendicular_to(double angle) const; bool perpendicular_to(double angle) const;
bool perpendicular_to(const Line& line) const; bool perpendicular_to(const Line& line) const;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
double atan2_() const { return atan2(this->b(1) - this->a(1), this->b(0) - this->a(0)); } double atan2_() const { return atan2(this->b(1) - this->a(1), this->b(0) - this->a(0)); }
double orientation() const; double orientation() const;
double direction() const; double direction() const;

View file

@ -80,9 +80,6 @@
// Enable rendering modifiers and similar objects always as transparent // Enable rendering modifiers and similar objects always as transparent
#define ENABLE_MODIFIERS_ALWAYS_TRANSPARENT (1 && ENABLE_2_4_0_BETA1) #define ENABLE_MODIFIERS_ALWAYS_TRANSPARENT (1 && ENABLE_2_4_0_BETA1)
// Enable the fix for the detection of the out of bed state for sinking objects
// and detection of out of bed using the bed perimeter
#define ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS (1 && ENABLE_2_4_0_BETA1)
//==================== //====================

View file

@ -436,7 +436,6 @@ BoundingBoxf3 TriangleMesh::transformed_bounding_box(const Transform3d &trafo) c
return bbox; return bbox;
} }
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
BoundingBoxf3 TriangleMesh::transformed_bounding_box(const Transform3d& trafod, double world_min_z) const BoundingBoxf3 TriangleMesh::transformed_bounding_box(const Transform3d& trafod, double world_min_z) const
{ {
// 1) Allocate transformed vertices with their position with respect to print bed surface. // 1) Allocate transformed vertices with their position with respect to print bed surface.
@ -487,7 +486,6 @@ BoundingBoxf3 TriangleMesh::transformed_bounding_box(const Transform3d& trafod,
}; };
return out; return out;
} }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
TriangleMesh TriangleMesh::convex_hull_3d() const TriangleMesh TriangleMesh::convex_hull_3d() const
{ {

View file

@ -125,10 +125,8 @@ public:
BoundingBoxf3 bounding_box() const; BoundingBoxf3 bounding_box() const;
// Returns the bbox of this TriangleMesh transformed by the given transformation // Returns the bbox of this TriangleMesh transformed by the given transformation
BoundingBoxf3 transformed_bounding_box(const Transform3d &trafo) const; BoundingBoxf3 transformed_bounding_box(const Transform3d &trafo) const;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// Variant returning the bbox of the part of this TriangleMesh above the given world_min_z // Variant returning the bbox of the part of this TriangleMesh above the given world_min_z
BoundingBoxf3 transformed_bounding_box(const Transform3d& trafo, double world_min_z) const; BoundingBoxf3 transformed_bounding_box(const Transform3d& trafo, double world_min_z) const;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// Return the size of the mesh in coordinates. // Return the size of the mesh in coordinates.
Vec3d size() const { return m_stats.size.cast<double>(); } Vec3d size() const { return m_stats.size.cast<double>(); }
/// Return the center of the related bounding box. /// Return the center of the related bounding box.

View file

@ -262,11 +262,9 @@ void GLIndexedVertexArray::render(
const std::pair<size_t, size_t>& tverts_range, const std::pair<size_t, size_t>& tverts_range,
const std::pair<size_t, size_t>& qverts_range) const const std::pair<size_t, size_t>& qverts_range) const
{ {
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// this method has been called before calling finalize() ? // this method has been called before calling finalize() ?
if (this->vertices_and_normals_interleaved_VBO_id == 0 && !this->vertices_and_normals_interleaved.empty()) if (this->vertices_and_normals_interleaved_VBO_id == 0 && !this->vertices_and_normals_interleaved.empty())
return; return;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
assert(this->vertices_and_normals_interleaved_VBO_id != 0); assert(this->vertices_and_normals_interleaved_VBO_id != 0);
assert(this->triangle_indices_VBO_id != 0 || this->quad_indices_VBO_id != 0); assert(this->triangle_indices_VBO_id != 0 || this->quad_indices_VBO_id != 0);
@ -524,7 +522,6 @@ BoundingBoxf3 GLVolume::transformed_convex_hull_bounding_box(const Transform3d &
bounding_box().transformed(trafo); bounding_box().transformed(trafo);
} }
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
BoundingBoxf3 GLVolume::transformed_non_sinking_bounding_box(const Transform3d& trafo) const BoundingBoxf3 GLVolume::transformed_non_sinking_bounding_box(const Transform3d& trafo) const
{ {
return GUI::wxGetApp().plater()->model().objects[object_idx()]->volumes[volume_idx()]->mesh().transformed_bounding_box(trafo, 0.0); return GUI::wxGetApp().plater()->model().objects[object_idx()]->volumes[volume_idx()]->mesh().transformed_bounding_box(trafo, 0.0);
@ -539,7 +536,6 @@ const BoundingBoxf3& GLVolume::transformed_non_sinking_bounding_box() const
} }
return *m_transformed_non_sinking_bounding_box; return *m_transformed_non_sinking_bounding_box;
} }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
void GLVolume::set_range(double min_z, double max_z) void GLVolume::set_range(double min_z, double max_z)
{ {
@ -773,9 +769,7 @@ int GLVolumeCollection::load_wipe_tower_preview(
volumes.emplace_back(new GLVolume(color)); volumes.emplace_back(new GLVolume(color));
GLVolume& v = *volumes.back(); GLVolume& v = *volumes.back();
v.indexed_vertex_array.load_mesh(mesh); v.indexed_vertex_array.load_mesh(mesh);
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
v.set_convex_hull(mesh.convex_hull_3d()); v.set_convex_hull(mesh.convex_hull_3d());
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
v.indexed_vertex_array.finalize_geometry(opengl_initialized); v.indexed_vertex_array.finalize_geometry(opengl_initialized);
v.set_volume_offset(Vec3d(pos_x, pos_y, 0.0)); v.set_volume_offset(Vec3d(pos_x, pos_y, 0.0));
v.set_volume_rotation(Vec3d(0., 0., (M_PI / 180.) * rotation_angle)); v.set_volume_rotation(Vec3d(0., 0., (M_PI / 180.) * rotation_angle));
@ -882,17 +876,10 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
shader->set_uniform("uniform_color", volume.first->render_color); shader->set_uniform("uniform_color", volume.first->render_color);
shader->set_uniform("z_range", m_z_range, 2); shader->set_uniform("z_range", m_z_range, 2);
shader->set_uniform("clipping_plane", m_clipping_plane, 4); shader->set_uniform("clipping_plane", m_clipping_plane, 4);
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
shader->set_uniform("print_volume.type", static_cast<int>(m_print_volume.type)); shader->set_uniform("print_volume.type", static_cast<int>(m_print_volume.type));
shader->set_uniform("print_volume.xy_data", m_print_volume.data); shader->set_uniform("print_volume.xy_data", m_print_volume.data);
shader->set_uniform("print_volume.z_data", m_print_volume.zs); shader->set_uniform("print_volume.z_data", m_print_volume.zs);
shader->set_uniform("volume_world_matrix", volume.first->world_matrix()); shader->set_uniform("volume_world_matrix", volume.first->world_matrix());
#else
shader->set_uniform("print_box.min", m_print_box_min, 3);
shader->set_uniform("print_box.max", m_print_box_max, 3);
shader->set_uniform("print_box.actived", volume.first->shader_outside_printer_detection_enabled);
shader->set_uniform("print_box.volume_world_matrix", volume.first->world_matrix());
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
shader->set_uniform("slope.actived", m_slope.active && !volume.first->is_modifier && !volume.first->is_wipe_tower); shader->set_uniform("slope.actived", m_slope.active && !volume.first->is_modifier && !volume.first->is_wipe_tower);
shader->set_uniform("slope.volume_world_normal_matrix", static_cast<Matrix3f>(volume.first->world_matrix().matrix().block(0, 0, 3, 3).inverse().transpose().cast<float>())); shader->set_uniform("slope.volume_world_normal_matrix", static_cast<Matrix3f>(volume.first->world_matrix().matrix().block(0, 0, 3, 3).inverse().transpose().cast<float>()));
shader->set_uniform("slope.normal_z", m_slope.normal_z); shader->set_uniform("slope.normal_z", m_slope.normal_z);

View file

@ -681,9 +681,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
if (wxGetApp().is_gcode_viewer()) if (wxGetApp().is_gcode_viewer())
m_custom_gcode_per_print_z = gcode_result.custom_gcode_per_print_z; m_custom_gcode_per_print_z = gcode_result.custom_gcode_per_print_z;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_max_print_height = gcode_result.max_print_height; m_max_print_height = gcode_result.max_print_height;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
load_toolpaths(gcode_result); load_toolpaths(gcode_result);
@ -831,9 +829,7 @@ void GCodeViewer::reset()
m_paths_bounding_box = BoundingBoxf3(); m_paths_bounding_box = BoundingBoxf3();
m_max_bounding_box = BoundingBoxf3(); m_max_bounding_box = BoundingBoxf3();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_max_print_height = 0.0f; m_max_print_height = 0.0f;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_tool_colors = std::vector<Color>(); m_tool_colors = std::vector<Color>();
m_extruders_count = 0; m_extruders_count = 0;
m_extruder_ids = std::vector<unsigned char>(); m_extruder_ids = std::vector<unsigned char>();
@ -850,9 +846,7 @@ void GCodeViewer::reset()
#if ENABLE_GCODE_VIEWER_STATISTICS #if ENABLE_GCODE_VIEWER_STATISTICS
m_statistics.reset_all(); m_statistics.reset_all();
#endif // ENABLE_GCODE_VIEWER_STATISTICS #endif // ENABLE_GCODE_VIEWER_STATISTICS
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_contained_in_bed = true; m_contained_in_bed = true;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
} }
void GCodeViewer::render() void GCodeViewer::render()

View file

@ -780,9 +780,7 @@ private:
BoundingBoxf3 m_paths_bounding_box; BoundingBoxf3 m_paths_bounding_box;
// bounding box of toolpaths + marker tools // bounding box of toolpaths + marker tools
BoundingBoxf3 m_max_bounding_box; BoundingBoxf3 m_max_bounding_box;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
float m_max_print_height{ 0.0f }; float m_max_print_height{ 0.0f };
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
std::vector<Color> m_tool_colors; std::vector<Color> m_tool_colors;
Layers m_layers; Layers m_layers;
std::array<unsigned int, 2> m_layers_z_range; std::array<unsigned int, 2> m_layers_z_range;
@ -807,9 +805,7 @@ private:
std::vector<CustomGCode::Item> m_custom_gcode_per_print_z; std::vector<CustomGCode::Item> m_custom_gcode_per_print_z;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
bool m_contained_in_bed{ true }; bool m_contained_in_bed{ true };
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
public: public:
GCodeViewer(); GCodeViewer();
@ -839,9 +835,7 @@ public:
const SequentialView& get_sequential_view() const { return m_sequential_view; } const SequentialView& get_sequential_view() const { return m_sequential_view; }
void update_sequential_view_current(unsigned int first, unsigned int last); void update_sequential_view_current(unsigned int first, unsigned int last);
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
bool is_contained_in_bed() const { return m_contained_in_bed; } bool is_contained_in_bed() const { return m_contained_in_bed; }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
EViewType get_view_type() const { return m_view_type; } EViewType get_view_type() const { return m_view_type; }
void set_view_type(EViewType type) { void set_view_type(EViewType type) {

View file

@ -2585,9 +2585,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
displacement = multiplier * direction; displacement = multiplier * direction;
m_selection.translate(displacement); m_selection.translate(displacement);
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_selection.stop_dragging(); m_selection.stop_dragging();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_dirty = true; m_dirty = true;
} }
); );
@ -2686,9 +2684,7 @@ void GLCanvas3D::on_key(wxKeyEvent& evt)
auto do_rotate = [this](double angle_z_rad) { auto do_rotate = [this](double angle_z_rad) {
m_selection.start_dragging(); m_selection.start_dragging();
m_selection.rotate(Vec3d(0.0, 0.0, angle_z_rad), TransformationType(TransformationType::World_Relative_Joint)); m_selection.rotate(Vec3d(0.0, 0.0, angle_z_rad), TransformationType(TransformationType::World_Relative_Joint));
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_selection.stop_dragging(); m_selection.stop_dragging();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_dirty = true; m_dirty = true;
// wxGetApp().obj_manipul()->set_dirty(); // wxGetApp().obj_manipul()->set_dirty();
}; };
@ -3242,10 +3238,8 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
} }
} }
else if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp()) { else if (evt.LeftUp() || evt.MiddleUp() || evt.RightUp()) {
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
if (evt.LeftUp()) if (evt.LeftUp())
m_selection.stop_dragging(); m_selection.stop_dragging();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
if (m_layers_editing.state != LayersEditing::Unknown) { if (m_layers_editing.state != LayersEditing::Unknown) {
m_layers_editing.state = LayersEditing::Unknown; m_layers_editing.state = LayersEditing::Unknown;
@ -6342,15 +6336,8 @@ void GLCanvas3D::_set_warning_notification_if_needed(EWarning warning)
show = _is_any_volume_outside(); show = _is_any_volume_outside();
else { else {
if (wxGetApp().is_editor()) { if (wxGetApp().is_editor()) {
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
if (current_printer_technology() != ptSLA) if (current_printer_technology() != ptSLA)
show = m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed(); show = m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed();
#else
BoundingBoxf3 test_volume = (m_config != nullptr) ? print_volume(*m_config) : BoundingBoxf3();
const BoundingBoxf3& paths_volume = m_gcode_viewer.get_paths_bounding_box();
if (test_volume.radius() > 0.0 && paths_volume.radius() > 0.0)
show = !test_volume.contains(paths_volume);
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
} }
} }

View file

@ -479,9 +479,7 @@ private:
const DynamicPrintConfig* m_config; const DynamicPrintConfig* m_config;
Model* m_model; Model* m_model;
BackgroundSlicingProcess *m_process; BackgroundSlicingProcess *m_process;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
bool m_requires_check_outside_state{ false }; bool m_requires_check_outside_state{ false };
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
std::array<unsigned int, 2> m_old_size{ 0, 0 }; std::array<unsigned int, 2> m_old_size{ 0, 0 };
@ -618,9 +616,7 @@ public:
void post_event(wxEvent &&event); void post_event(wxEvent &&event);
void set_as_dirty(); void set_as_dirty();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
void requires_check_outside_state() { m_requires_check_outside_state = true; } void requires_check_outside_state() { m_requires_check_outside_state = true; }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
unsigned int get_volumes_count() const; unsigned int get_volumes_count() const;
const GLVolumeCollection& get_volumes() const { return m_volumes; } const GLVolumeCollection& get_volumes() const { return m_volumes; }

View file

@ -61,12 +61,8 @@ std::pair<bool, std::string> GLShadersManager::init()
// used to render extrusion and travel paths as lines in gcode preview // used to render extrusion and travel paths as lines in gcode preview
valid &= append_shader("toolpaths_lines", { "toolpaths_lines.vs", "toolpaths_lines.fs" }); valid &= append_shader("toolpaths_lines", { "toolpaths_lines.vs", "toolpaths_lines.fs" });
// used to render objects in 3d editor // used to render objects in 3d editor
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
// When setting this technology to default rename the following from "gouraud_mod" to "gouraud" // When setting this technology to default rename the following from "gouraud_mod" to "gouraud"
valid &= append_shader("gouraud_mod", { "gouraud_mod.vs", "gouraud_mod.fs" } valid &= append_shader("gouraud_mod", { "gouraud_mod.vs", "gouraud_mod.fs" }
#else
valid &= append_shader("gouraud", { "gouraud.vs", "gouraud.fs" }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
#if ENABLE_ENVIRONMENT_MAP #if ENABLE_ENVIRONMENT_MAP
, { "ENABLE_ENVIRONMENT_MAP"sv } , { "ENABLE_ENVIRONMENT_MAP"sv }
#endif // ENABLE_ENVIRONMENT_MAP #endif // ENABLE_ENVIRONMENT_MAP

View file

@ -657,14 +657,10 @@ void ObjectManipulation::update_if_dirty()
else else
m_og->disable(); m_og->disable();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
if (!selection.is_dragging()) { if (!selection.is_dragging()) {
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
update_reset_buttons_visibility(); update_reset_buttons_visibility();
update_mirror_buttons_visibility(); update_mirror_buttons_visibility();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
} }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_dirty = false; m_dirty = false;
} }
@ -820,9 +816,7 @@ void ObjectManipulation::change_position_value(int axis, double value)
Selection& selection = canvas->get_selection(); Selection& selection = canvas->get_selection();
selection.start_dragging(); selection.start_dragging();
selection.translate(position - m_cache.position, selection.requires_local_axes()); selection.translate(position - m_cache.position, selection.requires_local_axes());
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
selection.stop_dragging(); selection.stop_dragging();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
canvas->do_move(L("Set Position")); canvas->do_move(L("Set Position"));
m_cache.position = position; m_cache.position = position;
@ -854,9 +848,7 @@ void ObjectManipulation::change_rotation_value(int axis, double value)
selection.rotate( selection.rotate(
(M_PI / 180.0) * (transformation_type.absolute() ? rotation : rotation - m_cache.rotation), (M_PI / 180.0) * (transformation_type.absolute() ? rotation : rotation - m_cache.rotation),
transformation_type); transformation_type);
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
selection.stop_dragging(); selection.stop_dragging();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
canvas->do_rotate(L("Set Orientation")); canvas->do_rotate(L("Set Orientation"));
m_cache.rotation = rotation; m_cache.rotation = rotation;
@ -935,9 +927,7 @@ void ObjectManipulation::do_scale(int axis, const Vec3d &scale) const
selection.start_dragging(); selection.start_dragging();
selection.scale(scaling_factor, transformation_type); selection.scale(scaling_factor, transformation_type);
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
selection.stop_dragging(); selection.stop_dragging();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
wxGetApp().plater()->canvas3D()->do_scale(L("Set Scale")); wxGetApp().plater()->canvas3D()->do_scale(L("Set Scale"));
} }

View file

@ -66,20 +66,12 @@ GLGizmoPainterBase::ClippingPlaneDataWrapper GLGizmoPainterBase::get_clipping_pl
void GLGizmoPainterBase::render_triangles(const Selection& selection) const void GLGizmoPainterBase::render_triangles(const Selection& selection) const
{ {
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
auto* shader = wxGetApp().get_shader("gouraud_mod"); auto* shader = wxGetApp().get_shader("gouraud_mod");
#else
auto* shader = wxGetApp().get_shader("gouraud");
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
if (! shader) if (! shader)
return; return;
shader->start_using(); shader->start_using();
shader->set_uniform("slope.actived", false); shader->set_uniform("slope.actived", false);
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
shader->set_uniform("print_volume.type", 0); shader->set_uniform("print_volume.type", 0);
#else
shader->set_uniform("print_box.actived", false);
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
shader->set_uniform("clipping_plane", this->get_clipping_plane_data().clp_dataf); shader->set_uniform("clipping_plane", this->get_clipping_plane_data().clp_dataf);
ScopeGuard guard([shader]() { if (shader) shader->stop_using(); }); ScopeGuard guard([shader]() { if (shader) shader->stop_using(); });
@ -106,11 +98,7 @@ void GLGizmoPainterBase::render_triangles(const Selection& selection) const
// to the shader input variable print_box.volume_world_matrix before // to the shader input variable print_box.volume_world_matrix before
// rendering the painted triangles. When this matrix is not set, the // rendering the painted triangles. When this matrix is not set, the
// wrong transformation matrix is used for "Clipping of view". // wrong transformation matrix is used for "Clipping of view".
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
shader->set_uniform("volume_world_matrix", trafo_matrix); shader->set_uniform("volume_world_matrix", trafo_matrix);
#else
shader->set_uniform("print_box.volume_world_matrix", trafo_matrix);
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_triangle_selectors[mesh_id]->render(m_imgui); m_triangle_selectors[mesh_id]->render(m_imgui);
@ -609,11 +597,7 @@ void TriangleSelectorGUI::render(ImGuiWrapper* imgui)
auto* shader = wxGetApp().get_current_shader(); auto* shader = wxGetApp().get_current_shader();
if (! shader) if (! shader)
return; return;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
assert(shader->get_name() == "gouraud_mod"); assert(shader->get_name() == "gouraud_mod");
#else
assert(shader->get_name() == "gouraud");
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
ScopeGuard guard([shader]() { if (shader) shader->set_uniform("offset_depth_buffer", false);}); ScopeGuard guard([shader]() { if (shader) shader->set_uniform("offset_depth_buffer", false);});
shader->set_uniform("offset_depth_buffer", true); shader->set_uniform("offset_depth_buffer", true);
for (auto iva : {std::make_pair(&m_iva_enforcers, enforcers_color), for (auto iva : {std::make_pair(&m_iva_enforcers, enforcers_color),

View file

@ -715,22 +715,18 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
} }
else if (evt.LeftUp() && m_current == Flatten && m_gizmos[m_current]->get_hover_id() != -1) { else if (evt.LeftUp() && m_current == Flatten && m_gizmos[m_current]->get_hover_id() != -1) {
// to avoid to loose the selection when user clicks an the white faces of a different object while the Flatten gizmo is active // to avoid to loose the selection when user clicks an the white faces of a different object while the Flatten gizmo is active
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
selection.stop_dragging(); selection.stop_dragging();
wxGetApp().obj_manipul()->set_dirty(); wxGetApp().obj_manipul()->set_dirty();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
processed = true; processed = true;
} }
else if (evt.RightUp() && (m_current == FdmSupports || m_current == Seam || m_current == MmuSegmentation) && !m_parent.is_mouse_dragging()) { else if (evt.RightUp() && (m_current == FdmSupports || m_current == Seam || m_current == MmuSegmentation) && !m_parent.is_mouse_dragging()) {
gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), control_down); gizmo_event(SLAGizmoEventType::RightUp, mouse_pos, evt.ShiftDown(), evt.AltDown(), control_down);
processed = true; processed = true;
} }
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
else if (evt.LeftUp()) { else if (evt.LeftUp()) {
selection.stop_dragging(); selection.stop_dragging();
wxGetApp().obj_manipul()->set_dirty(); wxGetApp().obj_manipul()->set_dirty();
} }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
} }
else { else {
// mouse inside toolbar // mouse inside toolbar

View file

@ -112,9 +112,7 @@ Selection::Selection()
, m_type(Empty) , m_type(Empty)
, m_valid(false) , m_valid(false)
, m_scale_factor(1.0f) , m_scale_factor(1.0f)
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
, m_dragging(false) , m_dragging(false)
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
{ {
this->set_bounding_boxes_dirty(); this->set_bounding_boxes_dirty();
} }
@ -693,10 +691,7 @@ void Selection::start_dragging()
if (!m_valid) if (!m_valid)
return; return;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
m_dragging = true; m_dragging = true;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
set_caches(); set_caches();
} }
@ -737,9 +732,7 @@ void Selection::translate(const Vec3d& displacement, bool local)
ensure_not_below_bed(); ensure_not_below_bed();
set_bounding_boxes_dirty(); set_bounding_boxes_dirty();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
wxGetApp().plater()->canvas3D()->requires_check_outside_state(); wxGetApp().plater()->canvas3D()->requires_check_outside_state();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
} }
// Rotate an object around one of the axes. Only one rotation component is expected to be changing. // Rotate an object around one of the axes. Only one rotation component is expected to be changing.
@ -853,9 +846,7 @@ void Selection::rotate(const Vec3d& rotation, TransformationType transformation_
} }
set_bounding_boxes_dirty(); set_bounding_boxes_dirty();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
wxGetApp().plater()->canvas3D()->requires_check_outside_state(); wxGetApp().plater()->canvas3D()->requires_check_outside_state();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
} }
void Selection::flattening_rotate(const Vec3d& normal) void Selection::flattening_rotate(const Vec3d& normal)
@ -954,9 +945,7 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
ensure_on_bed(); ensure_on_bed();
set_bounding_boxes_dirty(); set_bounding_boxes_dirty();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
wxGetApp().plater()->canvas3D()->requires_check_outside_state(); wxGetApp().plater()->canvas3D()->requires_check_outside_state();
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
} }
void Selection::scale_to_fit_print_volume(const DynamicPrintConfig& config) void Selection::scale_to_fit_print_volume(const DynamicPrintConfig& config)

View file

@ -219,10 +219,7 @@ private:
GLModel m_curved_arrow; GLModel m_curved_arrow;
float m_scale_factor; float m_scale_factor;
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
bool m_dragging; bool m_dragging;
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
public: public:
Selection(); Selection();
@ -316,10 +313,8 @@ public:
const BoundingBoxf3& get_scaled_instance_bounding_box() const; const BoundingBoxf3& get_scaled_instance_bounding_box() const;
void start_dragging(); void start_dragging();
#if ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
void stop_dragging() { m_dragging = false; } void stop_dragging() { m_dragging = false; }
bool is_dragging() const { return m_dragging; } bool is_dragging() const { return m_dragging; }
#endif // ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS
void translate(const Vec3d& displacement, bool local = false); void translate(const Vec3d& displacement, bool local = false);
void rotate(const Vec3d& rotation, TransformationType transformation_type); void rotate(const Vec3d& rotation, TransformationType transformation_type);