FIX:Right click is invalid on blank space in the assembly view

Jira:STUDIO-5950
modify the menu content of the left UI list

Change-Id: I9784386d8d221a88bf165953b2fc593dc21e3cf4
This commit is contained in:
zhou.xu 2024-01-15 11:12:09 +08:00 committed by Lane.Wei
parent e48abc7f30
commit 91f5bc4b52
4 changed files with 28 additions and 12 deletions

View File

@ -2113,6 +2113,7 @@ void GLCanvas3D::set_selected_visible(bool visible)
volume->render_color[3] = volume->color[3];
volume->force_native_color = !visible;
}
m_dirty = true;
}
void GLCanvas3D::delete_selected()

View File

@ -1322,17 +1322,28 @@ void ObjectList::show_context_menu(const bool evt_context_menu)
const ItemType type = m_objects_model->GetItemType(item);
if (!(type & (itPlate | itObject | itVolume | itInstance)))
return;
menu = type & itPlate ? plater->plate_menu() :
type & itInstance ? plater->instance_menu() :
type & itVolume ? plater->part_menu() :
printer_technology() == ptFFF ? plater->object_menu() : plater->sla_object_menu();
plater->SetPlateIndexByRightMenuInLeftUI(-1);
if (type & itPlate) {
int plate_idx = -1;
const ItemType type0 = m_objects_model->GetItemType(item, plate_idx);
if (plate_idx >= 0) {
plater->SetPlateIndexByRightMenuInLeftUI(plate_idx);
if (wxGetApp().plater()->get_current_canvas3D()->get_canvas_type() == GLCanvas3D::ECanvasType::CanvasAssembleView) {
if (type & itPlate) { return; }
if (type & itVolume){
ModelVolumeType volume_type = m_objects_model->GetVolumeType(item);
if (volume_type != ModelVolumeType::MODEL_PART)
return;
}
menu = plater->assemble_multi_selection_menu();
}
else {
menu = type & itPlate ? plater->plate_menu() :
type & itInstance ? plater->instance_menu() :
type & itVolume ? plater->part_menu() :
printer_technology() == ptFFF ? plater->object_menu() :
plater->sla_object_menu();
plater->SetPlateIndexByRightMenuInLeftUI(-1);
if (type & itPlate) {
int plate_idx = -1;
const ItemType type0 = m_objects_model->GetItemType(item, plate_idx);
if (plate_idx >= 0) {
plater->SetPlateIndexByRightMenuInLeftUI(plate_idx);
}
}
}
}

View File

@ -7020,7 +7020,9 @@ void Plater::priv::on_right_click(RBtnEvent& evt)
if (evt.data.second) { // right button was clicked on empty space
if (!get_selection().is_empty()) // several objects are selected in 3DScene
return;
menu = menus.default_menu();
if (current_panel != assemble_view) {
menu = menus.default_menu();
}
}
else {
if (current_panel == assemble_view) {
@ -13511,6 +13513,7 @@ wxMenu* Plater::default_menu() { return p->menus.default_menu();
wxMenu* Plater::instance_menu() { return p->menus.instance_menu(); }
wxMenu* Plater::layer_menu() { return p->menus.layer_menu(); }
wxMenu* Plater::multi_selection_menu() { return p->menus.multi_selection_menu(); }
wxMenu *Plater::assemble_multi_selection_menu() { return p->menus.assemble_multi_selection_menu(); }
int Plater::GetPlateIndexByRightMenuInLeftUI() { return p->m_is_RightClickInLeftUI; }
void Plater::SetPlateIndexByRightMenuInLeftUI(int index) { p->m_is_RightClickInLeftUI = index; }
SuppressBackgroundProcessingUpdate::SuppressBackgroundProcessingUpdate() :

View File

@ -711,6 +711,7 @@ public:
wxMenu* instance_menu();
wxMenu* layer_menu();
wxMenu* multi_selection_menu();
wxMenu* assemble_multi_selection_menu();
int GetPlateIndexByRightMenuInLeftUI();
void SetPlateIndexByRightMenuInLeftUI(int);
static bool has_illegal_filename_characters(const wxString& name);