Update extruder value for adding objects

This commit is contained in:
YuSanka 2018-12-11 08:53:18 +01:00
parent d7db1cdc73
commit 05fef33b10
3 changed files with 10 additions and 5 deletions

View File

@ -1174,7 +1174,9 @@ void ObjectList::add_object_to_list(size_t obj_idx)
{
auto model_object = (*m_objects)[obj_idx];
wxString item_name = model_object->name;
auto item = m_objects_model->Add(item_name);
const auto item = m_objects_model->Add(item_name,
!model_object->config.has("extruder") ? 0 :
model_object->config.option<ConfigOptionInt>("extruder")->value);
// Add error icon if detected auto-repaire
auto stats = model_object->volumes[0]->mesh.stl.stats;

View File

@ -454,9 +454,10 @@ PrusaObjectDataViewModel::~PrusaObjectDataViewModel()
m_bitmap_cache = nullptr;
}
wxDataViewItem PrusaObjectDataViewModel::Add(const wxString &name)
wxDataViewItem PrusaObjectDataViewModel::Add(const wxString &name, const int extruder)
{
auto root = new PrusaObjectDataViewModelNode(name);
const wxString extruder_str = extruder == 0 ? "default" : wxString::Format("%d", extruder);
auto root = new PrusaObjectDataViewModelNode(name, extruder_str);
m_objects.push_back(root);
// notify control
wxDataViewItem child((void*)root);

View File

@ -222,7 +222,8 @@ class PrusaObjectDataViewModelNode
size_t m_volumes_cnt = 0;
std::vector< std::string > m_opt_categories;
public:
PrusaObjectDataViewModelNode(const wxString &name) {
PrusaObjectDataViewModelNode(const wxString &name,
const wxString& extruder) {
m_parent = NULL;
m_name = name;
m_type = itObject;
@ -232,6 +233,7 @@ public:
// it will be produce "segmentation fault"
m_container = true;
#endif //__WXGTK__
m_extruder = extruder;
set_object_action_icon();
}
@ -438,7 +440,7 @@ public:
PrusaObjectDataViewModel();
~PrusaObjectDataViewModel();
wxDataViewItem Add(const wxString &name);
wxDataViewItem Add(const wxString &name, const int extruder);
wxDataViewItem AddVolumeChild(const wxDataViewItem &parent_item,
const wxString &name,
const int volume_type,