Added 'is_serializing' flag to GLGizmoBase::data_changed function

This commit is contained in:
Lukas Matena 2023-03-14 13:34:33 +01:00
parent 993d6bd561
commit e29970a2ed
26 changed files with 28 additions and 28 deletions

View File

@ -175,7 +175,7 @@ public:
/// <summary>
/// Is called when data (Selection) is changed
/// </summary>
virtual void data_changed(){};
virtual void data_changed(bool is_serializing){};
/// <summary>
/// Implement when want to process mouse events in gizmo

View File

@ -2496,7 +2496,7 @@ CommonGizmosDataID GLGizmoCut3D::on_get_requirements() const {
| int(CommonGizmosDataID::ObjectClipper));
}
void GLGizmoCut3D::data_changed()
void GLGizmoCut3D::data_changed(bool is_serializing)
{
update_bb();
if (auto oc = m_c->object_clipper())

View File

@ -255,7 +255,7 @@ protected:
std::string get_gizmo_leaving_text() const override { return _u8L("Leaving Cut gizmo"); }
std::string get_action_snapshot_name() override { return _u8L("Cut gizmo editing"); }
void data_changed() override;
void data_changed(bool is_serializing) override;
private:
void set_center(const Vec3d& center, bool update_tbb = false);

View File

@ -903,7 +903,7 @@ void GLGizmoEmboss::on_set_state()
}
}
void GLGizmoEmboss::data_changed() {
void GLGizmoEmboss::data_changed(bool is_serializing) {
set_volume_by_selection();
}

View File

@ -62,7 +62,7 @@ protected:
bool on_is_activable() const override { return true; }
bool on_is_selectable() const override { return false; }
void on_set_state() override;
void data_changed() override; // selection changed
void data_changed(bool is_serializing) override; // selection changed
void on_set_hover_id() override{ m_rotate_gizmo.set_hover_id(m_hover_id); }
void on_enable_grabber(unsigned int id) override { m_rotate_gizmo.enable_grabber(); }
void on_disable_grabber(unsigned int id) override { m_rotate_gizmo.disable_grabber(); }

View File

@ -386,9 +386,9 @@ void GLGizmoFdmSupports::select_facets_by_angle(float threshold_deg, bool block)
m_parent.set_as_dirty();
}
void GLGizmoFdmSupports::data_changed()
void GLGizmoFdmSupports::data_changed(bool is_serializing)
{
GLGizmoPainterBase::data_changed();
GLGizmoPainterBase::data_changed(is_serializing);
if (! m_c->selection_info())
return;

View File

@ -26,7 +26,7 @@ protected:
private:
bool on_init() override;
void data_changed() override;
void data_changed(bool is_serializing) override;
void update_model_object() const override;
void update_from_model_object() override;

View File

@ -57,7 +57,7 @@ bool GLGizmoFlatten::on_mouse(const wxMouseEvent &mouse_event)
return false;
}
void GLGizmoFlatten::data_changed()
void GLGizmoFlatten::data_changed(bool is_serializing)
{
const Selection & selection = m_parent.get_selection();
const ModelObject *model_object = nullptr;

View File

@ -55,7 +55,7 @@ public:
/// <returns>Return True when use the information otherwise False.</returns>
bool on_mouse(const wxMouseEvent &mouse_event) override;
void data_changed() override;
void data_changed(bool is_serializing) override;
protected:
bool on_init() override;
std::string on_get_name() const override;

View File

@ -42,7 +42,7 @@ bool GLGizmoHollow::on_init()
return true;
}
void GLGizmoHollow::data_changed()
void GLGizmoHollow::data_changed(bool is_serializing)
{
if (! m_c->selection_info())
return;

View File

@ -24,7 +24,7 @@ class GLGizmoHollow : public GLGizmoSlaBase
{
public:
GLGizmoHollow(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
void data_changed() override;
void data_changed(bool is_serializing) override;
bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down);
void delete_selected_points();
bool is_selection_rectangle_dragging() const override {

View File

@ -455,7 +455,7 @@ bool GLGizmoMeasure::on_mouse(const wxMouseEvent &mouse_event)
return false;
}
void GLGizmoMeasure::data_changed()
void GLGizmoMeasure::data_changed(bool is_serializing)
{
m_parent.toggle_sla_auxiliaries_visibility(false, nullptr, -1);

View File

@ -155,7 +155,7 @@ public:
/// <returns>Return True when use the information otherwise False.</returns>
bool on_mouse(const wxMouseEvent &mouse_event) override;
void data_changed() override;
void data_changed(bool is_serializing) override;
bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down);

View File

@ -147,9 +147,9 @@ void GLGizmoMmuSegmentation::render_painter_gizmo()
glsafe(::glDisable(GL_BLEND));
}
void GLGizmoMmuSegmentation::data_changed()
void GLGizmoMmuSegmentation::data_changed(bool is_serializing)
{
GLGizmoPainterBase::data_changed();
GLGizmoPainterBase::data_changed(is_serializing);
if (m_state != On || wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptFFF || wxGetApp().extruders_edited_cnt() <= 1)
return;

View File

@ -88,7 +88,7 @@ public:
void render_painter_gizmo() override;
void data_changed() override;
void data_changed(bool is_serializing) override;
void render_triangles(const Selection& selection) const override;

View File

@ -52,7 +52,7 @@ bool GLGizmoMove3D::on_mouse(const wxMouseEvent &mouse_event) {
return use_grabbers(mouse_event);
}
void GLGizmoMove3D::data_changed() {
void GLGizmoMove3D::data_changed(bool is_serializing) {
m_grabbers[2].enabled = !m_parent.get_selection().is_wipe_tower();
}

View File

@ -51,7 +51,7 @@ public:
/// <summary>
/// Detect reduction of move for wipetover on selection change
/// </summary>
void data_changed() override;
void data_changed(bool is_serializing) override;
protected:
bool on_init() override;
std::string on_get_name() const override;

View File

@ -32,7 +32,7 @@ GLGizmoPainterBase::~GLGizmoPainterBase()
s_sphere.reset();
}
void GLGizmoPainterBase::data_changed()
void GLGizmoPainterBase::data_changed(bool is_serializing)
{
if (m_state != On)
return;

View File

@ -82,7 +82,7 @@ private:
public:
GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
~GLGizmoPainterBase() override;
void data_changed() override;
void data_changed(bool is_serializing) override;
virtual bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down);
// Following function renders the triangles and cursor. Having this separated

View File

@ -601,7 +601,7 @@ bool GLGizmoRotate3D::on_mouse(const wxMouseEvent &mouse_event)
return use_grabbers(mouse_event);
}
void GLGizmoRotate3D::data_changed() {
void GLGizmoRotate3D::data_changed(bool is_serializing) {
if (m_parent.get_selection().is_wipe_tower()) {
#if !ENABLE_WORLD_COORDINATE
const DynamicPrintConfig& config = wxGetApp().preset_bundle->prints.get_edited_preset().config;

View File

@ -146,7 +146,7 @@ public:
/// <returns>Return True when use the information otherwise False.</returns>
bool on_mouse(const wxMouseEvent &mouse_event) override;
void data_changed() override;
void data_changed(bool is_serializing) override;
protected:
bool on_init() override;
std::string on_get_name() const override;

View File

@ -106,7 +106,7 @@ void GLGizmoScale3D::enable_ununiversal_scale(bool enable)
m_grabbers[i].enabled = enable;
}
void GLGizmoScale3D::data_changed()
void GLGizmoScale3D::data_changed(bool is_serializing)
{
#if ENABLE_WORLD_COORDINATE
set_scale(Vec3d::Ones());

View File

@ -82,7 +82,7 @@ public:
/// <returns>Return True when use the information otherwise False.</returns>
bool on_mouse(const wxMouseEvent &mouse_event) override;
void data_changed() override;
void data_changed(bool is_serializing) override;
void enable_ununiversal_scale(bool enable);
protected:
virtual bool on_init() override;

View File

@ -48,7 +48,7 @@ bool GLGizmoSlaSupports::on_init()
return true;
}
void GLGizmoSlaSupports::data_changed()
void GLGizmoSlaSupports::data_changed(bool is_serializing)
{
if (! m_c->selection_info())
return;

View File

@ -54,7 +54,7 @@ private:
public:
GLGizmoSlaSupports(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
virtual ~GLGizmoSlaSupports() = default;
void data_changed() override;
void data_changed(bool is_serializing) override;
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;

View File

@ -223,7 +223,7 @@ void GLGizmosManager::update_data()
m_common_gizmos_data->update(get_current()
? get_current()->get_requirements()
: CommonGizmosDataID(0));
if (m_current != Undefined) m_gizmos[m_current]->data_changed();
if (m_current != Undefined) m_gizmos[m_current]->data_changed(m_serializing);
}
bool GLGizmosManager::is_running() const