SLA gizmo on_set_state code is now called through CallAfter to prevent repeated wxMessageDialog appearances (seen on OSX)
This commit is contained in:
parent
ea3d30bff1
commit
837bc43c9f
@ -726,40 +726,45 @@ std::string GLGizmoSlaSupports::on_get_name() const
|
|||||||
|
|
||||||
void GLGizmoSlaSupports::on_set_state()
|
void GLGizmoSlaSupports::on_set_state()
|
||||||
{
|
{
|
||||||
if (m_state == On && m_old_state != On) { // the gizmo was just turned on
|
// Following is called through CallAfter, because otherwise there was a problem
|
||||||
|
// on OSX with the wxMessageDialog being shown several times when clicked into.
|
||||||
|
|
||||||
if (is_mesh_update_necessary())
|
wxGetApp().CallAfter([this]() {
|
||||||
update_mesh();
|
if (m_state == On && m_old_state != On) { // the gizmo was just turned on
|
||||||
|
|
||||||
// we'll now reload support points:
|
if (is_mesh_update_necessary())
|
||||||
if (m_model_object)
|
update_mesh();
|
||||||
editing_mode_reload_cache();
|
|
||||||
|
|
||||||
m_parent.toggle_model_objects_visibility(false);
|
// we'll now reload support points:
|
||||||
if (m_model_object)
|
if (m_model_object)
|
||||||
m_parent.toggle_model_objects_visibility(true, m_model_object, m_active_instance);
|
editing_mode_reload_cache();
|
||||||
|
|
||||||
// Set default head diameter from config.
|
m_parent.toggle_model_objects_visibility(false);
|
||||||
const DynamicPrintConfig& cfg = wxGetApp().preset_bundle->sla_prints.get_edited_preset().config;
|
if (m_model_object)
|
||||||
m_new_point_head_diameter = static_cast<const ConfigOptionFloat*>(cfg.option("support_head_front_diameter"))->value;
|
m_parent.toggle_model_objects_visibility(true, m_model_object, m_active_instance);
|
||||||
}
|
|
||||||
if (m_state == Off && m_old_state != Off) { // the gizmo was just turned Off
|
// Set default head diameter from config.
|
||||||
if (m_model_object) {
|
const DynamicPrintConfig& cfg = wxGetApp().preset_bundle->sla_prints.get_edited_preset().config;
|
||||||
if (m_unsaved_changes) {
|
m_new_point_head_diameter = static_cast<const ConfigOptionFloat*>(cfg.option("support_head_front_diameter"))->value;
|
||||||
wxMessageDialog dlg(GUI::wxGetApp().plater(), _(L("Do you want to save your manually edited support points ?\n")),
|
|
||||||
_(L("Save changes?")), wxICON_QUESTION | wxYES | wxNO);
|
|
||||||
if (dlg.ShowModal() == wxID_YES)
|
|
||||||
editing_mode_apply_changes();
|
|
||||||
else
|
|
||||||
editing_mode_discard_changes();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (m_state == Off && m_old_state != Off) { // the gizmo was just turned Off
|
||||||
|
if (m_model_object) {
|
||||||
|
if (m_unsaved_changes) {
|
||||||
|
wxMessageDialog dlg(GUI::wxGetApp().mainframe, _(L("Do you want to save your manually edited support points ?\n")),
|
||||||
|
_(L("Save changes?")), wxICON_QUESTION | wxYES | wxNO);
|
||||||
|
if (dlg.ShowModal() == wxID_YES)
|
||||||
|
editing_mode_apply_changes();
|
||||||
|
else
|
||||||
|
editing_mode_discard_changes();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_parent.toggle_model_objects_visibility(true);
|
m_parent.toggle_model_objects_visibility(true);
|
||||||
m_editing_mode = false; // so it is not active next time the gizmo opens
|
m_editing_mode = false; // so it is not active next time the gizmo opens
|
||||||
m_editing_mode_cache.clear();
|
m_editing_mode_cache.clear();
|
||||||
}
|
}
|
||||||
m_old_state = m_state;
|
m_old_state = m_state;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user