Merge branch 'master' into fs_emboss

# Conflicts:
#	src/slic3r/GUI/GUI_ObjectList.cpp
#	src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp
#	src/slic3r/GUI/ImGuiWrapper.hpp
This commit is contained in:
Filip Sykala 2021-11-23 09:09:09 +01:00
commit eba68f9a9e
311 changed files with 42234 additions and 9837 deletions
src/slic3r/GUI

View file

@ -420,10 +420,10 @@ MeshErrorsInfo ObjectList::get_mesh_errors_info(const int obj_idx, const int vol
if (repaired.facets_reversed > 0)
tooltip += "\t" + format_wxstr(_L_PLURAL("%1$d facet reversed", "%1$d facets reversed", repaired.facets_reversed), repaired.facets_reversed) + "\n";
if (repaired.backwards_edges > 0)
tooltip += "\t" + format_wxstr(_L_PLURAL("%1$d backwards edge", "%1$d backwards edges", repaired.backwards_edges), repaired.backwards_edges) + "\n";
tooltip += "\t" + format_wxstr(_L_PLURAL("%1$d backward edge", "%1$d backward edges", repaired.backwards_edges), repaired.backwards_edges) + "\n";
}
if (!stats.manifold()) {
remaining_info = format_wxstr(_L_PLURAL("Remaining %1$d open edge", "Remaining %1$d open edges", stats.open_edges), stats.open_edges);
remaining_info = format_wxstr(_L_PLURAL("%1$d open edge", "%1$d open edges", stats.open_edges), stats.open_edges);
tooltip += _L("Remaning errors") + ":\n";
tooltip += "\t" + format_wxstr(_L_PLURAL("%1$d open edge", "%1$d open edges", stats.open_edges), stats.open_edges) + "\n";
@ -920,21 +920,14 @@ void ObjectList::list_manipulation(const wxPoint& mouse_pos, bool evt_context_me
toggle_printable_state();
else if (title == _("Editing"))
show_context_menu(evt_context_menu);
else if (title == _("Name"))
{
if (wxOSX)
show_context_menu(evt_context_menu); // return context menu under OSX (related to #2909)
if (is_windows10())
{
int obj_idx, vol_idx;
get_selected_item_indexes(obj_idx, vol_idx, item);
if (m_objects_model->HasWarningIcon(item) &&
mouse_pos.x > 2 * wxGetApp().em_unit() && mouse_pos.x < 4 * wxGetApp().em_unit())
fix_through_netfabb();
}
}
else if (title == _("Name"))
{
if (is_windows10() && m_objects_model->HasWarningIcon(item) &&
mouse_pos.x > 2 * wxGetApp().em_unit() && mouse_pos.x < 4 * wxGetApp().em_unit())
fix_through_netfabb();
else if (evt_context_menu)
show_context_menu(evt_context_menu); // show context menu for "Name" column too
}
// workaround for extruder editing under OSX
else if (wxOSX && evt_context_menu && title == _("Extruder"))
extruder_editing();
@ -1775,12 +1768,9 @@ void ObjectList::load_mesh_object(const TriangleMesh &mesh, const wxString &name
new_object->invalidate_bounding_box();
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.z()));
} else {
new_object->instances[0]->set_offset(bb.center());
}
new_object->instances[0]->set_offset(center ?
to_3d(wxGetApp().plater()->build_volume().bounding_volume2d().center(), -new_object->origin_translation.z()) :
bb.center());
new_object->ensure_on_bed();
@ -2062,8 +2052,7 @@ void ObjectList::split()
void ObjectList::merge(bool to_multipart_object)
{
// merge selected objects to the multipart object
if (to_multipart_object)
{
if (to_multipart_object) {
auto get_object_idxs = [this](std::vector<int>& obj_idxs, wxDataViewItemArray& sels)
{
// check selections and split instances to the separated objects...
@ -2074,8 +2063,7 @@ void ObjectList::merge(bool to_multipart_object)
break;
}
if (!instance_selection)
{
if (!instance_selection) {
for (wxDataViewItem item : sels) {
assert(m_objects_model->GetItemType(item) & itObject);
obj_idxs.emplace_back(m_objects_model->GetIdByItem(item));
@ -2087,8 +2075,7 @@ void ObjectList::merge(bool to_multipart_object)
std::map<int, std::set<int>> sel_map;
std::set<int> empty_set;
for (wxDataViewItem item : sels) {
if (m_objects_model->GetItemType(item) & itObject)
{
if (m_objects_model->GetItemType(item) & itObject) {
int obj_idx = m_objects_model->GetIdByItem(item);
int inst_cnt = (*m_objects)[obj_idx]->instances.size();
if (inst_cnt == 1)
@ -2105,8 +2092,7 @@ void ObjectList::merge(bool to_multipart_object)
// all objects, created from the instances will be added to the end of list
int new_objects_cnt = 0; // count of this new objects
for (auto map_item : sel_map)
{
for (auto map_item : sel_map) {
int obj_idx = map_item.first;
// object with just 1 instance
if (map_item.second.empty()) {
@ -2166,37 +2152,36 @@ void ObjectList::merge(bool to_multipart_object)
new_object->name = _u8L("Merged");
ModelConfig &config = new_object->config;
for (int obj_idx : obj_idxs)
{
for (int obj_idx : obj_idxs) {
ModelObject* object = (*m_objects)[obj_idx];
const Geometry::Transformation& transformation = object->instances[0]->get_transformation();
Vec3d scale = transformation.get_scaling_factor();
Vec3d mirror = transformation.get_mirror();
Vec3d rotation = transformation.get_rotation();
const Vec3d scale = transformation.get_scaling_factor();
const Vec3d mirror = transformation.get_mirror();
const Vec3d rotation = transformation.get_rotation();
if (object->id() == (*m_objects)[obj_idxs.front()]->id())
new_object->add_instance();
Transform3d volume_offset_correction = new_object->instances[0]->get_transformation().get_matrix().inverse() * transformation.get_matrix();
const Transform3d& volume_offset_correction = transformation.get_matrix();
// merge volumes
for (const ModelVolume* volume : object->volumes) {
ModelVolume* new_volume = new_object->add_volume(*volume);
//set rotation
Vec3d vol_rot = new_volume->get_rotation() + rotation;
const Vec3d vol_rot = new_volume->get_rotation() + rotation;
new_volume->set_rotation(vol_rot);
// set scale
Vec3d vol_sc_fact = new_volume->get_scaling_factor().cwiseProduct(scale);
const Vec3d vol_sc_fact = new_volume->get_scaling_factor().cwiseProduct(scale);
new_volume->set_scaling_factor(vol_sc_fact);
// set mirror
Vec3d vol_mirror = new_volume->get_mirror().cwiseProduct(mirror);
const Vec3d vol_mirror = new_volume->get_mirror().cwiseProduct(mirror);
new_volume->set_mirror(vol_mirror);
// set offset
Vec3d vol_offset = volume_offset_correction* new_volume->get_offset();
const Vec3d vol_offset = volume_offset_correction* new_volume->get_offset();
new_volume->set_offset(vol_offset);
}
new_object->sort_volumes(wxGetApp().app_config->get("order_volumes") == "1");
@ -2229,6 +2214,11 @@ void ObjectList::merge(bool to_multipart_object)
for (const auto& range : object->layer_config_ranges)
new_object->layer_config_ranges.emplace(range);
}
new_object->center_around_origin();
new_object->translate_instances(-new_object->origin_translation);
new_object->origin_translation = Vec3d::Zero();
// remove selected objects
remove();
@ -2239,8 +2229,7 @@ void ObjectList::merge(bool to_multipart_object)
}
// merge all parts to the one single object
// all part's settings will be lost
else
{
else {
wxDataViewItem item = GetSelection();
if (!item)
return;
@ -4181,7 +4170,7 @@ void ObjectList::fix_through_netfabb()
wxString msg;
wxString bullet_suf = "\n - ";
if (!succes_models.empty()) {
msg = _L_PLURAL("Folowing model is repaired successfully", "Folowing models are repaired successfully", succes_models.size()) + ":";
msg = _L_PLURAL("The following model was repaired successfully", "The following models were repaired successfully", succes_models.size()) + ":";
for (auto& model : succes_models)
msg += bullet_suf + from_u8(model);
msg += "\n\n";