mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 12:41:20 -06:00 
			
		
		
		
	Merge branch 'master' of https://github.com/prusa3d/Slic3r
This commit is contained in:
		
						commit
						ba3b06599e
					
				
					 7 changed files with 100 additions and 73 deletions
				
			
		|  | @ -587,8 +587,10 @@ namespace Slic3r { | |||
|                 object.second->layer_height_profile = obj_layer_heights_profile->second; | ||||
| 
 | ||||
|             IdToSlaSupportPointsMap::iterator obj_sla_support_points = m_sla_support_points.find(object.first); | ||||
|             if (obj_sla_support_points != m_sla_support_points.end() && !obj_sla_support_points->second.empty()) | ||||
|             if (obj_sla_support_points != m_sla_support_points.end() && !obj_sla_support_points->second.empty()) { | ||||
|                 object.second->sla_support_points = obj_sla_support_points->second; | ||||
|                 object.second->sla_points_status = sla::PointsStatus::UserModified; | ||||
|             } | ||||
| 
 | ||||
|             IdToMetadataMap::iterator obj_metadata = m_objects_metadata.find(object.first); | ||||
|             if (obj_metadata != m_objects_metadata.end()) | ||||
|  |  | |||
|  | @ -600,6 +600,7 @@ void AMFParserContext::endElement(const char * /* name */) | |||
| 						break; | ||||
| 					p = end + 1; | ||||
|                 } | ||||
|                 m_object->sla_points_status = sla::PointsStatus::UserModified; | ||||
|             } | ||||
|             else if (m_path.size() == 5 && m_path[3] == NODE_TYPE_VOLUME && m_volume) { | ||||
|                 if (strcmp(opt_key, "modifier") == 0) { | ||||
|  |  | |||
|  | @ -1773,8 +1773,10 @@ void GLGizmoSlaSupports::set_sla_support_data(ModelObject* model_object, const G | |||
| 
 | ||||
|     if (model_object && selection.is_from_single_instance()) | ||||
|     { | ||||
|         if (is_mesh_update_necessary()) | ||||
|         if (is_mesh_update_necessary()) { | ||||
|             update_mesh(); | ||||
|             editing_mode_reload_cache(); | ||||
|         } | ||||
| 
 | ||||
|         if (m_model_object != m_old_model_object) | ||||
|             m_editing_mode = false; | ||||
|  | @ -1953,9 +1955,6 @@ void GLGizmoSlaSupports::update_mesh() | |||
| 
 | ||||
|     m_AABB = igl::AABB<Eigen::MatrixXf,3>(); | ||||
|     m_AABB.init(m_V, m_F); | ||||
| 
 | ||||
|     // we'll now reload support points (selection might have changed):
 | ||||
|     editing_mode_reload_cache(); | ||||
| } | ||||
| 
 | ||||
| Vec3f GLGizmoSlaSupports::unproject_on_mesh(const Vec2d& mouse_pos) | ||||
|  | @ -2441,17 +2440,19 @@ std::string GLGizmoSlaSupports::on_get_name() const | |||
| 
 | ||||
| void GLGizmoSlaSupports::on_set_state() | ||||
| { | ||||
|     if (m_state == On) { | ||||
|     if (m_state == On && m_old_state != On) { // the gizmo was just turned on
 | ||||
|         if (is_mesh_update_necessary()) | ||||
|             update_mesh(); | ||||
| 
 | ||||
|         // we'll now reload support points:
 | ||||
|         if (m_model_object) | ||||
|             editing_mode_reload_cache(); | ||||
| 
 | ||||
|         m_parent.toggle_model_objects_visibility(false); | ||||
|         if (m_model_object) | ||||
|             m_parent.toggle_model_objects_visibility(true, m_model_object, m_active_instance); | ||||
|     } | ||||
|     if (m_state == Off) { | ||||
|         if (m_old_state != Off) { // the gizmo was just turned Off
 | ||||
| 
 | ||||
|     if (m_state == Off && m_old_state != Off) { // the gizmo was just turned Off
 | ||||
|         if (m_model_object) { | ||||
|             if (m_unsaved_changes) { | ||||
|                 wxMessageDialog dlg(GUI::wxGetApp().plater(), _(L("Do you want to save your manually edited support points ?\n")), | ||||
|  | @ -2467,7 +2468,6 @@ void GLGizmoSlaSupports::on_set_state() | |||
|         m_editing_mode = false; // so it is not active next time the gizmo opens
 | ||||
|         m_editing_mode_cache.clear(); | ||||
|     } | ||||
|     } | ||||
|     m_old_state = m_state; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -365,20 +365,20 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : | |||
|      | ||||
|     Line line = Line { "", "" }; | ||||
| 
 | ||||
|     ConfigOptionDef def; | ||||
|     def.label = L("Supports"); | ||||
|     def.type = coStrings; | ||||
|     def.gui_type = "select_open"; | ||||
|     def.tooltip = L("Select what kind of support do you need"); | ||||
|     def.enum_labels.push_back(L("None")); | ||||
|     def.enum_labels.push_back(L("Support on build plate only")); | ||||
|     def.enum_labels.push_back(L("Everywhere")); | ||||
|     const std::string selection = !config->opt_bool("support_material") ? | ||||
|     ConfigOptionDef support_def; | ||||
|     support_def.label = L("Supports"); | ||||
|     support_def.type = coStrings; | ||||
|     support_def.gui_type = "select_open"; | ||||
|     support_def.tooltip = L("Select what kind of support do you need"); | ||||
|     support_def.enum_labels.push_back(L("None")); | ||||
|     support_def.enum_labels.push_back(L("Support on build plate only")); | ||||
|     support_def.enum_labels.push_back(L("Everywhere")); | ||||
|     std::string selection = !config->opt_bool("support_material") ? | ||||
|                             "None" : config->opt_bool("support_material_buildplate_only") ? | ||||
|                             "Support on build plate only" : | ||||
|                             "Everywhere"; | ||||
|     def.default_value = new ConfigOptionStrings{ selection }; | ||||
|     Option option = Option(def, "support"); | ||||
|     support_def.default_value = new ConfigOptionStrings{ selection }; | ||||
|     Option option = Option(support_def, "support"); | ||||
|     option.opt.full_width = true; | ||||
|     line.append_option(option); | ||||
|     m_og->append_line(line); | ||||
|  | @ -393,6 +393,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : | |||
|     line.append_option(option); | ||||
| 
 | ||||
|     m_brim_width = config->opt_float("brim_width"); | ||||
|     ConfigOptionDef def; | ||||
|     def.label = L("Brim"); | ||||
|     def.type = coBool; | ||||
|     def.tooltip = L("This flag enables the brim that will be printed around each object on the first layer."); | ||||
|  | @ -428,6 +429,7 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : | |||
| 
 | ||||
|     m_og->append_line(line); | ||||
| 
 | ||||
| 
 | ||||
|     // Frequently changed parameters for SLA_technology
 | ||||
|     m_og_sla = std::make_shared<ConfigOptionsGroup>(parent, ""); | ||||
|     DynamicPrintConfig*	config_sla = &wxGetApp().preset_bundle->sla_prints.get_edited_preset().config; | ||||
|  | @ -438,20 +440,43 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) : | |||
|         Tab* tab = wxGetApp().get_tab(Preset::TYPE_SLA_PRINT); | ||||
|         if (!tab) return; | ||||
| 
 | ||||
|         if (opt_key == "pad_enable") { | ||||
|             tab->set_value(opt_key, value); | ||||
| 
 | ||||
|             tab->update(); | ||||
|         } | ||||
|         else //(opt_key == "support")
 | ||||
|         { | ||||
|             DynamicPrintConfig new_conf = *config_sla; | ||||
|         new_conf.set_key_value(opt_key, new ConfigOptionBool(boost::any_cast<bool>(value))); | ||||
|             const wxString& selection = boost::any_cast<wxString>(value); | ||||
| 
 | ||||
|             const bool supports_enable = selection == _("None") ? false : true; | ||||
|             new_conf.set_key_value("supports_enable", new ConfigOptionBool(supports_enable)); | ||||
| 
 | ||||
|             if (selection == _("Everywhere")) | ||||
|                 new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(false)); | ||||
|             else if (selection == _("Support on build plate only")) | ||||
|                 new_conf.set_key_value("support_buildplate_only", new ConfigOptionBool(true)); | ||||
| 
 | ||||
|             tab->load_config(new_conf); | ||||
|         } | ||||
| 
 | ||||
|         tab->update_dirty(); | ||||
|     }; | ||||
| 
 | ||||
| 
 | ||||
|     line = Line{ "", "" }; | ||||
| 
 | ||||
|     option = m_og_sla->get_option("supports_enable"); | ||||
|     option.opt.sidetext = "     "; | ||||
|     selection = !config_sla->opt_bool("supports_enable") ? | ||||
|                 "None" : config_sla->opt_bool("support_buildplate_only") ? | ||||
|                 "Support on build plate only" : | ||||
|                 "Everywhere"; | ||||
|     support_def.default_value = new ConfigOptionStrings{ selection }; | ||||
|     option = Option(support_def, "support"); | ||||
|     option.opt.full_width = true; | ||||
|     line.append_option(option); | ||||
|     m_og_sla->append_line(line); | ||||
| 
 | ||||
| 
 | ||||
|     line = Line{ "", "" }; | ||||
| 
 | ||||
|     option = m_og_sla->get_option("pad_enable"); | ||||
|     option.opt.sidetext = "     "; | ||||
|  |  | |||
|  | @ -751,21 +751,25 @@ void Tab::load_key_value(const std::string& opt_key, const boost::any& value, bo | |||
| 
 | ||||
| void Tab::on_value_change(const std::string& opt_key, const boost::any& value) | ||||
| { | ||||
|     ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(supports_printer_technology(ptFFF)); | ||||
|     if (opt_key == "fill_density" || opt_key == "supports_enable" || opt_key == "pad_enable") | ||||
|     const bool is_fff = supports_printer_technology(ptFFF); | ||||
|     ConfigOptionsGroup* og_freq_chng_params = wxGetApp().sidebar().og_freq_chng_params(is_fff); | ||||
|     if (opt_key == "fill_density" || opt_key == "pad_enable") | ||||
| 	{ | ||||
|         boost::any val = og_freq_chng_params->get_config_value(*m_config, opt_key); | ||||
|         og_freq_chng_params->set_value(opt_key, val); | ||||
| 	} | ||||
| 	if (opt_key == "support_material" || opt_key == "support_material_buildplate_only") | ||||
| 
 | ||||
| 	if ( is_fff && (opt_key == "support_material" || opt_key == "support_material_buildplate_only") ||  | ||||
|         !is_fff && (opt_key == "supports_enable"  || opt_key == "support_buildplate_only")) | ||||
| 	{ | ||||
| 		wxString new_selection = !m_config->opt_bool("support_material") ? | ||||
| 								_("None") : | ||||
| 								m_config->opt_bool("support_material_buildplate_only") ? | ||||
| 									_("Support on build plate only") : | ||||
|         const std::string support         = is_fff ? "support_material"                 : "supports_enable"; | ||||
|         const std::string buildplate_only = is_fff ? "support_material_buildplate_only" : "support_buildplate_only"; | ||||
|         wxString new_selection = !m_config->opt_bool(support)         ? _("None") : | ||||
|                                   m_config->opt_bool(buildplate_only) ? _("Support on build plate only") : | ||||
| 									                                    _("Everywhere"); | ||||
|         og_freq_chng_params->set_value("support", new_selection); | ||||
| 	} | ||||
| 
 | ||||
| 	if (opt_key == "brim_width") | ||||
| 	{ | ||||
| 		bool val = m_config->opt_float("brim_width") > 0.0 ? true : false; | ||||
|  |  | |||
|  | @ -1958,21 +1958,8 @@ int PrusaDoubleSlider::get_value_from_position(const wxCoord x, const wxCoord y) | |||
|         return int(m_min_value + double(height - SLIDER_MARGIN - y) / step + 0.5); | ||||
| } | ||||
| 
 | ||||
| void PrusaDoubleSlider::detect_selected_slider(const wxPoint& pt, const bool is_mouse_wheel /*= false*/) | ||||
| void PrusaDoubleSlider::detect_selected_slider(const wxPoint& pt) | ||||
| { | ||||
|     if (is_mouse_wheel) | ||||
|     { | ||||
|         if (is_horizontal()) { | ||||
|             m_selection = pt.x <= m_rect_lower_thumb.GetRight() ? ssLower : | ||||
|                           pt.x >= m_rect_higher_thumb.GetLeft() ? ssHigher : ssUndef; | ||||
|         } | ||||
|         else { | ||||
|             m_selection = pt.y >= m_rect_lower_thumb.GetTop() ? ssLower : | ||||
|                           pt.y <= m_rect_higher_thumb.GetBottom() ? ssHigher : ssUndef;             | ||||
|         } | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     m_selection = is_point_in_rect(pt, m_rect_lower_thumb) ? ssLower : | ||||
|                   is_point_in_rect(pt, m_rect_higher_thumb) ? ssHigher : ssUndef; | ||||
| } | ||||
|  | @ -2192,12 +2179,20 @@ void PrusaDoubleSlider::action_tick(const TicksAction action) | |||
| 
 | ||||
| void PrusaDoubleSlider::OnWheel(wxMouseEvent& event) | ||||
| { | ||||
|     wxClientDC dc(this); | ||||
|     wxPoint pos = event.GetLogicalPosition(dc); | ||||
|     detect_selected_slider(pos, true); | ||||
| 
 | ||||
|     // Set nearest to the mouse thumb as a selected, if there is not selected thumb
 | ||||
|     if (m_selection == ssUndef)  | ||||
|         return; | ||||
|     { | ||||
|         const wxPoint& pt = event.GetLogicalPosition(wxClientDC(this)); | ||||
|          | ||||
|         if (is_horizontal()) | ||||
|             m_selection = abs(pt.x - m_rect_lower_thumb.GetRight()) <=  | ||||
|                           abs(pt.x - m_rect_higher_thumb.GetLeft()) ?  | ||||
|                           ssLower : ssHigher; | ||||
|         else | ||||
|             m_selection = abs(pt.y - m_rect_lower_thumb.GetTop()) <=  | ||||
|                           abs(pt.y - m_rect_higher_thumb.GetBottom()) ?  | ||||
|                           ssLower : ssHigher; | ||||
|     } | ||||
| 
 | ||||
|     move_current_thumb(event.GetWheelRotation() > 0); | ||||
| } | ||||
|  |  | |||
|  | @ -771,7 +771,7 @@ protected: | |||
|     void    draw_thumb_text(wxDC& dc, const wxPoint& pos, const SelectedSlider& selection) const; | ||||
| 
 | ||||
|     void    update_thumb_rect(const wxCoord& begin_x, const wxCoord& begin_y, const SelectedSlider& selection); | ||||
|     void    detect_selected_slider(const wxPoint& pt, const bool is_mouse_wheel = false); | ||||
|     void    detect_selected_slider(const wxPoint& pt); | ||||
|     void    correct_lower_value(); | ||||
|     void    correct_higher_value(); | ||||
|     void    move_current_thumb(const bool condition); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv