Added function for the updating of the Error icon after a fix through the NetFabb
This commit is contained in:
parent
88f93a0b44
commit
46d19aa52d
3 changed files with 35 additions and 12 deletions
|
@ -427,10 +427,8 @@ void ObjectList::OnContextMenu(wxDataViewEvent&)
|
||||||
else if (title == _("Name") && pt.x >15 &&
|
else if (title == _("Name") && pt.x >15 &&
|
||||||
m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.GetRefData())
|
m_objects_model->GetBitmap(item).GetRefData() == m_bmp_manifold_warning.GetRefData())
|
||||||
{
|
{
|
||||||
if (is_windows10()) {
|
if (is_windows10())
|
||||||
const auto obj_idx = m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item));
|
fix_through_netfabb();
|
||||||
wxGetApp().plater()->fix_through_netfabb(obj_idx);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#ifndef __WXMSW__
|
#ifndef __WXMSW__
|
||||||
GetMainWindow()->SetToolTip(""); // hide tooltip
|
GetMainWindow()->SetToolTip(""); // hide tooltip
|
||||||
|
@ -2272,13 +2270,37 @@ void ObjectList::fix_through_netfabb() const
|
||||||
if (!item)
|
if (!item)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemType type = m_objects_model->GetItemType(item);
|
const ItemType type = m_objects_model->GetItemType(item);
|
||||||
|
|
||||||
if (type & itObject)
|
const int obj_idx = type & itObject ? m_objects_model->GetIdByItem(item) :
|
||||||
wxGetApp().plater()->fix_through_netfabb(m_objects_model->GetIdByItem(item));
|
type & itVolume ? m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item)) : -1;
|
||||||
else if (type & itVolume)
|
|
||||||
wxGetApp().plater()->fix_through_netfabb(m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item)),
|
const int vol_idx = type & itVolume ? m_objects_model->GetVolumeIdByItem(item) : -1;
|
||||||
m_objects_model->GetVolumeIdByItem(item));
|
|
||||||
|
wxGetApp().plater()->fix_through_netfabb(obj_idx, vol_idx);
|
||||||
|
|
||||||
|
update_item_error_icon(obj_idx, vol_idx);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectList::update_item_error_icon(const int obj_idx, const int vol_idx) const
|
||||||
|
{
|
||||||
|
const wxDataViewItem item = vol_idx <0 ? m_objects_model->GetItemById(obj_idx) :
|
||||||
|
m_objects_model->GetItemByVolumeId(obj_idx, vol_idx);
|
||||||
|
if (!item)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto model_object = (*m_objects)[obj_idx];
|
||||||
|
|
||||||
|
const stl_stats& stats = model_object->volumes[vol_idx<0 ? 0 : vol_idx]->mesh.stl.stats;
|
||||||
|
const int errors = stats.degenerate_facets + stats.edges_fixed + stats.facets_removed +
|
||||||
|
stats.facets_added + stats.facets_reversed + stats.backwards_edges;
|
||||||
|
|
||||||
|
if (errors == 0) {
|
||||||
|
// delete Error_icon if all errors are fixed
|
||||||
|
wxVariant variant;
|
||||||
|
variant << PrusaDataViewBitmapText(from_u8(model_object->name), wxNullBitmap);
|
||||||
|
m_objects_model->SetValue(variant, item, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectList::ItemValueChanged(wxDataViewEvent &event)
|
void ObjectList::ItemValueChanged(wxDataViewEvent &event)
|
||||||
|
|
|
@ -270,6 +270,7 @@ public:
|
||||||
void split_instances();
|
void split_instances();
|
||||||
void rename_item();
|
void rename_item();
|
||||||
void fix_through_netfabb() const;
|
void fix_through_netfabb() const;
|
||||||
|
void update_item_error_icon(const int obj_idx, int vol_idx) const ;
|
||||||
private:
|
private:
|
||||||
void OnChar(wxKeyEvent& event);
|
void OnChar(wxKeyEvent& event);
|
||||||
void OnContextMenu(wxDataViewEvent &event);
|
void OnContextMenu(wxDataViewEvent &event);
|
||||||
|
|
|
@ -2455,7 +2455,7 @@ void Tab::load_current_preset()
|
||||||
//Regerenerate content of the page tree.
|
//Regerenerate content of the page tree.
|
||||||
void Tab::rebuild_page_tree(bool tree_sel_change_event /*= false*/)
|
void Tab::rebuild_page_tree(bool tree_sel_change_event /*= false*/)
|
||||||
{
|
{
|
||||||
Freeze();
|
// Freeze();
|
||||||
|
|
||||||
// get label of the currently selected item
|
// get label of the currently selected item
|
||||||
const auto sel_item = m_treectrl->GetSelection();
|
const auto sel_item = m_treectrl->GetSelection();
|
||||||
|
@ -2481,7 +2481,7 @@ void Tab::rebuild_page_tree(bool tree_sel_change_event /*= false*/)
|
||||||
// this is triggered on first load, so we don't disable the sel change event
|
// this is triggered on first load, so we don't disable the sel change event
|
||||||
m_treectrl->SelectItem(m_treectrl->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem));
|
m_treectrl->SelectItem(m_treectrl->GetFirstVisibleItem());//! (treectrl->GetFirstChild(rootItem));
|
||||||
}
|
}
|
||||||
Thaw();
|
// Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tab::update_page_tree_visibility()
|
void Tab::update_page_tree_visibility()
|
||||||
|
|
Loading…
Reference in a new issue