mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	New selection -> removed obsolete methods\n+\nFixed a few compile warnings
This commit is contained in:
		
							parent
							
								
									384cfa0e6d
								
							
						
					
					
						commit
						9ae6d115a2
					
				
					 14 changed files with 39 additions and 29 deletions
				
			
		|  | @ -1350,7 +1350,7 @@ namespace Slic3r { | |||
|             return false; | ||||
|         } | ||||
| 
 | ||||
|         m_curr_config.volume_id = object->second.volumes.size(); | ||||
|         m_curr_config.volume_id = (int)object->second.volumes.size(); | ||||
| 
 | ||||
|         unsigned int first_triangle_id = (unsigned int)get_attribute_value_int(attributes, num_attributes, FIRST_TRIANGLE_ID_ATTR); | ||||
|         unsigned int last_triangle_id = (unsigned int)get_attribute_value_int(attributes, num_attributes, LAST_TRIANGLE_ID_ATTR); | ||||
|  | @ -1408,7 +1408,7 @@ namespace Slic3r { | |||
|             return false; | ||||
|         } | ||||
| 
 | ||||
|         unsigned int geo_tri_count = geometry.triangles.size() / 3; | ||||
|         unsigned int geo_tri_count = (unsigned int)geometry.triangles.size() / 3; | ||||
| 
 | ||||
