Merge remote-tracking branch 'origin/master' into ys_unsaved_changes
This commit is contained in:
commit
4d053cc4ee
148 changed files with 13789 additions and 3328 deletions
src/slic3r/GUI
|
@ -2217,7 +2217,7 @@ void ObjectList::load_shape_object(const std::string& type_name)
|
|||
load_mesh_object(mesh, _(L("Shape")) + "-" + _(type_name));
|
||||
}
|
||||
|
||||
void ObjectList::load_mesh_object(const TriangleMesh &mesh, const wxString &name)
|
||||
void ObjectList::load_mesh_object(const TriangleMesh &mesh, const wxString &name, bool center)
|
||||
{
|
||||
// Add mesh to model as a new object
|
||||
Model& model = wxGetApp().plater()->model();
|
||||
|
@ -2227,6 +2227,7 @@ void ObjectList::load_mesh_object(const TriangleMesh &mesh, const wxString &name
|
|||
#endif /* _DEBUG */
|
||||
|
||||
std::vector<size_t> object_idxs;
|
||||
auto bb = mesh.bounding_box();
|
||||
ModelObject* new_object = model.add_object();
|
||||
new_object->name = into_u8(name);
|
||||
new_object->add_instance(); // each object should have at list one instance
|
||||
|
@ -2236,13 +2237,17 @@ void ObjectList::load_mesh_object(const TriangleMesh &mesh, const wxString &name
|
|||
// set a default extruder value, since user can't add it manually
|
||||
new_volume->config.set_key_value("extruder", new ConfigOptionInt(0));
|
||||
new_object->invalidate_bounding_box();
|
||||
|
||||
new_object->center_around_origin();
|
||||
new_object->translate(-bb.center());
|
||||
|
||||
if (center) {
|
||||
const BoundingBoxf bed_shape = wxGetApp().plater()->bed_shape_bb();
|
||||
new_object->instances[0]->set_offset(Slic3r::to_3d(bed_shape.center().cast<double>(), -new_object->origin_translation(2)));
|
||||
} else {
|
||||
new_object->instances[0]->set_offset(bb.center());
|
||||
}
|
||||
|
||||
new_object->ensure_on_bed();
|
||||
|
||||
const BoundingBoxf bed_shape = wxGetApp().plater()->bed_shape_bb();
|
||||
new_object->instances[0]->set_offset(Slic3r::to_3d(bed_shape.center().cast<double>(), -new_object->origin_translation(2)));
|
||||
|
||||
|
||||
object_idxs.push_back(model.objects.size() - 1);
|
||||
#ifdef _DEBUG
|
||||
check_model_ids_validity(model);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue