mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Fixed conflicts after merge with master
This commit is contained in:
		
						commit
						8e4274e100
					
				
					 36 changed files with 92 additions and 757 deletions
				
			
		|  | @ -162,9 +162,25 @@ int CLI::run(int argc, char **argv) | ||||||
| 
 | 
 | ||||||
|     // Initialize full print configs for both the FFF and SLA technologies.
 |     // Initialize full print configs for both the FFF and SLA technologies.
 | ||||||
|     FullPrintConfig    fff_print_config; |     FullPrintConfig    fff_print_config; | ||||||
| //    SLAFullPrintConfig sla_print_config;
 |     SLAFullPrintConfig sla_print_config; | ||||||
|  |      | ||||||
|  |     // Synchronize the default parameters and the ones received on the command line.
 | ||||||
|  |     if (printer_technology == ptFFF) { | ||||||
|         fff_print_config.apply(m_print_config, true); |         fff_print_config.apply(m_print_config, true); | ||||||
| //    sla_print_config.apply(m_print_config, true);
 |         m_print_config.apply(fff_print_config, true); | ||||||
|  |     } else if (printer_technology == ptSLA) { | ||||||
|  |         // The default value has to be different from the one in fff mode.
 | ||||||
|  |         sla_print_config.output_filename_format.value = "[input_filename_base].sl1"; | ||||||
|  |          | ||||||
|  |         // The default bed shape should reflect the default display parameters
 | ||||||
|  |         // and not the fff defaults.
 | ||||||
|  |         double w = sla_print_config.display_width.getFloat(); | ||||||
|  |         double h = sla_print_config.display_height.getFloat(); | ||||||
|  |         sla_print_config.bed_shape.values = { Vec2d(0, 0), Vec2d(w, 0), Vec2d(w, h), Vec2d(0, h) }; | ||||||
|  |          | ||||||
|  |         sla_print_config.apply(m_print_config, true); | ||||||
|  |         m_print_config.apply(sla_print_config, true); | ||||||
|  |     } | ||||||
|      |      | ||||||
|     // Loop through transform options.
 |     // Loop through transform options.
 | ||||||
