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
This commit is contained in:
liz.li 2023-11-23 15:38:23 +08:00 committed by Lane.Wei
parent 0dae851dc6
commit 21647a8a97
1 changed files with 16 additions and 5 deletions

View File

@ -54,8 +54,11 @@ static PrinterTechnology printer_technology()
static const Selection& scene_selection() static const Selection& scene_selection()
{ {
//BBS return current canvas3D return wxGetApp().plater()->get_view3D_canvas3D()->get_selection(); //BBS AssembleView canvas has its own selection
return wxGetApp().plater()->get_current_canvas3D()->get_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 // 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) 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}; wxMenu* menu {nullptr};
Plater* plater = wxGetApp().plater(); Plater* plater = wxGetApp().plater();
@ -4570,12 +4577,15 @@ void ObjectList::update_selections()
void ObjectList::update_selections_on_canvas() 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(); const int sel_cnt = GetSelectedItemsCount();
if (sel_cnt == 0) { if (sel_cnt == 0) {
selection.remove_all(); 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; return;
} }
@ -4679,7 +4689,8 @@ void ObjectList::update_selections_on_canvas()
selection.add_volumes(mode, volume_idxs, single_selection); 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(); wxGetApp().plater()->canvas3D()->render();
} }