mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Merge branch 'master' into lm_sla_supports_auto2
This commit is contained in:
		
						commit
						6ef9c23d19
					
				
					 7 changed files with 121 additions and 38 deletions
				
			
		|  | @ -12,6 +12,7 @@ | |||
| // Renders a small sphere in the center of the bounding box of the current selection when no gizmo is active
 | ||||
| #define ENABLE_RENDER_SELECTION_CENTER 0 | ||||
| 
 | ||||
| 
 | ||||
| //====================
 | ||||
| // 1.42.0.alpha1 techs
 | ||||
| //====================
 | ||||
|  | @ -25,6 +26,7 @@ | |||
| // Use wxDataViewRender instead of wxDataViewCustomRenderer
 | ||||
| #define ENABLE_NONCUSTOM_DATA_VIEW_RENDERING (0 && ENABLE_1_42_0_ALPHA1) | ||||
| 
 | ||||
| 
 | ||||
| //====================
 | ||||
| // 1.42.0.alpha2 techs
 | ||||
| //====================
 | ||||
|  | @ -32,7 +34,6 @@ | |||
| 
 | ||||
| // Adds print bed models to 3D scene
 | ||||
| #define ENABLE_PRINT_BED_MODELS (1 && ENABLE_1_42_0_ALPHA2) | ||||
| #endif // _technologies_h_
 | ||||
| 
 | ||||
| 
 | ||||
| //====================
 | ||||
|  | @ -61,3 +62,5 @@ | |||
| 
 | ||||
| // Toolbar items hidden/shown in dependence of the user mode
 | ||||
| #define ENABLE_MODE_AWARE_TOOLBAR_ITEMS (1 && ENABLE_1_42_0_ALPHA5) | ||||
| 
 | ||||
| #endif // _technologies_h_
 | ||||
|  |  | |||
|  | @ -366,7 +366,11 @@ const Pointfs& GLCanvas3D::Bed::get_shape() const | |||
| 
 | ||||
| bool GLCanvas3D::Bed::set_shape(const Pointfs& shape) | ||||
| { | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|     EType new_type = _detect_type(shape); | ||||
| #else | ||||
|     EType new_type = _detect_type(); | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
|     if (m_shape == shape && m_type == new_type) | ||||
|         // No change, no need to update the UI.
 | ||||
|         return false; | ||||
|  | @ -516,7 +520,11 @@ void GLCanvas3D::Bed::_calc_gridlines(const ExPolygon& poly, const BoundingBox& | |||
|         printf("Unable to create bed grid lines\n"); | ||||
| } | ||||
| 
 | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
| GLCanvas3D::Bed::EType GLCanvas3D::Bed::_detect_type(const Pointfs& shape) const | ||||
| #else | ||||
| GLCanvas3D::Bed::EType GLCanvas3D::Bed::_detect_type() const | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
| { | ||||
|     EType type = Custom; | ||||
| 
 | ||||
|  | @ -528,7 +536,27 @@ GLCanvas3D::Bed::EType GLCanvas3D::Bed::_detect_type() const | |||
|         { | ||||
| 			if (curr->config.has("bed_shape")) | ||||
| 			{ | ||||
| 				if (boost::contains(curr->name, "SL1")) | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|                 if ((curr->vendor != nullptr) && (curr->vendor->name == "Prusa Research") && (shape == dynamic_cast<const ConfigOptionPoints*>(curr->config.option("bed_shape"))->values)) | ||||
|                 { | ||||
|                     if (boost::contains(curr->name, "SL1")) | ||||
|                     { | ||||
|                         type = SL1; | ||||
|                         break; | ||||
|                     } | ||||
|                     else if (boost::contains(curr->name, "MK3") || boost::contains(curr->name, "MK2.5")) | ||||
|                     { | ||||
|                         type = MK3; | ||||
|                         break; | ||||
|                     } | ||||
|                     else if (boost::contains(curr->name, "MK2")) | ||||
|                     { | ||||
|                         type = MK2; | ||||
|                         break; | ||||
|                     } | ||||
|                 } | ||||
| #else | ||||
|                 if (boost::contains(curr->name, "SL1")) | ||||
| 				{ | ||||
| 					//FIXME add a condition on the size of the print bed?
 | ||||
| 					type = SL1; | ||||
|  | @ -549,7 +577,8 @@ GLCanvas3D::Bed::EType GLCanvas3D::Bed::_detect_type() const | |||
| 						} | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
|             } | ||||
| 
 | ||||
|             curr = bundle->printers.get_preset_parent(*curr); | ||||
|         } | ||||
|  | @ -707,6 +736,7 @@ void GLCanvas3D::Bed::_render_custom() const | |||
|     } | ||||
| } | ||||
| 
 | ||||
