diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index fdf9179..69715a8 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -87,6 +87,9 @@ static const Slic3r::ColorRGBA DARKMODE_BG_LIGHT_COLOR = {0.145f, 0.149f, 0.165f static const Slic3r::ColorRGBA ERROR_BG_DARK_COLOR = {0.478f, 0.192f, 0.039f, 1.0f}; static const Slic3r::ColorRGBA ERROR_BG_LIGHT_COLOR = {0.753f, 0.192f, 0.039f, 1.0f}; +//Y5 +bool isToolpathOutside = false; + // Number of floats static constexpr const size_t MAX_VERTEX_BUFFER_SIZE = 131072 * 6; // 3.15MB @@ -1032,6 +1035,8 @@ wxDEFINE_EVENT(EVT_GLCANVAS_FORCE_UPDATE, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_WIPETOWER_MOVED, Vec3dEvent); wxDEFINE_EVENT(EVT_GLCANVAS_WIPETOWER_ROTATED, Vec3dEvent); wxDEFINE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event); +//Y5 +wxDEFINE_EVENT(EVT_GLCANVAS_ENABLE_EXPORT_BUTTONS, Event); wxDEFINE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>); wxDEFINE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_STARTED, SimpleEvent); wxDEFINE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent); @@ -2642,8 +2647,17 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re } } - post_event(Event(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, + //Y5 if ToolpathOutside, unable export button + //post_event(Event(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, + // contained_min_one && !m_model->objects.empty() && !partlyOut)); + if (isToolpathOutside) { + post_event(Event(EVT_GLCANVAS_ENABLE_EXPORT_BUTTONS, false)); + isToolpathOutside = false; + } + else { + post_event(Event(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, contained_min_one && !m_model->objects.empty() && !partlyOut)); + } } else { _set_warning_notification(EWarning::ObjectOutside, false); @@ -7467,7 +7481,14 @@ void GLCanvas3D::_set_warning_notification_if_needed(EWarning warning) show = m_gcode_viewer.has_data() && !m_gcode_viewer.is_contained_in_bed(); } } - + + //Y5 + if (warning == EWarning::ToolpathOutside) { + isToolpathOutside = show; + } + else { + isToolpathOutside = false; + } _set_warning_notification(warning, show); } diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index a58decb..3f46cc1 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -161,6 +161,8 @@ wxDECLARE_EVENT(EVT_GLCANVAS_RESET_SKEW, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_INSTANCE_SCALED, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_WIPETOWER_ROTATED, Vec3dEvent); wxDECLARE_EVENT(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, Event); +//Y5 +wxDECLARE_EVENT(EVT_GLCANVAS_ENABLE_EXPORT_BUTTONS, Event); wxDECLARE_EVENT(EVT_GLCANVAS_UPDATE_GEOMETRY, Vec3dsEvent<2>); wxDECLARE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_STARTED, SimpleEvent); wxDECLARE_EVENT(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, SimpleEvent); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 9467df0..c5e7948 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1503,6 +1503,15 @@ void Sidebar::enable_buttons(bool enable) p->btn_export_gcode_removable->Enable(enable); } +//Y5 +void Sidebar::enable_export_buttons(bool enable) +{ + p->btn_export_gcode->Enable(enable); + p->btn_send_gcode->Enable(enable); +// p->btn_eject_device->Enable(enable); + p->btn_export_gcode_removable->Enable(enable); +} + bool Sidebar::show_reslice(bool show) const { return p->btn_reslice->Show(show); } bool Sidebar::show_export(bool show) const { return p->btn_export_gcode->Show(show); } bool Sidebar::show_send(bool show) const { return p->btn_send_gcode->Show(show); } @@ -2106,6 +2115,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) view3D_canvas->Bind(EVT_GLCANVAS_RESET_SKEW, [this](SimpleEvent&) { update(); }); view3D_canvas->Bind(EVT_GLCANVAS_INSTANCE_SCALED, [this](SimpleEvent&) { update(); }); view3D_canvas->Bind(EVT_GLCANVAS_ENABLE_ACTION_BUTTONS, [this](Event& evt) { this->sidebar->enable_buttons(evt.data); }); + //Y5 + view3D_canvas->Bind(EVT_GLCANVAS_ENABLE_EXPORT_BUTTONS, [this](Event& evt) { this->sidebar->enable_export_buttons(evt.data); }); view3D_canvas->Bind(EVT_GLCANVAS_UPDATE_GEOMETRY, &priv::on_update_geometry, this); view3D_canvas->Bind(EVT_GLCANVAS_MOUSE_DRAGGING_STARTED, &priv::on_3dcanvas_mouse_dragging_started, this); view3D_canvas->Bind(EVT_GLCANVAS_MOUSE_DRAGGING_FINISHED, &priv::on_3dcanvas_mouse_dragging_finished, this); diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 880448c..f35a62c 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -103,6 +103,8 @@ public: void show_sliced_info_sizer(const bool show); void update_sliced_info_sizer(); void enable_buttons(bool enable); + //Y5 + void enable_export_buttons(bool enable); void set_btn_label(const ActionButtonType btn_type, const wxString& label) const; bool show_reslice(bool show) const; bool show_export(bool show) const;