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>
/// 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

@ -2510,7 +2510,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

@ -256,7 +256,7 @@ protected:
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"); }
void data_changed() override;
void data_changed(bool is_serializing) override;
private:
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();
if (!is_serializing && m_volume == nullptr)
close();
}
void GLGizmoEmboss::on_start_dragging() { m_rotate_gizmo.start_dragging(); }

View File

@ -60,8 +60,8 @@ protected:
void on_unregister_raycasters_for_picking() override;
void on_render_input_window(float x, float y, float bottom_limit) override;
bool on_is_selectable() const override { return false; }
void on_set_state() override;
void data_changed() override; // selection changed
void on_set_state() override;
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

@ -383,9 +383,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

@ -28,7 +28,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

@ -56,7 +56,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

@ -454,7 +454,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

@ -156,7 +156,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

@ -90,7 +90,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

@ -34,7 +34,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

@ -47,7 +47,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

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

View File

@ -83,7 +83,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

@ -535,7 +535,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()) {
m_gizmos[0].disable_grabber();
m_gizmos[1].disable_grabber();

View File

@ -138,7 +138,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

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

View File

@ -61,7 +61,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

@ -49,7 +49,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

@ -55,7 +55,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