Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenricoturri1966 <enricoturri@seznam.cz>2021-12-09 17:02:11 +0300
committerLukas Matena <lukasmatena@seznam.cz>2021-12-10 16:36:28 +0300
commit8df5202e74d768add85a398e1d9e502c5a311019 (patch)
tree8702c58dabb28981995a26d08c07d9eddc5ed76f
parent26008adfa167561e77e3b5a9359cbee271d13d0b (diff)
#7429 - Fixes in reload from disk command
-rw-r--r--src/slic3r/GUI/GUI_ObjectList.cpp8
-rw-r--r--src/slic3r/GUI/Plater.cpp16
2 files changed, 16 insertions, 8 deletions
diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp
index f4d27b0b2..5f5caa80f 100644
--- a/src/slic3r/GUI/GUI_ObjectList.cpp
+++ b/src/slic3r/GUI/GUI_ObjectList.cpp
@@ -1556,7 +1556,7 @@ void ObjectList::load_modifier(ModelObject& model_object, std::vector<ModelVolum
for (auto object : model.objects) {
if (model_object.origin_translation != Vec3d::Zero()) {
object->center_around_origin();
- Vec3d delta = model_object.origin_translation - object->origin_translation;
+ const Vec3d delta = model_object.origin_translation - object->origin_translation;
for (auto volume : object->volumes) {
volume->translate(delta);
}
@@ -1570,6 +1570,12 @@ void ObjectList::load_modifier(ModelObject& model_object, std::vector<ModelVolum
new_volume->name = boost::filesystem::path(input_file).filename().string();
// set a default extruder value, since user can't add it manually
new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
+ // update source data
+ new_volume->source.input_file = input_file;
+ new_volume->source.object_idx = obj_idx;
+ new_volume->source.volume_idx = int(model_object.volumes.size()) - 1;
+ if (model.objects.size() == 1 && model.objects.front()->volumes.size() == 1)
+ new_volume->source.mesh_offset = model.objects.front()->volumes.front()->source.mesh_offset;
if (from_galery) {
// Transform the new modifier to be aligned with the print bed.
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index fed9fa5bf..8243f8caf 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -3651,12 +3651,12 @@ void Plater::priv::reload_from_disk()
if (has_source || has_name) {
int new_volume_idx = -1;
int new_object_idx = -1;
- if (has_source) {
- // take idxs from source
- new_volume_idx = old_volume->source.volume_idx;
- new_object_idx = old_volume->source.object_idx;
- }
- else {
+// if (has_source) {
+// // take idxs from source
+// new_volume_idx = old_volume->source.volume_idx;
+// new_object_idx = old_volume->source.object_idx;
+// }
+// else {
// take idxs from the 1st matching volume
for (size_t o = 0; o < new_model.objects.size(); ++o) {
ModelObject* obj = new_model.objects[o];
@@ -3672,7 +3672,7 @@ void Plater::priv::reload_from_disk()
if (found)
break;
}
- }
+// }
if (new_object_idx < 0 && (int)new_model.objects.size() <= new_object_idx) {
fail_list.push_back(from_u8(has_source ? old_volume->source.input_file : old_volume->name));
@@ -3692,6 +3692,8 @@ void Plater::priv::reload_from_disk()
new_volume->set_material_id(old_volume->material_id());
new_volume->set_transformation(old_volume->get_transformation());
new_volume->translate(new_volume->get_transformation().get_matrix(true) * (new_volume->source.mesh_offset - old_volume->source.mesh_offset));
+ new_volume->source.object_idx = old_volume->source.object_idx;
+ new_volume->source.volume_idx = old_volume->source.volume_idx;
assert(! old_volume->source.is_converted_from_inches || ! old_volume->source.is_converted_from_meters);
if (old_volume->source.is_converted_from_inches)
new_volume->convert_from_imperial_units();