Merge branch 'lm_gizmos' into lm_fdm_supports_gizmo

This commit is contained in:
Lukas Matena 2020-04-07 17:16:48 +02:00
commit a380053a17
227 changed files with 28690 additions and 16849 deletions

View file

@ -13,33 +13,18 @@
namespace Slic3r {
namespace GUI {
class ClippingPlane;
class MeshClipper;
class MeshRaycaster;
class CommonGizmosData;
enum class SLAGizmoEventType : unsigned char;
class GLGizmoSlaSupports : public GLGizmoBase
{
private:
//ModelObject* m_model_object = nullptr;
//ObjectID m_model_object_id = 0;
//int m_active_instance = -1;
//float m_active_instance_bb_radius; // to cache the bb
mutable double m_z_shift = 0.f;
bool unproject_on_mesh(const Vec2d& mouse_pos, std::pair<Vec3f, Vec3f>& pos_and_normal);
const float RenderPointScale = 1.f;
GLUquadricObj* m_quadric;
//std::unique_ptr<MeshRaycaster> m_mesh_raycaster;
//const TriangleMesh* m_mesh;
const indexed_triangle_set* m_its;
//mutable int m_old_timestamp = -1;
//mutable int m_print_object_idx = -1;
//mutable int m_print_objects_count = -1;
class CacheEntry {
public:
CacheEntry() :
@ -73,14 +58,12 @@ public:
void set_sla_support_data(ModelObject* model_object, const Selection& selection);
bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down);
void delete_selected_points(bool force = false);
ClippingPlane get_sla_clipping_plane() const;
//ClippingPlane get_sla_clipping_plane() const;
bool is_in_editing_mode() const { return m_editing_mode; }
bool is_selection_rectangle_dragging() const { return m_selection_rectangle.is_dragging(); }
bool has_backend_supports() const;
void reslice_SLA_supports(bool postpone_error_messages = false) const;
void update_clipping_plane(bool keep_normal = false) const;
void set_common_data_ptr(CommonGizmosData* ptr) { m_c = ptr; }
private:
bool on_init() override;
@ -88,9 +71,7 @@ private:
void on_render() const override;
void on_render_for_picking() const override;
//void render_selection_rectangle() const;
void render_points(const Selection& selection, bool picking = false) const;
void render_clipping_plane(const Selection& selection) const;
bool unsaved_changes() const;
bool m_lock_unique_islands = false;
@ -102,8 +83,7 @@ private:
float m_density_stash = 0.f; // and again
mutable std::vector<CacheEntry> m_editing_cache; // a support point and whether it is currently selected
std::vector<sla::SupportPoint> m_normal_cache; // to restore after discarding changes or undo/redo
//std::unique_ptr<ClippingPlane> m_clipping_plane;
const ModelObject* m_old_mo = nullptr;
// This map holds all translated description texts, so they can be easily referenced during layout calculations
// etc. When language changes, GUI is recreated and this class constructed again, so the change takes effect.
@ -115,11 +95,6 @@ private:
bool m_selection_empty = true;
EState m_old_state = Off; // to be able to see that the gizmo has just been closed (see on_set_state)
CommonGizmosData* m_c = nullptr;
//mutable std::unique_ptr<MeshClipper> m_object_clipper;
//mutable std::unique_ptr<MeshClipper> m_supports_clipper;
std::vector<const ConfigOption*> get_config_options(const std::vector<std::string>& keys) const;
bool is_mesh_point_clipped(const Vec3d& point) const;
bool is_point_in_hole(const Vec3f& pt) const;
@ -156,6 +131,7 @@ protected:
std::string on_get_name() const override;
bool on_is_activable() const override;
bool on_is_selectable() const override;
virtual CommonGizmosDataID on_get_requirements() const override;
void on_load(cereal::BinaryInputArchive& ar) override;
void on_save(cereal::BinaryOutputArchive& ar) const override;
};