mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Merge branch 'master' of https://github.com/prusa3d/Slic3r into svg_icons
This commit is contained in:
		
						commit
						806eff2325
					
				
					 8 changed files with 80 additions and 43 deletions
				
			
		|  | @ -1774,12 +1774,12 @@ void GLGizmoSlaSupports::set_sla_support_data(ModelObject* model_object, const G | |||
|         if (is_mesh_update_necessary()) | ||||
|             update_mesh(); | ||||
| 
 | ||||
|         // If there are no points, let's ask the backend if it calculated some.
 | ||||
|         if (m_editing_mode_cache.empty()) | ||||
|             get_data_from_backend(); | ||||
| 
 | ||||
|         if (m_model_object != m_old_model_object) | ||||
|             m_editing_mode = false; | ||||
| 
 | ||||
|         if (m_editing_mode_cache.empty() && m_model_object->sla_points_status != sla::PointsStatus::UserModified) | ||||
|             get_data_from_backend(); | ||||
| 
 | ||||
|         if (m_state == On) { | ||||
|             m_parent.toggle_model_objects_visibility(false); | ||||
|             m_parent.toggle_model_objects_visibility(true, m_model_object, m_active_instance); | ||||
|  | @ -2281,8 +2281,7 @@ RENDER_AGAIN: | |||
| 
 | ||||
|         m_imgui->text(" "); // vertical gap
 | ||||
| 
 | ||||
|         bool apply_changes = m_imgui->button(_(L("Apply changes"))); | ||||
|         if (apply_changes) { | ||||
|         if (m_imgui->button(_(L("Apply changes")))) { | ||||
|             editing_mode_apply_changes(); | ||||
|             force_refresh = true; | ||||
|         } | ||||
|  | @ -2293,24 +2292,28 @@ RENDER_AGAIN: | |||
|             force_refresh = true; | ||||
|         } | ||||
|     } | ||||
|     else { | ||||
|        /* ImGui::PushItemWidth(50.0f);
 | ||||
|     else { // not in editing mode:
 | ||||
|         /*ImGui::PushItemWidth(100.0f);
 | ||||
|         m_imgui->text(_(L("Minimal points distance: "))); | ||||
|         ImGui::SameLine(); | ||||
|         bool value_changed = ImGui::InputDouble("mm", &m_minimal_point_distance, 0.0f, 0.0f, "%.2f"); | ||||
|         bool value_changed = ImGui::SliderFloat("", &m_minimal_point_distance, 0.f, 20.f, "%.f mm"); | ||||
|         m_imgui->text(_(L("Support points density: "))); | ||||
|         ImGui::SameLine(); | ||||
|         value_changed |= ImGui::InputDouble("%", &m_density, 0.0f, 0.0f, "%.f");*/ | ||||
|         value_changed |= ImGui::SliderFloat(" ", &m_density, 0.f, 200.f, "%.f %%");*/ | ||||
| 
 | ||||
|         bool generate = m_imgui->button(_(L("Auto-generate points [A]"))); | ||||
| 
 | ||||
|         if (generate) | ||||
|             auto_generate(); | ||||
| 
 | ||||
|         m_imgui->text(""); | ||||
|         m_imgui->text(""); | ||||
|         if (m_imgui->button(_(L("Manual editing [M]")))) | ||||
|             switch_to_editing_mode(); | ||||
| 
 | ||||
|         m_imgui->text(m_model_object->sla_points_status == sla::PointsStatus::None ? "No points  (will be autogenerated)" : | ||||
|                      (m_model_object->sla_points_status == sla::PointsStatus::AutoGenerated ? "Autogenerated points (no modifications)" : | ||||
|                      (m_model_object->sla_points_status == sla::PointsStatus::UserModified ? "User-modified points" : | ||||
|                      (m_model_object->sla_points_status == sla::PointsStatus::Generating ? "Generation in progress..." : "UNKNOWN STATUS")))); | ||||
|     } | ||||
| 
 | ||||
|     m_imgui->end(); | ||||
|  | @ -2433,16 +2436,18 @@ void GLGizmoSlaSupports::editing_mode_apply_changes() | |||
|     // If there are no changes, don't touch the front-end. The data in the cache could have been
 | ||||
|     // taken from the backend and copying them to ModelObject would needlessly invalidate them.
 | ||||
|     if (m_unsaved_changes) { | ||||
|         m_model_object->sla_points_status = sla::PointsStatus::UserModified; | ||||
|         m_model_object->sla_support_points.clear(); | ||||
|         for (const std::pair<sla::SupportPoint, bool>& point_and_selection : m_editing_mode_cache) | ||||
|             m_model_object->sla_support_points.push_back(point_and_selection.first); | ||||
| 
 | ||||
|         // Recalculate support structures once the editing mode is left.
 | ||||
|         // m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
 | ||||
|         // m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
 | ||||
|         wxGetApp().plater()->reslice_SLA_supports(*m_model_object); | ||||
|     } | ||||
|     m_editing_mode = false; | ||||
|     m_unsaved_changes = false; | ||||
| 
 | ||||
|     // Recalculate support structures once the editing mode is left.
 | ||||
|     // m_parent.post_event(SimpleEvent(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS));
 | ||||
|     wxGetApp().plater()->reslice_SLA_supports(*m_model_object); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -2461,10 +2466,15 @@ void GLGizmoSlaSupports::get_data_from_backend() | |||
| { | ||||
|     for (const SLAPrintObject* po : m_parent.sla_print()->objects()) { | ||||
|         if (po->model_object()->id() == m_model_object->id() && po->is_step_done(slaposSupportPoints)) { | ||||
|             m_editing_mode_cache.clear(); | ||||
|             const std::vector<sla::SupportPoint>& points = po->get_support_points(); | ||||
|             auto mat = po->trafo().inverse().cast<float>(); | ||||
|             for (unsigned int i=0; i<points.size();++i) | ||||
|                 m_editing_mode_cache.emplace_back(sla::SupportPoint(mat * points[i].pos, points[i].head_front_radius, points[i].is_new_island), false); | ||||
| 
 | ||||
|             if (m_model_object->sla_points_status != sla::PointsStatus::UserModified) | ||||
|                 m_model_object->sla_points_status = sla::PointsStatus::AutoGenerated; | ||||
| 
 | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
|  | @ -2482,8 +2492,9 @@ void GLGizmoSlaSupports::auto_generate() | |||
|                 "Are you sure you want to do it?\n" | ||||
|                 )), _(L("Warning")), wxICON_WARNING | wxYES | wxNO); | ||||
| 
 | ||||
|     if (m_model_object->sla_support_points.empty() || dlg.ShowModal() == wxID_YES) { | ||||
|     if (m_model_object->sla_points_status != sla::PointsStatus::UserModified || dlg.ShowModal() == wxID_YES) { | ||||
|         m_model_object->sla_support_points.clear(); | ||||
|         m_model_object->sla_points_status = sla::PointsStatus::Generating; | ||||
|         m_editing_mode_cache.clear(); | ||||
|         wxGetApp().plater()->reslice_SLA_supports(*m_model_object); | ||||
|     } | ||||
|  |  | |||
|  | @ -518,19 +518,19 @@ private: | |||
| #endif // not ENABLE_IMGUI
 | ||||
| 
 | ||||
|     bool m_lock_unique_islands = false; | ||||
|     bool m_editing_mode = false; | ||||
|     bool m_old_editing_state = false; | ||||
|     float m_new_point_head_diameter = 0.4f; | ||||
|     double m_minimal_point_distance = 20.; | ||||
|     double m_density = 100.; | ||||
|     bool m_editing_mode = false;            // Is editing mode active?
 | ||||
|     bool m_old_editing_state = false;       // To keep track of whether the user toggled between the modes (needed for imgui refreshes).
 | ||||
|     float m_new_point_head_diameter = 0.4f; // Size of a new point.
 | ||||
|     float m_minimal_point_distance = 20.f; | ||||
|     float m_density = 100.f; | ||||
|     std::vector<std::pair<sla::SupportPoint, bool>> m_editing_mode_cache; // a support point and whether it is currently selected
 | ||||
| 
 | ||||
|     bool m_selection_rectangle_active = false; | ||||
|     Vec2d m_selection_rectangle_start_corner; | ||||
|     Vec2d m_selection_rectangle_end_corner; | ||||
|     bool m_ignore_up_event = false; | ||||
|     bool m_combo_box_open = false; | ||||
|     bool m_unsaved_changes = false; | ||||
|     bool m_combo_box_open = false;  // To ensure proper rendering of the imgui combobox.
 | ||||
|     bool m_unsaved_changes = false; // Are there unsaved changes in manual mode?
 | ||||
|     bool m_selection_empty = true; | ||||
|     EState m_old_state = Off; // to be able to see that the gizmo has just been closed (see on_set_state)
 | ||||
|     int m_canvas_width; | ||||
|  |  | |||
|  | @ -563,8 +563,12 @@ void Preview::create_double_slider() | |||
|             auto& config = wxGetApp().preset_bundle->project_config; | ||||
|             ((config.option<ConfigOptionFloats>("colorprint_heights"))->values) = (m_slider->GetTicksValues()); | ||||
|             m_schedule_background_process(); | ||||
|             bool color_print = !config.option<ConfigOptionFloats>("colorprint_heights")->values.empty(); | ||||
|             int type = m_choice_view_type->FindString(color_print ? _(L("Color Print")) : _(L("Feature type")) ); | ||||
| 
 | ||||
|             const wxString& choise = !config.option<ConfigOptionFloats>("colorprint_heights")->values.empty() ? _(L("Color Print")) : | ||||
|                                       config.option<ConfigOptionFloats>("wiping_volumes_matrix")->values.size() > 1  ?  | ||||
|                                       _(L("Tool")) : _(L("Feature type")); | ||||
| 
 | ||||
|             int type = m_choice_view_type->FindString(choise); | ||||
|             if (m_choice_view_type->GetSelection() != type) { | ||||
|                 m_choice_view_type->SetSelection(type); | ||||
|                 if ((0 <= type) && (type < (int)GCodePreviewData::Extrusion::Num_View_Types)) | ||||
|  | @ -638,18 +642,6 @@ void Preview::update_double_slider(const std::vector<double>& layers_z, bool for | |||
|     const auto& config = wxGetApp().preset_bundle->project_config; | ||||
|     const std::vector<double> &ticks_from_config = (config.option<ConfigOptionFloats>("colorprint_heights"))->values; | ||||
| 
 | ||||
|     // Switch to the "Feature type" from the very beginning of a new object slicing after deleting of the old one
 | ||||
|     if (ticks_from_config.empty()) | ||||
|     { | ||||
|         const int& type = m_choice_view_type->FindString(_(L("Feature type"))); | ||||
|         if (m_choice_view_type->GetSelection() != type) { | ||||
|             m_choice_view_type->SetSelection(type); | ||||
|             if (0 <= type && type < int(GCodePreviewData::Extrusion::Num_View_Types)) | ||||
|                 m_gcode_preview_data->extrusion.view_type = GCodePreviewData::Extrusion::EViewType(type); | ||||
|             m_preferred_color_mode = "feature"; | ||||
|             reload_print(); | ||||
|         } | ||||
|     } | ||||
|     m_slider->SetTicksValues(ticks_from_config); | ||||
| 
 | ||||
|     bool color_print_enable = (wxGetApp().plater()->printer_technology() == ptFFF); | ||||
|  |  | |||
|  | @ -1640,6 +1640,8 @@ void PrusaDoubleSlider::SetTicksValues(const std::vector<double>& heights) | |||
|     if (m_values.empty()) | ||||
|         return; | ||||
| 
 | ||||
|     const bool was_empty = m_ticks.empty(); | ||||
| 
 | ||||
|     m_ticks.clear(); | ||||
|     unsigned int i = 0; | ||||
|     for (auto h : heights) { | ||||
|  | @ -1649,7 +1651,10 @@ void PrusaDoubleSlider::SetTicksValues(const std::vector<double>& heights) | |||
|             return; | ||||
|         m_ticks.insert(i-1); | ||||
|     } | ||||
| 
 | ||||
|      | ||||
|     if (!was_empty && m_ticks.empty()) | ||||
|         // Switch to the "Feature type"/"Tool" from the very beginning of a new object slicing after deleting of the old one
 | ||||
|         wxPostEvent(this->GetParent(), wxCommandEvent(wxCUSTOMEVT_TICKSCHANGED)); | ||||
| } | ||||
| 
 | ||||
| void PrusaDoubleSlider::get_lower_and_higher_position(int& lower_pos, int& higher_pos) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Enrico Turri
						Enrico Turri