Fix of #3303
+ Fixed wrong update of selection in object and scene, when change selection in ObjectList after editing of values in Height range modifiers. Repro: 1. Add 2 objects 2. Add Height range modifiers for one of them 3. Select range 4. Edit some of values 5. Select other object. Expected behavior: 1. Edited value is saved 2. New object is selected in object list and on the 3D scene_selection Real behavior: 1. New object is selected in object list and on the 3D scene_selection But: 2. Every next selection in object list has no update on the scene or "temporary" panel 3. Selection from the scene updates selection in ObjectList But: 4. Next editing of layer range and press "Enter" causes a crash
This commit is contained in:
parent
7118d77bea
commit
8233a910b9
1 changed files with 20 additions and 4 deletions
|
@ -124,7 +124,14 @@ ObjectList::ObjectList(wxWindow* parent) :
|
|||
// On Windows and Linux, forces a kill focus emulation on the object manipulator fields because this event handler is called
|
||||
// before the kill focus event handler on the object manipulator when changing selection in the list, invalidating the object
|
||||
// manipulator cache with the following call to selection_changed()
|
||||
wxGetApp().obj_manipul()->emulate_kill_focus();
|
||||
// wxGetApp().obj_manipul()->emulate_kill_focus(); // It's not necessury anymore #ys_FIXME delete after testing
|
||||
|
||||
// On Windows and Linux:
|
||||
// It's not invoked KillFocus event for "temporary" panels (like "Manipulation panel", "Settings", "Layer ranges"),
|
||||
// if we change selection in object list.
|
||||
// see https://github.com/prusa3d/PrusaSlicer/issues/3303
|
||||
// But, if we call SetFocus() for ObjectList it will cause an invoking of a KillFocus event for "temporary" panels
|
||||
this->SetFocus();
|
||||
#else
|
||||
// To avoid selection update from SetSelection() and UnselectAll() under osx
|
||||
if (m_prevent_list_events)
|
||||
|
@ -3041,7 +3048,10 @@ void ObjectList::add_layer_item(const t_layer_height_range& range,
|
|||
|
||||
bool ObjectList::edit_layer_range(const t_layer_height_range& range, coordf_t layer_height)
|
||||
{
|
||||
const int obj_idx = get_selected_obj_idx();
|
||||
// Use m_selected_object_id instead of get_selected_obj_idx()
|
||||
// because of get_selected_obj_idx() return obj_idx for currently selected item.
|
||||
// But edit_layer_range(...) function can be called, when Selection in ObjectList could be changed
|
||||
const int obj_idx = m_selected_object_id ;
|
||||
if (obj_idx < 0)
|
||||
return false;
|
||||
|
||||
|
@ -3064,7 +3074,10 @@ bool ObjectList::edit_layer_range(const t_layer_height_range& range, coordf_t la
|
|||
|
||||
bool ObjectList::edit_layer_range(const t_layer_height_range& range, const t_layer_height_range& new_range, bool dont_update_ui)
|
||||
{
|
||||
const int obj_idx = get_selected_obj_idx();
|
||||
// Use m_selected_object_id instead of get_selected_obj_idx()
|
||||
// because of get_selected_obj_idx() return obj_idx for currently selected item.
|
||||
// But edit_layer_range(...) function can be called, when Selection in ObjectList could be changed
|
||||
const int obj_idx = m_selected_object_id;
|
||||
if (obj_idx < 0) return false;
|
||||
|
||||
take_snapshot(_(L("Edit Height Range")));
|
||||
|
@ -3091,10 +3104,13 @@ bool ObjectList::edit_layer_range(const t_layer_height_range& range, const t_lay
|
|||
add_layer_item(r.first, root_item);
|
||||
}
|
||||
|
||||
if (!dont_update_ui)
|
||||
// if this function was invoked from wxEVT_CHANGE_SELECTION selected item could be other than itLayer or itLayerRoot
|
||||
if (!dont_update_ui && (sel_type & (itLayer | itLayerRoot)))
|
||||
select_item(sel_type&itLayer ? m_objects_model->GetItemByLayerRange(obj_idx, new_range) : root_item);
|
||||
|
||||
Expand(root_item);
|
||||
|
||||
m_prevent_list_events = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue