mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 12:11:15 -06:00 
			
		
		
		
	Merge branch 'master' of https://github.com/Prusa3d/Slic3r
This commit is contained in:
		
						commit
						485de8e936
					
				
					 2 changed files with 54 additions and 17 deletions
				
			
		|  | @ -163,9 +163,31 @@ void Field::get_value_by_opt_type(wxString& str) | |||
| 		break; } | ||||
| 	case coString: | ||||
| 	case coStrings: | ||||
| 	case coFloatOrPercent: | ||||
| 		m_value = str.ToStdString(); | ||||
| 		break; | ||||
|     case coFloatOrPercent: { | ||||
|         if (m_opt.type == coFloatOrPercent && !str.IsEmpty() &&  str.Last() != '%') | ||||
|         { | ||||
|             double val; | ||||
|             if (!str.ToCDouble(&val)) | ||||
|             { | ||||
|                 show_error(m_parent, _(L("Input value contains incorrect symbol(s).\nUse, please, only digits"))); | ||||
|                 set_value(double_to_string(val), true);                 | ||||
|             } | ||||
|             else if (val > 1) | ||||
|             { | ||||
|                 const int nVal = int(val); | ||||
|                 wxString msg_text = wxString::Format(_(L("Do you mean %d%% instead of %dmm?\n" | ||||
|                     "Select YES if you want to change this value to %d%%, \n" | ||||
|                     "or NO if you are sure that %dmm is a correct value.")), nVal, nVal, nVal, nVal); | ||||
|                 auto dialog = new wxMessageDialog(m_parent, msg_text, _(L("Parameter validation")), wxICON_WARNING | wxYES | wxNO); | ||||
|                 if (dialog->ShowModal() == wxID_YES) { | ||||
|                     set_value(wxString::Format("%s%%", str), true); | ||||
|                     str += "%%"; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|      | ||||
|         m_value = str.ToStdString(); | ||||
| 		break; } | ||||
| 	default: | ||||
| 		break; | ||||
| 	} | ||||
|  | @ -611,9 +633,7 @@ boost::any& Choice::get_value() | |||
| 		if (m_opt_id == rp_option) | ||||
| 			return m_value = boost::any(ret_str); | ||||
| 
 | ||||
| 	if (m_opt.type != coEnum) | ||||
| 		/*m_value = */get_value_by_opt_type(ret_str); | ||||
| 	else | ||||
| 	if (m_opt.type == coEnum) | ||||
| 	{ | ||||
| 		int ret_enum = static_cast<wxComboBox*>(window)->GetSelection();  | ||||
| 		if (m_opt_id.compare("external_fill_pattern") == 0) | ||||
|  | @ -640,7 +660,16 @@ boost::any& Choice::get_value() | |||
| 			m_value = static_cast<PrintHostType>(ret_enum); | ||||
| 		else if (m_opt_id.compare("display_orientation") == 0) | ||||
| 			m_value = static_cast<SLADisplayOrientation>(ret_enum); | ||||
| 	}	 | ||||
| 	} | ||||
|     else if (m_opt.gui_type == "f_enum_open") { | ||||
|         const int ret_enum = static_cast<wxComboBox*>(window)->GetSelection(); | ||||
|         if (ret_enum < 0 || m_opt.enum_values.empty()) | ||||
|             get_value_by_opt_type(ret_str); | ||||
|         else  | ||||
|             m_value = m_opt.enum_values[ret_enum];             | ||||
|     } | ||||
| 	else	 | ||||
|         get_value_by_opt_type(ret_str); | ||||
| 
 | ||||
| 	return m_value; | ||||
| } | ||||
|  |  | |||
|  | @ -1033,6 +1033,7 @@ private: | |||
|     bool can_decrease_instances() const; | ||||
|     bool can_split_to_objects() const; | ||||
|     bool can_split_to_volumes() const; | ||||
|     bool can_split() const; | ||||
|     bool layers_height_allowed() const; | ||||
|     bool can_delete_all() const; | ||||
|     bool can_arrange() const; | ||||
|  | @ -1652,8 +1653,8 @@ void Plater::priv::selection_changed() | |||
|     view3D->enable_toolbar_item("delete", can_delete_object()); | ||||
|     view3D->enable_toolbar_item("more", can_increase_instances()); | ||||
|     view3D->enable_toolbar_item("fewer", can_decrease_instances()); | ||||
|     view3D->enable_toolbar_item("splitobjects", can_split_to_objects()); | ||||
|     view3D->enable_toolbar_item("splitvolumes", can_split_to_volumes()); | ||||
|     view3D->enable_toolbar_item("splitobjects", can_split/*_to_objects*/()); | ||||
|     view3D->enable_toolbar_item("splitvolumes", can_split/*_to_volumes*/()); | ||||
|     view3D->enable_toolbar_item("layersediting", layers_height_allowed()); | ||||
|     // forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears)
 | ||||
|     view3D->render(); | ||||
|  | @ -1661,8 +1662,8 @@ void Plater::priv::selection_changed() | |||
|     this->canvas3D->enable_toolbar_item("delete", can_delete_object()); | ||||
|     this->canvas3D->enable_toolbar_item("more", can_increase_instances()); | ||||
|     this->canvas3D->enable_toolbar_item("fewer", can_decrease_instances()); | ||||
|     this->canvas3D->enable_toolbar_item("splitobjects", can_split_to_objects()); | ||||
|     this->canvas3D->enable_toolbar_item("splitvolumes", can_split_to_volumes()); | ||||
|     this->canvas3D->enable_toolbar_item("splitobjects", can_split/*_to_objects*/()); | ||||
|     this->canvas3D->enable_toolbar_item("splitvolumes", can_split/*_to_volumes*/()); | ||||
|     this->canvas3D->enable_toolbar_item("layersediting", layers_height_allowed()); | ||||
|     // forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears)
 | ||||
|     this->canvas3D->render(); | ||||
|  | @ -2454,8 +2455,8 @@ void Plater::priv::on_action_layersediting(SimpleEvent&) | |||
| 
 | ||||
| void Plater::priv::on_object_select(SimpleEvent& evt) | ||||
| { | ||||
|     selection_changed(); | ||||
|     wxGetApp().obj_list()->update_selections(); | ||||
|     selection_changed(); | ||||
| } | ||||
| 
 | ||||
| void Plater::priv::on_viewport_changed(SimpleEvent& evt) | ||||
|  | @ -2605,9 +2606,9 @@ bool Plater::priv::complit_init_object_menu() | |||
|     // ui updates needs to be binded to the parent panel
 | ||||
|     if (q != nullptr) | ||||
|     { | ||||
|         q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_objects() || can_split_to_volumes()); }, item_split->GetId()); | ||||
|         q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_objects()); }, item_split_objects->GetId()); | ||||
|         q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_volumes()); }, item_split_volumes->GetId()); | ||||
|         q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split/*_to_objects() || can_split_to_volumes*/()); }, item_split->GetId()); | ||||
|         q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split/*_to_objects*/()); }, item_split_objects->GetId()); | ||||
|         q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split/*_to_volumes*/()); }, item_split_volumes->GetId()); | ||||
|     } | ||||
|     return true; | ||||
| } | ||||
|  | @ -2626,7 +2627,7 @@ bool Plater::priv::complit_init_sla_object_menu() | |||
|     // ui updates needs to be binded to the parent panel
 | ||||
|     if (q != nullptr) | ||||
|     { | ||||
|         q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_objects()); }, item_split->GetId()); | ||||
|         q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split/*_to_objects*/()); }, item_split->GetId()); | ||||
|     } | ||||
| 
 | ||||
|     return true; | ||||
|  | @ -2645,7 +2646,7 @@ bool Plater::priv::complit_init_part_menu() | |||
|     // ui updates needs to be binded to the parent panel
 | ||||
|     if (q != nullptr) | ||||
|     { | ||||
|         q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_volumes()); },  item_split->GetId()); | ||||
|         q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split/*_to_volumes*/()); },  item_split->GetId()); | ||||
|     } | ||||
| 
 | ||||
|     return true; | ||||
|  | @ -2763,6 +2764,13 @@ bool Plater::priv::can_split_to_volumes() const | |||
|     return sidebar->obj_list()->is_splittable(); | ||||
| } | ||||
| 
 | ||||
| bool Plater::priv::can_split() const | ||||
| { | ||||
|     if (printer_technology == ptSLA) | ||||
|         return false; | ||||
|     return sidebar->obj_list()->is_splittable(); | ||||
| } | ||||
| 
 | ||||
| bool Plater::priv::layers_height_allowed() const | ||||
| { | ||||
|     int obj_idx = get_selected_object_idx(); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv