Selection enabled only for 3D view and not for g-code preview

This commit is contained in:
Enrico Turri 2019-03-28 08:44:46 +01:00
parent 3c163285e5
commit a4f404a6a4
6 changed files with 13 additions and 3 deletions

View File

@ -2249,7 +2249,7 @@ bool GLCanvas3D::init(bool useVBOs, bool use_legacy_opengl)
if (!_init_toolbar())
return false;
if (!m_selection.init(m_use_VBOs))
if (m_selection.is_enabled() && !m_selection.init(m_use_VBOs))
return false;
post_event(SimpleEvent(EVT_GLCANVAS_INIT));
@ -2433,6 +2433,11 @@ void GLCanvas3D::enable_gizmos(bool enable)
m_gizmos.set_enabled(enable);
}
void GLCanvas3D::enable_selection(bool enable)
{
m_selection.set_enabled(enable);
}
void GLCanvas3D::enable_toolbar(bool enable)
{
m_toolbar.set_enabled(enable);

View File

@ -653,6 +653,7 @@ public:
void enable_picking(bool enable);
void enable_moving(bool enable);
void enable_gizmos(bool enable);
void enable_selection(bool enable);
void enable_toolbar(bool enable);
void enable_dynamic_background(bool enable);
void allow_multisample(bool allow);

View File

@ -62,6 +62,7 @@ bool View3D::init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_
m_canvas->set_process(process);
m_canvas->set_config(config);
m_canvas->enable_gizmos(true);
m_canvas->enable_selection(true);
m_canvas->enable_toolbar(true);
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);

View File

@ -1416,8 +1416,6 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_UPDATE_BED_SHAPE, [this](SimpleEvent&) { set_bed_shape(config->option<ConfigOptionPoints>("bed_shape")->values); });
preview->get_wxglcanvas()->Bind(EVT_GLCANVAS_TAB, [this](SimpleEvent&) { select_next_view_3D(); });
view3D_canvas->Bind(EVT_GLCANVAS_INIT, [this](SimpleEvent&) { init_view_toolbar(); });
q->Bind(EVT_SLICING_COMPLETED, &priv::on_slicing_completed, this);
q->Bind(EVT_PROCESS_COMPLETED, &priv::on_process_completed, this);
q->Bind(EVT_GLVIEWTOOLBAR_3D, [q](SimpleEvent&) { q->select_view_3D("3D"); });

View File

@ -49,6 +49,7 @@ Selection::VolumeCache::VolumeCache(const Geometry::Transformation& volume_trans
Selection::Selection()
: m_volumes(nullptr)
, m_model(nullptr)
, m_enabled(false)
, m_mode(Instance)
, m_type(Empty)
, m_valid(false)

View File

@ -154,6 +154,7 @@ private:
// Model, not owned.
Model* m_model;
bool m_enabled;
bool m_valid;
EMode m_mode;
EType m_type;
@ -180,6 +181,9 @@ public:
void set_volumes(GLVolumePtrs* volumes);
bool init(bool useVBOs);
bool is_enabled() const { return m_enabled; }
void set_enabled(bool enable) { m_enabled = enable; }
Model* get_model() const { return m_model; }
void set_model(Model* model);