Load the CAD recipe from projects saved before it was renamed

The recipe's 3MF entry moved from Metadata/SnapOrca_cad.bin to
Metadata/orca_cad.bin, so projects saved by earlier builds opened with an
empty Design tab. Both 3MF backends now read either name and write only the
new one; the recipe version advances to 6 to mark the move.
This commit is contained in:
SoftFever
2026-08-29 01:56:48 +08:00
parent 0fc62d03b9
commit 8f014de84c
7 changed files with 191 additions and 14 deletions
+5 -1
View File
@@ -74,6 +74,9 @@ const std::string PRINT_CONFIG_FILE = "Metadata/Slic3r_PE.config";
const std::string MODEL_CONFIG_FILE = "Metadata/Slic3r_PE_model.config";
const std::string LAYER_HEIGHTS_PROFILE_FILE = "Metadata/Slic3r_PE_layer_heights_profile.txt";
const std::string CAD_RECIPE_FILE = "Metadata/orca_cad.bin";
// Read-only: the recipe entry's pre-rename name. A reader that knows only the new one drops the
// feature tree of every project written before the move, without a word. Never written.
const std::string LEGACY_CAD_RECIPE_FILE = "Metadata/SnapOrca_cad.bin";
const std::string LAYER_CONFIG_RANGES_FILE = "Metadata/Prusa_Slicer_layer_config_ranges.xml";
const std::string SLA_SUPPORT_POINTS_FILE = "Metadata/Slic3r_PE_sla_support_points.txt";
const std::string SLA_DRAIN_HOLES_FILE = "Metadata/Slic3r_PE_sla_drain_holes.txt";
@@ -806,7 +809,8 @@ ModelVolumeType type_from_string(const std::string &s)
return false;
}
}
if (boost::algorithm::iequals(name, CAD_RECIPE_FILE)) {
if (boost::algorithm::iequals(name, CAD_RECIPE_FILE)
|| boost::algorithm::iequals(name, LEGACY_CAD_RECIPE_FILE)) {
if (stat.m_uncomp_size > 0) {
std::string buffer((size_t)stat.m_uncomp_size, 0);
if (mz_zip_reader_extract_file_to_mem(&archive, stat.m_filename,
+5 -1
View File
@@ -215,6 +215,9 @@ const std::string SLICE_INFO_CONFIG_FILE = "Metadata/slice_info.config";
const std::string FILAMENT_SEQUENCE_FILE = "Metadata/filament_sequence.json";
const std::string BBS_LAYER_HEIGHTS_PROFILE_FILE = "Metadata/layer_heights_profile.txt";
const std::string ORCA_CAD_RECIPE_FILE = "Metadata/orca_cad.bin";
// Read-only: the recipe entry's pre-rename name. A reader that knows only the new one drops the
// feature tree of every project written before the move, without a word. Never written.
const std::string LEGACY_CAD_RECIPE_FILE = "Metadata/SnapOrca_cad.bin";
const std::string LAYER_CONFIG_RANGES_FILE = "Metadata/layer_config_ranges.xml";
const std::string BRIM_EAR_POINTS_FILE = "Metadata/brim_ear_points.txt";
/*const std::string SLA_SUPPORT_POINTS_FILE = "Metadata/Slic3r_PE_sla_support_points.txt";
@@ -1971,7 +1974,8 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
// extract slic3r print config file
_extract_project_config_from_archive(archive, stat, config, config_substitutions, model);
}
else if (boost::algorithm::iequals(name, ORCA_CAD_RECIPE_FILE)) {
else if (boost::algorithm::iequals(name, ORCA_CAD_RECIPE_FILE)
|| boost::algorithm::iequals(name, LEGACY_CAD_RECIPE_FILE)) {
// Restore the editable CAD recipe (optional; absent in non-CAD projects).
if (stat.m_uncomp_size > 0) {
std::string buf((size_t)stat.m_uncomp_size, '\0');