Fixed the 'remove all points' button in sla gizmo (was only working in editing mode)

This commit is contained in:
Lukas Matena 2019-03-01 15:03:58 +01:00
parent 5846af256a
commit b45c80b8db
2 changed files with 6 additions and 7 deletions

View file

@ -2178,13 +2178,10 @@ bool GLGizmoSlaSupports::mouse_event(SLAGizmoEventType action, const Vec2d& mous
return false; return false;
} }
void GLGizmoSlaSupports::delete_selected_points() void GLGizmoSlaSupports::delete_selected_points(bool force)
{ {
if (!m_editing_mode)
return;
for (unsigned int idx=0; idx<m_editing_mode_cache.size(); ++idx) { for (unsigned int idx=0; idx<m_editing_mode_cache.size(); ++idx) {
if (m_editing_mode_cache[idx].second && (!m_editing_mode_cache[idx].first.is_new_island || !m_lock_unique_islands)) { if (m_editing_mode_cache[idx].second && (!m_editing_mode_cache[idx].first.is_new_island || !m_lock_unique_islands || force)) {
m_editing_mode_cache.erase(m_editing_mode_cache.begin() + (idx--)); m_editing_mode_cache.erase(m_editing_mode_cache.begin() + (idx--));
m_unsaved_changes = true; m_unsaved_changes = true;
} }
@ -2403,7 +2400,9 @@ RENDER_AGAIN:
m_parent.reload_scene(true); m_parent.reload_scene(true);
if (remove_all) if (remove_all)
select_point(AllPoints); select_point(AllPoints);
delete_selected_points(); delete_selected_points(remove_all);
if (remove_all && !m_editing_mode)
editing_mode_apply_changes();
if (first_run) { if (first_run) {
first_run = false; first_run = false;
goto RENDER_AGAIN; goto RENDER_AGAIN;

View file

@ -469,7 +469,7 @@ public:
virtual ~GLGizmoSlaSupports(); virtual ~GLGizmoSlaSupports();
void set_sla_support_data(ModelObject* model_object, const GLCanvas3D::Selection& selection); void set_sla_support_data(ModelObject* model_object, const GLCanvas3D::Selection& selection);
bool mouse_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down); bool mouse_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down);
void delete_selected_points(); void delete_selected_points(bool force = false);
private: private:
bool on_init(); bool on_init();