Fix for SPE-1686 : Bug with instance rotation around X or Y
Steps to repro: 1. Add object 2. Increase instances 3. Select some instance 4. Rotate around X or Y 5. After MouseUp: OSX -> hard crash MSW and Linux -> object and instance are selected at a same time
This commit is contained in:
parent
49fbf4ccce
commit
234956dfda
2 changed files with 36 additions and 18 deletions
|
@ -3641,6 +3641,7 @@ void GLCanvas3D::do_move(const std::string& snapshot_type)
|
|||
}
|
||||
|
||||
// Fixes flying instances
|
||||
std::set<int> obj_idx_for_update_info_items;
|
||||
for (const std::pair<int, int>& i : done) {
|
||||
ModelObject* m = m_model->objects[i.first];
|
||||
const double shift_z = m->get_instance_min_z(i.second);
|
||||
|
@ -3649,8 +3650,11 @@ void GLCanvas3D::do_move(const std::string& snapshot_type)
|
|||
m_selection.translate(i.first, i.second, shift);
|
||||
m->translate_instance(i.second, shift);
|
||||
}
|
||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(i.first));
|
||||
obj_idx_for_update_info_items.emplace(i.first);
|
||||
}
|
||||
//update sinking information in ObjectList
|
||||
for (int id : obj_idx_for_update_info_items)
|
||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(id));
|
||||
|
||||
// if the selection is not valid to allow for layer editing after the move, we need to turn off the tool if it is running
|
||||
// similar to void Plater::priv::selection_changed()
|
||||
|
@ -3728,6 +3732,7 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type)
|
|||
}
|
||||
|
||||
// Fixes sinking/flying instances
|
||||
std::set<int> obj_idx_for_update_info_items;
|
||||
for (const std::pair<int, int>& i : done) {
|
||||
ModelObject* m = m_model->objects[i.first];
|
||||
const double shift_z = m->get_instance_min_z(i.second);
|
||||
|
@ -3738,8 +3743,11 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type)
|
|||
m->translate_instance(i.second, shift);
|
||||
}
|
||||
|
||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(i.first));
|
||||
obj_idx_for_update_info_items.emplace(i.first);
|
||||
}
|
||||
//update sinking information in ObjectList
|
||||
for (int id : obj_idx_for_update_info_items)
|
||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(id));
|
||||
|
||||
if (!done.empty())
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_INSTANCE_ROTATED));
|
||||
|
@ -3797,6 +3805,7 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type)
|
|||
}
|
||||
|
||||
// Fixes sinking/flying instances
|
||||
std::set<int> obj_idx_for_update_info_items;
|
||||
for (const std::pair<int, int>& i : done) {
|
||||
ModelObject* m = m_model->objects[i.first];
|
||||
const double shift_z = m->get_instance_min_z(i.second);
|
||||
|
@ -3806,8 +3815,11 @@ void GLCanvas3D::do_scale(const std::string& snapshot_type)
|
|||
m_selection.translate(i.first, i.second, shift);
|
||||
m->translate_instance(i.second, shift);
|
||||
}
|
||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(i.first));
|
||||
obj_idx_for_update_info_items.emplace(i.first);
|
||||
}
|
||||
//update sinking information in ObjectList
|
||||
for (int id : obj_idx_for_update_info_items)
|
||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(id));
|
||||
|
||||
if (!done.empty())
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_INSTANCE_SCALED));
|
||||
|
@ -3860,6 +3872,7 @@ void GLCanvas3D::do_mirror(const std::string& snapshot_type)
|
|||
}
|
||||
|
||||
// Fixes sinking/flying instances
|
||||
std::set<int> obj_idx_for_update_info_items;
|
||||
for (const std::pair<int, int>& i : done) {
|
||||
ModelObject* m = m_model->objects[i.first];
|
||||
double shift_z = m->get_instance_min_z(i.second);
|
||||
|
@ -3869,8 +3882,11 @@ void GLCanvas3D::do_mirror(const std::string& snapshot_type)
|
|||
m_selection.translate(i.first, i.second, shift);
|
||||
m->translate_instance(i.second, shift);
|
||||
}
|
||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(i.first));
|
||||
obj_idx_for_update_info_items.emplace(i.first);
|
||||
}
|
||||
//update sinking information in ObjectList
|
||||
for (int id : obj_idx_for_update_info_items)
|
||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(id));
|
||||
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
|
||||
|
||||
|
@ -3922,6 +3938,7 @@ void GLCanvas3D::do_reset_skew(const std::string& snapshot_type)
|
|||
}
|
||||
|
||||
// Fixes sinking/flying instances
|
||||
std::set<int> obj_idx_for_update_info_items;
|
||||
for (const std::pair<int, int>& i : done) {
|
||||
ModelObject* m = m_model->objects[i.first];
|
||||
double shift_z = m->get_instance_min_z(i.second);
|
||||
|
@ -3931,8 +3948,11 @@ void GLCanvas3D::do_reset_skew(const std::string& snapshot_type)
|
|||
m_selection.translate(i.first, i.second, shift);
|
||||
m->translate_instance(i.second, shift);
|
||||
}
|
||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(i.first));
|
||||
obj_idx_for_update_info_items.emplace(i.first);
|
||||
}
|
||||
//update sinking information in ObjectList
|
||||
for (int id : obj_idx_for_update_info_items)
|
||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(id));
|
||||
|
||||
post_event(SimpleEvent(EVT_GLCANVAS_RESET_SKEW));
|
||||
|
||||
|
|
|
@ -2994,21 +2994,19 @@ void ObjectList::update_info_items(size_t obj_idx, wxDataViewItemArray* selectio
|
|||
wxGetApp().notification_manager()->push_updated_item_info_notification(type);
|
||||
}
|
||||
else if (shows && ! should_show) {
|
||||
if (!selections)
|
||||
if (!selections && IsSelected(item)) {
|
||||
Unselect(item);
|
||||
m_objects_model->Delete(item);
|
||||
if (selections) {
|
||||
if (selections->Index(item) != wxNOT_FOUND) {
|
||||
// If info item was deleted from the list,
|
||||
// it's need to be deleted from selection array, if it was there
|
||||
selections->Remove(item);
|
||||
// Select item_obj, if info_item doesn't exist for item anymore, but was selected
|
||||
if (selections->Index(item_obj) == wxNOT_FOUND)
|
||||
selections->Add(item_obj);
|
||||
}
|
||||
}
|
||||
else
|
||||
Select(item_obj);
|
||||
}
|
||||
m_objects_model->Delete(item);
|
||||
if (selections && selections->Index(item) != wxNOT_FOUND) {
|
||||
// If info item was deleted from the list,
|
||||
// it's need to be deleted from selection array, if it was there
|
||||
selections->Remove(item);
|
||||
// Select item_obj, if info_item doesn't exist for item anymore, but was selected
|
||||
if (selections->Index(item_obj) == wxNOT_FOUND)
|
||||
selections->Add(item_obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue