mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	ObjectList: Fixed a crash during a print technology change when InfoItem is selected
+ Add "Gallery" menu Item for Advanced mode too
This commit is contained in:
		
							parent
							
								
									bc81c22ea9
								
							
						
					
					
						commit
						7fd9a9cf6e
					
				
					 3 changed files with 18 additions and 6 deletions
				
			
		| 
						 | 
				
			
			@ -433,7 +433,7 @@ wxMenu* MenuFactory::append_submenu_add_generic(wxMenu* menu, ModelVolumeType ty
 | 
			
		|||
            [type, item](wxCommandEvent&) { obj_list()->load_generic_subobject(item, type); }, "", menu);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (wxGetApp().get_mode() == comExpert) {
 | 
			
		||||
    if (wxGetApp().get_mode() >= comAdvanced) {
 | 
			
		||||
        sub_menu->AppendSeparator();
 | 
			
		||||
        append_menu_item(sub_menu, wxID_ANY, _L("Gallery"), "",
 | 
			
		||||
            [type](wxCommandEvent&) { obj_list()->load_subobject(type, true); }, "", menu);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2517,7 +2517,7 @@ wxDataViewItem ObjectList::add_settings_item(wxDataViewItem parent_item, const D
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ObjectList::update_info_items(size_t obj_idx)
 | 
			
		||||
void ObjectList::update_info_items(size_t obj_idx, wxDataViewItemArray* selections/* = nullptr*/)
 | 
			
		||||
{
 | 
			
		||||
    const ModelObject* model_object = (*m_objects)[obj_idx];
 | 
			
		||||
    wxDataViewItem item_obj = m_objects_model->GetItemById(obj_idx);
 | 
			
		||||
| 
						 | 
				
			
			@ -2565,9 +2565,21 @@ void ObjectList::update_info_items(size_t obj_idx)
 | 
			
		|||
            
 | 
			
		||||
        }
 | 
			
		||||
        else if (shows && ! should_show) {
 | 
			
		||||
            Unselect(item);
 | 
			
		||||
            if (!selections)
 | 
			
		||||
                Unselect(item);
 | 
			
		||||
            m_objects_model->Delete(item);
 | 
			
		||||
            Select(item_obj);
 | 
			
		||||
            if (selections) {
 | 
			
		||||
                if (selections->Index(item) != wxNOT_FOUND) {
 | 
			
		||||
                    // If info item was deleted from the list, 
 | 
			
		||||
                    // it's need to be deleted from selection array, if it was there
 | 
			
		||||
                    selections->Remove(item);
 | 
			
		||||
                    // Select item_obj, if info_item doesn't exist for item anymore, but was selected
 | 
			
		||||
                    if (selections->Index(item_obj) == wxNOT_FOUND)
 | 
			
		||||
                        selections->Add(item_obj);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
                Select(item_obj);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3760,7 +3772,7 @@ void ObjectList::update_object_list_by_printer_technology()
 | 
			
		|||
 | 
			
		||||
    for (auto& object_item : object_items) {
 | 
			
		||||
        // update custom supports info
 | 
			
		||||
        update_info_items(m_objects_model->GetObjectIdByItem(object_item));
 | 
			
		||||
        update_info_items(m_objects_model->GetObjectIdByItem(object_item), &sel);
 | 
			
		||||
 | 
			
		||||
        // Update Settings Item for object
 | 
			
		||||
        update_settings_item_and_selection(object_item, sel);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -350,7 +350,7 @@ public:
 | 
			
		|||
    void update_and_show_object_settings_item();
 | 
			
		||||
    void update_settings_item_and_selection(wxDataViewItem item, wxDataViewItemArray& selections);
 | 
			
		||||
    void update_object_list_by_printer_technology();
 | 
			
		||||
    void update_info_items(size_t obj_idx);
 | 
			
		||||
    void update_info_items(size_t obj_idx, wxDataViewItemArray* selections = nullptr);
 | 
			
		||||
 | 
			
		||||
    void instances_to_separated_object(const int obj_idx, const std::set<int>& inst_idx);
 | 
			
		||||
    void instances_to_separated_objects(const int obj_idx);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue