Visual hints for layers editing enabled whenever a layer is selected into the objects list

This commit is contained in:
Enrico Turri 2019-07-02 10:34:30 +02:00
parent 125f474f02
commit b835075fd6
3 changed files with 18 additions and 8 deletions

View File

@ -197,17 +197,25 @@ void ObjectLayers::update_layers_list()
// Add new control according to the selected item // Add new control according to the selected item
if (type & itLayerRoot) if (type & itLayerRoot)
{
wxGetApp().plater()->canvas3D()->handle_sidebar_focus_event("", false);
m_selectable_range = { 0.0, 0.0 };
create_layers_list(); create_layers_list();
}
else else
create_layer(objects_ctrl->GetModel()->GetLayerRangeByItem(item)); {
t_layer_height_range range = objects_ctrl->GetModel()->GetLayerRangeByItem(item);
create_layer(range);
update_scene_from_editor_selection(range, etLayerHeight);
}
m_parent->Layout(); m_parent->Layout();
} }
void ObjectLayers::update_scene_from_editor_selection() const void ObjectLayers::update_scene_from_editor_selection(const t_layer_height_range& range, EditorType type) const
{ {
// needed to show the visual hints in 3D scene // needed to show the visual hints in 3D scene
wxGetApp().plater()->canvas3D()->handle_layers_data_focus_event(m_selectable_range, m_selection_type); wxGetApp().plater()->canvas3D()->handle_layers_data_focus_event(range, type);
} }
void ObjectLayers::UpdateAndShow(const bool show) void ObjectLayers::UpdateAndShow(const bool show)
@ -257,8 +265,6 @@ LayerRangeEditor::LayerRangeEditor( ObjectLayers* parent,
this->Bind(wxEVT_KILL_FOCUS, [this, edit_fn](wxFocusEvent& e) this->Bind(wxEVT_KILL_FOCUS, [this, edit_fn](wxFocusEvent& e)
{ {
wxGetApp().plater()->canvas3D()->handle_sidebar_focus_event("", false);
if (!m_enter_pressed) { if (!m_enter_pressed) {
#ifndef __WXGTK__ #ifndef __WXGTK__
/* Update data for next editor selection. /* Update data for next editor selection.
@ -291,7 +297,7 @@ LayerRangeEditor::LayerRangeEditor( ObjectLayers* parent,
this->Bind(wxEVT_SET_FOCUS, [this, parent](wxFocusEvent& e) this->Bind(wxEVT_SET_FOCUS, [this, parent](wxFocusEvent& e)
{ {
set_focus_data(); set_focus_data();
parent->update_scene_from_editor_selection(); parent->update_scene_from_editor_selection(parent->get_selectable_range(), parent->get_selection_type());
e.Skip(); e.Skip();
}, this->GetId()); }, this->GetId());

View File

@ -73,11 +73,14 @@ public:
void create_layers_list(); void create_layers_list();
void update_layers_list(); void update_layers_list();
void update_scene_from_editor_selection() const; void update_scene_from_editor_selection(const t_layer_height_range& range, EditorType type) const;
void UpdateAndShow(const bool show) override; void UpdateAndShow(const bool show) override;
void msw_rescale(); 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; }
friend class LayerRangeEditor; friend class LayerRangeEditor;
}; };

View File

@ -2067,6 +2067,7 @@ void ObjectList::part_selection_changed()
Sidebar& panel = wxGetApp().sidebar(); Sidebar& panel = wxGetApp().sidebar();
panel.Freeze(); panel.Freeze();
wxGetApp().plater()->canvas3D()->handle_sidebar_focus_event("", false);
wxGetApp().obj_manipul() ->UpdateAndShow(update_and_show_manipulations); wxGetApp().obj_manipul() ->UpdateAndShow(update_and_show_manipulations);
wxGetApp().obj_settings()->UpdateAndShow(update_and_show_settings); wxGetApp().obj_settings()->UpdateAndShow(update_and_show_settings);
wxGetApp().obj_layers() ->UpdateAndShow(update_and_show_layers); wxGetApp().obj_layers() ->UpdateAndShow(update_and_show_layers);