SLA supports gizmo is now enabled and uses the new infrastructure

This commit is contained in:
Lukas Matena 2020-04-07 15:38:24 +02:00
parent c79e90b921
commit c704849a7a
6 changed files with 194 additions and 127 deletions

View file

@ -16,7 +16,7 @@ namespace GUI {
class ClippingPlane;
class MeshClipper;
class MeshRaycaster;
class CommonGizmosData;
//class CommonGizmosData;
enum class SLAGizmoEventType : unsigned char;
class GLGizmoSlaSupports : public GLGizmoBase
@ -26,7 +26,7 @@ private:
//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;
//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;
@ -81,8 +81,8 @@ public:
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; }
//void update_clipping_plane(bool keep_normal = false) const;
//void set_common_data_ptr(CommonGizmosData* ptr) { m_c = ptr; }
private:
bool on_init() override;
@ -92,7 +92,7 @@ private:
//void render_selection_rectangle() const;
void render_points(const Selection& selection, bool picking = false) const;
void render_clipping_plane(const Selection& selection) const;
//void render_clipping_plane(const Selection& selection) const;
bool unsaved_changes() const;
bool m_lock_unique_islands = false;
@ -104,6 +104,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
const ModelObject* m_old_mo = nullptr;
//std::unique_ptr<ClippingPlane> m_clipping_plane;
@ -117,7 +118,7 @@ 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;
//CommonGizmosData* m_c = nullptr;
//mutable std::unique_ptr<MeshClipper> m_object_clipper;
//mutable std::unique_ptr<MeshClipper> m_supports_clipper;
@ -159,6 +160,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;
};