Implemented extruder selection for Layers

This commit is contained in:
YuSanka 2019-06-07 11:32:46 +02:00
parent 71cc0fdb53
commit 446e37b151
3 changed files with 15 additions and 5 deletions

View file

@ -2346,12 +2346,18 @@ void ObjectList::add_layer_item(const t_layer_height_range& range,
const wxDataViewItem layers_item, const wxDataViewItem layers_item,
const int layer_idx /* = -1*/) const int layer_idx /* = -1*/)
{ {
const wxDataViewItem layer_item = m_objects_model->AddLayersChild(layers_item, range, layer_idx);
const int obj_idx = get_selected_obj_idx(); const int obj_idx = get_selected_obj_idx();
if (obj_idx < 0) return; if (obj_idx < 0) return;
const DynamicPrintConfig& config = object(obj_idx)->layer_config_ranges[range]; const DynamicPrintConfig& config = object(obj_idx)->layer_config_ranges[range];
if (!config.has("extruder"))
return;
const auto layer_item = m_objects_model->AddLayersChild(layers_item,
range,
config.opt_int("extruder"),
layer_idx);
if (config.keys().size() > 2) if (config.keys().size() > 2)
select_item(m_objects_model->AddSettingsChild(layer_item)); select_item(m_objects_model->AddSettingsChild(layer_item));
} }

View file

@ -753,11 +753,14 @@ wxDataViewItem ObjectDataViewModel::AddLayersRoot(const wxDataViewItem &parent_i
wxDataViewItem ObjectDataViewModel::AddLayersChild(const wxDataViewItem &parent_item, wxDataViewItem ObjectDataViewModel::AddLayersChild(const wxDataViewItem &parent_item,
const t_layer_height_range& layer_range, const t_layer_height_range& layer_range,
const int extruder/* = 0*/,
const int index /* = -1*/) const int index /* = -1*/)
{ {
ObjectDataViewModelNode *parent_node = (ObjectDataViewModelNode*)parent_item.GetID(); ObjectDataViewModelNode *parent_node = (ObjectDataViewModelNode*)parent_item.GetID();
if (!parent_node) return wxDataViewItem(0); if (!parent_node) return wxDataViewItem(0);
wxString extruder_str = extruder == 0 ? _(L("default")) : wxString::Format("%d", extruder);
// get LayerRoot node // get LayerRoot node
ObjectDataViewModelNode *layer_root_node; ObjectDataViewModelNode *layer_root_node;
wxDataViewItem layer_root_item; wxDataViewItem layer_root_item;
@ -774,7 +777,7 @@ wxDataViewItem ObjectDataViewModel::AddLayersChild(const wxDataViewItem &parent_
} }
// Add layer node // Add layer node
ObjectDataViewModelNode *layer_node = new ObjectDataViewModelNode(layer_root_node, layer_range, index); ObjectDataViewModelNode *layer_node = new ObjectDataViewModelNode(layer_root_node, layer_range, index, extruder_str);
if (index < 0) if (index < 0)
layer_root_node->Append(layer_node); layer_root_node->Append(layer_node);
else else

View file

@ -402,6 +402,7 @@ public:
wxDataViewItem AddLayersRoot(const wxDataViewItem &parent_item); wxDataViewItem AddLayersRoot(const wxDataViewItem &parent_item);
wxDataViewItem AddLayersChild( const wxDataViewItem &parent_item, wxDataViewItem AddLayersChild( const wxDataViewItem &parent_item,
const t_layer_height_range& layer_range, const t_layer_height_range& layer_range,
const int extruder = 0,
const int index = -1); const int index = -1);
wxDataViewItem Delete(const wxDataViewItem &item); wxDataViewItem Delete(const wxDataViewItem &item);
wxDataViewItem DeleteLastInstance(const wxDataViewItem &parent_item, size_t num); wxDataViewItem DeleteLastInstance(const wxDataViewItem &parent_item, size_t num);