mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	Merge branch 'master' into fs_QuadricEdgeCollapse
This commit is contained in:
		
						commit
						cc48f6c6a4
					
				
					 3 changed files with 11 additions and 30 deletions
				
			
		|  | @ -306,7 +306,7 @@ void GLVolume::SinkingContours::update() | |||
|     int object_idx = m_parent.object_idx(); | ||||
|     Model& model = GUI::wxGetApp().plater()->model(); | ||||
| 
 | ||||
|     if (0 <= object_idx && object_idx < (int)model.objects.size() && m_parent.is_sinking() && !m_parent.is_below_printbed()) { | ||||
|     if (0 <= object_idx && object_idx < model.objects.size() && m_parent.is_sinking() && !m_parent.is_below_printbed()) { | ||||
|         const BoundingBoxf3& box = m_parent.transformed_convex_hull_bounding_box(); | ||||
|         if (!m_old_box.size().isApprox(box.size()) || m_old_box.min.z() != box.min.z()) { | ||||
|             m_old_box = box; | ||||
|  |  | |||
|  | @ -55,15 +55,8 @@ std::string GLGizmoCut::on_get_name() const | |||
| void GLGizmoCut::on_set_state() | ||||
| { | ||||
|     // Reset m_cut_z on gizmo activation
 | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
|     if (get_state() == On) { | ||||
|         m_cut_z = bounding_box().center().z(); | ||||
|         m_cut_contours.reset(); | ||||
|     } | ||||
| #else | ||||
|     if (get_state() == On) | ||||
|         m_cut_z = bounding_box().center().z(); | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| } | ||||
| 
 | ||||
| bool GLGizmoCut::on_is_activable() const | ||||
|  | @ -216,12 +209,8 @@ void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit) | |||
| 
 | ||||
|     m_imgui->end(); | ||||
| 
 | ||||
|     if (cut_clicked && (m_keep_upper || m_keep_lower)) { | ||||
|     if (cut_clicked && (m_keep_upper || m_keep_lower)) | ||||
|         perform_cut(m_parent.get_selection()); | ||||
| #if ENABLE_SINKING_CONTOURS | ||||
|         m_cut_contours.reset(); | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| void GLGizmoCut::set_cut_z(double cut_z) | ||||
|  | @ -293,21 +282,21 @@ void GLGizmoCut::update_contours() | |||
|     const GLVolume* first_glvolume = selection.get_volume(*selection.get_volume_idxs().begin()); | ||||
|     const BoundingBoxf3& box = first_glvolume->transformed_convex_hull_bounding_box(); | ||||
| 
 | ||||
|     const int object_idx = selection.get_object_idx(); | ||||
|     const ModelObject* model_object = wxGetApp().model().objects[selection.get_object_idx()]; | ||||
|     const int instance_idx = selection.get_instance_idx(); | ||||
| 
 | ||||
|     if (0.0 < m_cut_z && m_cut_z < m_max_z) { | ||||
|         if (m_cut_contours.cut_z != m_cut_z || m_cut_contours.object_idx != object_idx || m_cut_contours.instance_idx != instance_idx) { | ||||
|         if (m_cut_contours.cut_z != m_cut_z || m_cut_contours.object_id != model_object->id() || m_cut_contours.instance_idx != instance_idx) { | ||||
|             m_cut_contours.cut_z = m_cut_z; | ||||
| 
 | ||||
|             if (m_cut_contours.object_idx != object_idx) { | ||||
|                 m_cut_contours.mesh = wxGetApp().plater()->model().objects[object_idx]->raw_mesh(); | ||||
|             if (m_cut_contours.object_id != model_object->id()) { | ||||
|                 m_cut_contours.mesh = model_object->raw_mesh(); | ||||
|                 m_cut_contours.mesh.repair(); | ||||
|             } | ||||
| 
 | ||||
|             m_cut_contours.position = box.center(); | ||||
|             m_cut_contours.shift = Vec3d::Zero(); | ||||
|             m_cut_contours.object_idx = object_idx; | ||||
|             m_cut_contours.object_id = model_object->id(); | ||||
|             m_cut_contours.instance_idx = instance_idx; | ||||
|             m_cut_contours.contours.reset(); | ||||
| 
 | ||||
|  | @ -319,8 +308,9 @@ void GLGizmoCut::update_contours() | |||
|                 m_cut_contours.contours.set_color(-1, { 1.0f, 1.0f, 1.0f, 1.0f }); | ||||
|             } | ||||
|         } | ||||
|         else if (box.center() != m_cut_contours.position) | ||||
|         else if (box.center() != m_cut_contours.position) { | ||||
|             m_cut_contours.shift = box.center() - m_cut_contours.position; | ||||
|         } | ||||
|     } | ||||
|     else | ||||
|         m_cut_contours.contours.reset(); | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| #if ENABLE_SINKING_CONTOURS | ||||
| #include "slic3r/GUI/GLModel.hpp" | ||||
| #include "libslic3r/TriangleMesh.hpp" | ||||
| #include "libslic3r/ObjectID.hpp" | ||||
| #endif // ENABLE_SINKING_CONTOURS
 | ||||
| 
 | ||||
| namespace Slic3r { | ||||
|  | @ -33,18 +34,8 @@ class GLGizmoCut : public GLGizmoBase | |||
|         double cut_z{ 0.0 }; | ||||
|         Vec3d position{ Vec3d::Zero() }; | ||||
|         Vec3d shift{ Vec3d::Zero() }; | ||||
|         int object_idx{ -1 }; | ||||
|         ObjectID object_id; | ||||
|         int instance_idx{ -1 }; | ||||
| 
 | ||||
|         void reset() { | ||||
|             mesh.clear(); | ||||
|             contours.reset(); | ||||
|             cut_z = 0.0; | ||||
|             position = Vec3d::Zero(); | ||||
|             shift = Vec3d::Zero(); | ||||
|             object_idx = -1; | ||||
|             instance_idx = -1; | ||||
|         } | ||||
|     }; | ||||
| 
 | ||||
|     CutContours m_cut_contours; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Filip Sykala
						Filip Sykala