From afb89c4309ff2b5ebe554b2c7ad5f0ec533bd148 Mon Sep 17 00:00:00 2001 From: foghatredbird <156275986+foghatredbird@users.noreply.github.com> Date: Wed, 24 Jan 2024 07:50:42 -0800 Subject: [PATCH] Modifiers should load at object offset like in Prusaslicer (#3802) * fix precedence errors Fix a handful of precedence errors and 1 logic/precedence error. None of the code will compile as intended without these changes. * Update GUI_ObjectList.cpp Modifiers should load at same offset as object they are created against. Based on prusaslicer ObjectList::load_from_files where it works correctly. --------- Co-authored-by: SoftFever --- src/slic3r/GUI/GUI_ObjectList.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index c41285fc66d..725020ef309 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -2030,9 +2030,10 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo ModelVolume* new_volume = model_object.add_volume(std::move(mesh), type); new_volume->name = boost::filesystem::path(input_file).filename().string(); - // BBS: object_mesh.get_init_shift() keep the relative position - TriangleMesh object_mesh = model_object.volumes[0]->mesh(); - new_volume->set_offset(new_volume->mesh().get_init_shift() - object_mesh.get_init_shift()); + // adjust offset as prusaslicer ObjectList::load_from_files does (works) instead of BBS method + //// BBS: object_mesh.get_init_shift() keep the relative position + //TriangleMesh object_mesh = model_object.volumes[0]->mesh(); + //new_volume->set_offset(new_volume->mesh().get_init_shift() - object_mesh.get_init_shift()); // set a default extruder value, since user can't add it manually // BBS @@ -2056,6 +2057,8 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo const Vec3d offset = Vec3d(instance_bb.max.x(), instance_bb.min.y(), instance_bb.min.z()) + 0.5 * mesh_bb.size() - instance_offset; new_volume->set_offset(inv_inst_transform * offset); } + else + new_volume->set_offset(new_volume->source.mesh_offset - model_object.volumes.front()->source.mesh_offset); added_volumes.push_back(new_volume); }