Fix of freez when undo redo on text with modifier.

This commit is contained in:
Filip Sykala - NTB T15p 2023-04-03 16:24:07 +02:00
parent b9ac8aeafa
commit ad81d530b1
26 changed files with 31 additions and 30 deletions

View File

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

View File

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

View File

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

View File

@ -806,8 +806,10 @@ void GLGizmoEmboss::on_set_state()
} }
} }
void GLGizmoEmboss::data_changed() { void GLGizmoEmboss::data_changed(bool is_serializing) {
set_volume_by_selection(); set_volume_by_selection();
if (!is_serializing && m_volume == nullptr)
close();
} }
void GLGizmoEmboss::on_start_dragging() { m_rotate_gizmo.start_dragging(); } void GLGizmoEmboss::on_start_dragging() { m_rotate_gizmo.start_dragging(); }

View File

@ -61,7 +61,7 @@ protected:
void on_render_input_window(float x, float y, float bottom_limit) override; void on_render_input_window(float x, float y, float bottom_limit) override;
bool on_is_selectable() const override { return false; } bool on_is_selectable() const override { return false; }
void on_set_state() override; 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_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_enable_grabber(unsigned int id) override { m_rotate_gizmo.enable_grabber(); }
void on_disable_grabber(unsigned int id) override { m_rotate_gizmo.disable_grabber(); } void on_disable_grabber(unsigned int id) override { m_rotate_gizmo.disable_grabber(); }

View File

@ -383,9 +383,9 @@ void GLGizmoFdmSupports::select_facets_by_angle(float threshold_deg, bool block)
m_parent.set_as_dirty(); 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()) if (! m_c->selection_info())
return; return;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -156,7 +156,7 @@ public:
/// <returns>Return True when use the information otherwise False.</returns> /// <returns>Return True when use the information otherwise False.</returns>
bool on_mouse(const wxMouseEvent &mouse_event) override; 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); 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)); 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) if (m_state != On || wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptFFF || wxGetApp().extruders_edited_cnt() <= 1)
return; return;

View File

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

View File

@ -34,7 +34,7 @@ bool GLGizmoMove3D::on_mouse(const wxMouseEvent &mouse_event) {
return use_grabbers(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(); m_grabbers[2].enabled = !m_parent.get_selection().is_wipe_tower();
} }

View File

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

View File

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

View File

@ -83,7 +83,7 @@ private:
public: public:
GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id); GLGizmoPainterBase(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
~GLGizmoPainterBase() override; ~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); 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 // Following function renders the triangles and cursor. Having this separated

View File

@ -535,7 +535,7 @@ bool GLGizmoRotate3D::on_mouse(const wxMouseEvent &mouse_event)
return use_grabbers(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 (m_parent.get_selection().is_wipe_tower()) {
m_gizmos[0].disable_grabber(); m_gizmos[0].disable_grabber();
m_gizmos[1].disable_grabber(); m_gizmos[1].disable_grabber();

View File

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

View File

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

View File

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

View File

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

View File

@ -55,7 +55,7 @@ private:
public: public:
GLGizmoSlaSupports(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id); GLGizmoSlaSupports(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
virtual ~GLGizmoSlaSupports() = default; 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); 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); void delete_selected_points(bool force = false);
//ClippingPlane get_sla_clipping_plane() const; //ClippingPlane get_sla_clipping_plane() const;

View File

@ -223,7 +223,7 @@ void GLGizmosManager::update_data()
m_common_gizmos_data->update(get_current() m_common_gizmos_data->update(get_current()
? get_current()->get_requirements() ? get_current()->get_requirements()
: CommonGizmosDataID(0)); : 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 bool GLGizmosManager::is_running() const