| #if !ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
| bool GLCanvas3D::Bed::_are_equal(const Pointfs& bed_1, const Pointfs& bed_2) | ||||
| { | ||||
|     if (bed_1.size() != bed_2.size()) | ||||
|  | @ -720,6 +750,7 @@ bool GLCanvas3D::Bed::_are_equal(const Pointfs& bed_1, const Pointfs& bed_2) | |||
| 
 | ||||
|     return true; | ||||
| } | ||||
| #endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
| 
 | ||||
| const double GLCanvas3D::Axes::Radius = 0.5; | ||||
| const double GLCanvas3D::Axes::ArrowBaseRadius = 2.5 * GLCanvas3D::Axes::Radius; | ||||
|  | @ -4231,18 +4262,26 @@ void GLCanvas3D::set_bed_shape(const Pointfs& shape) | |||
| { | ||||
|     bool new_shape = m_bed.set_shape(shape); | ||||
| 
 | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|     if (new_shape) | ||||
|     { | ||||
|         // Set the origin and size for painting of the coordinate system axes.
 | ||||
|         m_axes.origin = Vec3d(0.0, 0.0, (double)GROUND_Z); | ||||
|         set_bed_axes_length(0.1 * m_bed.get_bounding_box().max_size()); | ||||
|         m_requires_zoom_to_bed = true; | ||||
| 
 | ||||
|         m_dirty = true; | ||||
|     } | ||||
| #else | ||||
|     // Set the origin and size for painting of the coordinate system axes.
 | ||||
|     m_axes.origin = Vec3d(0.0, 0.0, (double)GROUND_Z); | ||||
|     set_bed_axes_length(0.1 * m_bed.get_bounding_box().max_size()); | ||||
| 
 | ||||
|     if (new_shape) | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|         m_requires_zoom_to_bed = true; | ||||
| #else | ||||
|         zoom_to_bed(); | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
| 
 | ||||
|     m_dirty = true; | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::set_bed_axes_length(double length) | ||||
|  | @ -4793,7 +4832,9 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re | |||
|     if (m_reload_delayed) | ||||
|         return; | ||||
| 
 | ||||
| #if !ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|     set_bed_shape(dynamic_cast<const ConfigOptionPoints*>(m_config->option("bed_shape"))->values); | ||||
| #endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
| 
 | ||||
|     if (m_regenerate_volumes) | ||||
|     { | ||||
|  | @ -5116,17 +5157,21 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) | |||
|     // see include/wx/defs.h enum wxKeyCode
 | ||||
|     int keyCode = evt.GetKeyCode(); | ||||
|     int ctrlMask = wxMOD_CONTROL; | ||||
| #ifdef __APPLE__ | ||||
|     ctrlMask |= wxMOD_RAW_CONTROL; | ||||
| #endif /* __APPLE__ */ | ||||
| //#ifdef __APPLE__
 | ||||
| //    ctrlMask |= wxMOD_RAW_CONTROL;
 | ||||
| //#endif /* __APPLE__ */
 | ||||
|     if ((evt.GetModifiers() & ctrlMask) != 0) { | ||||
|         switch (keyCode) { | ||||
|         case 'a': | ||||
|         case 'A': | ||||
|         case WXK_CONTROL_A: post_event(SimpleEvent(EVT_GLCANVAS_SELECT_ALL)); break; | ||||
| #ifdef __APPLE__ | ||||
|         case WXK_BACK: // the low cost Apple solutions are not equipped with a Delete key, use Backspace instead.
 | ||||
| #else /* __APPLE__ */ | ||||
|         case WXK_DELETE: | ||||
| #endif /* __APPLE__ */ | ||||
|         case WXK_DELETE:    post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE_ALL)); break; | ||||
|         default:            evt.Skip(); | ||||
|                             post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE_ALL)); break; | ||||
| 		default:            evt.Skip(); | ||||
|         } | ||||
|     } else if (evt.HasModifiers()) { | ||||
|         evt.Skip(); | ||||
|  | @ -5137,9 +5182,11 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) | |||
|         case WXK_ESCAPE: { m_gizmos.reset_all_states(); m_dirty = true;  break; } | ||||
| #ifdef __APPLE__ | ||||
|         case WXK_BACK: // the low cost Apple solutions are not equipped with a Delete key, use Backspace instead.
 | ||||
| #else /* __APPLE__ */ | ||||
| 		case WXK_DELETE: | ||||
| #endif /* __APPLE__ */ | ||||
|         case WXK_DELETE: post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE)); break; | ||||
|         case '0': { select_view("iso"); break; } | ||||
|                   post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE)); break; | ||||
| 		case '0': { select_view("iso"); break; } | ||||
|         case '1': { select_view("top"); break; } | ||||
|         case '2': { select_view("bottom"); break; } | ||||
|         case '3': { select_view("front"); break; } | ||||
|  |  | |||
|  | @ -226,6 +226,10 @@ class GLCanvas3D | |||
|     public: | ||||
|         Bed(); | ||||
| 
 | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|         EType get_type() const { return m_type; } | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
| 
 | ||||
|         bool is_prusa() const; | ||||
|         bool is_custom() const; | ||||
| 
 | ||||
|  | @ -247,14 +251,20 @@ class GLCanvas3D | |||
|         void _calc_bounding_box(); | ||||
|         void _calc_triangles(const ExPolygon& poly); | ||||
|         void _calc_gridlines(const ExPolygon& poly, const BoundingBox& bed_bbox); | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|         EType _detect_type(const Pointfs& shape) const; | ||||
| #else | ||||
|         EType _detect_type() const; | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
| #if ENABLE_PRINT_BED_MODELS | ||||
|         void _render_prusa(const std::string &key, float theta, bool useVBOs) const; | ||||
| #else | ||||
|         void _render_prusa(const std::string &key, float theta) const; | ||||
| #endif // ENABLE_PRINT_BED_MODELS
 | ||||
|         void _render_custom() const; | ||||
| #if !ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|         static bool _are_equal(const Pointfs& bed_1, const Pointfs& bed_2); | ||||
| #endif // !ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
|     }; | ||||
| 
 | ||||
|     struct Axes | ||||
|  |  | |||
|  | @ -419,6 +419,10 @@ void Preview::reload_print(bool force) | |||
|     m_canvas->reset_legend_texture(); | ||||
|     m_loaded = false; | ||||
| 
 | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|     m_canvas->set_bed_shape(dynamic_cast<const ConfigOptionPoints*>(m_config->option("bed_shape"))->values); | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
| 
 | ||||
|     if (!IsShown() && !force) | ||||
|         return; | ||||
| 
 | ||||
|  |  | |||
|  | @ -319,29 +319,33 @@ void MainFrame::init_menubar() | |||
|         Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_slice()); }, m_menu_item_reslice_now->GetId()); | ||||
|     } | ||||
| 
 | ||||
| #ifdef _MSC_VER | ||||
|     // \xA0 is a non-breaking space. It is entered here to spoil the automatic accelerators,
 | ||||
|     // as the simple numeric accelerators spoil all numeric data entry.
 | ||||
|     wxString sep = "\t\xA0"; | ||||
|     wxString sep_space = "\xA0"; | ||||
| #else | ||||
|     wxString sep = " - "; | ||||
|     wxString sep_space = ""; | ||||
| #endif | ||||
| 
 | ||||
|     // Edit menu
 | ||||
