From 21647a8a979b1d5151b28f2c871c5e8dbdfc1c77 Mon Sep 17 00:00:00 2001 From: "liz.li" Date: Thu, 23 Nov 2023 15:38:23 +0800 Subject: [PATCH] FIX: add height range, modifier in Preview pane will crash jira: STUDIO-5340 1. fix crash at add height range, modifiers in Preview from objectList 2. fix an assert hit when slicing 3. fix an assert hit when enter AssembleView 4. forbidden popup menu by right-click objectList in Preview Change-Id: I444bc76b1a4307999b387e4f60386b2d272bd308 --- src/slic3r/GUI/GUI_ObjectList.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 169c442e8..2b3253ba1 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -54,8 +54,11 @@ static PrinterTechnology printer_technology() static const Selection& scene_selection() { - //BBS return current canvas3D return wxGetApp().plater()->get_view3D_canvas3D()->get_selection(); - return wxGetApp().plater()->get_current_canvas3D()->get_selection(); + //BBS AssembleView canvas has its own selection + if (wxGetApp().plater()->get_current_canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasAssembleView) + return wxGetApp().plater()->get_assmeble_canvas3D()->get_selection(); + + return wxGetApp().plater()->get_view3D_canvas3D()->get_selection(); } // Config from current edited printer preset @@ -1292,6 +1295,10 @@ void ObjectList::list_manipulation(const wxPoint& mouse_pos, bool evt_context_me void ObjectList::show_context_menu(const bool evt_context_menu) { + // BBS Disable menu popup if current canvas is Preview + if (wxGetApp().plater()->get_current_canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasPreview) + return; + wxMenu* menu {nullptr}; Plater* plater = wxGetApp().plater(); @@ -4570,12 +4577,15 @@ void ObjectList::update_selections() void ObjectList::update_selections_on_canvas() { - Selection& selection = wxGetApp().plater()->get_current_canvas3D()->get_selection(); + auto canvas_type = wxGetApp().plater()->get_current_canvas3D()->get_canvas_type(); + GLCanvas3D* canvas = canvas_type == GLCanvas3D::ECanvasType::CanvasAssembleView ? wxGetApp().plater()->get_current_canvas3D() : wxGetApp().plater()->get_view3D_canvas3D(); + Selection& selection = canvas->get_selection(); const int sel_cnt = GetSelectedItemsCount(); if (sel_cnt == 0) { selection.remove_all(); - wxGetApp().plater()->get_current_canvas3D()->update_gizmos_on_off_state(); + if (canvas_type != GLCanvas3D::ECanvasType::CanvasPreview) + wxGetApp().plater()->get_current_canvas3D()->update_gizmos_on_off_state(); return; } @@ -4679,7 +4689,8 @@ void ObjectList::update_selections_on_canvas() selection.add_volumes(mode, volume_idxs, single_selection); } - wxGetApp().plater()->get_current_canvas3D()->update_gizmos_on_off_state(); + if (canvas_type != GLCanvas3D::ECanvasType::CanvasPreview) + wxGetApp().plater()->get_current_canvas3D()->update_gizmos_on_off_state(); wxGetApp().plater()->canvas3D()->render(); }