mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 23:46:24 -06:00
remove: Revert "ENH: support default filament for volumes"
This reverts commit 8f1b7d6e8b603e32bc1fa5d52fd0ab6dd8ddcb29. Change-Id: I73ac458be7d2d5d1f9c0a976e936f3f97c90f57d
This commit is contained in:
parent
1c3375bb07
commit
95c285b5c1
8 changed files with 62 additions and 106 deletions
|
@ -343,16 +343,11 @@ void ObjectDataViewModelNode::UpdateExtruderAndColorIcon(wxString extruder /*= "
|
|||
m_extruder = extruder; // update extruder
|
||||
|
||||
// update color icon
|
||||
bool as_default = false;
|
||||
size_t extruder_idx = atoi(extruder.c_str());
|
||||
if (extruder_idx == 0) {
|
||||
if (m_type & itObject) {
|
||||
// Do nothing
|
||||
}
|
||||
else if (m_type & itVolume) {
|
||||
// m_volume_type should be MODEL_PART or PARAMETER_MODIFIER type
|
||||
if (m_type & itObject);
|
||||
else if (m_type & itVolume && m_volume_type == ModelVolumeType::MODEL_PART) {
|
||||
extruder_idx = atoi(m_parent->GetExtruder().c_str());
|
||||
as_default = true;
|
||||
}
|
||||
else {
|
||||
m_extruder_bmp = wxNullBitmap;
|
||||
|
@ -360,8 +355,15 @@ void ObjectDataViewModelNode::UpdateExtruderAndColorIcon(wxString extruder /*= "
|
|||
}
|
||||
}
|
||||
|
||||
wxBitmap* bitmap = get_extruder_color_icon(extruder_idx, as_default);
|
||||
m_extruder_bmp = bitmap ? *bitmap : wxNullBitmap;
|
||||
if (extruder_idx > 0) --extruder_idx;
|
||||
// Create the bitmap with color bars.
|
||||
std::vector<wxBitmap*> bmps = get_extruder_color_icons(false);// use wide icons
|
||||
if (bmps.empty()) {
|
||||
m_extruder_bmp = wxNullBitmap;
|
||||
return;
|
||||
}
|
||||
|
||||
m_extruder_bmp = *bmps[extruder_idx >= bmps.size() ? 0 : extruder_idx];
|
||||
}
|
||||
|
||||
// *****************************************************************************
|
||||
|
@ -547,7 +549,7 @@ wxDataViewItem ObjectDataViewModel::AddVolumeChild( const wxDataViewItem &parent
|
|||
wxString extruder_str = extruder == 0 ? _(L("default")) : wxString::Format("%d", extruder);
|
||||
|
||||
const auto node = new ObjectDataViewModelNode(root, name, volume_type, GetVolumeIcon(volume_type, warning_icon_name),
|
||||
extruder_str, root->m_volumes_cnt, warning_icon_name);
|
||||
extruder == 0 ? root->m_extruder : extruder_str, root->m_volumes_cnt, warning_icon_name);
|
||||
insert_position < 0 ? root->Append(node) : root->Insert(node, insert_position);
|
||||
|
||||
// if part with errors is added, but object wasn't marked, then mark it
|
||||
|
@ -1370,33 +1372,26 @@ void ObjectDataViewModel::UpdateItemNames()
|
|||
}
|
||||
|
||||
// BBS: add use_obj_extruder
|
||||
void ObjectDataViewModel::UpdateVolumesExtruderBitmap(wxDataViewItem obj_item)
|
||||
void ObjectDataViewModel::UpdateVolumesExtruderBitmap(wxDataViewItem obj_item, bool use_obj_extruder)
|
||||
{
|
||||
if (!obj_item.IsOk() || GetItemType(obj_item) != itObject)
|
||||
return;
|
||||
ObjectDataViewModelNode* obj_node = static_cast<ObjectDataViewModelNode*>(obj_item.GetID());
|
||||
ModelObject* mo = obj_node->m_model_object;
|
||||
for (auto child : obj_node->GetChildren())
|
||||
// BBS: also update PARAMETER_MODIFIER
|
||||
if (child->GetVolumeType() == ModelVolumeType::MODEL_PART || child->GetVolumeType() == ModelVolumeType::PARAMETER_MODIFIER) {
|
||||
int vol_idx = child->GetIdx();
|
||||
ModelVolume* mv = mo->volumes[vol_idx];
|
||||
const ConfigOption* opt = mv->config.option("extruder");
|
||||
int vol_extr = opt ? opt->getInt() : 0;
|
||||
child->UpdateExtruderAndColorIcon(std::to_string(vol_extr));
|
||||
}
|
||||
if (child->GetVolumeType() == ModelVolumeType::MODEL_PART)
|
||||
child->UpdateExtruderAndColorIcon(use_obj_extruder ? obj_node->GetExtruder() : "");
|
||||
}
|
||||
|
||||
int ObjectDataViewModel::GetDefaultExtruderIdx(wxDataViewItem item)
|
||||
{
|
||||
ItemType type = GetItemType(item);
|
||||
if (type == itObject)
|
||||
return 1;
|
||||
return 0;
|
||||
|
||||
if (type == itVolume && (GetVolumeType(item) == ModelVolumeType::MODEL_PART || GetVolumeType(item) == ModelVolumeType::PARAMETER_MODIFIER)) {
|
||||
if (type == itVolume && GetVolumeType(item) == ModelVolumeType::MODEL_PART) {
|
||||
wxDataViewItem obj_item = GetParent(item);
|
||||
int extruder_id = GetExtruderNumber(obj_item);
|
||||
//if (extruder_id > 0) extruder_id--;
|
||||
if (extruder_id > 0) extruder_id--;
|
||||
return extruder_id;
|
||||
}
|
||||
|
||||
|
@ -1587,7 +1582,7 @@ void ObjectDataViewModel::SetExtruder(const wxString& extruder, wxDataViewItem i
|
|||
|
||||
node->UpdateExtruderAndColorIcon(extruder);
|
||||
if (node->GetType() == itObject)
|
||||
UpdateVolumesExtruderBitmap(item);
|
||||
UpdateVolumesExtruderBitmap(item, true);
|
||||
|
||||
// BBS
|
||||
ItemChanged(item);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue