#3580 - Added menu item 'Edit/Reload from disk' and F5 key acceleration to reload the entire plater
This commit is contained in:
parent
570f77cbdc
commit
3a99b23ec7
@ -1256,6 +1256,7 @@ wxDEFINE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
|
|||||||
wxDEFINE_EVENT(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, SimpleEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, SimpleEvent);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, Event<float>);
|
wxDEFINE_EVENT(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, Event<float>);
|
||||||
wxDEFINE_EVENT(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, HeightProfileSmoothEvent);
|
wxDEFINE_EVENT(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, HeightProfileSmoothEvent);
|
||||||
|
wxDEFINE_EVENT(EVT_GLCANVAS_RELOAD_FROM_DISK, SimpleEvent);
|
||||||
|
|
||||||
#if ENABLE_THUMBNAIL_GENERATOR
|
#if ENABLE_THUMBNAIL_GENERATOR
|
||||||
const double GLCanvas3D::DefaultCameraZoomToBoxMarginFactor = 1.25;
|
const double GLCanvas3D::DefaultCameraZoomToBoxMarginFactor = 1.25;
|
||||||
@ -2625,6 +2626,7 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||||||
post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE));
|
post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE));
|
||||||
break;
|
break;
|
||||||
case WXK_ESCAPE: { deselect_all(); break; }
|
case WXK_ESCAPE: { deselect_all(); break; }
|
||||||
|
case WXK_F5: { post_event(SimpleEvent(EVT_GLCANVAS_RELOAD_FROM_DISK)); break; }
|
||||||
case '0': { select_view("iso"); break; }
|
case '0': { select_view("iso"); break; }
|
||||||
case '1': { select_view("top"); break; }
|
case '1': { select_view("top"); break; }
|
||||||
case '2': { select_view("bottom"); break; }
|
case '2': { select_view("bottom"); break; }
|
||||||
|
@ -108,6 +108,7 @@ wxDECLARE_EVENT(EVT_GLCANVAS_REDO, SimpleEvent);
|
|||||||
wxDECLARE_EVENT(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, SimpleEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, SimpleEvent);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, Event<float>);
|
wxDECLARE_EVENT(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, Event<float>);
|
||||||
wxDECLARE_EVENT(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, HeightProfileSmoothEvent);
|
wxDECLARE_EVENT(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, HeightProfileSmoothEvent);
|
||||||
|
wxDECLARE_EVENT(EVT_GLCANVAS_RELOAD_FROM_DISK, SimpleEvent);
|
||||||
|
|
||||||
class GLCanvas3D
|
class GLCanvas3D
|
||||||
{
|
{
|
||||||
|
@ -578,6 +578,11 @@ void MainFrame::init_menubar()
|
|||||||
append_menu_item(editMenu, wxID_ANY, _(L("&Paste")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "V",
|
append_menu_item(editMenu, wxID_ANY, _(L("&Paste")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "V",
|
||||||
_(L("Paste clipboard")), [this](wxCommandEvent&) { m_plater->paste_from_clipboard(); },
|
_(L("Paste clipboard")), [this](wxCommandEvent&) { m_plater->paste_from_clipboard(); },
|
||||||
"paste_menu", nullptr, [this](){return m_plater->can_paste_from_clipboard(); }, this);
|
"paste_menu", nullptr, [this](){return m_plater->can_paste_from_clipboard(); }, this);
|
||||||
|
|
||||||
|
editMenu->AppendSeparator();
|
||||||
|
append_menu_item(editMenu, wxID_ANY, _(L("Re&load from disk")) + sep + "F5",
|
||||||
|
_(L("Reload the plater from disk")), [this](wxCommandEvent&) { m_plater->reload_all_from_disk(); },
|
||||||
|
"", nullptr, [this]() {return !m_plater->model().objects.empty(); }, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Window menu
|
// Window menu
|
||||||
|
@ -1875,6 +1875,7 @@ struct Plater::priv
|
|||||||
}
|
}
|
||||||
void export_gcode(fs::path output_path, PrintHostJob upload_job);
|
void export_gcode(fs::path output_path, PrintHostJob upload_job);
|
||||||
void reload_from_disk();
|
void reload_from_disk();
|
||||||
|
void reload_all_from_disk();
|
||||||
void fix_through_netfabb(const int obj_idx, const int vol_idx = -1);
|
void fix_through_netfabb(const int obj_idx, const int vol_idx = -1);
|
||||||
|
|
||||||
void set_current_panel(wxPanel* panel);
|
void set_current_panel(wxPanel* panel);
|
||||||
@ -2075,6 +2076,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
view3D_canvas->Bind(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, [this](SimpleEvent&) { this->view3D->get_canvas3d()->reset_layer_height_profile(); });
|
view3D_canvas->Bind(EVT_GLCANVAS_RESET_LAYER_HEIGHT_PROFILE, [this](SimpleEvent&) { this->view3D->get_canvas3d()->reset_layer_height_profile(); });
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, [this](Event<float>& evt) { this->view3D->get_canvas3d()->adaptive_layer_height_profile(evt.data); });
|
view3D_canvas->Bind(EVT_GLCANVAS_ADAPTIVE_LAYER_HEIGHT_PROFILE, [this](Event<float>& evt) { this->view3D->get_canvas3d()->adaptive_layer_height_profile(evt.data); });
|
||||||
view3D_canvas->Bind(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, [this](HeightProfileSmoothEvent& evt) { this->view3D->get_canvas3d()->smooth_layer_height_profile(evt.data); });
|
view3D_canvas->Bind(EVT_GLCANVAS_SMOOTH_LAYER_HEIGHT_PROFILE, [this](HeightProfileSmoothEvent& evt) { this->view3D->get_canvas3d()->smooth_layer_height_profile(evt.data); });
|
||||||
|
view3D_canvas->Bind(EVT_GLCANVAS_RELOAD_FROM_DISK, [this](SimpleEvent&) { if (!this->model.objects.empty()) this->reload_all_from_disk(); });
|
||||||
|
|
||||||
// 3DScene/Toolbar:
|
// 3DScene/Toolbar:
|
||||||
view3D_canvas->Bind(EVT_GLTOOLBAR_ADD, &priv::on_action_add, this);
|
view3D_canvas->Bind(EVT_GLTOOLBAR_ADD, &priv::on_action_add, this);
|
||||||
@ -3447,6 +3449,24 @@ void Plater::priv::reload_from_disk()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plater::priv::reload_all_from_disk()
|
||||||
|
{
|
||||||
|
Plater::TakeSnapshot snapshot(q, _(L("Reload all from disk")));
|
||||||
|
Plater::SuppressSnapshots suppress(q);
|
||||||
|
|
||||||
|
Selection& selection = get_selection();
|
||||||
|
Selection::IndicesList curr_idxs = selection.get_volume_idxs();
|
||||||
|
// reload from disk uses selection
|
||||||
|
select_all();
|
||||||
|
reload_from_disk();
|
||||||
|
// restore previous selection
|
||||||
|
selection.clear();
|
||||||
|
for (unsigned int idx : curr_idxs)
|
||||||
|
{
|
||||||
|
selection.add(idx, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Plater::priv::fix_through_netfabb(const int obj_idx, const int vol_idx/* = -1*/)
|
void Plater::priv::fix_through_netfabb(const int obj_idx, const int vol_idx/* = -1*/)
|
||||||
{
|
{
|
||||||
if (obj_idx < 0)
|
if (obj_idx < 0)
|
||||||
@ -5034,6 +5054,11 @@ void Plater::reload_from_disk()
|
|||||||
p->reload_from_disk();
|
p->reload_from_disk();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Plater::reload_all_from_disk()
|
||||||
|
{
|
||||||
|
p->reload_all_from_disk();
|
||||||
|
}
|
||||||
|
|
||||||
bool Plater::has_toolpaths_to_export() const
|
bool Plater::has_toolpaths_to_export() const
|
||||||
{
|
{
|
||||||
return p->preview->get_canvas3d()->has_toolpaths_to_export();
|
return p->preview->get_canvas3d()->has_toolpaths_to_export();
|
||||||
|
@ -193,6 +193,7 @@ public:
|
|||||||
void export_amf();
|
void export_amf();
|
||||||
void export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path());
|
void export_3mf(const boost::filesystem::path& output_path = boost::filesystem::path());
|
||||||
void reload_from_disk();
|
void reload_from_disk();
|
||||||
|
void reload_all_from_disk();
|
||||||
bool has_toolpaths_to_export() const;
|
bool has_toolpaths_to_export() const;
|
||||||
void export_toolpaths_to_obj() const;
|
void export_toolpaths_to_obj() const;
|
||||||
void hollow();
|
void hollow();
|
||||||
|
Loading…
Reference in New Issue
Block a user