Update extruder value for the object from the beginning

This commit is contained in:
YuSanka 2018-08-15 13:59:33 +02:00
parent 76249e5625
commit 8c7cc73da6
3 changed files with 26 additions and 12 deletions

View File

@ -648,12 +648,15 @@ void add_object_to_list(const std::string &name, ModelObject* model_object)
if (model_object->volumes.size() > 1) {
for (auto id = 0; id < model_object->volumes.size(); id++)
m_objects_model->AddChild(item, model_object->volumes[id]->name, m_icon_solidmesh, false);
m_objects_model->AddChild(item,
model_object->volumes[id]->name,
m_icon_solidmesh,
model_object->volumes[id]->config.option<ConfigOptionInt>("extruder")->value,
false);
m_objects_ctrl->Expand(item);
}
// part_selection_changed();
#ifndef __WXOSX__ //#ifdef __WXMSW__
#ifndef __WXOSX__
object_ctrl_selection_changed();
#endif //__WXMSW__
}
@ -1257,13 +1260,18 @@ void on_btn_split(const bool split_part)
for (auto id = 0; id < model_object->volumes.size(); id++)
m_objects_model->AddChild(parent, model_object->volumes[id]->name,
model_object->volumes[id]->modifier ? m_icon_modifiermesh : m_icon_solidmesh, false);
model_object->volumes[id]->modifier ? m_icon_modifiermesh : m_icon_solidmesh,
model_object->volumes[id]->config.option<ConfigOptionInt>("extruder")->value,
false);
m_objects_ctrl->Expand(parent);
}
else {
for (auto id = 0; id < model_object->volumes.size(); id++)
m_objects_model->AddChild(item, model_object->volumes[id]->name, m_icon_solidmesh, false);
m_objects_model->AddChild(item, model_object->volumes[id]->name,
m_icon_solidmesh,
model_object->volumes[id]->config.option<ConfigOptionInt>("extruder")->value,
false);
m_objects_ctrl->Expand(item);
}
}
@ -1519,7 +1527,7 @@ void update_rotation_values()
auto rotation_z = (*m_objects)[m_selected_object_id]->instances[0]->rotation;
auto deg = int(Geometry::rad2deg(rotation_z));
if (deg > 180) deg -= 360;
// if (deg > 180) deg -= 360;
og->set_value("rotation_z", deg);
}
@ -1529,7 +1537,7 @@ void update_rotation_value(const double angle, const std::string& axis)
auto og = get_optgroup(ogFrequentlyObjectSettings);
int deg = int(Geometry::rad2deg(angle));
if (deg>180) deg -= 360;
// if (deg>180) deg -= 360;
og->set_value("rotation_"+axis, deg);
}

View File

@ -385,15 +385,18 @@ wxDataViewItem PrusaObjectDataViewModel::Add(wxString &name, int instances_count
wxDataViewItem PrusaObjectDataViewModel::AddChild( const wxDataViewItem &parent_item,
const wxString &name,
const wxIcon& icon,
bool create_frst_child/* = true*/)
const int extruder/* = 0*/,
const bool create_frst_child/* = true*/)
{
PrusaObjectDataViewModelNode *root = (PrusaObjectDataViewModelNode*)parent_item.GetID();
if (!root) return wxDataViewItem(0);
wxString extruder_str = extruder == 0 ? "default" : wxString::Format("%d", extruder);
if (root->GetChildren().Count() == 0 && create_frst_child)
{
auto icon_solid_mesh = wxIcon(Slic3r::GUI::from_u8(Slic3r::var("object.png")), wxBITMAP_TYPE_PNG);//(Slic3r::var("package.png")), wxBITMAP_TYPE_PNG);
auto node = new PrusaObjectDataViewModelNode(root, root->m_name, icon_solid_mesh, 0);
auto node = new PrusaObjectDataViewModelNode(root, root->m_name, icon_solid_mesh, extruder_str, 0);
root->Append(node);
// notify control
wxDataViewItem child((void*)node);
@ -401,7 +404,7 @@ wxDataViewItem PrusaObjectDataViewModel::AddChild( const wxDataViewItem &parent_
}
auto volume_id = root->GetChildCount();
auto node = new PrusaObjectDataViewModelNode(root, name, icon, volume_id);
auto node = new PrusaObjectDataViewModelNode(root, name, icon, extruder_str, volume_id);
root->Append(node);
// notify control
wxDataViewItem child((void*)node);

View File

@ -176,7 +176,8 @@ public:
PrusaObjectDataViewModelNode( PrusaObjectDataViewModelNode* parent,
const wxString& sub_obj_name,
const wxIcon& icon,
int volume_id=-1) {
const wxString& extruder,
const int volume_id=-1) {
m_parent = parent;
m_name = sub_obj_name;
m_copy = wxEmptyString;
@ -184,6 +185,7 @@ public:
m_icon = icon;
m_type = "volume";
m_volume_id = volume_id;
m_extruder = extruder;
set_part_action_icon();
}
@ -352,7 +354,8 @@ public:
wxDataViewItem AddChild(const wxDataViewItem &parent_item,
const wxString &name,
const wxIcon& icon,
bool create_frst_child = true);
const int = 0,
const bool create_frst_child = true);
wxDataViewItem Delete(const wxDataViewItem &item);
void DeleteAll();
void DeleteChildren(wxDataViewItem& parent);