Fix for the last commit
This commit is contained in:
parent
b835075fd6
commit
0bcad2a5c5
3 changed files with 31 additions and 18 deletions
|
@ -197,25 +197,17 @@ void ObjectLayers::update_layers_list()
|
|||
// Add new control according to the selected item
|
||||
|
||||
if (type & itLayerRoot)
|
||||
{
|
||||
wxGetApp().plater()->canvas3D()->handle_sidebar_focus_event("", false);
|
||||
m_selectable_range = { 0.0, 0.0 };
|
||||
create_layers_list();
|
||||
}
|
||||
else
|
||||
{
|
||||
t_layer_height_range range = objects_ctrl->GetModel()->GetLayerRangeByItem(item);
|
||||
create_layer(range);
|
||||
update_scene_from_editor_selection(range, etLayerHeight);
|
||||
}
|
||||
create_layer(objects_ctrl->GetModel()->GetLayerRangeByItem(item));
|
||||
|
||||
m_parent->Layout();
|
||||
}
|
||||
|
||||
void ObjectLayers::update_scene_from_editor_selection(const t_layer_height_range& range, EditorType type) const
|
||||
void ObjectLayers::update_scene_from_editor_selection() const
|
||||
{
|
||||
// needed to show the visual hints in 3D scene
|
||||
wxGetApp().plater()->canvas3D()->handle_layers_data_focus_event(range, type);
|
||||
wxGetApp().plater()->canvas3D()->handle_layers_data_focus_event(m_selectable_range, m_selection_type);
|
||||
}
|
||||
|
||||
void ObjectLayers::UpdateAndShow(const bool show)
|
||||
|
@ -232,6 +224,12 @@ void ObjectLayers::msw_rescale()
|
|||
m_bmp_add.msw_rescale();
|
||||
}
|
||||
|
||||
void ObjectLayers::reset_selection()
|
||||
{
|
||||
m_selectable_range = { 0.0, 0.0 };
|
||||
m_selection_type = etLayerHeight;
|
||||
}
|
||||
|
||||
LayerRangeEditor::LayerRangeEditor( ObjectLayers* parent,
|
||||
const wxString& value,
|
||||
EditorType type,
|
||||
|
@ -297,7 +295,7 @@ LayerRangeEditor::LayerRangeEditor( ObjectLayers* parent,
|
|||
this->Bind(wxEVT_SET_FOCUS, [this, parent](wxFocusEvent& e)
|
||||
{
|
||||
set_focus_data();
|
||||
parent->update_scene_from_editor_selection(parent->get_selectable_range(), parent->get_selection_type());
|
||||
parent->update_scene_from_editor_selection();
|
||||
e.Skip();
|
||||
}, this->GetId());
|
||||
|
||||
|
|
|
@ -73,13 +73,12 @@ public:
|
|||
void create_layers_list();
|
||||
void update_layers_list();
|
||||
|
||||
void update_scene_from_editor_selection(const t_layer_height_range& range, EditorType type) const;
|
||||
void update_scene_from_editor_selection() const;
|
||||
|
||||
void UpdateAndShow(const bool show) override;
|
||||
void msw_rescale();
|
||||
|
||||
const t_layer_height_range& get_selectable_range() const { return m_selectable_range; }
|
||||
EditorType get_selection_type() const { return m_selection_type; }
|
||||
void reset_selection();
|
||||
void set_selectable_range(const t_layer_height_range& range) { m_selectable_range = range; }
|
||||
|
||||
friend class LayerRangeEditor;
|
||||
};
|
||||
|
|
|
@ -578,6 +578,22 @@ void ObjectList::selection_changed()
|
|||
wxPostEvent(this, event);
|
||||
}
|
||||
|
||||
if (const wxDataViewItem item = GetSelection())
|
||||
{
|
||||
const ItemType type = m_objects_model->GetItemType(item);
|
||||
// to correct visual hints for layers editing on the Scene
|
||||
if (type & (itLayer|itLayerRoot)) {
|
||||
wxGetApp().obj_layers()->reset_selection();
|
||||
|
||||
if (type & itLayerRoot)
|
||||
wxGetApp().plater()->canvas3D()->handle_sidebar_focus_event("", false);
|
||||
else {
|
||||
wxGetApp().obj_layers()->set_selectable_range(m_objects_model->GetLayerRangeByItem(item));
|
||||
wxGetApp().obj_layers()->update_scene_from_editor_selection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part_selection_changed();
|
||||
}
|
||||
|
||||
|
@ -1864,7 +1880,7 @@ void ObjectList::layers_editing()
|
|||
|
||||
// set some default value
|
||||
if (ranges.empty())
|
||||
ranges[{ 0.0f, 0.6f }] = get_default_layer_config(obj_idx);
|
||||
ranges[{ 0.0f, 2.0f }] = get_default_layer_config(obj_idx);
|
||||
|
||||
// create layer root item
|
||||
layers_item = add_layer_root_item(obj_item);
|
||||
|
@ -2330,7 +2346,7 @@ void ObjectList::add_layer_range_after_current(const t_layer_height_range& curre
|
|||
|
||||
if (current_range == last_range)
|
||||
{
|
||||
const t_layer_height_range& new_range = { last_range.second, last_range.second + 0.5f };
|
||||
const t_layer_height_range& new_range = { last_range.second, last_range.second + 2.0f };
|
||||
ranges[new_range] = get_default_layer_config(obj_idx);
|
||||
add_layer_item(new_range, layers_item);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue