mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	Fixed updating of an option list for additional settings
This commit is contained in:
		
							parent
							
								
									6ea692ff34
								
							
						
					
					
						commit
						99bd054e99
					
				
					 4 changed files with 13 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -1566,9 +1566,9 @@ void ObjectList::create_freq_settings_popupmenu(wxMenu *menu)
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ObjectList::update_opt_keys(t_config_option_keys& opt_keys)
 | 
			
		||||
void ObjectList::update_opt_keys(t_config_option_keys& opt_keys, const bool is_object)
 | 
			
		||||
{
 | 
			
		||||
    auto full_current_opts = get_options(false);
 | 
			
		||||
    auto full_current_opts = get_options(!is_object);
 | 
			
		||||
    for (int i = opt_keys.size()-1; i >= 0; --i)
 | 
			
		||||
        if (find(full_current_opts.begin(), full_current_opts.end(), opt_keys[i]) == full_current_opts.end())
 | 
			
		||||
            opt_keys.erase(opt_keys.begin() + i);
 | 
			
		||||
| 
						 | 
				
			
			@ -2161,16 +2161,15 @@ void ObjectList::part_selection_changed()
 | 
			
		|||
    panel.Thaw();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SettingsBundle ObjectList::get_item_settings_bundle(const DynamicPrintConfig* config, const bool is_layers_range_settings)
 | 
			
		||||
SettingsBundle ObjectList::get_item_settings_bundle(const DynamicPrintConfig* config, const bool is_object_settings)
 | 
			
		||||
{
 | 
			
		||||
    auto opt_keys = config->keys();
 | 
			
		||||
    if (opt_keys.empty())
 | 
			
		||||
        return SettingsBundle();
 | 
			
		||||
 | 
			
		||||
    update_opt_keys(opt_keys); // update options list according to print technology
 | 
			
		||||
    update_opt_keys(opt_keys, is_object_settings); // update options list according to print technology
 | 
			
		||||
 | 
			
		||||
    if (opt_keys.size() == 1 && opt_keys[0] == "extruder" ||
 | 
			
		||||
        is_layers_range_settings && opt_keys.size() == 2)
 | 
			
		||||
    if (opt_keys.empty())
 | 
			
		||||
        return SettingsBundle();
 | 
			
		||||
 | 
			
		||||
    const int extruders_cnt = wxGetApp().extruders_edited_cnt();
 | 
			
		||||
| 
						 | 
				
			
			@ -2201,24 +2200,15 @@ wxDataViewItem ObjectList::add_settings_item(wxDataViewItem parent_item, const D
 | 
			
		|||
    if (!parent_item)
 | 
			
		||||
        return ret;
 | 
			
		||||
 | 
			
		||||
    const bool is_layers_range_settings = m_objects_model->GetItemType(parent_item) == itLayer;
 | 
			
		||||
    SettingsBundle cat_options = get_item_settings_bundle(config, is_layers_range_settings);
 | 
			
		||||
    const bool is_object_settings = m_objects_model->GetItemType(parent_item) == itObject;
 | 
			
		||||
    SettingsBundle cat_options = get_item_settings_bundle(config, is_object_settings);
 | 
			
		||||
    if (cat_options.empty())
 | 
			
		||||
        return ret;
 | 
			
		||||
 | 
			
		||||
    std::vector<std::string> categories;
 | 
			
		||||
    categories.reserve(cat_options.size());
 | 
			
		||||
    for (auto& cat : cat_options)
 | 
			
		||||
    {
 | 
			
		||||
        if (cat.second.size() == 1 &&
 | 
			
		||||
            (cat.second[0] == "extruder" || is_layers_range_settings && cat.second[0] == "layer_height"))
 | 
			
		||||
            continue;
 | 
			
		||||
 | 
			
		||||
        categories.push_back(cat.first);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (categories.empty())
 | 
			
		||||
        return ret;
 | 
			
		||||
 | 
			
		||||
    if (m_objects_model->GetItemType(parent_item) & itInstance)
 | 
			
		||||
        parent_item = m_objects_model->GetTopParent(parent_item);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -238,7 +238,7 @@ public:
 | 
			
		|||
    wxMenu*             create_settings_popupmenu(wxMenu *parent_menu);
 | 
			
		||||
    void                create_freq_settings_popupmenu(wxMenu *parent_menu);
 | 
			
		||||
 | 
			
		||||
    void                update_opt_keys(t_config_option_keys& t_optopt_keys);
 | 
			
		||||
    void                update_opt_keys(t_config_option_keys& t_optopt_keys, const bool is_object);
 | 
			
		||||
 | 
			
		||||
    void                load_subobject(ModelVolumeType type);
 | 
			
		||||
    void                load_part(ModelObject* model_object, std::vector<std::pair<wxString, bool>> &volumes_info, ModelVolumeType type);
 | 
			
		||||
| 
						 | 
				
			
			@ -266,7 +266,7 @@ public:
 | 
			
		|||
    wxBoxSizer*         get_sizer() {return  m_sizer;}
 | 
			
		||||
    int                 get_selected_obj_idx() const;
 | 
			
		||||
    DynamicPrintConfig& get_item_config(const wxDataViewItem& item) const;
 | 
			
		||||
    SettingsBundle      get_item_settings_bundle(const DynamicPrintConfig* config, const bool is_layers_range_settings);
 | 
			
		||||
    SettingsBundle      get_item_settings_bundle(const DynamicPrintConfig* config, const bool is_object_settings);
 | 
			
		||||
 | 
			
		||||
    void                changed_object(const int obj_idx = -1) const;
 | 
			
		||||
    void                part_selection_changed();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -77,8 +77,8 @@ bool ObjectSettings::update_settings_list()
 | 
			
		|||
    if (!item || !objects_model->IsSettingsItem(item) || !config || objects_ctrl->multiple_selection())
 | 
			
		||||
        return false;
 | 
			
		||||
 | 
			
		||||
    const bool is_layers_range_settings = objects_model->GetItemType(objects_model->GetParent(item)) == itLayer;
 | 
			
		||||
	SettingsBundle cat_options = objects_ctrl->get_item_settings_bundle(config, is_layers_range_settings);
 | 
			
		||||
    const bool is_object_settings = objects_model->GetItemType(objects_model->GetParent(item)) == itObject;
 | 
			
		||||
	SettingsBundle cat_options = objects_ctrl->get_item_settings_bundle(config, is_object_settings);
 | 
			
		||||
 | 
			
		||||
    if (!cat_options.empty())
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -107,10 +107,6 @@ bool ObjectSettings::update_settings_list()
 | 
			
		|||
 | 
			
		||||
        for (auto& cat : cat_options)
 | 
			
		||||
        {
 | 
			
		||||
            if (cat.second.size() == 1 &&
 | 
			
		||||
                (cat.second[0] == "extruder" || is_layers_range_settings && cat.second[0] == "layer_height"))
 | 
			
		||||
                continue;
 | 
			
		||||
 | 
			
		||||
            categories.push_back(cat.first);
 | 
			
		||||
 | 
			
		||||
            auto optgroup = std::make_shared<ConfigOptionsGroup>(m_og->ctrl_parent(), _(cat.first), config, false, extra_column);
 | 
			
		||||
| 
						 | 
				
			
			@ -131,8 +127,6 @@ bool ObjectSettings::update_settings_list()
 | 
			
		|||
            const bool is_extruders_cat = cat.first == "Extruders";
 | 
			
		||||
            for (auto& opt : cat.second)
 | 
			
		||||
            {
 | 
			
		||||
                if (opt == "extruder" || is_layers_range_settings && opt == "layer_height")
 | 
			
		||||
                    continue;
 | 
			
		||||
                Option option = optgroup->get_option(opt);
 | 
			
		||||
                option.opt.width = 12;
 | 
			
		||||
                if (is_extruders_cat)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3799,6 +3799,7 @@ void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator
 | 
			
		|||
                model.wipe_tower.position = Vec2d(config.opt_float("wipe_tower_x"), config.opt_float("wipe_tower_y"));
 | 
			
		||||
                model.wipe_tower.rotation = config.opt_float("wipe_tower_rotation_angle");
 | 
			
		||||
    }
 | 
			
		||||
    const int layer_range_idx = it_snapshot->snapshot_data.layer_range_idx;
 | 
			
		||||
    // Flags made of Snapshot::Flags enum values.
 | 
			
		||||
    unsigned int new_flags = it_snapshot->snapshot_data.flags;
 | 
			
		||||
	UndoRedo::SnapshotData top_snapshot_data;
 | 
			
		||||
| 
						 | 
				
			
			@ -3858,7 +3859,7 @@ void Plater::priv::undo_redo_to(std::vector<UndoRedo::Snapshot>::const_iterator
 | 
			
		|||
                                                      new_selected_layerroot_on_sidebar ? ObjectList::SELECTION_MODE::smLayerRoot : 
 | 
			
		||||
                                                                                          ObjectList::SELECTION_MODE::smUndef);
 | 
			
		||||
        if (new_selected_settings_on_sidebar || new_selected_layer_on_sidebar)
 | 
			
		||||
            this->sidebar->obj_list()->set_selected_layers_range_idx(it_snapshot->snapshot_data.layer_range_idx);
 | 
			
		||||
            this->sidebar->obj_list()->set_selected_layers_range_idx(layer_range_idx);
 | 
			
		||||
 | 
			
		||||
        this->update_after_undo_redo(temp_snapshot_was_taken);
 | 
			
		||||
		// Enable layer editing after the Undo / Redo jump.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue