diff options
author | enricoturri1966 <enricoturri@seznam.cz> | 2021-09-10 11:22:44 +0300 |
---|---|---|
committer | enricoturri1966 <enricoturri@seznam.cz> | 2021-09-10 11:22:44 +0300 |
commit | 37c9e207785567744f874f8729dc014239c53775 (patch) | |
tree | 1b216a53ffca228ae69e074a02a4cfffab24c3db /src/slic3r | |
parent | 638fc5a869acc15b42cbec094b19d07bf12600f1 (diff) |
ENABLE_RELOAD_FROM_DISK_REPLACE_FILE - Search missing files in the same folder of the current project
Diffstat (limited to 'src/slic3r')
-rw-r--r-- | src/slic3r/GUI/Plater.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 9a436c1f0..f8d13ccff 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3417,8 +3417,28 @@ void Plater::priv::reload_from_disk() if (!volume->source.input_file.empty()) { if (fs::exists(volume->source.input_file)) input_paths.push_back(volume->source.input_file); +#if ENABLE_RELOAD_FROM_DISK_REPLACE_FILE + else { + // searches the source in the same folder containing the object + bool found = false; + if (!object->input_file.empty()) { + fs::path object_path = fs::path(object->input_file).remove_filename(); + if (!object_path.empty()) { + object_path /= fs::path(volume->source.input_file).filename(); + const std::string source_input_file = object_path.string(); + if (fs::exists(source_input_file)) { + input_paths.push_back(source_input_file); + found = true; + } + } + } + if (!found) + missing_input_paths.push_back(volume->source.input_file); + } +#else else missing_input_paths.push_back(volume->source.input_file); +#endif // ENABLE_RELOAD_FROM_DISK_REPLACE_FILE } else if (!object->input_file.empty() && volume->is_model_part() && !volume->name.empty() && !volume->source.is_from_builtin_objects) missing_input_paths.push_back(volume->name); |