Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11453,6 +11453,13 @@ static std::vector<std::pair<int, int>> reloadable_volumes(const Model &model, c
}
return ret;
}

static bool source_filenames_equal(const std::string &lhs, const std::string &rhs)
{
if (lhs.empty() || rhs.empty())
return false;
return boost::algorithm::iequals(fs::path(lhs).filename().string(), fs::path(rhs).filename().string());
}
#endif // ENABLE_RELOAD_FROM_DISK_REWORK

void Plater::priv::reload_from_disk()
Expand Down Expand Up @@ -11710,15 +11717,18 @@ void Plater::priv::reload_from_disk()
if (has_source && old_volume->source.object_idx < int(new_model.objects.size())) {
const ModelObject *obj = new_model.objects[old_volume->source.object_idx];
if (old_volume->source.volume_idx < int(obj->volumes.size())) {
if (obj->volumes[old_volume->source.volume_idx]->source.input_file == old_volume->source.input_file) {
const std::string &loaded_src = obj->volumes[old_volume->source.volume_idx]->source.input_file;
if (source_filenames_equal(loaded_src, old_volume->source.input_file)) {
new_volume_idx = old_volume->source.volume_idx;
new_object_idx = old_volume->source.object_idx;
match_found = true;
}
}
}

if (!match_found && has_name) {
// Search the loaded model by part name. Do not require the volume
// name to equal the source filename (Roller != tpu_tube-Roller.3mf).
if (!match_found && !old_volume->name.empty()) {
// take idxs from the 1st matching volume
for (size_t o = 0; o < new_model.objects.size(); ++o) {
ModelObject *obj = new_model.objects[o];
Expand Down
Loading