|         for (const ObjectMetadata::VolumeMetadata& volume_data : volumes) | ||||
|         { | ||||
|  | @ -1429,7 +1429,7 @@ namespace Slic3r { | |||
| 
 | ||||
|             unsigned int src_start_id = volume_data.first_triangle_id * 3; | ||||
| 
 | ||||
|             for (size_t i = 0; i < triangles_count; ++i) | ||||
|             for (unsigned int i = 0; i < triangles_count; ++i) | ||||
|             { | ||||
|                 unsigned int ii = i * 3; | ||||
|                 stl_facet& facet = stl.facet_start[i]; | ||||
|  |  | |||
|  | @ -911,7 +911,7 @@ bool store_amf(const char *path, Model *model, Print* print, bool export_print_c | |||
|             if (volume->is_modifier()) | ||||
|                 stream << "        <metadata type=\"slic3r.modifier\">1</metadata>\n"; | ||||
|             stream << "        <metadata type=\"slic3r.volume_type\">" << ModelVolume::type_to_string(volume->type()) << "</metadata>\n"; | ||||
|             for (int i = 0; i < volume->mesh.stl.stats.number_of_facets; ++i) { | ||||
|             for (int i = 0; i < (int)volume->mesh.stl.stats.number_of_facets; ++i) { | ||||
|                 stream << "        <triangle>\n"; | ||||
|                 for (int j = 0; j < 3; ++j) | ||||
|                 stream << "          <v" << j + 1 << ">" << volume->mesh.stl.v_indices[i].vertex[j] + vertices_offset << "</v" << j + 1 << ">\n"; | ||||
|  |  | |||
|  | @ -37,7 +37,7 @@ static_assert(sizeof(StlHeader) == 84, "StlHeader size not correct"); | |||
| class LineReader | ||||
| { | ||||
| public: | ||||
|     LineReader(std::vector<char> &data) : m_buffer(data), m_pos(0), m_len(data.size()) {} | ||||
|     LineReader(std::vector<char> &data) : m_buffer(data), m_pos(0), m_len((int)data.size()) {} | ||||
| 
 | ||||
|     const char* next_line() { | ||||
|         // Skip empty lines.
 | ||||
|  | @ -154,7 +154,7 @@ static void extract_model_from_archive( | |||
| #if ENABLE_MODELINSTANCE_3D_FULL_TRANSFORM | ||||
|             instance_offset = Vec3d((double)(position[0] - zero[0]), (double)(position[1] - zero[1]), (double)(position[2] - zero[2])); | ||||
|             // CHECK_ME -> Is the following correct ?
 | ||||
|             trafo[2][3] = position[2] / instance_scaling_factor(2); | ||||
|             trafo[2][3] = position[2] / (float)instance_scaling_factor(2); | ||||
| #else | ||||
|             instance_offset(0) = position[0] - zero[0]; | ||||
|             instance_offset(1) = position[1] - zero[1]; | ||||
|  | @ -291,8 +291,8 @@ static void extract_model_from_archive( | |||
|         if (! facets.empty() && solid_name.empty()) { | ||||
|             stl_file &stl = mesh.stl; | ||||
|             stl.stats.type = inmemory; | ||||
|             stl.stats.number_of_facets = facets.size(); | ||||
|             stl.stats.original_num_facets = facets.size(); | ||||
|             stl.stats.number_of_facets = (uint32_t)facets.size(); | ||||
|             stl.stats.original_num_facets = (int)facets.size(); | ||||
|             stl_allocate(&stl); | ||||
|             memcpy((void*)stl.facet_start, facets.data(), facets.size() * 50); | ||||
|             stl_get_size(&stl); | ||||
|  |  | |||
|  | @ -698,7 +698,7 @@ void GCodeAnalyzer::_calc_gcode_preview_extrusion_layers(GCodePreviewData& previ | |||
| 
 | ||||
|             // update current values
 | ||||
|             data = move.data; | ||||
|             z = move.start_position.z(); | ||||
|             z = (float)move.start_position.z(); | ||||
|             volumetric_rate = move.data.feedrate * (float)move.data.mm3_per_mm; | ||||
|             height_range.update_from(move.data.height); | ||||
|             width_range.update_from(move.data.width); | ||||
|  |  | |||
|  | @ -484,14 +484,14 @@ namespace Slic3r { | |||
|     { | ||||
|         _state.filament_load_times.clear(); | ||||
|         for (double t : filament_load_times) | ||||
|             _state.filament_load_times.push_back(t); | ||||
|             _state.filament_load_times.push_back((float)t); | ||||
|     } | ||||
| 
 | ||||
|     void GCodeTimeEstimator::set_filament_unload_times(const std::vector<double> &filament_unload_times) | ||||
|     { | ||||
|         _state.filament_unload_times.clear(); | ||||
|         for (double t : filament_unload_times) | ||||
|             _state.filament_unload_times.push_back(t); | ||||
|             _state.filament_unload_times.push_back((float)t); | ||||
|     } | ||||
| 
 | ||||
|     float GCodeTimeEstimator::get_filament_load_time(unsigned int id_extruder) | ||||
|  | @ -731,7 +731,7 @@ namespace Slic3r { | |||
| #endif // ENABLE_MOVE_STATS
 | ||||
|         } | ||||
| 
 | ||||
|         _last_st_synchronized_block_id = _blocks.size() - 1; | ||||
|         _last_st_synchronized_block_id = (int)_blocks.size() - 1; | ||||
|         // The additional time has been consumed (added to the total time), reset it to zero.
 | ||||
|         set_additional_time(0.); | ||||
|     } | ||||
|  |  | |||
|  | @ -36,7 +36,7 @@ void GLIndexedVertexArray::load_mesh_flat_shading(const TriangleMesh &mesh) | |||
| 
 | ||||
|     this->vertices_and_normals_interleaved.reserve(this->vertices_and_normals_interleaved.size() + 3 * 3 * 2 * mesh.facets_count()); | ||||
|      | ||||
|     for (int i = 0; i < mesh.stl.stats.number_of_facets; ++ i) { | ||||
|     for (int i = 0; i < (int)mesh.stl.stats.number_of_facets; ++i) { | ||||
|         const stl_facet &facet = mesh.stl.facet_start[i]; | ||||
|         for (int j = 0; j < 3; ++ j) | ||||
|             this->push_geometry(facet.vertex[j](0), facet.vertex[j](1), facet.vertex[j](2), facet.normal(0), facet.normal(1), facet.normal(2)); | ||||
|  | @ -52,7 +52,7 @@ void GLIndexedVertexArray::load_mesh_full_shading(const TriangleMesh &mesh) | |||
|     this->vertices_and_normals_interleaved.reserve(this->vertices_and_normals_interleaved.size() + 3 * 3 * 2 * mesh.facets_count()); | ||||
| 
 | ||||
|     unsigned int vertices_count = 0; | ||||
|     for (int i = 0; i < mesh.stl.stats.number_of_facets; ++i) { | ||||
|     for (int i = 0; i < (int)mesh.stl.stats.number_of_facets; ++i) { | ||||
|         const stl_facet &facet = mesh.stl.facet_start[i]; | ||||
|         for (int j = 0; j < 3; ++j) | ||||
|             this->push_geometry(facet.vertex[j](0), facet.vertex[j](1), facet.vertex[j](2), facet.normal(0), facet.normal(1), facet.normal(2)); | ||||
|  | @ -244,7 +244,7 @@ void GLVolume::set_render_color(float r, float g, float b, float a) | |||
| void GLVolume::set_render_color(const float* rgba, unsigned int size) | ||||
| { | ||||
|     size = std::min((unsigned int)4, size); | ||||
|     for (int i = 0; i < size; ++i) | ||||
|     for (unsigned int i = 0; i < size; ++i) | ||||
|     { | ||||
|         render_color[i] = rgba[i]; | ||||
|     } | ||||
|  | @ -802,9 +802,9 @@ int GLVolumeCollection::load_wipe_tower_preview( | |||
|         // edge has y=0 and centerline of the back edge has y=depth:
 | ||||
|         Pointf3s points; | ||||
|         std::vector<Vec3crd> facets; | ||||
|         float out_points_idx[][3] = {{0, -depth, 0}, {0, 0, 0}, {38.453, 0, 0}, {61.547, 0, 0}, {100, 0, 0}, {100, -depth, 0}, {55.7735, -10, 0}, {44.2265, 10, 0}, | ||||
|                                      {38.453, 0, 1}, {0, 0, 1}, {0, -depth, 1}, {100, -depth, 1}, {100, 0, 1}, {61.547, 0, 1}, {55.7735, -10, 1}, {44.2265, 10, 1}}; | ||||
|         int out_facets_idx[][3] = {{0, 1, 2}, {3, 4, 5}, {6, 5, 0}, {3, 5, 6}, {6, 2, 7}, {6, 0, 2}, {8, 9, 10}, {11, 12, 13}, {10, 11, 14}, {14, 11, 13}, {15, 8, 14}, | ||||
|         float out_points_idx[][3] = { { 0, -depth, 0 }, { 0, 0, 0 }, { 38.453f, 0, 0 }, { 61.547f, 0, 0 }, { 100.0f, 0, 0 }, { 100.0f, -depth, 0 }, { 55.7735f, -10.0f, 0 }, { 44.2265f, 10.0f, 0 }, | ||||
|         { 38.453f, 0, 1 }, { 0, 0, 1 }, { 0, -depth, 1 }, { 100.0f, -depth, 1 }, { 100.0f, 0, 1 }, { 61.547f, 0, 1 }, { 55.7735f, -10.0f, 1 }, { 44.2265f, 10.0f, 1 } }; | ||||
|         int out_facets_idx[][3] = { { 0, 1, 2 }, { 3, 4, 5 }, { 6, 5, 0 }, { 3, 5, 6 }, { 6, 2, 7 }, { 6, 0, 2 }, { 8, 9, 10 }, { 11, 12, 13 }, { 10, 11, 14 }, { 14, 11, 13 }, { 15, 8, 14 }, | ||||
|                                    {8, 10, 14}, {3, 12, 4}, {3, 13, 12}, {6, 13, 3}, {6, 14, 13}, {7, 14, 6}, {7, 15, 14}, {2, 15, 7}, {2, 8, 15}, {1, 8, 2}, {1, 9, 8}, | ||||
|                                    {0, 9, 1}, {0, 10, 9}, {5, 10, 0}, {5, 11, 10}, {4, 11, 5}, {4, 12, 11}}; | ||||
|         for (int i=0;i<16;++i) | ||||
|  | @ -1032,7 +1032,7 @@ void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig* con | |||
|             continue; | ||||
| 
 | ||||
|         int extruder_id = volume->extruder_id - 1; | ||||
|         if ((extruder_id < 0) || ((unsigned int)colors.size() <= extruder_id)) | ||||
|         if ((extruder_id < 0) || ((int)colors.size() <= extruder_id)) | ||||
|             extruder_id = 0; | ||||
| 
 | ||||
|         const Color& color = colors[extruder_id]; | ||||
|  | @ -1837,6 +1837,7 @@ void _3DScene::reset_volumes(wxGLCanvas* canvas) | |||
|     s_canvas_mgr.reset_volumes(canvas); | ||||
| } | ||||
| 
 | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
| void _3DScene::deselect_volumes(wxGLCanvas* canvas) | ||||
| { | ||||
|     s_canvas_mgr.deselect_volumes(canvas); | ||||
|  | @ -1851,6 +1852,7 @@ void _3DScene::update_volumes_selection(wxGLCanvas* canvas, const std::vector<in | |||
| { | ||||
|     s_canvas_mgr.update_volumes_selection(canvas, selections); | ||||
| } | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
| 
 | ||||
| int _3DScene::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) | ||||
| { | ||||
|  |  | |||
|  | @ -510,9 +510,11 @@ public: | |||
| 
 | ||||
|     static unsigned int get_volumes_count(wxGLCanvas* canvas); | ||||
|     static void reset_volumes(wxGLCanvas* canvas); | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
|     static void deselect_volumes(wxGLCanvas* canvas); | ||||
|     static void select_volume(wxGLCanvas* canvas, unsigned int id); | ||||
|     static void update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections); | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
|     static int check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config); | ||||
|     static bool move_volume_up(wxGLCanvas* canvas, unsigned int id); | ||||
|     static bool move_volume_down(wxGLCanvas* canvas, unsigned int id); | ||||
|  |  | |||
|  | @ -414,7 +414,7 @@ void GLCanvas3D::Bed::_calc_gridlines(const ExPolygon& poly, const BoundingBox& | |||
|     } | ||||
| 
 | ||||
|     // clip with a slightly grown expolygon because our lines lay on the contours and may get erroneously clipped
 | ||||
|     Lines gridlines = to_lines(intersection_pl(axes_lines, offset(poly, SCALED_EPSILON))); | ||||
|     Lines gridlines = to_lines(intersection_pl(axes_lines, offset(poly, (float)SCALED_EPSILON))); | ||||
| 
 | ||||
|     // append bed contours
 | ||||
|     Lines contour_lines = to_lines(poly); | ||||
|  | @ -644,7 +644,7 @@ bool GLCanvas3D::CuttingPlane::set(float z, const ExPolygons& polygons) | |||
|     m_z = z; | ||||
| 
 | ||||
|     // grow slices in order to display them better
 | ||||
|     ExPolygons expolygons = offset_ex(polygons, scale_(0.1)); | ||||
|     ExPolygons expolygons = offset_ex(polygons, (float)scale_(0.1)); | ||||
|     Lines lines = to_lines(expolygons); | ||||
|     return m_lines.set_from_lines(lines, m_z); | ||||
| } | ||||
|  | @ -2621,32 +2621,28 @@ void GLCanvas3D::reset_volumes() | |||
|     _reset_warning_texture(); | ||||
| } | ||||
| 
 | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
| void GLCanvas3D::deselect_volumes() | ||||
| { | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
|     for (GLVolume* vol : m_volumes.volumes) | ||||
|     { | ||||
|         if (vol != nullptr) | ||||
|             vol->selected = false; | ||||
|     } | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::select_volume(unsigned int id) | ||||
| { | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
|     if (id < (unsigned int)m_volumes.volumes.size()) | ||||
|     { | ||||
|         GLVolume* vol = m_volumes.volumes[id]; | ||||
|         if (vol != nullptr) | ||||
|             vol->selected = true; | ||||
|     } | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
| } | ||||
| 
 | ||||
| void GLCanvas3D::update_volumes_selection(const std::vector<int>& selections) | ||||
| { | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
|     if (m_model == nullptr) | ||||
|         return; | ||||
| 
 | ||||
|  | @ -2664,8 +2660,8 @@ void GLCanvas3D::update_volumes_selection(const std::vector<int>& selections) | |||
|             } | ||||
|         } | ||||
|     } | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
| } | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
| 
 | ||||
| int GLCanvas3D::check_volumes_outside_state(const DynamicPrintConfig* config) const | ||||
| { | ||||
|  |  | |||
|  | @ -693,9 +693,11 @@ public: | |||
| 
 | ||||
|     unsigned int get_volumes_count() const; | ||||
|     void reset_volumes(); | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
|     void deselect_volumes(); | ||||
|     void select_volume(unsigned int id); | ||||
|     void update_volumes_selection(const std::vector<int>& selections); | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
|     int check_volumes_outside_state(const DynamicPrintConfig* config) const; | ||||
|     bool move_volume_up(unsigned int id); | ||||
|     bool move_volume_down(unsigned int id); | ||||
|  |  | |||
|  | @ -246,6 +246,7 @@ void GLCanvas3DManager::reset_volumes(wxGLCanvas* canvas) | |||
|         it->second->reset_volumes(); | ||||
| } | ||||
| 
 | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
| void GLCanvas3DManager::deselect_volumes(wxGLCanvas* canvas) | ||||
| { | ||||
|     CanvasesMap::iterator it = _get_canvas(canvas); | ||||
|  | @ -266,6 +267,7 @@ void GLCanvas3DManager::update_volumes_selection(wxGLCanvas* canvas, const std:: | |||
|     if (it != m_canvases.end()) | ||||
|         it->second->update_volumes_selection(selections); | ||||
| } | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
| 
 | ||||
| int GLCanvas3DManager::check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) const | ||||
| { | ||||
|  |  | |||
|  | @ -87,9 +87,11 @@ public: | |||
| 
 | ||||
|     unsigned int get_volumes_count(wxGLCanvas* canvas) const; | ||||
|     void reset_volumes(wxGLCanvas* canvas); | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
|     void deselect_volumes(wxGLCanvas* canvas); | ||||
|     void select_volume(wxGLCanvas* canvas, unsigned int id); | ||||
|     void update_volumes_selection(wxGLCanvas* canvas, const std::vector<int>& selections); | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
|     int check_volumes_outside_state(wxGLCanvas* canvas, const DynamicPrintConfig* config) const; | ||||
|     bool move_volume_up(wxGLCanvas* canvas, unsigned int id); | ||||
|     bool move_volume_down(wxGLCanvas* canvas, unsigned int id); | ||||
|  |  | |||
|  | @ -135,7 +135,7 @@ bool GLShader::load_from_file(const char* fragment_shader_filename, const char* | |||
|         return false; | ||||
| 
 | ||||
|     vs.seekg(0, vs.end); | ||||
|     int file_length = vs.tellg(); | ||||
|     int file_length = (int)vs.tellg(); | ||||
|     vs.seekg(0, vs.beg); | ||||
|     std::string vertex_shader(file_length, '\0'); | ||||
|     vs.read(const_cast<char*>(vertex_shader.data()), file_length); | ||||
|  | @ -149,7 +149,7 @@ bool GLShader::load_from_file(const char* fragment_shader_filename, const char* | |||
|         return false; | ||||
| 
 | ||||
|     fs.seekg(0, fs.end); | ||||
|     file_length = fs.tellg(); | ||||
|     file_length = (int)fs.tellg(); | ||||
|     fs.seekg(0, fs.beg); | ||||
|     std::string fragment_shader(file_length, '\0'); | ||||
|     fs.read(const_cast<char*>(fragment_shader.data()), file_length); | ||||
|  |  | |||
|  | @ -26,7 +26,9 @@ wxDEFINE_EVENT(EVT_GLTOOLBAR_SPLIT, SimpleEvent); | |||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_CUT, SimpleEvent); | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_SETTINGS, SimpleEvent); | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_LAYERSEDITING, SimpleEvent); | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
| wxDEFINE_EVENT(EVT_GLTOOLBAR_SELECTBYPARTS, SimpleEvent); | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
| 
 | ||||
| 
 | ||||
| GLToolbarItem::Data::Data() | ||||
|  |  | |||
|  | @ -26,7 +26,9 @@ wxDECLARE_EVENT(EVT_GLTOOLBAR_SPLIT, SimpleEvent); | |||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_CUT, SimpleEvent); | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_SETTINGS, SimpleEvent); | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_LAYERSEDITING, SimpleEvent); | ||||
| #if !ENABLE_EXTENDED_SELECTION | ||||
| wxDECLARE_EVENT(EVT_GLTOOLBAR_SELECTBYPARTS, SimpleEvent); | ||||
| #endif // !ENABLE_EXTENDED_SELECTION
 | ||||
| 
 | ||||
| class GLToolbarItem | ||||
| { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Enrico Turri
						Enrico Turri