diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index d8d99fdf4..c8e656888 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1415,13 +1415,18 @@ void ObjectList::update_opt_keys(t_config_option_keys& opt_keys) void ObjectList::load_subobject(ModelVolumeType type) { - auto item = GetSelection(); - if (!item || m_objects_model->GetParent(item) != wxDataViewItem(0)) + wxDataViewItem item = GetSelection(); + // we can add volumes for Object or Instance + if (!item || !(m_objects_model->GetItemType(item)&(itObject|itInstance))) return; - int obj_idx = m_objects_model->GetIdByItem(item); + const int obj_idx = m_objects_model->GetObjectIdByItem(item); if (obj_idx < 0) return; + // Get object item, if Instance is selected + if (m_objects_model->GetItemType(item)&itInstance) + item = m_objects_model->GetItemById(obj_idx); + std::vector> volumes_info; load_part((*m_objects)[obj_idx], volumes_info, type); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 76ba853dc..06cf9b7d5 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -586,7 +586,7 @@ wxDataViewItem ObjectDataViewModel::AddVolumeChild( const wxDataViewItem &parent ItemAdded(parent_item, child); root->m_volumes_cnt++; - if (insert_position > 0) insert_position++; + if (insert_position >= 0) insert_position++; } const auto node = new ObjectDataViewModelNode(root, name, GetVolumeIcon(volume_type, has_errors), extruder_str, root->m_volumes_cnt);