diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp index 1f934b6c8..e918ac575 100644 --- a/src/libslic3r/Technologies.hpp +++ b/src/libslic3r/Technologies.hpp @@ -47,9 +47,6 @@ //================== #define ENABLE_2_2_0_BETA1 1 -// Enhance reload from disk to be able to work with 3mf/amf files saved with PrusaSlicer 2.1.0 and earlier -#define ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK (1 && ENABLE_2_2_0_BETA1) - // Enable showing object/instance info with labels into the 3D scene #define ENABLE_SHOW_SCENE_LABELS (1 && ENABLE_2_2_0_BETA1) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 6e5c601d3..11eebb0de 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -2270,9 +2270,7 @@ void ObjectList::split() add_settings_item(vol_item, &volume->config); } -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK model_object->input_file.clear(); -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK if (parent == item) Expand(parent); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index d351d5793..f3f96a2df 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -26,9 +26,7 @@ #include #include #include -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK #include -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK #include "libslic3r/libslic3r.h" #include "libslic3r/Format/STL.hpp" @@ -1790,9 +1788,7 @@ struct Plater::priv #endif // ENABLE_SHOW_SCENE_LABELS void set_current_canvas_as_dirty(); -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK GLCanvas3D* get_current_canvas3D(); -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK bool init_view_toolbar(); @@ -3256,10 +3252,8 @@ void Plater::priv::reload_from_disk() else missing_input_paths.push_back(volume->source.input_file); } -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK else if (!object->input_file.empty() && !volume->name.empty()) missing_input_paths.push_back(volume->name); -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK } std::sort(missing_input_paths.begin(), missing_input_paths.end()); @@ -3314,19 +3308,15 @@ void Plater::priv::reload_from_disk() std::sort(input_paths.begin(), input_paths.end()); input_paths.erase(std::unique(input_paths.begin(), input_paths.end()), input_paths.end()); -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK std::vector fail_list; -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK // load one file at a time for (size_t i = 0; i < input_paths.size(); ++i) { const auto& path = input_paths[i].string(); -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK wxBusyCursor wait; wxBusyInfo info(_(L("Reload from: ")) + from_u8(path), q->get_current_canvas3D()->get_wxglcanvas()); -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK Model new_model; try @@ -3350,19 +3340,10 @@ void Plater::priv::reload_from_disk() ModelObject* old_model_object = model.objects[sel_v.object_idx]; ModelVolume* old_volume = old_model_object->volumes[sel_v.volume_idx]; -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK bool has_source = !old_volume->source.input_file.empty() && boost::algorithm::iequals(fs::path(old_volume->source.input_file).filename().string(), fs::path(path).filename().string()); bool has_name = !old_volume->name.empty() && boost::algorithm::iequals(old_volume->name, fs::path(path).filename().string()); if (has_source || has_name) -#else - int new_volume_idx = old_volume->source.volume_idx; - int new_object_idx = old_volume->source.object_idx; - - if (boost::algorithm::iequals(fs::path(old_volume->source.input_file).filename().string(), - fs::path(path).filename().string())) -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK { -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK int new_volume_idx = -1; int new_object_idx = -1; if (has_source) @@ -3398,17 +3379,12 @@ void Plater::priv::reload_from_disk() fail_list.push_back(from_u8(has_source ? old_volume->source.input_file : old_volume->name)); continue; } -#else - assert(new_object_idx < (int)new_model.objects.size()); -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK ModelObject* new_model_object = new_model.objects[new_object_idx]; -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK if ((new_volume_idx < 0) && ((int)new_model.objects.size() <= new_volume_idx)) { fail_list.push_back(from_u8(has_source ? old_volume->source.input_file : old_volume->name)); continue; } -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK if (new_volume_idx < (int)new_model_object->volumes.size()) { old_model_object->add_volume(*new_model_object->volumes[new_volume_idx]); @@ -3419,9 +3395,6 @@ void Plater::priv::reload_from_disk() new_volume->set_material_id(old_volume->material_id()); new_volume->set_transformation(old_volume->get_transformation() * old_volume->source.transform); new_volume->translate(new_volume->get_transformation().get_matrix(true) * (new_volume->source.mesh_offset - old_volume->source.mesh_offset)); -#if !ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK - new_volume->source.input_file = path; -#endif // !ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK std::swap(old_model_object->volumes[sel_v.volume_idx], old_model_object->volumes.back()); old_model_object->delete_volume(old_model_object->volumes.size() - 1); old_model_object->ensure_on_bed(); @@ -3430,7 +3403,6 @@ void Plater::priv::reload_from_disk() } } -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK if (!fail_list.empty()) { wxString message = _(L("Unable to reload:")) + "\n"; @@ -3441,7 +3413,6 @@ void Plater::priv::reload_from_disk() wxMessageDialog dlg(q, message, _(L("Error during reload")), wxOK | wxOK_DEFAULT | wxICON_WARNING); dlg.ShowModal(); } -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK // update 3D scene update(); @@ -4073,12 +4044,10 @@ void Plater::priv::set_current_canvas_as_dirty() preview->set_as_dirty(); } -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK GLCanvas3D* Plater::priv::get_current_canvas3D() { return (current_panel == view3D) ? view3D->get_canvas3d() : ((current_panel == preview) ? preview->get_canvas3d() : nullptr); } -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK bool Plater::priv::init_view_toolbar() { @@ -4190,10 +4159,8 @@ bool Plater::priv::can_reload_from_disk() const const ModelVolume* volume = object->volumes[v.volume_idx]; if (!volume->source.input_file.empty()) paths.push_back(volume->source.input_file); -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK else if (!object->input_file.empty() && !volume->name.empty()) paths.push_back(volume->name); -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK } std::sort(paths.begin(), paths.end()); paths.erase(std::unique(paths.begin(), paths.end()), paths.end()); @@ -5507,12 +5474,10 @@ GLCanvas3D* Plater::canvas3D() return p->view3D->get_canvas3d(); } -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK GLCanvas3D* Plater::get_current_canvas3D() { return p->get_current_canvas3D(); } -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK BoundingBoxf Plater::bed_shape_bb() const { diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 3c1dde0f3..87ba3d60e 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -250,9 +250,7 @@ public: int get_selected_object_idx(); bool is_single_full_object_selection() const; GLCanvas3D* canvas3D(); -#if ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK GLCanvas3D* get_current_canvas3D(); -#endif // ENABLE_BACKWARD_COMPATIBLE_RELOAD_FROM_DISK BoundingBoxf bed_shape_bb() const; void set_current_canvas_as_dirty();