|     wxMenu* editMenu = nullptr; | ||||
|     if (m_plater != nullptr) | ||||
|     { | ||||
|         editMenu = new wxMenu(); | ||||
|         // \xA0 is a non-breaking space. It is entered here to spoil the automatic accelerators,
 | ||||
|         // as the simple numeric accelerators spoil all numeric data entry.
 | ||||
|         wxMenuItem* item_select_all = append_menu_item(editMenu, wxID_ANY, _(L("&Select all")) + | ||||
| #ifdef _MSC_VER | ||||
|             "\t\xA0" + "Ctrl+\xA0" + "A" | ||||
| #else | ||||
| #ifdef __APPLE__ | ||||
|             "\tCtrl+A" | ||||
| #else | ||||
|             " - Ctrl+A" | ||||
| #endif | ||||
| #endif | ||||
|             , _(L("Selects all objects")), | ||||
|     #ifdef __APPLE__ | ||||
|         // Backspace sign
 | ||||
|         wxString hotkey_delete = "\u232b"; | ||||
|     #else | ||||
|         wxString hotkey_delete = "Del"; | ||||
|     #endif | ||||
|         wxMenuItem* item_select_all = append_menu_item(editMenu, wxID_ANY, _(L("&Select all")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "A", _(L("Selects all objects")), | ||||
|             [this](wxCommandEvent&) { m_plater->select_all(); }, ""); | ||||
|         editMenu->AppendSeparator(); | ||||
|         wxMenuItem* item_delete_sel = append_menu_item(editMenu, wxID_ANY, _(L("&Delete selected")) + "\tDel", _(L("Deletes the current selection")), | ||||
|         wxMenuItem* item_delete_sel = append_menu_item(editMenu, wxID_ANY, _(L("&Delete selected")) + sep + hotkey_delete, _(L("Deletes the current selection")), | ||||
|             [this](wxCommandEvent&) { m_plater->remove_selected(); }, ""); | ||||
|         wxMenuItem* item_delete_all = append_menu_item(editMenu, wxID_ANY, _(L("Delete &all")) + "\tCtrl+Del", _(L("Deletes all objects")), | ||||
|         wxMenuItem* item_delete_all = append_menu_item(editMenu, wxID_ANY, _(L("Delete &all")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + hotkey_delete, _(L("Deletes all objects")), | ||||
|             [this](wxCommandEvent&) { m_plater->reset(); }, ""); | ||||
| 
 | ||||
|         Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_select()); }, item_select_all->GetId()); | ||||
|  | @ -398,12 +402,6 @@ void MainFrame::init_menubar() | |||
| 
 | ||||
|     // View menu
 | ||||
|     wxMenu* viewMenu = nullptr; | ||||
|     wxString sep = | ||||
| #ifdef _MSC_VER | ||||
|         "\t"; | ||||
| #else | ||||
|         " - "; | ||||
| #endif | ||||
|     if (m_plater) { | ||||
|         viewMenu = new wxMenu(); | ||||
|         // The camera control accelerators are captured by GLCanvas3D::on_char().
 | ||||
|  |  | |||
|  | @ -3017,13 +3017,20 @@ void Plater::on_extruders_change(int num_extruders) | |||
| void Plater::on_config_change(const DynamicPrintConfig &config) | ||||
| { | ||||
|     bool update_scheduled = false; | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|     bool bed_shape_changed = false; | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
|     for (auto opt_key : p->config->diff(config)) { | ||||
|         p->config->set_key_value(opt_key, config.option(opt_key)->clone()); | ||||
|         if (opt_key == "printer_technology") | ||||
|             this->set_printer_technology(config.opt_enum<PrinterTechnology>(opt_key)); | ||||
|         else if (opt_key == "bed_shape") { | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|             bed_shape_changed = true; | ||||
| #else | ||||
|             if (p->view3D) p->view3D->set_bed_shape(p->config->option<ConfigOptionPoints>(opt_key)->values); | ||||
|             if (p->preview) p->preview->set_bed_shape(p->config->option<ConfigOptionPoints>(opt_key)->values); | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
|             update_scheduled = true; | ||||
|         }  | ||||
|         else if (boost::starts_with(opt_key, "wipe_tower") || | ||||
|  | @ -3049,8 +3056,12 @@ void Plater::on_config_change(const DynamicPrintConfig &config) | |||
|         } | ||||
|         else if (opt_key == "printer_model") { | ||||
|             // update to force bed selection(for texturing)
 | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|             bed_shape_changed = true; | ||||
| #else | ||||
|             if (p->view3D) p->view3D->set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values); | ||||
|             if (p->preview) p->preview->set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values); | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
|             update_scheduled = true; | ||||
|         } | ||||
|         else if (opt_key == "host_type" && this->p->printer_technology == ptSLA) { | ||||
|  | @ -3063,6 +3074,14 @@ void Plater::on_config_change(const DynamicPrintConfig &config) | |||
|         p->sidebar->show_send(prin_host_opt != nullptr && !prin_host_opt->value.empty()); | ||||
|     } | ||||
| 
 | ||||
| #if ENABLE_REWORKED_BED_SHAPE_CHANGE | ||||
|     if (bed_shape_changed) | ||||
|     { | ||||
|         if (p->view3D) p->view3D->set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values); | ||||
|         if (p->preview) p->preview->set_bed_shape(p->config->option<ConfigOptionPoints>("bed_shape")->values); | ||||
|     } | ||||
| #endif // ENABLE_REWORKED_BED_SHAPE_CHANGE
 | ||||
| 
 | ||||
|     if (update_scheduled)  | ||||
|         update(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -497,13 +497,15 @@ void TabSLAMaterial::init_options_list() | |||
| 
 | ||||
| void Tab::get_sys_and_mod_flags(const std::string& opt_key, bool& sys_page, bool& modified_page) | ||||
| { | ||||
| 	auto opt = m_options_list.find(opt_key); | ||||
|     auto opt = m_options_list.find(opt_key); | ||||
| 	if (sys_page) sys_page = (opt->second & osSystemValue) != 0; | ||||
| 	modified_page |= (opt->second & osInitValue) == 0; | ||||
| } | ||||
| 
 | ||||
| void Tab::update_changed_tree_ui() | ||||
| { | ||||
| 	if (m_options_list.empty()) | ||||
|         return; | ||||
| 	auto cur_item = m_treectrl->GetFirstVisibleItem(); | ||||
|     if (!cur_item || !m_treectrl->IsVisible(cur_item)) | ||||
|         return; | ||||
|  | @ -689,9 +691,9 @@ void Tab::update_visibility() | |||
| 	Thaw(); | ||||
| 
 | ||||
|     // to update tree items color
 | ||||
|     wxTheApp->CallAfter([this]() { | ||||
| //    wxTheApp->CallAfter([this]() {
 | ||||
|         update_changed_tree_ui(); | ||||
|     }); | ||||
| //     });
 | ||||
| } | ||||
| 
 | ||||
| Field* Tab::get_field(const t_config_option_key& opt_key, int opt_index/* = -1*/) const | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv