Skip to content

Commit

Permalink
Modifiers should load at object offset like in Prusaslicer (#3802)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
foghatredbird and SoftFever authored Jan 24, 2024
1 parent 55b6f2a commit afb89c4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/slic3r/GUI/GUI_ObjectList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
Expand Down

0 comments on commit afb89c4

Please sign in to comment.