|     bool user_center_specified = false; |     bool user_center_specified = false; | ||||||
|  | @ -641,18 +657,10 @@ bool CLI::export_models(IO::ExportFormat format) | ||||||
|         const std::string path = this->output_filepath(model, format); |         const std::string path = this->output_filepath(model, format); | ||||||
|         bool success = false; |         bool success = false; | ||||||
|         switch (format) { |         switch (format) { | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|             case IO::AMF: success = Slic3r::store_amf(path.c_str(), &model, nullptr, false); break; |             case IO::AMF: success = Slic3r::store_amf(path.c_str(), &model, nullptr, false); break; | ||||||
| #else |  | ||||||
|             case IO::AMF: success = Slic3r::store_amf(path.c_str(), &model, nullptr); break; |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
|             case IO::OBJ: success = Slic3r::store_obj(path.c_str(), &model);          break; |             case IO::OBJ: success = Slic3r::store_obj(path.c_str(), &model);          break; | ||||||
|             case IO::STL: success = Slic3r::store_stl(path.c_str(), &model, true);    break; |             case IO::STL: success = Slic3r::store_stl(path.c_str(), &model, true);    break; | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|             case IO::TMF: success = Slic3r::store_3mf(path.c_str(), &model, nullptr, false); break; |             case IO::TMF: success = Slic3r::store_3mf(path.c_str(), &model, nullptr, false); break; | ||||||
| #else |  | ||||||
|             case IO::TMF: success = Slic3r::store_3mf(path.c_str(), &model, nullptr); break; |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
|             default: assert(false); break; |             default: assert(false); break; | ||||||
|         } |         } | ||||||
|         if (success) |         if (success) | ||||||
|  |  | ||||||
|  | @ -1966,24 +1966,14 @@ namespace Slic3r { | ||||||
|         typedef std::vector<BuildItem> BuildItemsList; |         typedef std::vector<BuildItem> BuildItemsList; | ||||||
|         typedef std::map<int, ObjectData> IdToObjectDataMap; |         typedef std::map<int, ObjectData> IdToObjectDataMap; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|         bool m_fullpath_sources{ true }; |         bool m_fullpath_sources{ true }; | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
|     public: |     public: | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
|         bool save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data = nullptr); |         bool save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data = nullptr); | ||||||
| #else | #else | ||||||
|         bool save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, bool fullpath_sources); |         bool save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, bool fullpath_sources); | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
| #else |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR |  | ||||||
|         bool save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, const ThumbnailData* thumbnail_data = nullptr); |  | ||||||
| #else |  | ||||||
|         bool save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config); |  | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
|     private: |     private: | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
|  | @ -2009,7 +1999,6 @@ namespace Slic3r { | ||||||
|         bool _add_custom_gcode_per_print_z_file_to_archive(mz_zip_archive& archive, Model& model); |         bool _add_custom_gcode_per_print_z_file_to_archive(mz_zip_archive& archive, Model& model); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
|     bool _3MF_Exporter::save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data) |     bool _3MF_Exporter::save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data) | ||||||
|     { |     { | ||||||
|  | @ -2024,21 +2013,6 @@ namespace Slic3r { | ||||||
|         return _save_model_to_file(filename, model, config); |         return _save_model_to_file(filename, model, config); | ||||||
|     } |     } | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
| #else |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR |  | ||||||
|     bool _3MF_Exporter::save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, const ThumbnailData* thumbnail_data) |  | ||||||
|     { |  | ||||||
|         clear_errors(); |  | ||||||
|         return _save_model_to_file(filename, model, config, thumbnail_data); |  | ||||||
|     } |  | ||||||
| #else |  | ||||||
|     bool _3MF_Exporter::save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config) |  | ||||||
|     { |  | ||||||
|         clear_errors(); |  | ||||||
|         return _save_model_to_file(filename, model, config); |  | ||||||
|     } |  | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
|     bool _3MF_Exporter::_save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, const ThumbnailData* thumbnail_data) |     bool _3MF_Exporter::_save_model_to_file(const std::string& filename, Model& model, const DynamicPrintConfig* config, const ThumbnailData* thumbnail_data) | ||||||
|  | @ -2725,12 +2699,8 @@ namespace Slic3r { | ||||||
|                             // stores volume's source data
 |                             // stores volume's source data
 | ||||||
|                             if (!volume->source.input_file.empty()) |                             if (!volume->source.input_file.empty()) | ||||||
|                             { |                             { | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|                                 std::string input_file = xml_escape(m_fullpath_sources ? volume->source.input_file : boost::filesystem::path(volume->source.input_file).filename().string()); |                                 std::string input_file = xml_escape(m_fullpath_sources ? volume->source.input_file : boost::filesystem::path(volume->source.input_file).filename().string()); | ||||||
|                                 stream << "   <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << VOLUME_TYPE << "\" " << KEY_ATTR << "=\"" << SOURCE_FILE_KEY << "\" " << VALUE_ATTR << "=\"" << input_file << "\"/>\n"; |                                 stream << "   <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << VOLUME_TYPE << "\" " << KEY_ATTR << "=\"" << SOURCE_FILE_KEY << "\" " << VALUE_ATTR << "=\"" << input_file << "\"/>\n"; | ||||||
| #else |  | ||||||
|                                 stream << "   <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << VOLUME_TYPE << "\" " << KEY_ATTR << "=\"" << SOURCE_FILE_KEY << "\" " << VALUE_ATTR << "=\"" << xml_escape(volume->source.input_file) << "\"/>\n"; |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
|                                 stream << "   <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << VOLUME_TYPE << "\" " << KEY_ATTR << "=\"" << SOURCE_OBJECT_ID_KEY << "\" " << VALUE_ATTR << "=\"" << volume->source.object_idx << "\"/>\n"; |                                 stream << "   <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << VOLUME_TYPE << "\" " << KEY_ATTR << "=\"" << SOURCE_OBJECT_ID_KEY << "\" " << VALUE_ATTR << "=\"" << volume->source.object_idx << "\"/>\n"; | ||||||
|                                 stream << "   <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << VOLUME_TYPE << "\" " << KEY_ATTR << "=\"" << SOURCE_VOLUME_ID_KEY << "\" " << VALUE_ATTR << "=\"" << volume->source.volume_idx << "\"/>\n"; |                                 stream << "   <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << VOLUME_TYPE << "\" " << KEY_ATTR << "=\"" << SOURCE_VOLUME_ID_KEY << "\" " << VALUE_ATTR << "=\"" << volume->source.volume_idx << "\"/>\n"; | ||||||
|                                 stream << "   <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << VOLUME_TYPE << "\" " << KEY_ATTR << "=\"" << SOURCE_OFFSET_X_KEY << "\" " << VALUE_ATTR << "=\"" << volume->source.mesh_offset(0) << "\"/>\n"; |                                 stream << "   <" << METADATA_TAG << " " << TYPE_ATTR << "=\"" << VOLUME_TYPE << "\" " << KEY_ATTR << "=\"" << SOURCE_OFFSET_X_KEY << "\" " << VALUE_ATTR << "=\"" << volume->source.mesh_offset(0) << "\"/>\n"; | ||||||
|  | @ -2825,37 +2795,21 @@ bool load_3mf(const char* path, DynamicPrintConfig* config, Model* model, bool c | ||||||
|         return res; |         return res; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
| bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data) | bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data) | ||||||
| #else | #else | ||||||
| bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources) | bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources) | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
| #else |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR |  | ||||||
|     bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, const ThumbnailData* thumbnail_data) |  | ||||||
| #else |  | ||||||
|     bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config) |  | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
|     { |     { | ||||||
|         if ((path == nullptr) || (model == nullptr)) |         if ((path == nullptr) || (model == nullptr)) | ||||||
|             return false; |             return false; | ||||||
| 
 | 
 | ||||||
|         _3MF_Exporter exporter; |         _3MF_Exporter exporter; | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
|         bool res = exporter.save_model_to_file(path, *model, config, fullpath_sources, thumbnail_data); |         bool res = exporter.save_model_to_file(path, *model, config, fullpath_sources, thumbnail_data); | ||||||
| #else | #else | ||||||
|         bool res = exporter.save_model_to_file(path, *model, config, fullpath_sources); |         bool res = exporter.save_model_to_file(path, *model, config, fullpath_sources); | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
| #else |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR |  | ||||||
|         bool res = exporter.save_model_to_file(path, *model, config, thumbnail_data); |  | ||||||
| #else |  | ||||||
|         bool res = exporter.save_model_to_file(path, *model, config); |  | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
|         if (!res) |         if (!res) | ||||||
|             exporter.log_errors(); |             exporter.log_errors(); | ||||||
|  |  | ||||||
|  | @ -35,19 +35,11 @@ namespace Slic3r { | ||||||
| 
 | 
 | ||||||
|     // Save the given model and the config data contained in the given Print into a 3mf file.
 |     // Save the given model and the config data contained in the given Print into a 3mf file.
 | ||||||
|     // The model could be modified during the export process if meshes are not repaired or have no shared vertices
 |     // The model could be modified during the export process if meshes are not repaired or have no shared vertices
 | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
|     extern bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data = nullptr); |     extern bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources, const ThumbnailData* thumbnail_data = nullptr); | ||||||
| #else | #else | ||||||
|     extern bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources); |     extern bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources); | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
| #else |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR |  | ||||||
|     extern bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config, const ThumbnailData* thumbnail_data = nullptr); |  | ||||||
| #else |  | ||||||
|     extern bool store_3mf(const char* path, Model* model, const DynamicPrintConfig* config); |  | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
| }; // namespace Slic3r
 | }; // namespace Slic3r
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1022,11 +1022,7 @@ bool load_amf(const char* path, DynamicPrintConfig* config, Model* model, bool c | ||||||
|         return false; |         return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| bool store_amf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources) | bool store_amf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources) | ||||||
| #else |  | ||||||
| bool store_amf(const char *path, Model *model, const DynamicPrintConfig *config) |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| { | { | ||||||
|     if ((path == nullptr) || (model == nullptr)) |     if ((path == nullptr) || (model == nullptr)) | ||||||
|         return false; |         return false; | ||||||
|  | @ -1180,12 +1176,8 @@ bool store_amf(const char *path, Model *model, const DynamicPrintConfig *config) | ||||||
|             stream << "</metadata>\n"; |             stream << "</metadata>\n"; | ||||||
|             if (!volume->source.input_file.empty()) |             if (!volume->source.input_file.empty()) | ||||||
|             { |             { | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|                 std::string input_file = xml_escape(fullpath_sources ? volume->source.input_file : boost::filesystem::path(volume->source.input_file).filename().string()); |                 std::string input_file = xml_escape(fullpath_sources ? volume->source.input_file : boost::filesystem::path(volume->source.input_file).filename().string()); | ||||||
|                 stream << "        <metadata type=\"slic3r.source_file\">" << input_file << "</metadata>\n"; |                 stream << "        <metadata type=\"slic3r.source_file\">" << input_file << "</metadata>\n"; | ||||||
| #else |  | ||||||
|                 stream << "        <metadata type=\"slic3r.source_file\">" << xml_escape(volume->source.input_file) << "</metadata>\n"; |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
|                 stream << "        <metadata type=\"slic3r.source_object_id\">" << volume->source.object_idx << "</metadata>\n"; |                 stream << "        <metadata type=\"slic3r.source_object_id\">" << volume->source.object_idx << "</metadata>\n"; | ||||||
|                 stream << "        <metadata type=\"slic3r.source_volume_id\">" << volume->source.volume_idx << "</metadata>\n"; |                 stream << "        <metadata type=\"slic3r.source_volume_id\">" << volume->source.volume_idx << "</metadata>\n"; | ||||||
|                 stream << "        <metadata type=\"slic3r.source_offset_x\">" << volume->source.mesh_offset(0) << "</metadata>\n"; |                 stream << "        <metadata type=\"slic3r.source_offset_x\">" << volume->source.mesh_offset(0) << "</metadata>\n"; | ||||||
|  |  | ||||||
|  | @ -11,11 +11,7 @@ extern bool load_amf(const char* path, DynamicPrintConfig* config, Model* model, | ||||||
| 
 | 
 | ||||||
| // Save the given model and the config data into an amf file.
 | // Save the given model and the config data into an amf file.
 | ||||||
| // The model could be modified during the export process if meshes are not repaired or have no shared vertices
 | // The model could be modified during the export process if meshes are not repaired or have no shared vertices
 | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| extern bool store_amf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources); | extern bool store_amf(const char* path, Model* model, const DynamicPrintConfig* config, bool fullpath_sources); | ||||||
| #else |  | ||||||
| extern bool store_amf(const char *path, Model *model, const DynamicPrintConfig *config); |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
| }; // namespace Slic3r
 | }; // namespace Slic3r
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1101,11 +1101,7 @@ static inline std::vector<const PrintInstance*> sort_object_instances_by_max_z(c | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Produce a vector of PrintObjects in the order of their respective ModelObjects in print.model().
 | // Produce a vector of PrintObjects in the order of their respective ModelObjects in print.model().
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
| std::vector<const PrintInstance*> sort_object_instances_by_model_order(const Print& print) | std::vector<const PrintInstance*> sort_object_instances_by_model_order(const Print& print) | ||||||
| #else |  | ||||||
| static inline std::vector<const PrintInstance*> sort_object_instances_by_model_order(const Print& print) |  | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| { | { | ||||||
|     // Build up map from ModelInstance* to PrintInstance*
 |     // Build up map from ModelInstance* to PrintInstance*
 | ||||||
|     std::vector<std::pair<const ModelInstance*, const PrintInstance*>> model_instance_to_print_instance; |     std::vector<std::pair<const ModelInstance*, const PrintInstance*>> model_instance_to_print_instance; | ||||||
|  |  | ||||||
|  | @ -418,9 +418,7 @@ private: | ||||||
|     friend class WipeTowerIntegration; |     friend class WipeTowerIntegration; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
| std::vector<const PrintInstance*> sort_object_instances_by_model_order(const Print& print); | std::vector<const PrintInstance*> sort_object_instances_by_model_order(const Print& print); | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -64,7 +64,7 @@ std::string PrintBase::output_filename(const std::string &format, const std::str | ||||||
| 		boost::filesystem::path filename = format.empty() ? | 		boost::filesystem::path filename = format.empty() ? | ||||||
| 			cfg.opt_string("input_filename_base") + default_ext : | 			cfg.opt_string("input_filename_base") + default_ext : | ||||||
| 			this->placeholder_parser().process(format, 0, &cfg); | 			this->placeholder_parser().process(format, 0, &cfg); | ||||||
|         if (filename.extension().string() != default_ext) |         if (filename.extension().empty()) | ||||||
|             filename = boost::filesystem::change_extension(filename, default_ext); |             filename = boost::filesystem::change_extension(filename, default_ext); | ||||||
|         return filename.string(); |         return filename.string(); | ||||||
|     } catch (std::runtime_error &err) { |     } catch (std::runtime_error &err) { | ||||||
|  |  | ||||||
|  | @ -47,22 +47,5 @@ | ||||||
| //==================
 | //==================
 | ||||||
| #define ENABLE_2_2_0_BETA1 1 | #define ENABLE_2_2_0_BETA1 1 | ||||||
| 
 | 
 | ||||||
| // Enable using Y axis of 3Dconnexion devices as zoom
 |  | ||||||
| #define ENABLE_3DCONNEXION_Y_AS_ZOOM (1 && ENABLE_2_2_0_BETA1) |  | ||||||
| 
 |  | ||||||
| // Enable a modified version of the toolbar textures where all the icons are separated by 1 pixel
 |  | ||||||
| #define ENABLE_MODIFIED_TOOLBAR_TEXTURES (1 && ENABLE_2_2_0_BETA1) |  | ||||||
| 
 |  | ||||||
| // Enable configurable paths export (fullpath or not) to 3mf and amf
 |  | ||||||
| #define ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF (1 && ENABLE_2_2_0_BETA1) |  | ||||||
| 
 |  | ||||||
| // Enable 6 degrees of freedom camera
 |  | ||||||
| #define ENABLE_6DOF_CAMERA (1 && ENABLE_2_2_0_BETA1) |  | ||||||
| 
 |  | ||||||
| // Enhance reload from disk to be able to work with 3mf/amf files saved with PrusaSlicer 2.1.0 and earlier
 |  | ||||||
| #define ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK (1 && ENABLE_2_2_0_BETA1) |  | ||||||
| 
 |  | ||||||
| // Enable showing object/instance info with labels into the 3D scene
 |  | ||||||
| #define ENABLE_SHOW_SCENE_LABELS (1 && ENABLE_2_2_0_BETA1) |  | ||||||
| 
 | 
 | ||||||
| #endif // _technologies_h_
 | #endif // _technologies_h_
 | ||||||
|  |  | ||||||
|  | @ -131,6 +131,7 @@ set(SLIC3R_GUI_SOURCES | ||||||
|     Utils/Serial.hpp |     Utils/Serial.hpp | ||||||
|     GUI/ConfigWizard.cpp |     GUI/ConfigWizard.cpp | ||||||
|     GUI/ConfigWizard.hpp |     GUI/ConfigWizard.hpp | ||||||
|  |     GUI/ConfigWizard_private.hpp | ||||||
|     GUI/MsgDialog.cpp |     GUI/MsgDialog.cpp | ||||||
|     GUI/MsgDialog.hpp |     GUI/MsgDialog.hpp | ||||||
|     GUI/UpdateDialogs.cpp |     GUI/UpdateDialogs.cpp | ||||||
|  |  | ||||||
|  | @ -260,11 +260,7 @@ Point Bed3D::point_projection(const Point& point) const | ||||||
|     return m_polygon.point_projection(point); |     return m_polygon.point_projection(point); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
| void Bed3D::render(GLCanvas3D& canvas, bool bottom, float scale_factor, bool show_axes) const | void Bed3D::render(GLCanvas3D& canvas, bool bottom, float scale_factor, bool show_axes) const | ||||||
| #else |  | ||||||
| void Bed3D::render(GLCanvas3D& canvas, float theta, float scale_factor, bool show_axes) const |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| { | { | ||||||
|     m_scale_factor = scale_factor; |     m_scale_factor = scale_factor; | ||||||
| 
 | 
 | ||||||
|  | @ -275,15 +271,9 @@ void Bed3D::render(GLCanvas3D& canvas, float theta, float scale_factor, bool sho | ||||||
| 
 | 
 | ||||||
|     switch (m_type) |     switch (m_type) | ||||||
|     { |     { | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     case System: { render_system(canvas, bottom); break; } |     case System: { render_system(canvas, bottom); break; } | ||||||
|     default: |     default: | ||||||
|     case Custom: { render_custom(canvas, bottom); break; } |     case Custom: { render_custom(canvas, bottom); break; } | ||||||
| #else |  | ||||||
|     case System: { render_system(canvas, theta > 90.0f); break; } |  | ||||||
|     default: |  | ||||||
|     case Custom: { render_custom(canvas, theta > 90.0f); break; } |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     glsafe(::glDisable(GL_DEPTH_TEST)); |     glsafe(::glDisable(GL_DEPTH_TEST)); | ||||||
|  |  | ||||||
|  | @ -107,11 +107,7 @@ public: | ||||||
|     bool contains(const Point& point) const; |     bool contains(const Point& point) const; | ||||||
|     Point point_projection(const Point& point) const; |     Point point_projection(const Point& point) const; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     void render(GLCanvas3D& canvas, bool bottom, float scale_factor, bool show_axes) const; |     void render(GLCanvas3D& canvas, bool bottom, float scale_factor, bool show_axes) const; | ||||||
| #else |  | ||||||
|     void render(GLCanvas3D& canvas, float theta, float scale_factor, bool show_axes) const; |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     void calc_bounding_boxes() const; |     void calc_bounding_boxes() const; | ||||||
|  |  | ||||||
|  | @ -61,10 +61,8 @@ void AppConfig::set_defaults() | ||||||
|     if (get("preset_update").empty()) |     if (get("preset_update").empty()) | ||||||
|         set("preset_update", "1"); |         set("preset_update", "1"); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|     if (get("export_sources_full_pathnames").empty()) |     if (get("export_sources_full_pathnames").empty()) | ||||||
|         set("export_sources_full_pathnames", "0"); |         set("export_sources_full_pathnames", "0"); | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
|     // remove old 'use_legacy_opengl' parameter from this config, if present
 |     // remove old 'use_legacy_opengl' parameter from this config, if present
 | ||||||
|     if (!get("use_legacy_opengl").empty()) |     if (!get("use_legacy_opengl").empty()) | ||||||
|  | @ -90,10 +88,8 @@ void AppConfig::set_defaults() | ||||||
|     if (get("use_perspective_camera").empty()) |     if (get("use_perspective_camera").empty()) | ||||||
|         set("use_perspective_camera", "1"); |         set("use_perspective_camera", "1"); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     if (get("use_free_camera").empty()) |     if (get("use_free_camera").empty()) | ||||||
|         set("use_free_camera", "0"); |         set("use_free_camera", "0"); | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
|     // Remove legacy window positions/sizes
 |     // Remove legacy window positions/sizes
 | ||||||
|     erase("", "main_frame_maximized"); |     erase("", "main_frame_maximized"); | ||||||
|  | @ -284,11 +280,7 @@ void AppConfig::set_recent_projects(const std::vector<std::string>& recent_proje | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
| void AppConfig::set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed) | void AppConfig::set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed) | ||||||
| #else |  | ||||||
| void AppConfig::set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone) |  | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
| { | { | ||||||
|     std::string key = std::string("mouse_device:") + name; |     std::string key = std::string("mouse_device:") + name; | ||||||
|     auto it = m_storage.find(key); |     auto it = m_storage.find(key); | ||||||
|  | @ -300,9 +292,7 @@ void AppConfig::set_mouse_device(const std::string& name, double translation_spe | ||||||
|     it->second["translation_deadzone"] = std::to_string(translation_deadzone); |     it->second["translation_deadzone"] = std::to_string(translation_deadzone); | ||||||
|     it->second["rotation_speed"] = std::to_string(rotation_speed); |     it->second["rotation_speed"] = std::to_string(rotation_speed); | ||||||
|     it->second["rotation_deadzone"] = std::to_string(rotation_deadzone); |     it->second["rotation_deadzone"] = std::to_string(rotation_deadzone); | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|     it->second["zoom_speed"] = std::to_string(zoom_speed); |     it->second["zoom_speed"] = std::to_string(zoom_speed); | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool AppConfig::get_mouse_device_translation_speed(const std::string& name, double& speed) | bool AppConfig::get_mouse_device_translation_speed(const std::string& name, double& speed) | ||||||
|  | @ -365,7 +355,6 @@ bool AppConfig::get_mouse_device_rotation_deadzone(const std::string& name, floa | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
| bool AppConfig::get_mouse_device_zoom_speed(const std::string& name, double& speed) | bool AppConfig::get_mouse_device_zoom_speed(const std::string& name, double& speed) | ||||||
| { | { | ||||||
|     std::string key = std::string("mouse_device:") + name; |     std::string key = std::string("mouse_device:") + name; | ||||||
|  | @ -380,7 +369,6 @@ bool AppConfig::get_mouse_device_zoom_speed(const std::string& name, double& spe | ||||||
|     speed = (float)::atof(it_val->second.c_str()); |     speed = (float)::atof(it_val->second.c_str()); | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
| 
 | 
 | ||||||
| void AppConfig::update_config_dir(const std::string &dir) | void AppConfig::update_config_dir(const std::string &dir) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -133,18 +133,12 @@ public: | ||||||
|     std::vector<std::string> get_recent_projects() const; |     std::vector<std::string> get_recent_projects() const; | ||||||
|     void set_recent_projects(const std::vector<std::string>& recent_projects); |     void set_recent_projects(const std::vector<std::string>& recent_projects); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
| 	void set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed); | 	void set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone, double zoom_speed); | ||||||
| #else |  | ||||||
| 	void set_mouse_device(const std::string& name, double translation_speed, double translation_deadzone, float rotation_speed, float rotation_deadzone); |  | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
| 	bool get_mouse_device_translation_speed(const std::string& name, double& speed); | 	bool get_mouse_device_translation_speed(const std::string& name, double& speed); | ||||||
|     bool get_mouse_device_translation_deadzone(const std::string& name, double& deadzone); |     bool get_mouse_device_translation_deadzone(const std::string& name, double& deadzone); | ||||||
|     bool get_mouse_device_rotation_speed(const std::string& name, float& speed); |     bool get_mouse_device_rotation_speed(const std::string& name, float& speed); | ||||||
|     bool get_mouse_device_rotation_deadzone(const std::string& name, float& deadzone); |     bool get_mouse_device_rotation_deadzone(const std::string& name, float& deadzone); | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
| 	bool get_mouse_device_zoom_speed(const std::string& name, double& speed); | 	bool get_mouse_device_zoom_speed(const std::string& name, double& speed); | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
| 
 | 
 | ||||||
| 	static const std::string SECTION_FILAMENTS; | 	static const std::string SECTION_FILAMENTS; | ||||||
|     static const std::string SECTION_MATERIALS; |     static const std::string SECTION_MATERIALS; | ||||||
|  |  | ||||||
|  | @ -7,17 +7,11 @@ | ||||||
| #include "GUI_App.hpp" | #include "GUI_App.hpp" | ||||||
| #include "AppConfig.hpp" | #include "AppConfig.hpp" | ||||||
| #if ENABLE_CAMERA_STATISTICS | #if ENABLE_CAMERA_STATISTICS | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
| #include "Mouse3DController.hpp" | #include "Mouse3DController.hpp" | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| #endif // ENABLE_CAMERA_STATISTICS
 | #endif // ENABLE_CAMERA_STATISTICS
 | ||||||
| 
 | 
 | ||||||
| #include <GL/glew.h> | #include <GL/glew.h> | ||||||
| 
 | 
 | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
| static const float GIMBALL_LOCK_THETA_MAX = 180.0f; |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 |  | ||||||
| // phi / theta angles to orient the camera.
 | // phi / theta angles to orient the camera.
 | ||||||
| static const float VIEW_DEFAULT[2] = { 45.0f, 45.0f }; | static const float VIEW_DEFAULT[2] = { 45.0f, 45.0f }; | ||||||
| static const float VIEW_LEFT[2] = { 90.0f, 90.0f }; | static const float VIEW_LEFT[2] = { 90.0f, 90.0f }; | ||||||
|  | @ -41,29 +35,17 @@ double Camera::FrustrumZMargin = 10.0; | ||||||
| double Camera::MaxFovDeg = 60.0; | double Camera::MaxFovDeg = 60.0; | ||||||
| 
 | 
 | ||||||
| Camera::Camera() | Camera::Camera() | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     : requires_zoom_to_bed(false) |     : requires_zoom_to_bed(false) | ||||||
| #else |  | ||||||
|     : phi(45.0f) |  | ||||||
|     , requires_zoom_to_bed(false) |  | ||||||
|     , inverted_phi(false) |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     , m_type(Perspective) |     , m_type(Perspective) | ||||||
|     , m_target(Vec3d::Zero()) |     , m_target(Vec3d::Zero()) | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     , m_zenit(45.0f) |     , m_zenit(45.0f) | ||||||
| #else |  | ||||||
|     , m_theta(45.0f) |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     , m_zoom(1.0) |     , m_zoom(1.0) | ||||||
|     , m_distance(DefaultDistance) |     , m_distance(DefaultDistance) | ||||||
|     , m_gui_scale(1.0) |     , m_gui_scale(1.0) | ||||||
|     , m_view_matrix(Transform3d::Identity()) |     , m_view_matrix(Transform3d::Identity()) | ||||||
|     , m_projection_matrix(Transform3d::Identity()) |     , m_projection_matrix(Transform3d::Identity()) | ||||||
| { | { | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     set_default_orientation(); |     set_default_orientation(); | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| std::string Camera::get_type_as_string() const | std::string Camera::get_type_as_string() const | ||||||
|  | @ -103,36 +85,9 @@ void Camera::select_next_type() | ||||||
| 
 | 
 | ||||||
| void Camera::set_target(const Vec3d& target) | void Camera::set_target(const Vec3d& target) | ||||||
| { | { | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     translate_world(target - m_target); |     translate_world(target - m_target); | ||||||
| #else |  | ||||||
|     BoundingBoxf3 test_box = m_scene_box; |  | ||||||
|     test_box.translate(-m_scene_box.center()); |  | ||||||
|     // We may let this factor be customizable
 |  | ||||||
|     static const double ScaleFactor = 1.5; |  | ||||||
|     test_box.scale(ScaleFactor); |  | ||||||
|     test_box.translate(m_scene_box.center()); |  | ||||||
| 
 |  | ||||||
|     m_target(0) = clamp(test_box.min(0), test_box.max(0), target(0)); |  | ||||||
|     m_target(1) = clamp(test_box.min(1), test_box.max(1), target(1)); |  | ||||||
|     m_target(2) = clamp(test_box.min(2), test_box.max(2), target(2)); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
| void Camera::set_theta(float theta, bool apply_limit) |  | ||||||
| { |  | ||||||
|     if (apply_limit) |  | ||||||
|         m_theta = clamp(0.0f, GIMBALL_LOCK_THETA_MAX, theta); |  | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         m_theta = fmod(theta, 360.0f); |  | ||||||
|         if (m_theta < 0.0f) |  | ||||||
|             m_theta += 360.0f; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 |  | ||||||
| void Camera::update_zoom(double delta_zoom) | void Camera::update_zoom(double delta_zoom) | ||||||
| { | { | ||||||
|     set_zoom(m_zoom / (1.0 - std::max(std::min(delta_zoom, 4.0), -4.0) * 0.1)); |     set_zoom(m_zoom / (1.0 - std::max(std::min(delta_zoom, 4.0), -4.0) * 0.1)); | ||||||
|  | @ -149,7 +104,6 @@ void Camera::set_zoom(double zoom) | ||||||
|     m_zoom = std::min(zoom, max_zoom()); |     m_zoom = std::min(zoom, max_zoom()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
| void Camera::select_view(const std::string& direction) | void Camera::select_view(const std::string& direction) | ||||||
| { | { | ||||||
|     if (direction == "iso") |     if (direction == "iso") | ||||||
|  | @ -167,36 +121,6 @@ void Camera::select_view(const std::string& direction) | ||||||
|     else if (direction == "rear") |     else if (direction == "rear") | ||||||
|         look_at(m_target + m_distance * Vec3d::UnitY(), m_target, Vec3d::UnitZ()); |         look_at(m_target + m_distance * Vec3d::UnitY(), m_target, Vec3d::UnitZ()); | ||||||
| } | } | ||||||
| #else |  | ||||||
| bool Camera::select_view(const std::string& direction) |  | ||||||
| { |  | ||||||
|     const float* dir_vec = nullptr; |  | ||||||
| 
 |  | ||||||
|     if (direction == "iso") |  | ||||||
|         dir_vec = VIEW_DEFAULT; |  | ||||||
|     else if (direction == "left") |  | ||||||
|         dir_vec = VIEW_LEFT; |  | ||||||
|     else if (direction == "right") |  | ||||||
|         dir_vec = VIEW_RIGHT; |  | ||||||
|     else if (direction == "top") |  | ||||||
|         dir_vec = VIEW_TOP; |  | ||||||
|     else if (direction == "bottom") |  | ||||||
|         dir_vec = VIEW_BOTTOM; |  | ||||||
|     else if (direction == "front") |  | ||||||
|         dir_vec = VIEW_FRONT; |  | ||||||
|     else if (direction == "rear") |  | ||||||
|         dir_vec = VIEW_REAR; |  | ||||||
| 
 |  | ||||||
|     if (dir_vec != nullptr) |  | ||||||
|     { |  | ||||||
|         phi = dir_vec[0]; |  | ||||||
|         set_theta(dir_vec[1], false); |  | ||||||
|         return true; |  | ||||||
|     } |  | ||||||
|     else |  | ||||||
|         return false; |  | ||||||
| } |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
| double Camera::get_fov() const | double Camera::get_fov() const | ||||||
| { | { | ||||||
|  | @ -218,48 +142,21 @@ void Camera::apply_viewport(int x, int y, unsigned int w, unsigned int h) const | ||||||
| 
 | 
 | ||||||
| void Camera::apply_view_matrix() const | void Camera::apply_view_matrix() const | ||||||
| { | { | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|     double theta_rad = Geometry::deg2rad(-(double)m_theta); |  | ||||||
|     double phi_rad = Geometry::deg2rad((double)phi); |  | ||||||
|     double sin_theta = ::sin(theta_rad); |  | ||||||
|     Vec3d camera_pos = m_target + m_distance * Vec3d(sin_theta * ::sin(phi_rad), sin_theta * ::cos(phi_rad), ::cos(theta_rad)); |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 |  | ||||||
|     glsafe(::glMatrixMode(GL_MODELVIEW)); |     glsafe(::glMatrixMode(GL_MODELVIEW)); | ||||||
|     glsafe(::glLoadIdentity()); |     glsafe(::glLoadIdentity()); | ||||||
| 
 |  | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     glsafe(::glMultMatrixd(m_view_matrix.data())); |     glsafe(::glMultMatrixd(m_view_matrix.data())); | ||||||
| #else |  | ||||||
|     glsafe(::glRotatef(-m_theta, 1.0f, 0.0f, 0.0f)); // pitch
 |  | ||||||
|     glsafe(::glRotatef(phi, 0.0f, 0.0f, 1.0f));      // yaw
 |  | ||||||
| 
 |  | ||||||
|     glsafe(::glTranslated(-camera_pos(0), -camera_pos(1), -camera_pos(2)));  |  | ||||||
| 
 |  | ||||||
|     glsafe(::glGetDoublev(GL_MODELVIEW_MATRIX, m_view_matrix.data())); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Camera::apply_projection(const BoundingBoxf3& box, double near_z, double far_z) const | void Camera::apply_projection(const BoundingBoxf3& box, double near_z, double far_z) const | ||||||
| { | { | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|     set_distance(DefaultDistance); |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 |  | ||||||
|     double w = 0.0; |     double w = 0.0; | ||||||
|     double h = 0.0; |     double h = 0.0; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     double old_distance = m_distance; |     double old_distance = m_distance; | ||||||
|     m_frustrum_zs = calc_tight_frustrum_zs_around(box); |     m_frustrum_zs = calc_tight_frustrum_zs_around(box); | ||||||
|     if (m_distance != old_distance) |     if (m_distance != old_distance) | ||||||
|         // the camera has been moved re-apply view matrix
 |         // the camera has been moved re-apply view matrix
 | ||||||
|         apply_view_matrix(); |         apply_view_matrix(); | ||||||
| #else |  | ||||||
|     while (true) |  | ||||||
|     { |  | ||||||
|         m_frustrum_zs = calc_tight_frustrum_zs_around(box); |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
|     if (near_z > 0.0) |     if (near_z > 0.0) | ||||||
|         m_frustrum_zs.first = std::max(std::min(m_frustrum_zs.first, near_z), FrustrumMinNearZ); |         m_frustrum_zs.first = std::max(std::min(m_frustrum_zs.first, near_z), FrustrumMinNearZ); | ||||||
|  | @ -293,28 +190,6 @@ void Camera::apply_projection(const BoundingBoxf3& box, double near_z, double fa | ||||||
|     } |     } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|         if (m_type == Perspective) |  | ||||||
|         { |  | ||||||
|             double fov_deg = Geometry::rad2deg(2.0 * std::atan(h / m_frustrum_zs.first)); |  | ||||||
| 
 |  | ||||||
|             // adjust camera distance to keep fov in a limited range
 |  | ||||||
|             if (fov_deg > MaxFovDeg) |  | ||||||
|             { |  | ||||||
|                 double delta_z = h / ::tan(0.5 * Geometry::deg2rad(MaxFovDeg)) - m_frustrum_zs.first; |  | ||||||
|                 if (delta_z > 0.001) |  | ||||||
|                     set_distance(m_distance + delta_z); |  | ||||||
|                 else |  | ||||||
|                     break; |  | ||||||
|             } |  | ||||||
|             else |  | ||||||
|                 break; |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|             break; |  | ||||||
|     } |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 |  | ||||||
|     glsafe(::glMatrixMode(GL_PROJECTION)); |     glsafe(::glMatrixMode(GL_PROJECTION)); | ||||||
|     glsafe(::glLoadIdentity()); |     glsafe(::glLoadIdentity()); | ||||||
| 
 | 
 | ||||||
|  | @ -338,22 +213,14 @@ void Camera::apply_projection(const BoundingBoxf3& box, double near_z, double fa | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
| void Camera::zoom_to_box(const BoundingBoxf3& box, double margin_factor) | void Camera::zoom_to_box(const BoundingBoxf3& box, double margin_factor) | ||||||
| #else | #else | ||||||
| void Camera::zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h, double margin_factor) |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| #else |  | ||||||
| void Camera::zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h) | void Camera::zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h) | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
| { | { | ||||||
|     // Calculate the zoom factor needed to adjust the view around the given box.
 |     // Calculate the zoom factor needed to adjust the view around the given box.
 | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     double zoom = calc_zoom_to_bounding_box_factor(box, margin_factor); |     double zoom = calc_zoom_to_bounding_box_factor(box, margin_factor); | ||||||
| #else |  | ||||||
|     double zoom = calc_zoom_to_bounding_box_factor(box, canvas_w, canvas_h, margin_factor); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| #else | #else | ||||||
|     double zoom = calc_zoom_to_bounding_box_factor(box, canvas_w, canvas_h); |     double zoom = calc_zoom_to_bounding_box_factor(box, canvas_w, canvas_h); | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
|  | @ -361,36 +228,20 @@ void Camera::zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h) | ||||||
|     { |     { | ||||||
|         m_zoom = zoom; |         m_zoom = zoom; | ||||||
|         // center view around box center
 |         // center view around box center
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|         set_target(box.center()); |         set_target(box.center()); | ||||||
| #else |  | ||||||
|         m_target = box.center(); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
| void Camera::zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor) | void Camera::zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor) | ||||||
| #else |  | ||||||
| void Camera::zoom_to_volumes(const GLVolumePtrs& volumes, int canvas_w, int canvas_h, double margin_factor) |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| { | { | ||||||
|     Vec3d center; |     Vec3d center; | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     double zoom = calc_zoom_to_volumes_factor(volumes, center, margin_factor); |     double zoom = calc_zoom_to_volumes_factor(volumes, center, margin_factor); | ||||||
| #else |  | ||||||
|     double zoom = calc_zoom_to_volumes_factor(volumes, canvas_w, canvas_h, center, margin_factor); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     if (zoom > 0.0) |     if (zoom > 0.0) | ||||||
|     { |     { | ||||||
|         m_zoom = zoom; |         m_zoom = zoom; | ||||||
|         // center view around the calculated center
 |         // center view around the calculated center
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|         set_target(center); |         set_target(center); | ||||||
| #else |  | ||||||
|         m_target = center; |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
|  | @ -402,18 +253,15 @@ void Camera::debug_render() const | ||||||
|     imgui.begin(std::string("Camera statistics"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); |     imgui.begin(std::string("Camera statistics"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse); | ||||||
| 
 | 
 | ||||||
|     std::string type = get_type_as_string(); |     std::string type = get_type_as_string(); | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     if (wxGetApp().plater()->get_mouse3d_controller().is_running() || (wxGetApp().app_config->get("use_free_camera") == "1")) |     if (wxGetApp().plater()->get_mouse3d_controller().is_running() || (wxGetApp().app_config->get("use_free_camera") == "1")) | ||||||
|         type += "/free"; |         type += "/free"; | ||||||
|     else |     else | ||||||
|         type += "/constrained"; |         type += "/constrained"; | ||||||
| #endif // ENABLE_6DOF_CAMERA
 | 
 | ||||||
|     Vec3f position = get_position().cast<float>(); |     Vec3f position = get_position().cast<float>(); | ||||||
|     Vec3f target = m_target.cast<float>(); |     Vec3f target = m_target.cast<float>(); | ||||||
|     float distance = (float)get_distance(); |     float distance = (float)get_distance(); | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     float zenit = (float)m_zenit; |     float zenit = (float)m_zenit; | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     Vec3f forward = get_dir_forward().cast<float>(); |     Vec3f forward = get_dir_forward().cast<float>(); | ||||||
|     Vec3f right = get_dir_right().cast<float>(); |     Vec3f right = get_dir_right().cast<float>(); | ||||||
|     Vec3f up = get_dir_up().cast<float>(); |     Vec3f up = get_dir_up().cast<float>(); | ||||||
|  | @ -430,10 +278,8 @@ void Camera::debug_render() const | ||||||
|     ImGui::InputFloat3("Position", position.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); |     ImGui::InputFloat3("Position", position.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); | ||||||
|     ImGui::InputFloat3("Target", target.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); |     ImGui::InputFloat3("Target", target.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); | ||||||
|     ImGui::InputFloat("Distance", &distance, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); |     ImGui::InputFloat("Distance", &distance, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     ImGui::Separator(); |     ImGui::Separator(); | ||||||
|     ImGui::InputFloat("Zenit", &zenit, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); |     ImGui::InputFloat("Zenit", &zenit, 0.0f, 0.0f, "%.6f", ImGuiInputTextFlags_ReadOnly); | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     ImGui::Separator(); |     ImGui::Separator(); | ||||||
|     ImGui::InputFloat3("Forward", forward.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); |     ImGui::InputFloat3("Forward", forward.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); | ||||||
|     ImGui::InputFloat3("Right", right.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); |     ImGui::InputFloat3("Right", right.data(), "%.6f", ImGuiInputTextFlags_ReadOnly); | ||||||
|  | @ -453,7 +299,6 @@ void Camera::debug_render() const | ||||||
| } | } | ||||||
| #endif // ENABLE_CAMERA_STATISTICS
 | #endif // ENABLE_CAMERA_STATISTICS
 | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
| void Camera::translate_world(const Vec3d& displacement) | void Camera::translate_world(const Vec3d& displacement) | ||||||
| { | { | ||||||
|     Vec3d new_target = validate_target(m_target + displacement); |     Vec3d new_target = validate_target(m_target + displacement); | ||||||
|  | @ -524,15 +369,10 @@ void Camera::rotate_local_around_pivot(const Vec3d& rotation_rad, const Vec3d& p | ||||||
|     translate_world(center); |     translate_world(center); | ||||||
|     update_zenit(); |     update_zenit(); | ||||||
| } | } | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
| double Camera::min_zoom() const | double Camera::min_zoom() const | ||||||
| { | { | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     return 0.7 * calc_zoom_to_bounding_box_factor(m_scene_box); |     return 0.7 * calc_zoom_to_bounding_box_factor(m_scene_box); | ||||||
| #else |  | ||||||
|     return 0.7 * calc_zoom_to_bounding_box_factor(m_scene_box, m_viewport[2], m_viewport[3]); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| std::pair<double, double> Camera::calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const | std::pair<double, double> Camera::calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const | ||||||
|  | @ -540,10 +380,6 @@ std::pair<double, double> Camera::calc_tight_frustrum_zs_around(const BoundingBo | ||||||
|     std::pair<double, double> ret; |     std::pair<double, double> ret; | ||||||
|     auto& [near_z, far_z] = ret; |     auto& [near_z, far_z] = ret; | ||||||
| 
 | 
 | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|     while (true) |  | ||||||
|     { |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
|     // box in eye space
 |     // box in eye space
 | ||||||
|     BoundingBoxf3 eye_box = box.transformed(m_view_matrix); |     BoundingBoxf3 eye_box = box.transformed(m_view_matrix); | ||||||
|     near_z = -eye_box.max(2); |     near_z = -eye_box.max(2); | ||||||
|  | @ -562,7 +398,6 @@ std::pair<double, double> Camera::calc_tight_frustrum_zs_around(const BoundingBo | ||||||
|         far_z = mid_z + half_size; |         far_z = mid_z + half_size; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     if (near_z < FrustrumMinNearZ) |     if (near_z < FrustrumMinNearZ) | ||||||
|     { |     { | ||||||
|         float delta = FrustrumMinNearZ - near_z; |         float delta = FrustrumMinNearZ - near_z; | ||||||
|  | @ -577,25 +412,13 @@ std::pair<double, double> Camera::calc_tight_frustrum_zs_around(const BoundingBo | ||||||
|         near_z -= delta; |         near_z -= delta; | ||||||
|         far_z -= delta; |         far_z -= delta; | ||||||
|     } |     } | ||||||
| #else |  | ||||||
|         if (near_z >= FrustrumMinNearZ) |  | ||||||
|             break; |  | ||||||
| 
 |  | ||||||
|         // ensure min near z
 |  | ||||||
|         set_distance(m_distance + FrustrumMinNearZ - near_z); |  | ||||||
|     } |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
|     return ret; |     return ret; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
| double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double margin_factor) const | double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double margin_factor) const | ||||||
| #else | #else | ||||||
| double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h, double margin_factor) const |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| #else |  | ||||||
| double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const | double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
| { | { | ||||||
|  | @ -606,11 +429,6 @@ double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int ca | ||||||
|     // project the box vertices on a plane perpendicular to the camera forward axis
 |     // project the box vertices on a plane perpendicular to the camera forward axis
 | ||||||
|     // then calculates the vertices coordinate on this plane along the camera xy axes
 |     // then calculates the vertices coordinate on this plane along the camera xy axes
 | ||||||
| 
 | 
 | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|     // ensure that the view matrix is updated
 |  | ||||||
|     apply_view_matrix(); |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 |  | ||||||
|     Vec3d right = get_dir_right(); |     Vec3d right = get_dir_right(); | ||||||
|     Vec3d up = get_dir_up(); |     Vec3d up = get_dir_up(); | ||||||
|     Vec3d forward = get_dir_forward(); |     Vec3d forward = get_dir_forward(); | ||||||
|  | @ -666,19 +484,11 @@ double Camera::calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int ca | ||||||
|     dx *= margin_factor; |     dx *= margin_factor; | ||||||
|     dy *= margin_factor; |     dy *= margin_factor; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     return std::min((double)m_viewport[2] / dx, (double)m_viewport[3] / dy); |     return std::min((double)m_viewport[2] / dx, (double)m_viewport[3] / dy); | ||||||
| #else |  | ||||||
|     return std::min((double)canvas_w / dx, (double)canvas_h / dy); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
| double Camera::calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& center, double margin_factor) const | double Camera::calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& center, double margin_factor) const | ||||||
| #else |  | ||||||
| double Camera::calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, int canvas_w, int canvas_h, Vec3d& center, double margin_factor) const |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| { | { | ||||||
|     if (volumes.empty()) |     if (volumes.empty()) | ||||||
|         return -1.0; |         return -1.0; | ||||||
|  | @ -686,11 +496,6 @@ double Camera::calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, int canv | ||||||
|     // project the volumes vertices on a plane perpendicular to the camera forward axis
 |     // project the volumes vertices on a plane perpendicular to the camera forward axis
 | ||||||
|     // then calculates the vertices coordinate on this plane along the camera xy axes
 |     // then calculates the vertices coordinate on this plane along the camera xy axes
 | ||||||
| 
 | 
 | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|     // ensure that the view matrix is updated
 |  | ||||||
|     apply_view_matrix(); |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 |  | ||||||
|     Vec3d right = get_dir_right(); |     Vec3d right = get_dir_right(); | ||||||
|     Vec3d up = get_dir_up(); |     Vec3d up = get_dir_up(); | ||||||
|     Vec3d forward = get_dir_forward(); |     Vec3d forward = get_dir_forward(); | ||||||
|  | @ -741,29 +546,19 @@ double Camera::calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, int canv | ||||||
|     if ((dx <= 0.0) || (dy <= 0.0)) |     if ((dx <= 0.0) || (dy <= 0.0)) | ||||||
|         return -1.0f; |         return -1.0f; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     return std::min((double)m_viewport[2] / dx, (double)m_viewport[3] / dy); |     return std::min((double)m_viewport[2] / dx, (double)m_viewport[3] / dy); | ||||||
| #else |  | ||||||
|     return std::min((double)canvas_w / dx, (double)canvas_h / dy); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| } | } | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
| 
 | 
 | ||||||
| void Camera::set_distance(double distance) const | void Camera::set_distance(double distance) const | ||||||
| { | { | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     if (m_distance != distance) |     if (m_distance != distance) | ||||||
|     { |     { | ||||||
|         m_view_matrix.translate((distance - m_distance) * get_dir_forward()); |         m_view_matrix.translate((distance - m_distance) * get_dir_forward()); | ||||||
|         m_distance = distance; |         m_distance = distance; | ||||||
|     } |     } | ||||||
| #else |  | ||||||
|     m_distance = distance; |  | ||||||
|     apply_view_matrix(); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
| void Camera::look_at(const Vec3d& position, const Vec3d& target, const Vec3d& up) | void Camera::look_at(const Vec3d& position, const Vec3d& target, const Vec3d& up) | ||||||
| { | { | ||||||
|     Vec3d unit_z = (position - target).normalized(); |     Vec3d unit_z = (position - target).normalized(); | ||||||
|  | @ -825,7 +620,6 @@ void Camera::update_zenit() | ||||||
| { | { | ||||||
|     m_zenit = Geometry::rad2deg(0.5 * M_PI - std::acos(std::clamp(-get_dir_forward().dot(Vec3d::UnitZ()), -1.0, 1.0))); |     m_zenit = Geometry::rad2deg(0.5 * M_PI - std::acos(std::clamp(-get_dir_forward().dot(Vec3d::UnitZ()), -1.0, 1.0))); | ||||||
| } | } | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
| } // GUI
 | } // GUI
 | ||||||
| } // Slic3r
 | } // Slic3r
 | ||||||
|  |  | ||||||
|  | @ -30,20 +30,12 @@ struct Camera | ||||||
|         Num_types |         Num_types | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|     float phi; |  | ||||||
|     bool inverted_phi; |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
|     bool requires_zoom_to_bed; |     bool requires_zoom_to_bed; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     EType m_type; |     EType m_type; | ||||||
|     Vec3d m_target; |     Vec3d m_target; | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     float m_zenit; |     float m_zenit; | ||||||
| #else |  | ||||||
|     float m_theta; |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     double m_zoom; |     double m_zoom; | ||||||
|     // Distance between camera position and camera target measured along the camera Z axis
 |     // Distance between camera position and camera target measured along the camera Z axis
 | ||||||
|     mutable double m_distance; |     mutable double m_distance; | ||||||
|  | @ -69,18 +61,9 @@ public: | ||||||
|     const Vec3d& get_target() const { return m_target; } |     const Vec3d& get_target() const { return m_target; } | ||||||
|     void set_target(const Vec3d& target); |     void set_target(const Vec3d& target); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     double get_distance() const { return (get_position() - m_target).norm(); } |     double get_distance() const { return (get_position() - m_target).norm(); } | ||||||
| #else |  | ||||||
|     double get_distance() const { return m_distance; } |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     double get_gui_scale() const { return m_gui_scale; } |     double get_gui_scale() const { return m_gui_scale; } | ||||||
| 
 | 
 | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|     float get_theta() const { return m_theta; } |  | ||||||
|     void set_theta(float theta, bool apply_limit); |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 |  | ||||||
|     double get_zoom() const { return m_zoom; } |     double get_zoom() const { return m_zoom; } | ||||||
|     double get_inv_zoom() const { assert(m_zoom != 0.0); return 1.0 / m_zoom; } |     double get_inv_zoom() const { assert(m_zoom != 0.0); return 1.0 / m_zoom; } | ||||||
|     void update_zoom(double delta_zoom); |     void update_zoom(double delta_zoom); | ||||||
|  | @ -89,11 +72,7 @@ public: | ||||||
|     const BoundingBoxf3& get_scene_box() const { return m_scene_box; } |     const BoundingBoxf3& get_scene_box() const { return m_scene_box; } | ||||||
|     void set_scene_box(const BoundingBoxf3& box) { m_scene_box = box; } |     void set_scene_box(const BoundingBoxf3& box) { m_scene_box = box; } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     void select_view(const std::string& direction); |     void select_view(const std::string& direction); | ||||||
| #else |  | ||||||
|     bool select_view(const std::string& direction); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
|     const std::array<int, 4>& get_viewport() const { return m_viewport; } |     const std::array<int, 4>& get_viewport() const { return m_viewport; } | ||||||
|     const Transform3d& get_view_matrix() const { return m_view_matrix; } |     const Transform3d& get_view_matrix() const { return m_view_matrix; } | ||||||
|  | @ -117,13 +96,8 @@ public: | ||||||
|     void apply_projection(const BoundingBoxf3& box, double near_z = -1.0, double far_z = -1.0) const; |     void apply_projection(const BoundingBoxf3& box, double near_z = -1.0, double far_z = -1.0) const; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     void zoom_to_box(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor); |     void zoom_to_box(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor); | ||||||
|     void zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor = DefaultZoomToVolumesMarginFactor); |     void zoom_to_volumes(const GLVolumePtrs& volumes, double margin_factor = DefaultZoomToVolumesMarginFactor); | ||||||
| #else |  | ||||||
|     void zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h, double margin_factor = DefaultZoomToBoxMarginFactor); |  | ||||||
|     void zoom_to_volumes(const GLVolumePtrs& volumes, int canvas_w, int canvas_h, double margin_factor = DefaultZoomToVolumesMarginFactor); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| #else | #else | ||||||
|     void zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h); |     void zoom_to_box(const BoundingBoxf3& box, int canvas_w, int canvas_h); | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
|  | @ -132,7 +106,6 @@ public: | ||||||
|     void debug_render() const; |     void debug_render() const; | ||||||
| #endif // ENABLE_CAMERA_STATISTICS
 | #endif // ENABLE_CAMERA_STATISTICS
 | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     // translate the camera in world space
 |     // translate the camera in world space
 | ||||||
|     void translate_world(const Vec3d& displacement); |     void translate_world(const Vec3d& displacement); | ||||||
| 
 | 
 | ||||||
|  | @ -149,7 +122,7 @@ public: | ||||||
| 
 | 
 | ||||||
|     // returns true if the camera z axis (forward) is pointing in the negative direction of the world z axis
 |     // returns true if the camera z axis (forward) is pointing in the negative direction of the world z axis
 | ||||||
|     bool is_looking_downward() const { return get_dir_forward().dot(Vec3d::UnitZ()) < 0.0; } |     bool is_looking_downward() const { return get_dir_forward().dot(Vec3d::UnitZ()) < 0.0; } | ||||||
| #endif // ENABLE_6DOF_CAMERA
 | 
 | ||||||
|     double max_zoom() const { return 100.0; } |     double max_zoom() const { return 100.0; } | ||||||
|     double min_zoom() const; |     double min_zoom() const; | ||||||
| 
 | 
 | ||||||
|  | @ -158,24 +131,17 @@ private: | ||||||
|     // the camera MUST be outside of the bounding box in eye coordinate of the given box
 |     // the camera MUST be outside of the bounding box in eye coordinate of the given box
 | ||||||
|     std::pair<double, double> calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const; |     std::pair<double, double> calc_tight_frustrum_zs_around(const BoundingBoxf3& box) const; | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor) const; |     double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, double margin_factor = DefaultZoomToBoxMarginFactor) const; | ||||||
|     double calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& center, double margin_factor = DefaultZoomToVolumesMarginFactor) const; |     double calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, Vec3d& center, double margin_factor = DefaultZoomToVolumesMarginFactor) const; | ||||||
| #else |  | ||||||
|     double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h, double margin_factor = DefaultZoomToBoxMarginFactor) const; |  | ||||||
|     double calc_zoom_to_volumes_factor(const GLVolumePtrs& volumes, int canvas_w, int canvas_h, Vec3d& center, double margin_factor = DefaultZoomToVolumesMarginFactor) const; |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| #else | #else | ||||||
|     double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const; |     double calc_zoom_to_bounding_box_factor(const BoundingBoxf3& box, int canvas_w, int canvas_h) const; | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
|     void set_distance(double distance) const; |     void set_distance(double distance) const; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     void look_at(const Vec3d& position, const Vec3d& target, const Vec3d& up); |     void look_at(const Vec3d& position, const Vec3d& target, const Vec3d& up); | ||||||
|     void set_default_orientation(); |     void set_default_orientation(); | ||||||
|     Vec3d validate_target(const Vec3d& target) const; |     Vec3d validate_target(const Vec3d& target) const; | ||||||
|     void update_zenit(); |     void update_zenit(); | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // GUI
 | } // GUI
 | ||||||
|  |  | ||||||
|  | @ -793,7 +793,6 @@ PageUpdate::PageUpdate(ConfigWizard *parent) | ||||||
|     box_presets->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &event) { this->preset_update = event.IsChecked(); }); |     box_presets->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent &event) { this->preset_update = event.IsChecked(); }); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| PageReloadFromDisk::PageReloadFromDisk(ConfigWizard* parent) | PageReloadFromDisk::PageReloadFromDisk(ConfigWizard* parent) | ||||||
|     : ConfigWizardPage(parent, _(L("Reload from disk")), _(L("Reload from disk"))) |     : ConfigWizardPage(parent, _(L("Reload from disk")), _(L("Reload from disk"))) | ||||||
|     , full_pathnames(false) |     , full_pathnames(false) | ||||||
|  | @ -808,7 +807,6 @@ PageReloadFromDisk::PageReloadFromDisk(ConfigWizard* parent) | ||||||
| 
 | 
 | ||||||
|     box_pathnames->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { this->full_pathnames = event.IsChecked(); }); |     box_pathnames->Bind(wxEVT_CHECKBOX, [this](wxCommandEvent& event) { this->full_pathnames = event.IsChecked(); }); | ||||||
| } | } | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
| PageMode::PageMode(ConfigWizard *parent) | PageMode::PageMode(ConfigWizard *parent) | ||||||
|     : ConfigWizardPage(parent, _(L("View mode")), _(L("View mode"))) |     : ConfigWizardPage(parent, _(L("View mode")), _(L("View mode"))) | ||||||
|  | @ -1401,9 +1399,7 @@ void ConfigWizard::priv::load_pages() | ||||||
|     btn_finish->Enable(any_fff_selected || any_sla_selected); |     btn_finish->Enable(any_fff_selected || any_sla_selected); | ||||||
| 
 | 
 | ||||||
|     index->add_page(page_update); |     index->add_page(page_update); | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|     index->add_page(page_reload_from_disk); |     index->add_page(page_reload_from_disk); | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
|     index->add_page(page_mode); |     index->add_page(page_mode); | ||||||
| 
 | 
 | ||||||
|     index->go_to(former_active);   // Will restore the active item/page if possible
 |     index->go_to(former_active);   // Will restore the active item/page if possible
 | ||||||
|  | @ -1853,10 +1849,7 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese | ||||||
|     } |     } | ||||||
|     app_config->set("version_check", page_update->version_check ? "1" : "0"); |     app_config->set("version_check", page_update->version_check ? "1" : "0"); | ||||||
|     app_config->set("preset_update", page_update->preset_update ? "1" : "0"); |     app_config->set("preset_update", page_update->preset_update ? "1" : "0"); | ||||||
| 
 |  | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|     app_config->set("export_sources_full_pathnames", page_reload_from_disk->full_pathnames ? "1" : "0"); |     app_config->set("export_sources_full_pathnames", page_reload_from_disk->full_pathnames ? "1" : "0"); | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
|     page_mode->serialize_mode(app_config); |     page_mode->serialize_mode(app_config); | ||||||
| 
 | 
 | ||||||
|  | @ -2017,9 +2010,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent) | ||||||
| 
 | 
 | ||||||
|     p->add_page(p->page_custom   = new PageCustom(this)); |     p->add_page(p->page_custom   = new PageCustom(this)); | ||||||
|     p->add_page(p->page_update   = new PageUpdate(this)); |     p->add_page(p->page_update   = new PageUpdate(this)); | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|     p->add_page(p->page_reload_from_disk = new PageReloadFromDisk(this)); |     p->add_page(p->page_reload_from_disk = new PageReloadFromDisk(this)); | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
|     p->add_page(p->page_mode     = new PageMode(this)); |     p->add_page(p->page_mode     = new PageMode(this)); | ||||||
|     p->add_page(p->page_firmware = new PageFirmware(this)); |     p->add_page(p->page_firmware = new PageFirmware(this)); | ||||||
|     p->add_page(p->page_bed      = new PageBedShape(this)); |     p->add_page(p->page_bed      = new PageBedShape(this)); | ||||||
|  |  | ||||||
|  | @ -305,16 +305,12 @@ struct PageUpdate: ConfigWizardPage | ||||||
|     PageUpdate(ConfigWizard *parent); |     PageUpdate(ConfigWizard *parent); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 |  | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| struct PageReloadFromDisk : ConfigWizardPage | struct PageReloadFromDisk : ConfigWizardPage | ||||||
| { | { | ||||||
|     bool full_pathnames; |     bool full_pathnames; | ||||||
| 
 | 
 | ||||||
|     PageReloadFromDisk(ConfigWizard* parent); |     PageReloadFromDisk(ConfigWizard* parent); | ||||||
| }; | }; | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 |  | ||||||
| 
 | 
 | ||||||
| struct PageMode: ConfigWizardPage | struct PageMode: ConfigWizardPage | ||||||
| { | { | ||||||
|  | @ -470,11 +466,7 @@ struct ConfigWizard::priv | ||||||
|     PageMaterials    *page_sla_materials = nullptr; |     PageMaterials    *page_sla_materials = nullptr; | ||||||
|     PageCustom       *page_custom = nullptr; |     PageCustom       *page_custom = nullptr; | ||||||
|     PageUpdate       *page_update = nullptr; |     PageUpdate       *page_update = nullptr; | ||||||
| //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 |  | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|     PageReloadFromDisk *page_reload_from_disk = nullptr; |     PageReloadFromDisk *page_reload_from_disk = nullptr; | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 |  | ||||||
|     PageMode         *page_mode = nullptr; |     PageMode         *page_mode = nullptr; | ||||||
|     PageVendors      *page_vendors = nullptr; |     PageVendors      *page_vendors = nullptr; | ||||||
|     Pages3rdparty     pages_3rdparty; |     Pages3rdparty     pages_3rdparty; | ||||||
|  |  | ||||||
|  | @ -6,9 +6,6 @@ | ||||||
| #include "polypartition.h" | #include "polypartition.h" | ||||||
| #include "libslic3r/ClipperUtils.hpp" | #include "libslic3r/ClipperUtils.hpp" | ||||||
| #include "libslic3r/PrintConfig.hpp" | #include "libslic3r/PrintConfig.hpp" | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
| #include "libslic3r/GCode.hpp" |  | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| #include "libslic3r/GCode/PreviewData.hpp" | #include "libslic3r/GCode/PreviewData.hpp" | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
| #include "libslic3r/GCode/ThumbnailData.hpp" | #include "libslic3r/GCode/ThumbnailData.hpp" | ||||||
|  | @ -68,9 +65,7 @@ | ||||||
| #include <chrono> | #include <chrono> | ||||||
| #endif // ENABLE_RENDER_STATISTICS
 | #endif // ENABLE_RENDER_STATISTICS
 | ||||||
| 
 | 
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
| #include <imgui/imgui_internal.h> | #include <imgui/imgui_internal.h> | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
| static const float TRACKBALLSIZE = 0.8f; | static const float TRACKBALLSIZE = 0.8f; | ||||||
| 
 | 
 | ||||||
|  | @ -1237,7 +1232,6 @@ void GLCanvas3D::LegendTexture::render(const GLCanvas3D& canvas) const | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
| void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_instances) const | void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_instances) const | ||||||
| { | { | ||||||
|     if (!m_enabled || !is_shown()) |     if (!m_enabled || !is_shown()) | ||||||
|  | @ -1370,7 +1364,6 @@ void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_ | ||||||
|         ImGui::PopStyleVar(2); |         ImGui::PopStyleVar(2); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
| wxDEFINE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent); | wxDEFINE_EVENT(EVT_GLCANVAS_SCHEDULE_BACKGROUND_PROCESS, SimpleEvent); | ||||||
| wxDEFINE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, SimpleEvent); | wxDEFINE_EVENT(EVT_GLCANVAS_OBJECT_SELECT, SimpleEvent); | ||||||
|  | @ -1441,9 +1434,7 @@ GLCanvas3D::GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar | ||||||
|     , m_show_picking_texture(false) |     , m_show_picking_texture(false) | ||||||
| #endif // ENABLE_RENDER_PICKING_PASS
 | #endif // ENABLE_RENDER_PICKING_PASS
 | ||||||
|     , m_render_sla_auxiliaries(true) |     , m_render_sla_auxiliaries(true) | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     , m_labels(*this) |     , m_labels(*this) | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| { | { | ||||||
|     if (m_canvas != nullptr) { |     if (m_canvas != nullptr) { | ||||||
|         m_timer.SetOwner(m_canvas); |         m_timer.SetOwner(m_canvas); | ||||||
|  | @ -1809,14 +1800,9 @@ void GLCanvas3D::zoom_to_selection() | ||||||
| 
 | 
 | ||||||
| void GLCanvas3D::select_view(const std::string& direction) | void GLCanvas3D::select_view(const std::string& direction) | ||||||
| { | { | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     m_camera.select_view(direction); |     m_camera.select_view(direction); | ||||||
|     if (m_canvas != nullptr) |     if (m_canvas != nullptr) | ||||||
|         m_canvas->Refresh(); |         m_canvas->Refresh(); | ||||||
| #else |  | ||||||
|     if (m_camera.select_view(direction) && (m_canvas != nullptr)) |  | ||||||
|         m_canvas->Refresh(); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void GLCanvas3D::update_volumes_colors_by_extruder() | void GLCanvas3D::update_volumes_colors_by_extruder() | ||||||
|  | @ -1857,13 +1843,11 @@ void GLCanvas3D::render() | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const Size& cnv_size = get_canvas_size(); |     const Size& cnv_size = get_canvas_size(); | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     // Probably due to different order of events on Linux/GTK2, when one switched from 3D scene
 |     // Probably due to different order of events on Linux/GTK2, when one switched from 3D scene
 | ||||||
|     // to preview, this was called before canvas had its final size. It reported zero width
 |     // to preview, this was called before canvas had its final size. It reported zero width
 | ||||||
|     // and the viewport was set incorrectly, leading to tripping glAsserts further down
 |     // and the viewport was set incorrectly, leading to tripping glAsserts further down
 | ||||||
|     // the road (in apply_projection). That's why the minimum size is forced to 10.
 |     // the road (in apply_projection). That's why the minimum size is forced to 10.
 | ||||||
|     m_camera.apply_viewport(0, 0, std::max(10u, (unsigned int)cnv_size.get_width()), std::max(10u, (unsigned int)cnv_size.get_height())); |     m_camera.apply_viewport(0, 0, std::max(10u, (unsigned int)cnv_size.get_width()), std::max(10u, (unsigned int)cnv_size.get_height())); | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
|     if (m_camera.requires_zoom_to_bed) |     if (m_camera.requires_zoom_to_bed) | ||||||
|     { |     { | ||||||
|  | @ -1880,13 +1864,6 @@ void GLCanvas3D::render() | ||||||
|     GLfloat position_top[4] = { -0.5f, -0.5f, 1.0f, 0.0f }; |     GLfloat position_top[4] = { -0.5f, -0.5f, 1.0f, 0.0f }; | ||||||
|     glsafe(::glLightfv(GL_LIGHT0, GL_POSITION, position_top)); |     glsafe(::glLightfv(GL_LIGHT0, GL_POSITION, position_top)); | ||||||
| 
 | 
 | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|     float theta = m_camera.get_theta(); |  | ||||||
|     if (theta > 180.f) |  | ||||||
|         // absolute value of the rotation
 |  | ||||||
|         theta = 360.f - theta; |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 |  | ||||||
|     wxGetApp().imgui()->new_frame(); |     wxGetApp().imgui()->new_frame(); | ||||||
| 
 | 
 | ||||||
|     if (m_picking_enabled) |     if (m_picking_enabled) | ||||||
|  | @ -1910,11 +1887,7 @@ void GLCanvas3D::render() | ||||||
|     _render_objects(); |     _render_objects(); | ||||||
|     _render_sla_slices(); |     _render_sla_slices(); | ||||||
|     _render_selection(); |     _render_selection(); | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     _render_bed(!m_camera.is_looking_downward(), true); |     _render_bed(!m_camera.is_looking_downward(), true); | ||||||
| #else |  | ||||||
|     _render_bed(theta, true); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
| #if ENABLE_RENDER_SELECTION_CENTER | #if ENABLE_RENDER_SELECTION_CENTER | ||||||
|     _render_selection_center(); |     _render_selection_center(); | ||||||
|  | @ -2826,10 +2799,8 @@ void GLCanvas3D::on_char(wxKeyEvent& evt) | ||||||
|         case 'a': { post_event(SimpleEvent(EVT_GLCANVAS_ARRANGE)); break; } |         case 'a': { post_event(SimpleEvent(EVT_GLCANVAS_ARRANGE)); break; } | ||||||
|         case 'B': |         case 'B': | ||||||
|         case 'b': { zoom_to_bed(); break; } |         case 'b': { zoom_to_bed(); break; } | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|         case 'E': |         case 'E': | ||||||
|         case 'e': { m_labels.show(!m_labels.is_shown()); m_dirty = true; break; } |         case 'e': { m_labels.show(!m_labels.is_shown()); m_dirty = true; break; } | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
|         case 'I': |         case 'I': | ||||||
|         case 'i': { _update_camera_zoom(1.0); break; } |         case 'i': { _update_camera_zoom(1.0); break; } | ||||||
|         case 'K': |         case 'K': | ||||||
|  | @ -3429,11 +3400,7 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) | ||||||
|             // we do not want to translate objects if the user just clicked on an object while pressing shift to remove it from the selection and then drag
 |             // we do not want to translate objects if the user just clicked on an object while pressing shift to remove it from the selection and then drag
 | ||||||
|             if (m_selection.contains_volume(get_first_hover_volume_idx())) |             if (m_selection.contains_volume(get_first_hover_volume_idx())) | ||||||
|             { |             { | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|                 if (std::abs(m_camera.get_dir_forward()(2)) < EPSILON) |                 if (std::abs(m_camera.get_dir_forward()(2)) < EPSILON) | ||||||
| #else |  | ||||||
|                 if (m_camera.get_theta() == 90.0f) |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|                 { |                 { | ||||||
|                     // side view -> move selected volumes orthogonally to camera view direction
 |                     // side view -> move selected volumes orthogonally to camera view direction
 | ||||||
|                     Linef3 ray = mouse_ray(pos); |                     Linef3 ray = mouse_ray(pos); | ||||||
|  | @ -3493,18 +3460,13 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) | ||||||
|             if (m_hover_volume_idxs.empty() && m_mouse.is_start_position_3D_defined()) |             if (m_hover_volume_idxs.empty() && m_mouse.is_start_position_3D_defined()) | ||||||
|             { |             { | ||||||
|                 const Vec3d& orig = m_mouse.drag.start_position_3D; |                 const Vec3d& orig = m_mouse.drag.start_position_3D; | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|                 double x = Geometry::deg2rad(pos(0) - orig(0)) * (double)TRACKBALLSIZE; |                 double x = Geometry::deg2rad(pos(0) - orig(0)) * (double)TRACKBALLSIZE; | ||||||
|                 double y = Geometry::deg2rad(pos(1) - orig(1)) * (double)TRACKBALLSIZE; |                 double y = Geometry::deg2rad(pos(1) - orig(1)) * (double)TRACKBALLSIZE; | ||||||
|                 if (wxGetApp().plater()->get_mouse3d_controller().is_running() || (wxGetApp().app_config->get("use_free_camera") == "1")) |                 if (wxGetApp().plater()->get_mouse3d_controller().is_running() || (wxGetApp().app_config->get("use_free_camera") == "1")) | ||||||
|                     m_camera.rotate_local_around_target(Vec3d(y, x, 0.0)); |                     m_camera.rotate_local_around_target(Vec3d(y, x, 0.0)); | ||||||
|                 else |                 else | ||||||
|                     m_camera.rotate_on_sphere(x, y, wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA); |                     m_camera.rotate_on_sphere(x, y, wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA); | ||||||
| #else | 
 | ||||||
|                 float sign = m_camera.inverted_phi ? -1.0f : 1.0f; |  | ||||||
|                 m_camera.phi += sign * ((float)pos(0) - (float)orig(0)) * TRACKBALLSIZE; |  | ||||||
|                 m_camera.set_theta(m_camera.get_theta() - ((float)pos(1) - (float)orig(1)) * TRACKBALLSIZE, wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|                 m_dirty = true; |                 m_dirty = true; | ||||||
|             } |             } | ||||||
|             m_mouse.drag.start_position_3D = Vec3d((double)pos(0), (double)pos(1), 0.0); |             m_mouse.drag.start_position_3D = Vec3d((double)pos(0), (double)pos(1), 0.0); | ||||||
|  | @ -3554,11 +3516,6 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt) | ||||||
|             if (!evt.ShiftDown() && m_picking_enabled) |             if (!evt.ShiftDown() && m_picking_enabled) | ||||||
|                 deselect_all(); |                 deselect_all(); | ||||||
|         } |         } | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|         else if (evt.LeftUp() && m_mouse.dragging) |  | ||||||
|             // Flips X mouse deltas if bed is upside down
 |  | ||||||
|             m_camera.inverted_phi = (m_camera.get_dir_up()(2) < 0.0); |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
|         else if (evt.RightUp()) |         else if (evt.RightUp()) | ||||||
|         { |         { | ||||||
|             m_mouse.position = pos.cast<double>(); |             m_mouse.position = pos.cast<double>(); | ||||||
|  | @ -4163,16 +4120,9 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, bool | ||||||
| 
 | 
 | ||||||
|     Camera camera; |     Camera camera; | ||||||
|     camera.set_type(Camera::Ortho); |     camera.set_type(Camera::Ortho); | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     camera.set_scene_box(scene_bounding_box()); |     camera.set_scene_box(scene_bounding_box()); | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     camera.apply_viewport(0, 0, thumbnail_data.width, thumbnail_data.height); |     camera.apply_viewport(0, 0, thumbnail_data.width, thumbnail_data.height); | ||||||
|     camera.zoom_to_volumes(visible_volumes); |     camera.zoom_to_volumes(visible_volumes); | ||||||
| #else |  | ||||||
|     camera.zoom_to_volumes(visible_volumes, thumbnail_data.width, thumbnail_data.height); |  | ||||||
|     camera.apply_viewport(0, 0, thumbnail_data.width, thumbnail_data.height); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     camera.apply_view_matrix(); |     camera.apply_view_matrix(); | ||||||
| 
 | 
 | ||||||
|     double near_z = -1.0; |     double near_z = -1.0; | ||||||
|  | @ -4221,11 +4171,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, bool | ||||||
|     glsafe(::glDisable(GL_DEPTH_TEST)); |     glsafe(::glDisable(GL_DEPTH_TEST)); | ||||||
| 
 | 
 | ||||||
|     if (show_bed) |     if (show_bed) | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|         _render_bed(!camera.is_looking_downward(), false); |         _render_bed(!camera.is_looking_downward(), false); | ||||||
| #else |  | ||||||
|         _render_bed(camera.get_theta(), false); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
|     if (transparent_background) |     if (transparent_background) | ||||||
|         glsafe(::glClearColor(1.0f, 1.0f, 1.0f, 1.0f)); |         glsafe(::glClearColor(1.0f, 1.0f, 1.0f, 1.0f)); | ||||||
|  | @ -4762,11 +4708,6 @@ void GLCanvas3D::_resize(unsigned int w, unsigned int h) | ||||||
| 
 | 
 | ||||||
|     // ensures that this canvas is current
 |     // ensures that this canvas is current
 | ||||||
|     _set_current(); |     _set_current(); | ||||||
| 
 |  | ||||||
| #if !ENABLE_6DOF_CAMERA |  | ||||||
|     // updates camera
 |  | ||||||
|     m_camera.apply_viewport(0, 0, w, h); |  | ||||||
| #endif // !ENABLE_6DOF_CAMERA
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_gizmos, bool include_bed_model) const | BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_gizmos, bool include_bed_model) const | ||||||
|  | @ -4790,12 +4731,7 @@ BoundingBoxf3 GLCanvas3D::_max_bounding_box(bool include_gizmos, bool include_be | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
| void GLCanvas3D::_zoom_to_box(const BoundingBoxf3& box, double margin_factor) | void GLCanvas3D::_zoom_to_box(const BoundingBoxf3& box, double margin_factor) | ||||||
| { | { | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     m_camera.zoom_to_box(box, margin_factor); |     m_camera.zoom_to_box(box, margin_factor); | ||||||
| #else |  | ||||||
|     const Size& cnv_size = get_canvas_size(); |  | ||||||
|     m_camera.zoom_to_box(box, cnv_size.get_width(), cnv_size.get_height(), margin_factor); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     m_dirty = true; |     m_dirty = true; | ||||||
| } | } | ||||||
| #else | #else | ||||||
|  | @ -5098,7 +5034,6 @@ void GLCanvas3D::_render_overlays() const | ||||||
|     if ((m_layers_editing.last_object_id >= 0) && (m_layers_editing.object_max_z() > 0.0f)) |     if ((m_layers_editing.last_object_id >= 0) && (m_layers_editing.object_max_z() > 0.0f)) | ||||||
|         m_layers_editing.render_overlay(*this); |         m_layers_editing.render_overlay(*this); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     const ConfigOptionBool* opt = dynamic_cast<const ConfigOptionBool*>(m_config->option("complete_objects")); |     const ConfigOptionBool* opt = dynamic_cast<const ConfigOptionBool*>(m_config->option("complete_objects")); | ||||||
|     bool sequential_print = opt != nullptr && opt->value; |     bool sequential_print = opt != nullptr && opt->value; | ||||||
|     std::vector<const ModelInstance*> sorted_instances; |     std::vector<const ModelInstance*> sorted_instances; | ||||||
|  | @ -5109,7 +5044,6 @@ void GLCanvas3D::_render_overlays() const | ||||||
|             } |             } | ||||||
|     } |     } | ||||||
|     m_labels.render(sorted_instances); |     m_labels.render(sorted_instances); | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
|     glsafe(::glPopMatrix()); |     glsafe(::glPopMatrix()); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -375,7 +375,6 @@ private: | ||||||
|     }; |     }; | ||||||
| #endif // ENABLE_RENDER_STATISTICS
 | #endif // ENABLE_RENDER_STATISTICS
 | ||||||
| 
 | 
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     class Labels |     class Labels | ||||||
|     { |     { | ||||||
|         bool m_enabled{ false }; |         bool m_enabled{ false }; | ||||||
|  | @ -389,7 +388,6 @@ private: | ||||||
|         bool is_shown() const { return m_shown; } |         bool is_shown() const { return m_shown; } | ||||||
|         void render(const std::vector<const ModelInstance*>& sorted_instances) const; |         void render(const std::vector<const ModelInstance*>& sorted_instances) const; | ||||||
|     }; |     }; | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
|     enum ECursorType : unsigned char |     enum ECursorType : unsigned char | ||||||
|  | @ -468,9 +466,7 @@ private: | ||||||
|     mutable int m_imgui_undo_redo_hovered_pos{ -1 }; |     mutable int m_imgui_undo_redo_hovered_pos{ -1 }; | ||||||
|     int m_selected_extruder; |     int m_selected_extruder; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     Labels m_labels; |     Labels m_labels; | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
| public: | public: | ||||||
|     GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar); |     GLCanvas3D(wxGLCanvas* canvas, Bed3D& bed, Camera& camera, GLToolbar& view_toolbar); | ||||||
|  | @ -487,9 +483,7 @@ public: | ||||||
|     void set_as_dirty(); |     void set_as_dirty(); | ||||||
| 
 | 
 | ||||||
|     unsigned int get_volumes_count() const; |     unsigned int get_volumes_count() const; | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     const GLVolumeCollection& get_volumes() const { return m_volumes; } |     const GLVolumeCollection& get_volumes() const { return m_volumes; } | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
|     void reset_volumes(); |     void reset_volumes(); | ||||||
|     int check_volumes_outside_state() const; |     int check_volumes_outside_state() const; | ||||||
| 
 | 
 | ||||||
|  | @ -501,9 +495,7 @@ public: | ||||||
|     void set_config(const DynamicPrintConfig* config); |     void set_config(const DynamicPrintConfig* config); | ||||||
|     void set_process(BackgroundSlicingProcess* process); |     void set_process(BackgroundSlicingProcess* process); | ||||||
|     void set_model(Model* model); |     void set_model(Model* model); | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     const Model* get_model() const { return m_model; } |     const Model* get_model() const { return m_model; } | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
|     const Selection& get_selection() const { return m_selection; } |     const Selection& get_selection() const { return m_selection; } | ||||||
|     Selection& get_selection() { return m_selection; } |     Selection& get_selection() { return m_selection; } | ||||||
|  | @ -551,9 +543,7 @@ public: | ||||||
|     void enable_main_toolbar(bool enable); |     void enable_main_toolbar(bool enable); | ||||||
|     void enable_undoredo_toolbar(bool enable); |     void enable_undoredo_toolbar(bool enable); | ||||||
|     void enable_dynamic_background(bool enable); |     void enable_dynamic_background(bool enable); | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     void enable_labels(bool enable) { m_labels.enable(enable); } |     void enable_labels(bool enable) { m_labels.enable(enable); } | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
|     void allow_multisample(bool allow); |     void allow_multisample(bool allow); | ||||||
| 
 | 
 | ||||||
|     void zoom_to_bed(); |     void zoom_to_bed(); | ||||||
|  | @ -675,10 +665,8 @@ public: | ||||||
| 
 | 
 | ||||||
|     void mouse_up_cleanup(); |     void mouse_up_cleanup(); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     bool are_labels_shown() const { return m_labels.is_shown(); } |     bool are_labels_shown() const { return m_labels.is_shown(); } | ||||||
|     void show_labels(bool show) { m_labels.show(show); } |     void show_labels(bool show) { m_labels.show(show); } | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     bool _is_shown_on_screen() const; |     bool _is_shown_on_screen() const; | ||||||
|  |  | ||||||
|  | @ -168,25 +168,15 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri | ||||||
|     if (filenames.empty() || states.empty() || (sprite_size_px == 0)) |     if (filenames.empty() || states.empty() || (sprite_size_px == 0)) | ||||||
|         return false; |         return false; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|     // every tile needs to have a 1px border around it to avoid artifacts when linear sampling on its edges
 |     // every tile needs to have a 1px border around it to avoid artifacts when linear sampling on its edges
 | ||||||
|     unsigned int sprite_size_px_ex = sprite_size_px + 1; |     unsigned int sprite_size_px_ex = sprite_size_px + 1; | ||||||
| 
 | 
 | ||||||
|     m_width = 1 + (int)(sprite_size_px_ex * states.size()); |     m_width = 1 + (int)(sprite_size_px_ex * states.size()); | ||||||
|     m_height = 1 + (int)(sprite_size_px_ex * filenames.size()); |     m_height = 1 + (int)(sprite_size_px_ex * filenames.size()); | ||||||
| #else |  | ||||||
|     m_width = (int)(sprite_size_px * states.size()); |  | ||||||
|     m_height = (int)(sprite_size_px * filenames.size()); |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
| 
 | 
 | ||||||
|     int n_pixels = m_width * m_height; |     int n_pixels = m_width * m_height; | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|     int sprite_n_pixels = sprite_size_px_ex * sprite_size_px_ex; |     int sprite_n_pixels = sprite_size_px_ex * sprite_size_px_ex; | ||||||
|     int sprite_stride = sprite_size_px_ex * 4; |     int sprite_stride = sprite_size_px_ex * 4; | ||||||
| #else |  | ||||||
|     int sprite_n_pixels = sprite_size_px * sprite_size_px; |  | ||||||
|     int sprite_stride = sprite_size_px * 4; |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
|     int sprite_bytes = sprite_n_pixels * 4; |     int sprite_bytes = sprite_n_pixels * 4; | ||||||
| 
 | 
 | ||||||
|     if (n_pixels <= 0) |     if (n_pixels <= 0) | ||||||
|  | @ -225,12 +215,8 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri | ||||||
| 
 | 
 | ||||||
|         float scale = (float)sprite_size_px / std::max(image->width, image->height); |         float scale = (float)sprite_size_px / std::max(image->width, image->height); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|         // offset by 1 to leave the first pixel empty (both in x and y)
 |         // offset by 1 to leave the first pixel empty (both in x and y)
 | ||||||
|         nsvgRasterize(rast, image, 1, 1, scale, sprite_data.data(), sprite_size_px, sprite_size_px, sprite_stride); |         nsvgRasterize(rast, image, 1, 1, scale, sprite_data.data(), sprite_size_px, sprite_size_px, sprite_stride); | ||||||
| #else |  | ||||||
|         nsvgRasterize(rast, image, 0, 0, scale, sprite_data.data(), sprite_size_px, sprite_size_px, sprite_stride); |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
| 
 | 
 | ||||||
|         // makes white only copy of the sprite
 |         // makes white only copy of the sprite
 | ||||||
|         ::memcpy((void*)sprite_white_only_data.data(), (const void*)sprite_data.data(), sprite_bytes); |         ::memcpy((void*)sprite_white_only_data.data(), (const void*)sprite_data.data(), sprite_bytes); | ||||||
|  | @ -250,11 +236,7 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri | ||||||
|                 ::memset((void*)&sprite_gray_only_data.data()[offset], 128, 3); |                 ::memset((void*)&sprite_gray_only_data.data()[offset], 128, 3); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|         int sprite_offset_px = sprite_id * (int)sprite_size_px_ex * m_width; |         int sprite_offset_px = sprite_id * (int)sprite_size_px_ex * m_width; | ||||||
| #else |  | ||||||
|         int sprite_offset_px = sprite_id * sprite_size_px * m_width; |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
|         int state_id = -1; |         int state_id = -1; | ||||||
|         for (const std::pair<int, bool>& state : states) |         for (const std::pair<int, bool>& state : states) | ||||||
|         { |         { | ||||||
|  | @ -273,7 +255,6 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri | ||||||
|             // applies background, if needed
 |             // applies background, if needed
 | ||||||
|             if (state.second) |             if (state.second) | ||||||
|             { |             { | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|                 float inv_255 = 1.0f / 255.0f; |                 float inv_255 = 1.0f / 255.0f; | ||||||
|                 // offset by 1 to leave the first pixel empty (both in x and y)
 |                 // offset by 1 to leave the first pixel empty (both in x and y)
 | ||||||
|                 for (unsigned int r = 1; r <= sprite_size_px; ++r) |                 for (unsigned int r = 1; r <= sprite_size_px; ++r) | ||||||
|  | @ -289,32 +270,13 @@ bool GLTexture::load_from_svg_files_as_sprites_array(const std::vector<std::stri | ||||||
|                         output_data.data()[offset + 3] = (unsigned char)(128 * (1.0f - alpha) + output_data.data()[offset + 3] * alpha); |                         output_data.data()[offset + 3] = (unsigned char)(128 * (1.0f - alpha) + output_data.data()[offset + 3] * alpha); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
| #else |  | ||||||
|                 for (int i = 0; i < sprite_n_pixels; ++i) |  | ||||||
|                 { |  | ||||||
|                     int offset = i * 4; |  | ||||||
|                     float alpha = (float)output_data.data()[offset + 3] / 255.0f; |  | ||||||
|                     output_data.data()[offset + 0] = (unsigned char)(output_data.data()[offset + 0] * alpha); |  | ||||||
|                     output_data.data()[offset + 1] = (unsigned char)(output_data.data()[offset + 1] * alpha); |  | ||||||
|                     output_data.data()[offset + 2] = (unsigned char)(output_data.data()[offset + 2] * alpha); |  | ||||||
|                     output_data.data()[offset + 3] = (unsigned char)(128 * (1.0f - alpha) + output_data.data()[offset + 3] * alpha); |  | ||||||
|                 } |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|             int state_offset_px = sprite_offset_px + state_id * sprite_size_px_ex; |             int state_offset_px = sprite_offset_px + state_id * sprite_size_px_ex; | ||||||
|             for (int j = 0; j < (int)sprite_size_px_ex; ++j) |             for (int j = 0; j < (int)sprite_size_px_ex; ++j) | ||||||
|             { |             { | ||||||
|                 ::memcpy((void*)&data.data()[(state_offset_px + j * m_width) * 4], (const void*)&output_data.data()[j * sprite_stride], sprite_stride); |                 ::memcpy((void*)&data.data()[(state_offset_px + j * m_width) * 4], (const void*)&output_data.data()[j * sprite_stride], sprite_stride); | ||||||
|             } |             } | ||||||
| #else |  | ||||||
|             int state_offset_px = sprite_offset_px + state_id * sprite_size_px; |  | ||||||
|             for (int j = 0; j < (int)sprite_size_px; ++j) |  | ||||||
|             { |  | ||||||
|                 ::memcpy((void*)&data.data()[(state_offset_px + j * m_width) * 4], (const void*)&output_data.data()[j * sprite_stride], sprite_stride); |  | ||||||
|             } |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         nsvgDelete(image); |         nsvgDelete(image); | ||||||
|  |  | ||||||
|  | @ -86,7 +86,6 @@ bool GLToolbarItem::update_enabled_state() | ||||||
| 
 | 
 | ||||||
| void GLToolbarItem::render(unsigned int tex_id, float left, float right, float bottom, float top, unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) const | void GLToolbarItem::render(unsigned int tex_id, float left, float right, float bottom, float top, unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) const | ||||||
| { | { | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|     auto uvs = [this](unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) ->GLTexture::Quad_UVs |     auto uvs = [this](unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) ->GLTexture::Quad_UVs | ||||||
|     { |     { | ||||||
|         assert((tex_width != 0) && (tex_height != 0)); |         assert((tex_width != 0) && (tex_height != 0)); | ||||||
|  | @ -112,9 +111,6 @@ void GLToolbarItem::render(unsigned int tex_id, float left, float right, float b | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     GLTexture::render_sub_texture(tex_id, left, right, bottom, top, uvs(tex_width, tex_height, icon_size)); |     GLTexture::render_sub_texture(tex_id, left, right, bottom, top, uvs(tex_width, tex_height, icon_size)); | ||||||
| #else |  | ||||||
|     GLTexture::render_sub_texture(tex_id, left, right, bottom, top, get_uvs(tex_width, tex_height, icon_size)); |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
| 
 | 
 | ||||||
|     if (is_pressed()) |     if (is_pressed()) | ||||||
|     { |     { | ||||||
|  | @ -125,29 +121,6 @@ void GLToolbarItem::render(unsigned int tex_id, float left, float right, float b | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if !ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
| GLTexture::Quad_UVs GLToolbarItem::get_uvs(unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) const |  | ||||||
| { |  | ||||||
|     GLTexture::Quad_UVs uvs; |  | ||||||
| 
 |  | ||||||
|     float inv_tex_width = (tex_width != 0) ? 1.0f / (float)tex_width : 0.0f; |  | ||||||
|     float inv_tex_height = (tex_height != 0) ? 1.0f / (float)tex_height : 0.0f; |  | ||||||
| 
 |  | ||||||
|     float scaled_icon_width = (float)icon_size * inv_tex_width; |  | ||||||
|     float scaled_icon_height = (float)icon_size * inv_tex_height; |  | ||||||
|     float left = (float)m_state * scaled_icon_width; |  | ||||||
|     float right = left + scaled_icon_width; |  | ||||||
|     float top = (float)m_data.sprite_id * scaled_icon_height; |  | ||||||
|     float bottom = top + scaled_icon_height; |  | ||||||
|     uvs.left_top = { left, top }; |  | ||||||
|     uvs.left_bottom = { left, bottom }; |  | ||||||
|     uvs.right_bottom = { right, bottom }; |  | ||||||
|     uvs.right_top = { right, top }; |  | ||||||
| 
 |  | ||||||
|     return uvs; |  | ||||||
| } |  | ||||||
| #endif // !ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
| 
 |  | ||||||
| BackgroundTexture::Metadata::Metadata() | BackgroundTexture::Metadata::Metadata() | ||||||
|     : filename("") |     : filename("") | ||||||
|     , left(0) |     , left(0) | ||||||
|  |  | ||||||
|  | @ -143,9 +143,6 @@ public: | ||||||
|     void render(unsigned int tex_id, float left, float right, float bottom, float top, unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) const; |     void render(unsigned int tex_id, float left, float right, float bottom, float top, unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) const; | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
| #if !ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|     GLTexture::Quad_UVs get_uvs(unsigned int tex_width, unsigned int tex_height, unsigned int icon_size) const; |  | ||||||
| #endif // !ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
|     void set_visible(bool visible) { m_data.visible = visible; } |     void set_visible(bool visible) { m_data.visible = visible; } | ||||||
| 
 | 
 | ||||||
|     friend class GLToolbar; |     friend class GLToolbar; | ||||||
|  |  | ||||||
|  | @ -2270,9 +2270,7 @@ void ObjectList::split() | ||||||
|         add_settings_item(vol_item, &volume->config); |         add_settings_item(vol_item, &volume->config); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|     model_object->input_file.clear(); |     model_object->input_file.clear(); | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
| 
 | 
 | ||||||
|     if (parent == item) |     if (parent == item) | ||||||
|         Expand(parent); |         Expand(parent); | ||||||
|  |  | ||||||
|  | @ -65,9 +65,7 @@ bool View3D::init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view_ | ||||||
|     m_canvas->enable_selection(true); |     m_canvas->enable_selection(true); | ||||||
|     m_canvas->enable_main_toolbar(true); |     m_canvas->enable_main_toolbar(true); | ||||||
|     m_canvas->enable_undoredo_toolbar(true); |     m_canvas->enable_undoredo_toolbar(true); | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     m_canvas->enable_labels(true); |     m_canvas->enable_labels(true); | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
|     wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); |     wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL); | ||||||
|     main_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0); |     main_sizer->Add(m_canvas_widget, 1, wxALL | wxEXPAND, 0); | ||||||
|  |  | ||||||
|  | @ -889,14 +889,9 @@ void GLGizmosManager::render_background(float left, float top, float right, floa | ||||||
| 
 | 
 | ||||||
| void GLGizmosManager::do_render_overlay() const | void GLGizmosManager::do_render_overlay() const | ||||||
| { | { | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|     std::vector<size_t> selectable_idxs = get_selectable_idxs(); |     std::vector<size_t> selectable_idxs = get_selectable_idxs(); | ||||||
|     if (selectable_idxs.empty()) |     if (selectable_idxs.empty()) | ||||||
|         return; |         return; | ||||||
| #else |  | ||||||
|     if (m_gizmos.empty()) |  | ||||||
|         return; |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
| 
 | 
 | ||||||
|     float cnv_w = (float)m_parent.get_canvas_size().get_width(); |     float cnv_w = (float)m_parent.get_canvas_size().get_width(); | ||||||
|     float cnv_h = (float)m_parent.get_canvas_size().get_height(); |     float cnv_h = (float)m_parent.get_canvas_size().get_height(); | ||||||
|  | @ -928,7 +923,6 @@ void GLGizmosManager::do_render_overlay() const | ||||||
|     int tex_width = m_icons_texture.get_width(); |     int tex_width = m_icons_texture.get_width(); | ||||||
|     int tex_height = m_icons_texture.get_height(); |     int tex_height = m_icons_texture.get_height(); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|     if ((icons_texture_id == 0) || (tex_width <= 1) || (tex_height <= 1)) |     if ((icons_texture_id == 0) || (tex_width <= 1) || (tex_height <= 1)) | ||||||
|         return; |         return; | ||||||
| 
 | 
 | ||||||
|  | @ -938,39 +932,18 @@ void GLGizmosManager::do_render_overlay() const | ||||||
|     // tiles in the texture are spaced by 1 pixel
 |     // tiles in the texture are spaced by 1 pixel
 | ||||||
|     float u_offset = 1.0f / (float)tex_width; |     float u_offset = 1.0f / (float)tex_width; | ||||||
|     float v_offset = 1.0f / (float)tex_height; |     float v_offset = 1.0f / (float)tex_height; | ||||||
| #else |  | ||||||
|     if ((icons_texture_id == 0) || (tex_width <= 0) || (tex_height <= 0)) |  | ||||||
|         return; |  | ||||||
| 
 | 
 | ||||||
|     float inv_tex_width = (tex_width != 0) ? 1.0f / tex_width : 0.0f; |  | ||||||
|     float inv_tex_height = (tex_height != 0) ? 1.0f / tex_height : 0.0f; |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
| 
 |  | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|     for (size_t idx : selectable_idxs) |     for (size_t idx : selectable_idxs) | ||||||
| #else |  | ||||||
|     for (size_t idx : get_selectable_idxs()) |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
|     { |     { | ||||||
|         GLGizmoBase* gizmo = m_gizmos[idx].get(); |         GLGizmoBase* gizmo = m_gizmos[idx].get(); | ||||||
| 
 | 
 | ||||||
|         unsigned int sprite_id = gizmo->get_sprite_id(); |         unsigned int sprite_id = gizmo->get_sprite_id(); | ||||||
|         int icon_idx = (m_current == idx) ? 2 : ((m_hover == idx) ? 1 : (gizmo->is_activable()? 0 : 3)); |         int icon_idx = (m_current == idx) ? 2 : ((m_hover == idx) ? 1 : (gizmo->is_activable()? 0 : 3)); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_MODIFIED_TOOLBAR_TEXTURES |  | ||||||
|         float v_top = v_offset + sprite_id * dv; |         float v_top = v_offset + sprite_id * dv; | ||||||
|         float u_left = u_offset + icon_idx * du; |         float u_left = u_offset + icon_idx * du; | ||||||
|         float v_bottom = v_top + dv - v_offset; |         float v_bottom = v_top + dv - v_offset; | ||||||
|         float u_right = u_left + du - u_offset; |         float u_right = u_left + du - u_offset; | ||||||
| #else |  | ||||||
|         float u_icon_size = icons_size * inv_tex_width; |  | ||||||
|         float v_icon_size = icons_size * inv_tex_height; |  | ||||||
| 
 |  | ||||||
|         float v_top = sprite_id * v_icon_size; |  | ||||||
|         float u_left = icon_idx * u_icon_size; |  | ||||||
|         float v_bottom = v_top + v_icon_size; |  | ||||||
|         float u_right = u_left + u_icon_size; |  | ||||||
| #endif // ENABLE_MODIFIED_TOOLBAR_TEXTURES
 |  | ||||||
| 
 | 
 | ||||||
|         GLTexture::render_sub_texture(icons_texture_id, zoomed_top_x, zoomed_top_x + zoomed_icons_size, zoomed_top_y - zoomed_icons_size, zoomed_top_y, { { u_left, v_bottom }, { u_right, v_bottom }, { u_right, v_top }, { u_left, v_top } }); |         GLTexture::render_sub_texture(icons_texture_id, zoomed_top_x, zoomed_top_x + zoomed_icons_size, zoomed_top_y - zoomed_icons_size, zoomed_top_y, { { u_left, v_bottom }, { u_right, v_bottom }, { u_right, v_top }, { u_left, v_top } }); | ||||||
|         if (idx == m_current) { |         if (idx == m_current) { | ||||||
|  |  | ||||||
|  | @ -672,12 +672,10 @@ void MainFrame::init_menubar() | ||||||
|             "", nullptr, [this](){return can_change_view(); }, this); |             "", nullptr, [this](){return can_change_view(); }, this); | ||||||
|         append_menu_item(viewMenu, wxID_ANY, _(L("Right")) + sep + "&6", _(L("Right View")), [this](wxCommandEvent&) { select_view("right"); }, |         append_menu_item(viewMenu, wxID_ANY, _(L("Right")) + sep + "&6", _(L("Right View")), [this](wxCommandEvent&) { select_view("right"); }, | ||||||
|             "", nullptr, [this](){return can_change_view(); }, this); |             "", nullptr, [this](){return can_change_view(); }, this); | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|         viewMenu->AppendSeparator(); |         viewMenu->AppendSeparator(); | ||||||
|         append_menu_check_item(viewMenu, wxID_ANY, _(L("Show &labels")) + sep + "E", _(L("Show object/instance labels in 3D scene")), |         append_menu_check_item(viewMenu, wxID_ANY, _(L("Show &labels")) + sep + "E", _(L("Show object/instance labels in 3D scene")), | ||||||
|             [this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); }, this, |             [this](wxCommandEvent&) { m_plater->show_view3D_labels(!m_plater->are_view3D_labels_shown()); }, this, | ||||||
|             [this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this); |             [this]() { return m_plater->is_view3D_shown(); }, [this]() { return m_plater->are_view3D_labels_shown(); }, this); | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // Help menu
 |     // Help menu
 | ||||||
|  |  | ||||||
|  | @ -60,17 +60,13 @@ const double Mouse3DController::State::DefaultTranslationDeadzone = 0.5 * Mouse3 | ||||||
| const float Mouse3DController::State::DefaultRotationScale = 1.0f; | const float Mouse3DController::State::DefaultRotationScale = 1.0f; | ||||||
| const float Mouse3DController::State::MaxRotationDeadzone = 0.2f; | const float Mouse3DController::State::MaxRotationDeadzone = 0.2f; | ||||||
| const float Mouse3DController::State::DefaultRotationDeadzone = 0.5f * Mouse3DController::State::MaxRotationDeadzone; | const float Mouse3DController::State::DefaultRotationDeadzone = 0.5f * Mouse3DController::State::MaxRotationDeadzone; | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
| const double Mouse3DController::State::DefaultZoomScale = 0.1; | const double Mouse3DController::State::DefaultZoomScale = 0.1; | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
| 
 | 
 | ||||||
| Mouse3DController::State::State() | Mouse3DController::State::State() | ||||||
|     : m_buttons_enabled(false) |     : m_buttons_enabled(false) | ||||||
|     , m_translation_params(DefaultTranslationScale, DefaultTranslationDeadzone) |     , m_translation_params(DefaultTranslationScale, DefaultTranslationDeadzone) | ||||||
|     , m_rotation_params(DefaultRotationScale, DefaultRotationDeadzone) |     , m_rotation_params(DefaultRotationScale, DefaultRotationDeadzone) | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|     , m_zoom_params(DefaultZoomScale, 0.0) |     , m_zoom_params(DefaultZoomScale, 0.0) | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
|     , m_mouse_wheel_counter(0) |     , m_mouse_wheel_counter(0) | ||||||
| #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT | #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT | ||||||
|     , m_translation_queue_max_size(0) |     , m_translation_queue_max_size(0) | ||||||
|  | @ -156,31 +152,18 @@ bool Mouse3DController::State::apply(Camera& camera) | ||||||
|     if (has_translation()) |     if (has_translation()) | ||||||
|     { |     { | ||||||
|         const Vec3d& translation = m_translation.queue.front(); |         const Vec3d& translation = m_translation.queue.front(); | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|         double zoom_factor = camera.min_zoom() / camera.get_zoom(); |         double zoom_factor = camera.min_zoom() / camera.get_zoom(); | ||||||
|         camera.set_target(camera.get_target() + zoom_factor * m_translation_params.scale * (translation(0) * camera.get_dir_right() + translation(2) * camera.get_dir_up())); |         camera.set_target(camera.get_target() + zoom_factor * m_translation_params.scale * (translation(0) * camera.get_dir_right() + translation(2) * camera.get_dir_up())); | ||||||
|         if (translation(1) != 0.0) |         if (translation(1) != 0.0) | ||||||
|             camera.update_zoom(m_zoom_params.scale * translation(1) / std::abs(translation(1))); |             camera.update_zoom(m_zoom_params.scale * translation(1) / std::abs(translation(1))); | ||||||
| #else |  | ||||||
|         camera.set_target(camera.get_target() + m_translation_params.scale * (translation(0) * camera.get_dir_right() + translation(1) * camera.get_dir_forward() + translation(2) * camera.get_dir_up())); |  | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
|         m_translation.queue.pop(); |         m_translation.queue.pop(); | ||||||
|         ret = true; |         ret = true; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (has_rotation()) |     if (has_rotation()) | ||||||
|     { |     { | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|         Vec3d rotation = (m_rotation_params.scale * m_rotation.queue.front()).cast<double>(); |         Vec3d rotation = (m_rotation_params.scale * m_rotation.queue.front()).cast<double>(); | ||||||
|         camera.rotate_local_around_target(Vec3d(Geometry::deg2rad(rotation(0)), Geometry::deg2rad(-rotation(2)), Geometry::deg2rad(-rotation(1)))); |         camera.rotate_local_around_target(Vec3d(Geometry::deg2rad(rotation(0)), Geometry::deg2rad(-rotation(2)), Geometry::deg2rad(-rotation(1)))); | ||||||
| #else |  | ||||||
|         const Vec3f& rotation = m_rotation.queue.front(); |  | ||||||
|         float theta = m_rotation_params.scale * rotation(0); |  | ||||||
|         float phi = m_rotation_params.scale * rotation(2); |  | ||||||
|         float sign = camera.inverted_phi ? -1.0f : 1.0f; |  | ||||||
|         camera.phi += sign * phi; |  | ||||||
|         camera.set_theta(camera.get_theta() + theta, wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|         m_rotation.queue.pop(); |         m_rotation.queue.pop(); | ||||||
|         ret = true; |         ret = true; | ||||||
|     } |     } | ||||||
|  | @ -321,11 +304,9 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const | ||||||
|             if (imgui.slider_float(_(L("Rotation")) + "##1", &rotation_scale, 0.1f, 10.0f, "%.1f")) |             if (imgui.slider_float(_(L("Rotation")) + "##1", &rotation_scale, 0.1f, 10.0f, "%.1f")) | ||||||
|                 m_state.set_rotation_scale(State::DefaultRotationScale * rotation_scale); |                 m_state.set_rotation_scale(State::DefaultRotationScale * rotation_scale); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|             float zoom_scale = m_state.get_zoom_scale() / State::DefaultZoomScale; |             float zoom_scale = m_state.get_zoom_scale() / State::DefaultZoomScale; | ||||||
|             if (imgui.slider_float(_(L("Zoom")), &zoom_scale, 0.1f, 10.0f, "%.1f")) |             if (imgui.slider_float(_(L("Zoom")), &zoom_scale, 0.1f, 10.0f, "%.1f")) | ||||||
|                 m_state.set_zoom_scale(State::DefaultZoomScale * zoom_scale); |                 m_state.set_zoom_scale(State::DefaultZoomScale * zoom_scale); | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
| 
 | 
 | ||||||
|             ImGui::Separator(); |             ImGui::Separator(); | ||||||
|             ImGui::PushStyleColor(ImGuiCol_Text, color); |             ImGui::PushStyleColor(ImGuiCol_Text, color); | ||||||
|  | @ -333,11 +314,7 @@ void Mouse3DController::render_settings_dialog(GLCanvas3D& canvas) const | ||||||
|             ImGui::PopStyleColor(); |             ImGui::PopStyleColor(); | ||||||
| 
 | 
 | ||||||
|             float translation_deadzone = (float)m_state.get_translation_deadzone(); |             float translation_deadzone = (float)m_state.get_translation_deadzone(); | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|             if (imgui.slider_float(_(L("Translation")) + "/" + _(L("Zoom")), &translation_deadzone, 0.0f, (float)State::MaxTranslationDeadzone, "%.2f")) |             if (imgui.slider_float(_(L("Translation")) + "/" + _(L("Zoom")), &translation_deadzone, 0.0f, (float)State::MaxTranslationDeadzone, "%.2f")) | ||||||
| #else |  | ||||||
|             if (imgui.slider_float(_(L("Translation")) + "##2", &translation_deadzone, 0.0f, (float)State::MaxTranslationDeadzone, "%.2f")) |  | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
|                 m_state.set_translation_deadzone((double)translation_deadzone); |                 m_state.set_translation_deadzone((double)translation_deadzone); | ||||||
| 
 | 
 | ||||||
|             float rotation_deadzone = m_state.get_rotation_deadzone(); |             float rotation_deadzone = m_state.get_rotation_deadzone(); | ||||||
|  | @ -651,24 +628,18 @@ bool Mouse3DController::connect_device() | ||||||
|         float rotation_speed = 4.0; |         float rotation_speed = 4.0; | ||||||
|         double translation_deadzone = State::DefaultTranslationDeadzone; |         double translation_deadzone = State::DefaultTranslationDeadzone; | ||||||
|         float rotation_deadzone = State::DefaultRotationDeadzone; |         float rotation_deadzone = State::DefaultRotationDeadzone; | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|         double zoom_speed = 2.0; |         double zoom_speed = 2.0; | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
|         wxGetApp().app_config->get_mouse_device_translation_speed(m_device_str, translation_speed); |         wxGetApp().app_config->get_mouse_device_translation_speed(m_device_str, translation_speed); | ||||||
|         wxGetApp().app_config->get_mouse_device_translation_deadzone(m_device_str, translation_deadzone); |         wxGetApp().app_config->get_mouse_device_translation_deadzone(m_device_str, translation_deadzone); | ||||||
|         wxGetApp().app_config->get_mouse_device_rotation_speed(m_device_str, rotation_speed); |         wxGetApp().app_config->get_mouse_device_rotation_speed(m_device_str, rotation_speed); | ||||||
|         wxGetApp().app_config->get_mouse_device_rotation_deadzone(m_device_str, rotation_deadzone); |         wxGetApp().app_config->get_mouse_device_rotation_deadzone(m_device_str, rotation_deadzone); | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|         wxGetApp().app_config->get_mouse_device_zoom_speed(m_device_str, zoom_speed); |         wxGetApp().app_config->get_mouse_device_zoom_speed(m_device_str, zoom_speed); | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
|         // clamp to valid values
 |         // clamp to valid values
 | ||||||
|         m_state.set_translation_scale(State::DefaultTranslationScale * std::clamp(translation_speed, 0.1, 10.0)); |         m_state.set_translation_scale(State::DefaultTranslationScale * std::clamp(translation_speed, 0.1, 10.0)); | ||||||
|         m_state.set_translation_deadzone(std::clamp(translation_deadzone, 0.0, State::MaxTranslationDeadzone)); |         m_state.set_translation_deadzone(std::clamp(translation_deadzone, 0.0, State::MaxTranslationDeadzone)); | ||||||
|         m_state.set_rotation_scale(State::DefaultRotationScale * std::clamp(rotation_speed, 0.1f, 10.0f)); |         m_state.set_rotation_scale(State::DefaultRotationScale * std::clamp(rotation_speed, 0.1f, 10.0f)); | ||||||
|         m_state.set_rotation_deadzone(std::clamp(rotation_deadzone, 0.0f, State::MaxRotationDeadzone)); |         m_state.set_rotation_deadzone(std::clamp(rotation_deadzone, 0.0f, State::MaxRotationDeadzone)); | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|         m_state.set_zoom_scale(State::DefaultZoomScale * std::clamp(zoom_speed, 0.1, 10.0)); |         m_state.set_zoom_scale(State::DefaultZoomScale * std::clamp(zoom_speed, 0.1, 10.0)); | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
|     } |     } | ||||||
| #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT | #if ENABLE_3DCONNEXION_DEVICES_DEBUG_OUTPUT | ||||||
|     else |     else | ||||||
|  | @ -694,13 +665,9 @@ void Mouse3DController::disconnect_device() | ||||||
|         m_thread.join(); |         m_thread.join(); | ||||||
| 
 | 
 | ||||||
|     // Store current device parameters into the config
 |     // Store current device parameters into the config
 | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|     wxGetApp().app_config->set_mouse_device(m_device_str, m_state.get_translation_scale() / State::DefaultTranslationScale, m_state.get_translation_deadzone(), |     wxGetApp().app_config->set_mouse_device(m_device_str, m_state.get_translation_scale() / State::DefaultTranslationScale, m_state.get_translation_deadzone(), | ||||||
|         m_state.get_rotation_scale() / State::DefaultRotationScale, m_state.get_rotation_deadzone(), m_state.get_zoom_scale() / State::DefaultZoomScale); |         m_state.get_rotation_scale() / State::DefaultRotationScale, m_state.get_rotation_deadzone(), m_state.get_zoom_scale() / State::DefaultZoomScale); | ||||||
| #else | 
 | ||||||
|     wxGetApp().app_config->set_mouse_device(m_device_str, m_state.get_translation_scale() / State::DefaultTranslationScale, m_state.get_translation_deadzone(), |  | ||||||
|         m_state.get_rotation_scale() / State::DefaultRotationScale, m_state.get_rotation_deadzone()); |  | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
|     wxGetApp().app_config->save(); |     wxGetApp().app_config->save(); | ||||||
| 
 | 
 | ||||||
|     // Close the 3Dconnexion device
 |     // Close the 3Dconnexion device
 | ||||||
|  | @ -911,15 +878,9 @@ bool Mouse3DController::handle_packet_translation(const DataPacketRaw& packet) | ||||||
| bool Mouse3DController::handle_packet_rotation(const DataPacketRaw& packet, unsigned int first_byte) | bool Mouse3DController::handle_packet_rotation(const DataPacketRaw& packet, unsigned int first_byte) | ||||||
| { | { | ||||||
|     double deadzone = (double)m_state.get_rotation_deadzone(); |     double deadzone = (double)m_state.get_rotation_deadzone(); | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     Vec3f rotation((float)convert_input(packet[first_byte + 0], packet[first_byte + 1], deadzone), |     Vec3f rotation((float)convert_input(packet[first_byte + 0], packet[first_byte + 1], deadzone), | ||||||
|         (float)convert_input(packet[first_byte + 2], packet[first_byte + 3], deadzone), |         (float)convert_input(packet[first_byte + 2], packet[first_byte + 3], deadzone), | ||||||
|         (float)convert_input(packet[first_byte + 4], packet[first_byte + 5], deadzone)); |         (float)convert_input(packet[first_byte + 4], packet[first_byte + 5], deadzone)); | ||||||
| #else |  | ||||||
|     Vec3f rotation(-(float)convert_input(packet[first_byte + 0], packet[first_byte + 1], deadzone), |  | ||||||
|         (float)convert_input(packet[first_byte + 2], packet[first_byte + 3], deadzone), |  | ||||||
|         -(float)convert_input(packet[first_byte + 4], packet[first_byte + 5], deadzone)); |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
|     if (!rotation.isApprox(Vec3f::Zero())) |     if (!rotation.isApprox(Vec3f::Zero())) | ||||||
|     { |     { | ||||||
|  |  | ||||||
|  | @ -37,9 +37,7 @@ class Mouse3DController | ||||||
|         static const float DefaultRotationScale; |         static const float DefaultRotationScale; | ||||||
|         static const float MaxRotationDeadzone; |         static const float MaxRotationDeadzone; | ||||||
|         static const float DefaultRotationDeadzone; |         static const float DefaultRotationDeadzone; | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|         static const double DefaultZoomScale; |         static const double DefaultZoomScale; | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
| 
 | 
 | ||||||
|     private: |     private: | ||||||
|         template <typename Number> |         template <typename Number> | ||||||
|  | @ -71,9 +69,7 @@ class Mouse3DController | ||||||
| 
 | 
 | ||||||
|         CustomParameters<double> m_translation_params; |         CustomParameters<double> m_translation_params; | ||||||
|         CustomParameters<float> m_rotation_params; |         CustomParameters<float> m_rotation_params; | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|         CustomParameters<double> m_zoom_params; |         CustomParameters<double> m_zoom_params; | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
| 
 | 
 | ||||||
|         // When the 3Dconnexion driver is running the system gets, by default, mouse wheel events when rotations around the X axis are detected.
 |         // When the 3Dconnexion driver is running the system gets, by default, mouse wheel events when rotations around the X axis are detected.
 | ||||||
|         // We want to filter these out because we are getting the data directly from the device, bypassing the driver, and those mouse wheel events interfere
 |         // We want to filter these out because we are getting the data directly from the device, bypassing the driver, and those mouse wheel events interfere
 | ||||||
|  | @ -109,10 +105,8 @@ class Mouse3DController | ||||||
|         float get_rotation_scale() const { return m_rotation_params.scale; } |         float get_rotation_scale() const { return m_rotation_params.scale; } | ||||||
|         void set_rotation_scale(float scale) { m_rotation_params.scale = scale; } |         void set_rotation_scale(float scale) { m_rotation_params.scale = scale; } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_3DCONNEXION_Y_AS_ZOOM |  | ||||||
|         double get_zoom_scale() const { return m_zoom_params.scale; } |         double get_zoom_scale() const { return m_zoom_params.scale; } | ||||||
|         void set_zoom_scale(double scale) { m_zoom_params.scale = scale; } |         void set_zoom_scale(double scale) { m_zoom_params.scale = scale; } | ||||||
| #endif // ENABLE_3DCONNEXION_Y_AS_ZOOM
 |  | ||||||
| 
 | 
 | ||||||
|         double get_translation_deadzone() const { return m_translation_params.deadzone; } |         double get_translation_deadzone() const { return m_translation_params.deadzone; } | ||||||
|         void set_translation_deadzone(double deadzone) { m_translation_params.deadzone = deadzone; } |         void set_translation_deadzone(double deadzone) { m_translation_params.deadzone = deadzone; } | ||||||
|  |  | ||||||
|  | @ -26,9 +26,7 @@ | ||||||
| #include <wx/colordlg.h> | #include <wx/colordlg.h> | ||||||
| #include <wx/numdlg.h> | #include <wx/numdlg.h> | ||||||
| #include <wx/debug.h> | #include <wx/debug.h> | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
| #include <wx/busyinfo.h> | #include <wx/busyinfo.h> | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
| 
 | 
 | ||||||
| #include "libslic3r/libslic3r.h" | #include "libslic3r/libslic3r.h" | ||||||
| #include "libslic3r/Format/STL.hpp" | #include "libslic3r/Format/STL.hpp" | ||||||
|  | @ -1784,15 +1782,11 @@ struct Plater::priv | ||||||
|     bool is_preview_loaded() const { return preview->is_loaded(); } |     bool is_preview_loaded() const { return preview->is_loaded(); } | ||||||
|     bool is_view3D_shown() const { return current_panel == view3D; } |     bool is_view3D_shown() const { return current_panel == view3D; } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     bool are_view3D_labels_shown() const { return (current_panel == view3D) && view3D->get_canvas3d()->are_labels_shown(); } |     bool are_view3D_labels_shown() const { return (current_panel == view3D) && view3D->get_canvas3d()->are_labels_shown(); } | ||||||
|     void show_view3D_labels(bool show) { if (current_panel == view3D) view3D->get_canvas3d()->show_labels(show); } |     void show_view3D_labels(bool show) { if (current_panel == view3D) view3D->get_canvas3d()->show_labels(show); } | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
|     void set_current_canvas_as_dirty(); |     void set_current_canvas_as_dirty(); | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|     GLCanvas3D* get_current_canvas3D(); |     GLCanvas3D* get_current_canvas3D(); | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
| 
 | 
 | ||||||
|     bool init_view_toolbar(); |     bool init_view_toolbar(); | ||||||
| 
 | 
 | ||||||
|  | @ -3256,10 +3250,8 @@ void Plater::priv::reload_from_disk() | ||||||
|             else |             else | ||||||
|                 missing_input_paths.push_back(volume->source.input_file); |                 missing_input_paths.push_back(volume->source.input_file); | ||||||
|         } |         } | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|         else if (!object->input_file.empty() && !volume->name.empty()) |         else if (!object->input_file.empty() && !volume->name.empty()) | ||||||
|             missing_input_paths.push_back(volume->name); |             missing_input_paths.push_back(volume->name); | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     std::sort(missing_input_paths.begin(), missing_input_paths.end()); |     std::sort(missing_input_paths.begin(), missing_input_paths.end()); | ||||||
|  | @ -3314,19 +3306,15 @@ void Plater::priv::reload_from_disk() | ||||||
|     std::sort(input_paths.begin(), input_paths.end()); |     std::sort(input_paths.begin(), input_paths.end()); | ||||||
|     input_paths.erase(std::unique(input_paths.begin(), input_paths.end()), input_paths.end()); |     input_paths.erase(std::unique(input_paths.begin(), input_paths.end()), input_paths.end()); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|     std::vector<wxString> fail_list; |     std::vector<wxString> fail_list; | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
| 
 | 
 | ||||||
|     // load one file at a time
 |     // load one file at a time
 | ||||||
|     for (size_t i = 0; i < input_paths.size(); ++i) |     for (size_t i = 0; i < input_paths.size(); ++i) | ||||||
|     { |     { | ||||||
|         const auto& path = input_paths[i].string(); |         const auto& path = input_paths[i].string(); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|         wxBusyCursor wait; |         wxBusyCursor wait; | ||||||
|         wxBusyInfo info(_(L("Reload from: ")) + from_u8(path), q->get_current_canvas3D()->get_wxglcanvas()); |         wxBusyInfo info(_(L("Reload from: ")) + from_u8(path), q->get_current_canvas3D()->get_wxglcanvas()); | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
| 
 | 
 | ||||||
|         Model new_model; |         Model new_model; | ||||||
|         try |         try | ||||||
|  | @ -3350,19 +3338,10 @@ void Plater::priv::reload_from_disk() | ||||||
|             ModelObject* old_model_object = model.objects[sel_v.object_idx]; |             ModelObject* old_model_object = model.objects[sel_v.object_idx]; | ||||||
|             ModelVolume* old_volume = old_model_object->volumes[sel_v.volume_idx]; |             ModelVolume* old_volume = old_model_object->volumes[sel_v.volume_idx]; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|             bool has_source = !old_volume->source.input_file.empty() && boost::algorithm::iequals(fs::path(old_volume->source.input_file).filename().string(), fs::path(path).filename().string()); |             bool has_source = !old_volume->source.input_file.empty() && boost::algorithm::iequals(fs::path(old_volume->source.input_file).filename().string(), fs::path(path).filename().string()); | ||||||
|             bool has_name = !old_volume->name.empty() && boost::algorithm::iequals(old_volume->name, fs::path(path).filename().string()); |             bool has_name = !old_volume->name.empty() && boost::algorithm::iequals(old_volume->name, fs::path(path).filename().string()); | ||||||
|             if (has_source || has_name) |             if (has_source || has_name) | ||||||
| #else |  | ||||||
|             int new_volume_idx = old_volume->source.volume_idx; |  | ||||||
|             int new_object_idx = old_volume->source.object_idx; |  | ||||||
| 
 |  | ||||||
|             if (boost::algorithm::iequals(fs::path(old_volume->source.input_file).filename().string(), |  | ||||||
|                 fs::path(path).filename().string())) |  | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
|             { |             { | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|                 int new_volume_idx = -1; |                 int new_volume_idx = -1; | ||||||
|                 int new_object_idx = -1; |                 int new_object_idx = -1; | ||||||
|                 if (has_source) |                 if (has_source) | ||||||
|  | @ -3398,17 +3377,12 @@ void Plater::priv::reload_from_disk() | ||||||
|                     fail_list.push_back(from_u8(has_source ? old_volume->source.input_file : old_volume->name)); |                     fail_list.push_back(from_u8(has_source ? old_volume->source.input_file : old_volume->name)); | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
| #else |  | ||||||
|                 assert(new_object_idx < (int)new_model.objects.size()); |  | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
|                 ModelObject* new_model_object = new_model.objects[new_object_idx]; |                 ModelObject* new_model_object = new_model.objects[new_object_idx]; | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|                 if ((new_volume_idx < 0) && ((int)new_model.objects.size() <= new_volume_idx)) |                 if ((new_volume_idx < 0) && ((int)new_model.objects.size() <= new_volume_idx)) | ||||||
|                 { |                 { | ||||||
|                     fail_list.push_back(from_u8(has_source ? old_volume->source.input_file : old_volume->name)); |                     fail_list.push_back(from_u8(has_source ? old_volume->source.input_file : old_volume->name)); | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
|                 if (new_volume_idx < (int)new_model_object->volumes.size()) |                 if (new_volume_idx < (int)new_model_object->volumes.size()) | ||||||
|                 { |                 { | ||||||
|                     old_model_object->add_volume(*new_model_object->volumes[new_volume_idx]); |                     old_model_object->add_volume(*new_model_object->volumes[new_volume_idx]); | ||||||
|  | @ -3419,9 +3393,6 @@ void Plater::priv::reload_from_disk() | ||||||
|                     new_volume->set_material_id(old_volume->material_id()); |                     new_volume->set_material_id(old_volume->material_id()); | ||||||
|                     new_volume->set_transformation(old_volume->get_transformation() * old_volume->source.transform); |                     new_volume->set_transformation(old_volume->get_transformation() * old_volume->source.transform); | ||||||
|                     new_volume->translate(new_volume->get_transformation().get_matrix(true) * (new_volume->source.mesh_offset - old_volume->source.mesh_offset)); |                     new_volume->translate(new_volume->get_transformation().get_matrix(true) * (new_volume->source.mesh_offset - old_volume->source.mesh_offset)); | ||||||
| #if !ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|                     new_volume->source.input_file = path; |  | ||||||
| #endif // !ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
|                     std::swap(old_model_object->volumes[sel_v.volume_idx], old_model_object->volumes.back()); |                     std::swap(old_model_object->volumes[sel_v.volume_idx], old_model_object->volumes.back()); | ||||||
|                     old_model_object->delete_volume(old_model_object->volumes.size() - 1); |                     old_model_object->delete_volume(old_model_object->volumes.size() - 1); | ||||||
|                     old_model_object->ensure_on_bed(); |                     old_model_object->ensure_on_bed(); | ||||||
|  | @ -3430,7 +3401,6 @@ void Plater::priv::reload_from_disk() | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|     if (!fail_list.empty()) |     if (!fail_list.empty()) | ||||||
|     { |     { | ||||||
|         wxString message = _(L("Unable to reload:")) + "\n"; |         wxString message = _(L("Unable to reload:")) + "\n"; | ||||||
|  | @ -3441,7 +3411,6 @@ void Plater::priv::reload_from_disk() | ||||||
|         wxMessageDialog dlg(q, message, _(L("Error during reload")), wxOK | wxOK_DEFAULT | wxICON_WARNING); |         wxMessageDialog dlg(q, message, _(L("Error during reload")), wxOK | wxOK_DEFAULT | wxICON_WARNING); | ||||||
|         dlg.ShowModal(); |         dlg.ShowModal(); | ||||||
|     } |     } | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
| 
 | 
 | ||||||
|     // update 3D scene
 |     // update 3D scene
 | ||||||
|     update(); |     update(); | ||||||
|  | @ -4073,12 +4042,10 @@ void Plater::priv::set_current_canvas_as_dirty() | ||||||
|         preview->set_as_dirty(); |         preview->set_as_dirty(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
| GLCanvas3D* Plater::priv::get_current_canvas3D() | GLCanvas3D* Plater::priv::get_current_canvas3D() | ||||||
| { | { | ||||||
|     return (current_panel == view3D) ? view3D->get_canvas3d() : ((current_panel == preview) ? preview->get_canvas3d() : nullptr); |     return (current_panel == view3D) ? view3D->get_canvas3d() : ((current_panel == preview) ? preview->get_canvas3d() : nullptr); | ||||||
| } | } | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
| 
 | 
 | ||||||
| bool Plater::priv::init_view_toolbar() | bool Plater::priv::init_view_toolbar() | ||||||
| { | { | ||||||
|  | @ -4190,10 +4157,8 @@ bool Plater::priv::can_reload_from_disk() const | ||||||
|         const ModelVolume* volume = object->volumes[v.volume_idx]; |         const ModelVolume* volume = object->volumes[v.volume_idx]; | ||||||
|         if (!volume->source.input_file.empty()) |         if (!volume->source.input_file.empty()) | ||||||
|             paths.push_back(volume->source.input_file); |             paths.push_back(volume->source.input_file); | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|         else if (!object->input_file.empty() && !volume->name.empty()) |         else if (!object->input_file.empty() && !volume->name.empty()) | ||||||
|             paths.push_back(volume->name); |             paths.push_back(volume->name); | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
|     } |     } | ||||||
|     std::sort(paths.begin(), paths.end()); |     std::sort(paths.begin(), paths.end()); | ||||||
|     paths.erase(std::unique(paths.begin(), paths.end()), paths.end()); |     paths.erase(std::unique(paths.begin(), paths.end()), paths.end()); | ||||||
|  | @ -4669,10 +4634,8 @@ bool Plater::is_preview_shown() const { return p->is_preview_shown(); } | ||||||
| bool Plater::is_preview_loaded() const { return p->is_preview_loaded(); } | bool Plater::is_preview_loaded() const { return p->is_preview_loaded(); } | ||||||
| bool Plater::is_view3D_shown() const { return p->is_view3D_shown(); } | bool Plater::is_view3D_shown() const { return p->is_view3D_shown(); } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
| bool Plater::are_view3D_labels_shown() const { return p->are_view3D_labels_shown(); } | bool Plater::are_view3D_labels_shown() const { return p->are_view3D_labels_shown(); } | ||||||
| void Plater::show_view3D_labels(bool show) { p->show_view3D_labels(show); } | void Plater::show_view3D_labels(bool show) { p->show_view3D_labels(show); } | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
| void Plater::select_all() { p->select_all(); } | void Plater::select_all() { p->select_all(); } | ||||||
| void Plater::deselect_all() { p->deselect_all(); } | void Plater::deselect_all() { p->deselect_all(); } | ||||||
|  | @ -5012,12 +4975,8 @@ void Plater::export_amf() | ||||||
|     wxBusyCursor wait; |     wxBusyCursor wait; | ||||||
|     bool export_config = true; |     bool export_config = true; | ||||||
|     DynamicPrintConfig cfg = wxGetApp().preset_bundle->full_config_secure(); |     DynamicPrintConfig cfg = wxGetApp().preset_bundle->full_config_secure(); | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|     bool full_pathnames = wxGetApp().app_config->get("export_sources_full_pathnames") == "1"; |     bool full_pathnames = wxGetApp().app_config->get("export_sources_full_pathnames") == "1"; | ||||||
|     if (Slic3r::store_amf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames)) { |     if (Slic3r::store_amf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames)) { | ||||||
| #else |  | ||||||
|     if (Slic3r::store_amf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr)) { |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
|         // Success
 |         // Success
 | ||||||
|         p->statusbar()->set_status_text(wxString::Format(_(L("AMF file exported to %s")), path)); |         p->statusbar()->set_status_text(wxString::Format(_(L("AMF file exported to %s")), path)); | ||||||
|     } else { |     } else { | ||||||
|  | @ -5046,7 +5005,6 @@ void Plater::export_3mf(const boost::filesystem::path& output_path) | ||||||
|     DynamicPrintConfig cfg = wxGetApp().preset_bundle->full_config_secure(); |     DynamicPrintConfig cfg = wxGetApp().preset_bundle->full_config_secure(); | ||||||
|     const std::string path_u8 = into_u8(path); |     const std::string path_u8 = into_u8(path); | ||||||
|     wxBusyCursor wait; |     wxBusyCursor wait; | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|     bool full_pathnames = wxGetApp().app_config->get("export_sources_full_pathnames") == "1"; |     bool full_pathnames = wxGetApp().app_config->get("export_sources_full_pathnames") == "1"; | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR | #if ENABLE_THUMBNAIL_GENERATOR | ||||||
|     ThumbnailData thumbnail_data; |     ThumbnailData thumbnail_data; | ||||||
|  | @ -5055,15 +5013,6 @@ void Plater::export_3mf(const boost::filesystem::path& output_path) | ||||||
| #else | #else | ||||||
|     if (Slic3r::store_3mf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames)) { |     if (Slic3r::store_3mf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames)) { | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 | #endif // ENABLE_THUMBNAIL_GENERATOR
 | ||||||
| #else |  | ||||||
| #if ENABLE_THUMBNAIL_GENERATOR |  | ||||||
|     ThumbnailData thumbnail_data; |  | ||||||
|     p->generate_thumbnail(thumbnail_data, THUMBNAIL_SIZE_3MF.first, THUMBNAIL_SIZE_3MF.second, false, true, true, true); |  | ||||||
|     if (Slic3r::store_3mf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, &thumbnail_data)) { |  | ||||||
| #else |  | ||||||
|     if (Slic3r::store_3mf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr)) { |  | ||||||
| #endif // ENABLE_THUMBNAIL_GENERATOR
 |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
|         // Success
 |         // Success
 | ||||||
|         p->statusbar()->set_status_text(wxString::Format(_(L("3MF file exported to %s")), path)); |         p->statusbar()->set_status_text(wxString::Format(_(L("3MF file exported to %s")), path)); | ||||||
|         p->set_project_filename(path); |         p->set_project_filename(path); | ||||||
|  | @ -5521,12 +5470,10 @@ GLCanvas3D* Plater::canvas3D() | ||||||
|     return p->view3D->get_canvas3d(); |     return p->view3D->get_canvas3d(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
| GLCanvas3D* Plater::get_current_canvas3D() | GLCanvas3D* Plater::get_current_canvas3D() | ||||||
| { | { | ||||||
|     return p->get_current_canvas3D(); |     return p->get_current_canvas3D(); | ||||||
| } | } | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
| 
 | 
 | ||||||
| BoundingBoxf Plater::bed_shape_bb() const | BoundingBoxf Plater::bed_shape_bb() const | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -170,10 +170,8 @@ public: | ||||||
|     bool is_preview_loaded() const; |     bool is_preview_loaded() const; | ||||||
|     bool is_view3D_shown() const; |     bool is_view3D_shown() const; | ||||||
| 
 | 
 | ||||||
| #if ENABLE_SHOW_SCENE_LABELS |  | ||||||
|     bool are_view3D_labels_shown() const; |     bool are_view3D_labels_shown() const; | ||||||
|     void show_view3D_labels(bool show); |     void show_view3D_labels(bool show); | ||||||
| #endif // ENABLE_SHOW_SCENE_LABELS
 |  | ||||||
| 
 | 
 | ||||||
|     // Called after the Preferences dialog is closed and the program settings are saved.
 |     // Called after the Preferences dialog is closed and the program settings are saved.
 | ||||||
|     // Update the UI based on the current preferences.
 |     // Update the UI based on the current preferences.
 | ||||||
|  | @ -250,9 +248,7 @@ public: | ||||||
|     int get_selected_object_idx(); |     int get_selected_object_idx(); | ||||||
|     bool is_single_full_object_selection() const; |     bool is_single_full_object_selection() const; | ||||||
|     GLCanvas3D* canvas3D(); |     GLCanvas3D* canvas3D(); | ||||||
| #if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK |  | ||||||
|     GLCanvas3D* get_current_canvas3D(); |     GLCanvas3D* get_current_canvas3D(); | ||||||
| #endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK
 |  | ||||||
|     BoundingBoxf bed_shape_bb() const; |     BoundingBoxf bed_shape_bb() const; | ||||||
| 
 | 
 | ||||||
|     void set_current_canvas_as_dirty(); |     void set_current_canvas_as_dirty(); | ||||||
|  |  | ||||||
|  | @ -68,7 +68,6 @@ void PreferencesDialog::build() | ||||||
| 	option = Option (def, "version_check"); | 	option = Option (def, "version_check"); | ||||||
| 	m_optgroup_general->append_single_option_line(option); | 	m_optgroup_general->append_single_option_line(option); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| 	// Please keep in sync with ConfigWizard
 | 	// Please keep in sync with ConfigWizard
 | ||||||
| 	def.label = L("Export sources full pathnames to 3mf and amf"); | 	def.label = L("Export sources full pathnames to 3mf and amf"); | ||||||
| 	def.type = coBool; | 	def.type = coBool; | ||||||
|  | @ -76,7 +75,6 @@ void PreferencesDialog::build() | ||||||
| 	def.set_default_value(new ConfigOptionBool(app_config->get("export_sources_full_pathnames") == "1")); | 	def.set_default_value(new ConfigOptionBool(app_config->get("export_sources_full_pathnames") == "1")); | ||||||
| 	option = Option(def, "export_sources_full_pathnames"); | 	option = Option(def, "export_sources_full_pathnames"); | ||||||
| 	m_optgroup_general->append_single_option_line(option); | 	m_optgroup_general->append_single_option_line(option); | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
| 	// Please keep in sync with ConfigWizard
 | 	// Please keep in sync with ConfigWizard
 | ||||||
| 	def.label = L("Update built-in Presets automatically"); | 	def.label = L("Update built-in Presets automatically"); | ||||||
|  | @ -125,14 +123,12 @@ void PreferencesDialog::build() | ||||||
| 	option = Option(def, "use_perspective_camera"); | 	option = Option(def, "use_perspective_camera"); | ||||||
| 	m_optgroup_camera->append_single_option_line(option); | 	m_optgroup_camera->append_single_option_line(option); | ||||||
| 
 | 
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
| 	def.label = L("Use free camera"); | 	def.label = L("Use free camera"); | ||||||
| 	def.type = coBool; | 	def.type = coBool; | ||||||
| 	def.tooltip = L("If enabled, use free camera. If not enabled, use constrained camera."); | 	def.tooltip = L("If enabled, use free camera. If not enabled, use constrained camera."); | ||||||
| 	def.set_default_value(new ConfigOptionBool(app_config->get("use_free_camera") == "1")); | 	def.set_default_value(new ConfigOptionBool(app_config->get("use_free_camera") == "1")); | ||||||
| 	option = Option(def, "use_free_camera"); | 	option = Option(def, "use_free_camera"); | ||||||
| 	m_optgroup_camera->append_single_option_line(option); | 	m_optgroup_camera->append_single_option_line(option); | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
| 
 | 
 | ||||||
| 	m_optgroup_gui = std::make_shared<ConfigOptionsGroup>(this, _(L("GUI"))); | 	m_optgroup_gui = std::make_shared<ConfigOptionsGroup>(this, _(L("GUI"))); | ||||||
| 	m_optgroup_gui->label_width = 40; | 	m_optgroup_gui->label_width = 40; | ||||||
|  |  | ||||||
|  | @ -2005,11 +2005,7 @@ void Selection::render_sidebar_layers_hints(const std::string& sidebar_field) co | ||||||
|     const float max_y = box.max(1) + Margin; |     const float max_y = box.max(1) + Margin; | ||||||
| 
 | 
 | ||||||
|     // view dependend order of rendering to keep correct transparency
 |     // view dependend order of rendering to keep correct transparency
 | ||||||
| #if ENABLE_6DOF_CAMERA |  | ||||||
|     bool camera_on_top = wxGetApp().plater()->get_camera().is_looking_downward(); |     bool camera_on_top = wxGetApp().plater()->get_camera().is_looking_downward(); | ||||||
| #else |  | ||||||
|     bool camera_on_top = wxGetApp().plater()->get_camera().get_theta() <= 90.0f; |  | ||||||
| #endif // ENABLE_6DOF_CAMERA
 |  | ||||||
|     float z1 = camera_on_top ? min_z : max_z; |     float z1 = camera_on_top ? min_z : max_z; | ||||||
|     float z2 = camera_on_top ? max_z : min_z; |     float z2 = camera_on_top ? max_z : min_z; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1708,12 +1708,16 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup) | ||||||
|     host_line.append_widget(printhost_browse); |     host_line.append_widget(printhost_browse); | ||||||
|     host_line.append_widget(print_host_test); |     host_line.append_widget(print_host_test); | ||||||
|     optgroup->append_line(host_line); |     optgroup->append_line(host_line); | ||||||
|     optgroup->append_single_option_line("printhost_apikey"); |     option = optgroup->get_option("printhost_apikey"); | ||||||
|  |     option.opt.width = Field::def_width_wider(); | ||||||
|  |     optgroup->append_single_option_line(option); | ||||||
| 
 | 
 | ||||||
|     const auto ca_file_hint = _(L("HTTPS CA file is optional. It is only needed if you use HTTPS with a self-signed certificate.")); |     const auto ca_file_hint = _(L("HTTPS CA file is optional. It is only needed if you use HTTPS with a self-signed certificate.")); | ||||||
| 
 | 
 | ||||||
|     if (Http::ca_file_supported()) { |     if (Http::ca_file_supported()) { | ||||||
|         Line cafile_line = optgroup->create_single_option_line("printhost_cafile"); |         option = optgroup->get_option("printhost_cafile"); | ||||||
|  |         option.opt.width = Field::def_width_wider(); | ||||||
|  |         Line cafile_line = optgroup->create_single_option_line(option); | ||||||
| 
 | 
 | ||||||
|         auto printhost_cafile_browse = [this, optgroup] (wxWindow* parent) { |         auto printhost_cafile_browse = [this, optgroup] (wxWindow* parent) { | ||||||
|             auto btn = new wxButton(parent, wxID_ANY, " " + _(L("Browse"))+" " +dots, wxDefaultPosition, wxDefaultSize, wxBU_LEFT); |             auto btn = new wxButton(parent, wxID_ANY, " " + _(L("Browse"))+" " +dots, wxDefaultPosition, wxDefaultSize, wxBU_LEFT); | ||||||
|  |  | ||||||
|  | @ -363,17 +363,10 @@ void fix_model_by_win10_sdk_gui(ModelObject &model_object, int volume_idx) | ||||||
| 				ModelObject *model_object = model.add_object(); | 				ModelObject *model_object = model.add_object(); | ||||||
| 				model_object->add_volume(*volumes[ivolume]); | 				model_object->add_volume(*volumes[ivolume]); | ||||||
| 				model_object->add_instance(); | 				model_object->add_instance(); | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
| 				if (!Slic3r::store_3mf(path_src.string().c_str(), &model, nullptr, false)) { | 				if (!Slic3r::store_3mf(path_src.string().c_str(), &model, nullptr, false)) { | ||||||
| 					boost::filesystem::remove(path_src); | 					boost::filesystem::remove(path_src); | ||||||
| 					throw std::runtime_error(L("Export of a temporary 3mf file failed")); | 					throw std::runtime_error(L("Export of a temporary 3mf file failed")); | ||||||
| 				} | 				} | ||||||
| #else |  | ||||||
| 				if (! Slic3r::store_3mf(path_src.string().c_str(), &model, nullptr)) { |  | ||||||
| 					boost::filesystem::remove(path_src); |  | ||||||
| 					throw std::runtime_error(L("Export of a temporary 3mf file failed")); |  | ||||||
| 				} |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 				model.clear_objects(); | 				model.clear_objects(); | ||||||
| 				model.clear_materials(); | 				model.clear_materials(); | ||||||
| 				boost::filesystem::path path_dst = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path(); | 				boost::filesystem::path path_dst = boost::filesystem::temp_directory_path() / boost::filesystem::unique_path(); | ||||||
|  |  | ||||||
|  | @ -51,11 +51,7 @@ SCENARIO("Export+Import geometry to/from 3mf file cycle", "[3mf]") { | ||||||
|         WHEN("model is saved+loaded to/from 3mf file") { |         WHEN("model is saved+loaded to/from 3mf file") { | ||||||
|             // save the model to 3mf file
 |             // save the model to 3mf file
 | ||||||
|             std::string test_file = std::string(TEST_DATA_DIR) + "/test_3mf/prusa.3mf"; |             std::string test_file = std::string(TEST_DATA_DIR) + "/test_3mf/prusa.3mf"; | ||||||
| #if ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF |  | ||||||
|             store_3mf(test_file.c_str(), &src_model, nullptr, false); |             store_3mf(test_file.c_str(), &src_model, nullptr, false); | ||||||
| #else |  | ||||||
|             store_3mf(test_file.c_str(), &src_model, nullptr); |  | ||||||
| #endif // ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF
 |  | ||||||
| 
 | 
 | ||||||
|             // load back the model from the 3mf file
 |             // load back the model from the 3mf file
 | ||||||
|             Model dst_model; |             Model dst_model; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Enrico Turri
						Enrico Turri