mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Fixed object adding to list with same object's name
+ Added name for main object for complex objects + Fixed incorrect Instances and Settings deleting from ObjectList
This commit is contained in:
		
							parent
							
								
									d7f013ba19
								
							
						
					
					
						commit
						5557ee3cd2
					
				
					 4 changed files with 8 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -415,6 +415,7 @@ void Model::convert_multipart_object(unsigned int max_extruders)
 | 
			
		|||
    
 | 
			
		||||
    ModelObject* object = new ModelObject(this);
 | 
			
		||||
    object->input_file = this->objects.front()->input_file;
 | 
			
		||||
    object->name = this->objects.front()->name;
 | 
			
		||||
 | 
			
		||||
    reset_auto_extruder_id();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -868,7 +868,7 @@ void ObjectList::del_settings_from_config()
 | 
			
		|||
 | 
			
		||||
void ObjectList::del_instances_from_object(const int obj_idx)
 | 
			
		||||
{
 | 
			
		||||
    auto instances = (*m_objects)[obj_idx]->instances;
 | 
			
		||||
    auto& instances = (*m_objects)[obj_idx]->instances;
 | 
			
		||||
    if (instances.size() <= 1)
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1109,6 +1109,9 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path> &input_
 | 
			
		|||
                // $self->async_apply_config;
 | 
			
		||||
            } else {
 | 
			
		||||
                model = Slic3r::Model::read_from_file(path.string(), nullptr, false);
 | 
			
		||||
                for (auto obj : model.objects)
 | 
			
		||||
                    if (obj->name.empty())
 | 
			
		||||
                        obj->name = fs::path(obj->input_file).filename().string();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        catch (const std::runtime_error &e) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1156,7 +1159,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path> &input_
 | 
			
		|||
            new_model->convert_multipart_object(nozzle_dmrs->values.size());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        auto loaded_idxs = load_model_objects(model.objects);
 | 
			
		||||
        auto loaded_idxs = load_model_objects(new_model->objects);
 | 
			
		||||
        obj_idxs.insert(obj_idxs.end(), loaded_idxs.begin(), loaded_idxs.end());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1176,7 +1179,7 @@ std::vector<size_t> Plater::priv::load_model_objects(const ModelObjectPtrs &mode
 | 
			
		|||
    bool scaled_down = false;
 | 
			
		||||
    std::vector<size_t> obj_idxs;
 | 
			
		||||
#if ENABLE_EXTENDED_SELECTION
 | 
			
		||||
    unsigned int obj_count = 0;
 | 
			
		||||
    unsigned int obj_count = model.objects.size();
 | 
			
		||||
#endif // ENABLE_EXTENDED_SELECTION
 | 
			
		||||
 | 
			
		||||
    for (ModelObject *model_object : model_objects) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -789,7 +789,7 @@ void PrusaObjectDataViewModel::GetItemInfo(const wxDataViewItem& item, ItemType&
 | 
			
		|||
    type = itUndef;
 | 
			
		||||
 | 
			
		||||
    PrusaObjectDataViewModelNode *node = (PrusaObjectDataViewModelNode*)item.GetID();
 | 
			
		||||
    if (!node || node->GetIdx() < 0 && node->GetType() != itObject) 
 | 
			
		||||
    if (!node || node->GetIdx() < 0 && !(node->GetType() & (itObject|itSettings|itInstanceRoot))) 
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
    idx = node->GetIdx();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue