Fixed part settings updating

This commit is contained in:
YuSanka 2018-10-31 15:41:27 +01:00
parent d6d632d4fc
commit 5a4cef9ac1
5 changed files with 23 additions and 9 deletions

View file

@ -150,7 +150,8 @@ void ObjectList::set_tooltip_for_item(const wxPoint& pt)
GetMainWindow()->SetToolTip(""); // hide tooltip
}
wxPoint ObjectList::get_mouse_position_in_control() {
wxPoint ObjectList::get_mouse_position_in_control()
{
const wxPoint& pt = wxGetMousePosition();
// wxWindow* win = GetMainWindow();
// wxPoint screen_pos = win->GetScreenPosition();
@ -159,10 +160,9 @@ wxPoint ObjectList::get_mouse_position_in_control() {
int ObjectList::get_selected_obj_idx() const
{
if (GetSelectedItemsCount() == 1) {
auto item = GetSelection();
return m_objects_model->GetIdByItem(item);
}
if (GetSelectedItemsCount() == 1)
return m_objects_model->GetIdByItem(m_objects_model->GetTopParent(GetSelection()));
return -1;
}
@ -687,6 +687,7 @@ void ObjectList::load_part( ModelObject* model_object,
{
wxWindow* parent = wxGetApp().tab_panel()->GetPage(0);
m_parts_changed = false;
wxArrayString input_files;
wxGetApp().open_model(parent, input_files);
for (int i = 0; i < input_files.size(); ++i) {
@ -739,6 +740,7 @@ void ObjectList::load_lambda( ModelObject* model_object,
{
auto dlg = new LambdaObjectDialog(GetMainWindow());
if (dlg->ShowModal() == wxID_CANCEL) {
m_parts_changed = false;
return;
}
@ -1002,9 +1004,17 @@ bool ObjectList::is_splittable_object(const bool split_part)
return splittable;
}
void ObjectList::part_settings_changed()
{
m_part_settings_changed = true;
wxGetApp().plater()->changed_object(get_selected_obj_idx());
m_part_settings_changed = false;
}
void ObjectList::parts_changed(int obj_idx)
{
wxGetApp().mainframe->m_plater->changed_object_settings(obj_idx);
wxGetApp().plater()->changed_object(get_selected_obj_idx());
m_parts_changed = false;
}
void ObjectList::part_selection_changed()

View file

@ -99,6 +99,7 @@ public:
int get_selected_obj_idx() const;
bool is_parts_changed() const { return m_parts_changed; }
bool is_part_settings_changed() const { return m_part_settings_changed; }
void part_settings_changed();
void parts_changed(int obj_idx);
void part_selection_changed();

View file

@ -225,6 +225,9 @@ void ObjectManipulation::update_settings_list()
optgroup->label_width = 150;
optgroup->sidetext_width = 70;
optgroup->m_on_change = [](const t_config_option_key& opt_id, const boost::any& value) {
wxGetApp().obj_list()->part_settings_changed(); };
for (auto& opt : cat.second)
{
if (opt == "extruder")

View file

@ -2608,7 +2608,7 @@ wxGLCanvas* Plater::canvas3D()
return p->canvas3D;
}
void Plater::changed_object_settings(int obj_idx)
void Plater::changed_object(int obj_idx)
{
if (obj_idx < 0)
return;
@ -2622,6 +2622,7 @@ void Plater::changed_object_settings(int obj_idx)
auto model_object = p->model.objects[obj_idx];
model_object->center_around_origin();
model_object->ensure_on_bed();
_3DScene::reload_scene(p->canvas3D, false);
}
// update print
@ -2632,7 +2633,6 @@ void Plater::changed_object_settings(int obj_idx)
auto selections = p->collect_selections();
_3DScene::set_objects_selections(p->canvas3D, selections);
#endif // !ENABLE_EXTENDED_SELECTION
_3DScene::reload_scene(p->canvas3D, false);
#if !ENABLE_MODIFIED_CAMERA_TARGET
_3DScene::zoom_to_volumes(p->canvas3D);
#endif // !ENABLE_MODIFIED_CAMERA_TARGET

View file

@ -123,7 +123,7 @@ public:
void export_amf();
void export_3mf();
void reslice();
void changed_object_settings(int obj_idx);
void changed_object(int obj_idx);
void send_gcode();
void on_extruders_change(int extruders_count);