mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-29 11:51:24 +00:00
Keep the Process and Printer of an inherits_group of the Wrong Length
A project whose inherits_group did not have one entry per filament plus the process and printer entries was loaded as if it had none. The CLI then looked for system presets under the names of the user presets, found none and refused to slice a project that slices on main. The group is now read as before: the process first, the printer last and the filaments in between, up to the filament count. A filament without an entry counts as a system preset. A group with fewer than two entries is still ignored. The warning stays.
This commit is contained in:
+9
-10
@@ -1707,11 +1707,13 @@ int CLI::run(int argc, char **argv)
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("current_printer_name %1%, current_process_name %2%")%current_printer_name %current_process_name;
|
||||
ConfigOptionStrings* option_strings = config.option<ConfigOptionStrings>("inherits_group");
|
||||
// One entry for the process, one per filament and one for the printer.
|
||||
// One entry for the process, one per filament and one for the printer. A group of another
|
||||
// length still has the process first and the printer last; one too short for that is ignored.
|
||||
if (option_strings && option_strings->values.size() != current_filaments_name.size() + 2) {
|
||||
boost::nowide::cerr << "Warning: ignoring inherits_group with " << option_strings->values.size() << " entries, expected "
|
||||
boost::nowide::cerr << "Warning: inherits_group has " << option_strings->values.size() << " entries, expected "
|
||||
<< current_filaments_name.size() + 2 << " for " << current_filaments_name.size() << " filaments" << std::endl;
|
||||
option_strings = nullptr;
|
||||
if (option_strings->values.size() < 2)
|
||||
option_strings = nullptr;
|
||||
}
|
||||
if (option_strings) {
|
||||
current_inherits_group = option_strings->values;
|
||||
@@ -1734,14 +1736,11 @@ int CLI::run(int argc, char **argv)
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("inherits of process valid, current_process_system_name is %1%") %current_process_system_name;
|
||||
}
|
||||
|
||||
current_filaments_system_name.resize(size - 2);
|
||||
for (int index = 1; index < (size - 1); index++) {
|
||||
if (current_inherits_group[index].empty()) {
|
||||
current_filaments_system_name[index-1] = current_filaments_name[index-1];
|
||||
}
|
||||
else {
|
||||
// A filament without an entry of its own counts as a system preset.
|
||||
current_filaments_system_name = current_filaments_name;
|
||||
for (size_t index = 1; index < size - 1 && index <= current_filaments_name.size(); index++) {
|
||||
if (!current_inherits_group[index].empty())
|
||||
current_filaments_system_name[index-1] = current_inherits_group[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# orca-slicer binary. Each case lives inline in CLI::run(), so only the binary can reach it.
|
||||
#
|
||||
# - A project whose inherits_group does not have one entry per filament plus the process and
|
||||
# printer entries is loaded as if it had none.
|
||||
# printer entries still loads.
|
||||
# - --slice N --arrange 1 on a project without plate metadata slices plate N.
|
||||
# - An assemble list object with an empty filament list, or a negative filament id, is rejected
|
||||
# as a config error.
|
||||
@@ -155,7 +155,7 @@ run_presets export --slice 0 --export-3mf project.3mf "$WORK/cube.stl"
|
||||
expect_status export $CLI_SUCCESS
|
||||
[ -f "$WORK/export/project.3mf" ] || { echo "FAIL: project export failed"; tail -n 40 "$WORK/export/log"; exit 1; }
|
||||
|
||||
echo "== an inherits_group of the wrong length is ignored"
|
||||
echo "== an inherits_group of the wrong length still loads"
|
||||
for group in '[]' '[""]' '["", "", "", "", ""]'; do
|
||||
tag="inherits_$("$PY" -c 'import json, sys; print(len(json.loads(sys.argv[1])))' "$group")"
|
||||
rewrite_3mf "$WORK/export/project.3mf" "$WORK/$tag.3mf" inherits "$group"
|
||||
|
||||
Reference in New Issue
Block a user