ENH: preview: refine the logic to switch camera view
when switch between preview and view3D, if the screen center is on the plate don't change to the plate view Change-Id: I16b8815ad9b10a7cea174faa6a16bb9e582a77c3
This commit is contained in:
parent
92ad7ff1d0
commit
6a08c2d509
4 changed files with 16 additions and 16 deletions
|
@ -909,6 +909,10 @@ public:
|
|||
|
||||
bool is_object_sinking(int object_idx) const;
|
||||
|
||||
// Convert the screen space coordinate to an object space coordinate.
|
||||
// If the Z screen space coordinate is not provided, a depth buffer value is substituted.
|
||||
Vec3d _mouse_to_3d(const Point& mouse_pos, float* z = nullptr);
|
||||
|
||||
private:
|
||||
bool _is_shown_on_screen() const;
|
||||
|
||||
|
@ -981,10 +985,6 @@ private:
|
|||
|
||||
void _update_volumes_hover_state();
|
||||
|
||||
// Convert the screen space coordinate to an object space coordinate.
|
||||
// If the Z screen space coordinate is not provided, a depth buffer value is substituted.
|
||||
Vec3d _mouse_to_3d(const Point& mouse_pos, float* z = nullptr);
|
||||
|
||||
// Convert the screen space coordinate to world coordinate on the bed.
|
||||
Vec3d _mouse_to_bed_3d(const Point& mouse_pos);
|
||||
|
||||
|
|
|
@ -1840,7 +1840,7 @@ bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, Ve
|
|||
ExPolygon logo_poly;
|
||||
generate_logo_polygon(logo_poly);
|
||||
if (!m_logo_triangles.set_from_triangles(triangulate_expolygon_2f(logo_poly, NORMALS_UP), GROUND_Z+0.02f))
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":Unable to create plate triangles\n";
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":Unable to create logo triangles\n";
|
||||
|
||||
ExPolygon poly;
|
||||
/*for (const Vec2d& p : m_shape) {
|
||||
|
@ -1883,9 +1883,9 @@ const BoundingBox PartPlate::get_bounding_box_crd()
|
|||
return plate_shape.bounding_box();
|
||||
}
|
||||
|
||||
bool PartPlate::contains(const Point& point) const
|
||||
bool PartPlate::contains(const Vec3d& point) const
|
||||
{
|
||||
return m_polygon.contains(point);
|
||||
return m_bounding_box.contains(point);
|
||||
}
|
||||
|
||||
bool PartPlate::contains(const GLVolume& v) const
|
||||
|
@ -1917,11 +1917,6 @@ bool PartPlate::intersects(const BoundingBoxf3& bb) const
|
|||
return print_volume.intersects(bb);
|
||||
}
|
||||
|
||||
Point PartPlate::point_projection(const Point& point) const
|
||||
{
|
||||
return m_polygon.point_projection(point);
|
||||
}
|
||||
|
||||
void PartPlate::render(bool bottom, bool only_body, bool force_background_color, HeightLimitMode mode, int hover_id)
|
||||
{
|
||||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
|
|
|
@ -114,7 +114,6 @@ private:
|
|||
Transform3d m_grabber_trans_matrix;
|
||||
Slic3r::Geometry::Transformation position;
|
||||
std::vector<Vec3f> positions;
|
||||
Polygon m_polygon;
|
||||
unsigned int m_vbo_id{ 0 };
|
||||
GeometryBuffer m_triangles;
|
||||
GeometryBuffer m_exclude_triangles;
|
||||
|
@ -285,12 +284,11 @@ public:
|
|||
/*rendering related functions*/
|
||||
const Pointfs& get_shape() const { return m_shape; }
|
||||
bool set_shape(const Pointfs& shape, const Pointfs& exclude_areas, Vec2d position, float height_to_lid, float height_to_rod);
|
||||
bool contains(const Point& point) const;
|
||||
bool contains(const Vec3d& point) const;
|
||||
bool contains(const GLVolume& v) const;
|
||||
bool contains(const BoundingBoxf3& bb) const;
|
||||
bool intersects(const BoundingBoxf3& bb) const;
|
||||
|
||||
Point point_projection(const Point& point) const;
|
||||
void render(bool bottom, bool only_body = false, bool force_background_color = false, HeightLimitMode mode = HEIGHT_LIMIT_NONE, int hover_id = -1);
|
||||
void render_for_picking() const { on_render_for_picking(); }
|
||||
void set_selected();
|
||||
|
|
|
@ -4482,7 +4482,14 @@ void Plater::priv::set_current_panel(wxPanel* panel, bool no_slice)
|
|||
preview->get_canvas3d()->render(true);
|
||||
}
|
||||
}
|
||||
this->partplate_list.select_plate_view();
|
||||
//TODO: turn off this switch currently
|
||||
/*auto canvas_w = float(preview->get_canvas3d()->get_canvas_size().get_width());
|
||||
auto canvas_h = float(preview->get_canvas3d()->get_canvas_size().get_height());
|
||||
Point screen_center(canvas_w/2, canvas_h/2);
|
||||
auto center_point = preview->get_canvas3d()->_mouse_to_3d(screen_center);
|
||||
center_point(2) = 0.f;
|
||||
if (!current_plate->contains(center_point))
|
||||
this->partplate_list.select_plate_view();*/
|
||||
|
||||
// keeps current gcode preview, if any
|
||||
if (this->m_slice_all) {
|
||||
|
|
Loading…
Reference in a new issue