mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-20 07:11:12 -06:00 
			
		
		
		
	Merge remote-tracking branch 'origin/dev_native' into tm_sla_supports_backend
This commit is contained in:
		
						commit
						f3b7b36d20
					
				
					 5 changed files with 34 additions and 10 deletions
				
			
		|  | @ -1858,7 +1858,7 @@ namespace Slic3r { | ||||||
|             if (volume == nullptr) |             if (volume == nullptr) | ||||||
|                 continue; |                 continue; | ||||||
| 
 | 
 | ||||||
|             VolumeToOffsetsMap::iterator volume_it = volumes_offsets.insert(VolumeToOffsetsMap::value_type(volume, Offsets(vertices_count))).first; |             volumes_offsets.insert(VolumeToOffsetsMap::value_type(volume, Offsets(vertices_count))).first; | ||||||
| 
 | 
 | ||||||
|             if (!volume->mesh.repaired) |             if (!volume->mesh.repaired) | ||||||
|                 volume->mesh.repair(); |                 volume->mesh.repair(); | ||||||
|  | @ -1875,12 +1875,23 @@ namespace Slic3r { | ||||||
| 
 | 
 | ||||||
|             vertices_count += stl.stats.shared_vertices; |             vertices_count += stl.stats.shared_vertices; | ||||||
| 
 | 
 | ||||||
|  | #if ENABLE_MODELVOLUME_TRANSFORM | ||||||
|  |             Transform3d matrix = volume->get_matrix(); | ||||||
|  | #endif // ENABLE_MODELVOLUME_TRANSFORM
 | ||||||
|  | 
 | ||||||
|             for (int i = 0; i < stl.stats.shared_vertices; ++i) |             for (int i = 0; i < stl.stats.shared_vertices; ++i) | ||||||
|             { |             { | ||||||
|                 stream << "     <" << VERTEX_TAG << " "; |                 stream << "     <" << VERTEX_TAG << " "; | ||||||
|  | #if ENABLE_MODELVOLUME_TRANSFORM | ||||||
|  |                 Vec3d v = matrix * stl.v_shared[i].cast<double>(); | ||||||
|  |                 stream << "x=\"" << v(0) << "\" "; | ||||||
|  |                 stream << "y=\"" << v(1) << "\" "; | ||||||
|  |                 stream << "z=\"" << v(2) << "\" />\n"; | ||||||
|  | #else | ||||||
|                 stream << "x=\"" << stl.v_shared[i](0) << "\" "; |                 stream << "x=\"" << stl.v_shared[i](0) << "\" "; | ||||||
|                 stream << "y=\"" << stl.v_shared[i](1) << "\" "; |                 stream << "y=\"" << stl.v_shared[i](1) << "\" "; | ||||||
|                 stream << "z=\"" << stl.v_shared[i](2) << "\" />\n"; |                 stream << "z=\"" << stl.v_shared[i](2) << "\" />\n"; | ||||||
|  | #endif // ENABLE_MODELVOLUME_TRANSFORM
 | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2357,11 +2357,15 @@ bool GLCanvas3D::Gizmos::init(GLCanvas3D& parent) | ||||||
|     m_gizmos.insert(GizmosMap::value_type(Flatten, gizmo)); |     m_gizmos.insert(GizmosMap::value_type(Flatten, gizmo)); | ||||||
| 
 | 
 | ||||||
|     gizmo = new GLGizmoCut(parent); |     gizmo = new GLGizmoCut(parent); | ||||||
|  |     if (gizmo == nullptr) | ||||||
|  |         return false; | ||||||
|  | 
 | ||||||
|     if (!gizmo->init()) { |     if (!gizmo->init()) { | ||||||
|  |         _reset(); | ||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     m_gizmos.insert({ Cut, gizmo }); |     m_gizmos.insert(GizmosMap::value_type(Cut, gizmo)); | ||||||
| 
 | 
 | ||||||
|     gizmo = new GLGizmoSlaSupports(parent); |     gizmo = new GLGizmoSlaSupports(parent); | ||||||
|     if (gizmo == nullptr) |     if (gizmo == nullptr) | ||||||
|  | @ -2399,7 +2403,7 @@ std::string GLCanvas3D::Gizmos::update_hover_state(const GLCanvas3D& canvas, con | ||||||
|     float top_y = 0.5f * (cnv_h - height); |     float top_y = 0.5f * (cnv_h - height); | ||||||
|     for (GizmosMap::iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it) |     for (GizmosMap::iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it) | ||||||
|     { |     { | ||||||
|         if (it->second == nullptr) |         if ((it->second == nullptr) || !it->second->is_selectable()) | ||||||
|             continue; |             continue; | ||||||
| 
 | 
 | ||||||
|         float tex_size = (float)it->second->get_textures_size() * OverlayTexturesScale; |         float tex_size = (float)it->second->get_textures_size() * OverlayTexturesScale; | ||||||
|  | @ -2429,7 +2433,7 @@ void GLCanvas3D::Gizmos::update_on_off_state(const GLCanvas3D& canvas, const Vec | ||||||
|     float top_y = 0.5f * (cnv_h - height); |     float top_y = 0.5f * (cnv_h - height); | ||||||
|     for (GizmosMap::iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it) |     for (GizmosMap::iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it) | ||||||
|     { |     { | ||||||
|         if (it->second == nullptr) |         if ((it->second == nullptr) || !it->second->is_selectable()) | ||||||
|             continue; |             continue; | ||||||
| 
 | 
 | ||||||
|         float tex_size = (float)it->second->get_textures_size() * OverlayTexturesScale; |         float tex_size = (float)it->second->get_textures_size() * OverlayTexturesScale; | ||||||
|  | @ -2527,7 +2531,7 @@ bool GLCanvas3D::Gizmos::overlay_contains_mouse(const GLCanvas3D& canvas, const | ||||||
|     float top_y = 0.5f * (cnv_h - height); |     float top_y = 0.5f * (cnv_h - height); | ||||||
|     for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it) |     for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it) | ||||||
|     { |     { | ||||||
|         if (it->second == nullptr) |         if ((it->second == nullptr) || !it->second->is_selectable()) | ||||||
|             continue; |             continue; | ||||||
| 
 | 
 | ||||||
|         float tex_size = (float)it->second->get_textures_size() * OverlayTexturesScale; |         float tex_size = (float)it->second->get_textures_size() * OverlayTexturesScale; | ||||||
|  | @ -2779,8 +2783,9 @@ void GLCanvas3D::Gizmos::_render_overlay(const GLCanvas3D& canvas) const | ||||||
|     float scaled_gap_y = OverlayGapY * inv_zoom; |     float scaled_gap_y = OverlayGapY * inv_zoom; | ||||||
|     for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it) |     for (GizmosMap::const_iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it) | ||||||
|     { |     { | ||||||
|         if (it->first == SlaSupports && wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA) |         if ((it->second == nullptr) || !it->second->is_selectable()) | ||||||
|             continue; |             continue; | ||||||
|  | 
 | ||||||
|         float tex_size = (float)it->second->get_textures_size() * OverlayTexturesScale * inv_zoom; |         float tex_size = (float)it->second->get_textures_size() * OverlayTexturesScale * inv_zoom; | ||||||
|         GLTexture::render_texture(it->second->get_texture_id(), top_x, top_x + tex_size, top_y - tex_size, top_y); |         GLTexture::render_texture(it->second->get_texture_id(), top_x, top_x + tex_size, top_y - tex_size, top_y); | ||||||
|         top_y -= (tex_size + scaled_gap_y); |         top_y -= (tex_size + scaled_gap_y); | ||||||
|  |  | ||||||
|  | @ -568,8 +568,8 @@ private: | ||||||
|             Scale, |             Scale, | ||||||
|             Rotate, |             Rotate, | ||||||
|             Flatten, |             Flatten, | ||||||
|             SlaSupports, |  | ||||||
|             Cut, |             Cut, | ||||||
|  |             SlaSupports, | ||||||
|             Num_Types |             Num_Types | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1779,6 +1779,11 @@ bool GLGizmoSlaSupports::on_is_activable(const GLCanvas3D::Selection& selection) | ||||||
|     return (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA); |     return (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | bool GLGizmoSlaSupports::on_is_selectable() const | ||||||
|  | { | ||||||
|  |     return (wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| std::string GLGizmoSlaSupports::on_get_name() const | std::string GLGizmoSlaSupports::on_get_name() const | ||||||
| { | { | ||||||
|     return L("SLA Support Points"); |     return L("SLA Support Points"); | ||||||
|  |  | ||||||
|  | @ -101,6 +101,7 @@ public: | ||||||
|     void set_state(EState state) { m_state = state; on_set_state(); } |     void set_state(EState state) { m_state = state; on_set_state(); } | ||||||
| 
 | 
 | ||||||
|     bool is_activable(const GLCanvas3D::Selection& selection) const { return on_is_activable(selection); } |     bool is_activable(const GLCanvas3D::Selection& selection) const { return on_is_activable(selection); } | ||||||
|  |     bool is_selectable() const { return on_is_selectable(); } | ||||||
| 
 | 
 | ||||||
|     unsigned int get_texture_id() const { return m_textures[m_state].get_id(); } |     unsigned int get_texture_id() const { return m_textures[m_state].get_id(); } | ||||||
|     int get_textures_size() const { return m_textures[Off].get_width(); } |     int get_textures_size() const { return m_textures[Off].get_width(); } | ||||||
|  | @ -134,6 +135,7 @@ protected: | ||||||
|     virtual void on_set_state() {} |     virtual void on_set_state() {} | ||||||
|     virtual void on_set_hover_id() {} |     virtual void on_set_hover_id() {} | ||||||
|     virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const { return true; } |     virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const { return true; } | ||||||
|  |     virtual bool on_is_selectable() const { return true; } | ||||||
|     virtual void on_enable_grabber(unsigned int id) {} |     virtual void on_enable_grabber(unsigned int id) {} | ||||||
|     virtual void on_disable_grabber(unsigned int id) {} |     virtual void on_disable_grabber(unsigned int id) {} | ||||||
|     virtual void on_start_dragging(const GLCanvas3D::Selection& selection) {} |     virtual void on_start_dragging(const GLCanvas3D::Selection& selection) {} | ||||||
|  | @ -454,8 +456,9 @@ protected: | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     std::string on_get_name() const override; |     virtual std::string on_get_name() const; | ||||||
|     bool on_is_activable(const GLCanvas3D::Selection& selection) const override; |     virtual bool on_is_activable(const GLCanvas3D::Selection& selection) const; | ||||||
|  |     virtual bool on_is_selectable() const; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 tamasmeszaros
						tamasmeszaros