ENABLE_CONFIGURABLE_PATHS_EXPORT_TO_3MF_AND_AMF set as default
This commit is contained in:
parent
b0218daafe
commit
904263d231
14 changed files with 1 additions and 123 deletions
|
@ -641,18 +641,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
|
||||||
|
|
||||||
|
|
|
@ -47,9 +47,6 @@
|
||||||
//==================
|
//==================
|
||||||
#define ENABLE_2_2_0_BETA1 1
|
#define ENABLE_2_2_0_BETA1 1
|
||||||
|
|
||||||
// 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
|
// Enable 6 degrees of freedom camera
|
||||||
#define ENABLE_6DOF_CAMERA (1 && ENABLE_2_2_0_BETA1)
|
#define ENABLE_6DOF_CAMERA (1 && ENABLE_2_2_0_BETA1)
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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())
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -5012,12 +5012,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 +5042,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 +5050,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);
|
||||||
|
|
|
@ -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");
|
||||||
|
|
|
@ -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…
Reference in a new issue