mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Fixed conflicts after merge with master
This commit is contained in:
commit
ac4d9ea172
86 changed files with 3385 additions and 2422 deletions
|
@ -663,7 +663,7 @@ void GLCanvas3D::WarningTexture::activate(WarningTexture::Warning warning, bool
|
|||
if (it != m_warnings.end()) // this warning is already set to be shown
|
||||
return;
|
||||
|
||||
m_warnings.push_back(warning);
|
||||
m_warnings.emplace_back(warning);
|
||||
std::sort(m_warnings.begin(), m_warnings.end());
|
||||
}
|
||||
else {
|
||||
|
@ -1289,7 +1289,7 @@ void GLCanvas3D::Labels::render(const std::vector<const ModelInstance*>& sorted_
|
|||
if (model_object->instances.size() > 1)
|
||||
owner.label += " (" + std::to_string(inst_idx + 1) + ")";
|
||||
owner.selected = volume->selected;
|
||||
owners.push_back(owner);
|
||||
owners.emplace_back(owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2093,7 +2093,7 @@ std::vector<int> GLCanvas3D::load_object(const ModelObject& model_object, int ob
|
|||
{
|
||||
for (unsigned int i = 0; i < model_object.instances.size(); ++i)
|
||||
{
|
||||
instance_idxs.push_back(i);
|
||||
instance_idxs.emplace_back(i);
|
||||
}
|
||||
}
|
||||
return m_volumes.load_object(&model_object, obj_idx, instance_idxs, m_color_by, m_initialized);
|
||||
|
@ -2533,9 +2533,9 @@ static void load_gcode_retractions(const GCodePreviewData::Retraction& retractio
|
|||
|
||||
for (const GCodePreviewData::Retraction::Position& position : copy)
|
||||
{
|
||||
volume->print_zs.push_back(unscale<double>(position.position(2)));
|
||||
volume->offsets.push_back(volume->indexed_vertex_array.quad_indices.size());
|
||||
volume->offsets.push_back(volume->indexed_vertex_array.triangle_indices.size());
|
||||
volume->print_zs.emplace_back(unscale<double>(position.position(2)));
|
||||
volume->offsets.emplace_back(volume->indexed_vertex_array.quad_indices.size());
|
||||
volume->offsets.emplace_back(volume->indexed_vertex_array.triangle_indices.size());
|
||||
|
||||
_3DScene::point3_to_verts(position.position, position.width, position.height, *volume);
|
||||
|
||||
|
@ -3541,11 +3541,26 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
if (m_hover_volume_idxs.empty() && m_mouse.is_start_position_3D_defined())
|
||||
{
|
||||
const Vec3d rot = (Vec3d(pos.x(), pos.y(), 0.) - m_mouse.drag.start_position_3D) * (PI * TRACKBALLSIZE / 180.);
|
||||
#if ENABLE_AUTO_CONSTRAINED_CAMERA
|
||||
if (wxGetApp().app_config->get("use_free_camera") == "1")
|
||||
// Virtual track ball (similar to the 3DConnexion mouse).
|
||||
m_camera.rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.));
|
||||
else
|
||||
{
|
||||
// Forces camera right vector to be parallel to XY plane in case it has been misaligned using the 3D mouse free rotation.
|
||||
// It is cheaper to call this function right away instead of testing wxGetApp().plater()->get_mouse3d_controller().connected(),
|
||||
// which checks an atomics (flushes CPU caches).
|
||||
// See GH issue #3816.
|
||||
m_camera.recover_from_free_camera();
|
||||
m_camera.rotate_on_sphere(rot.x(), rot.y(), wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA);
|
||||
}
|
||||
#else
|
||||
if (wxGetApp().plater()->get_mouse3d_controller().connected() || (wxGetApp().app_config->get("use_free_camera") == "1"))
|
||||
// Virtual track ball (similar to the 3DConnexion mouse).
|
||||
m_camera.rotate_local_around_target(Vec3d(rot.y(), rot.x(), 0.));
|
||||
else
|
||||
m_camera.rotate_on_sphere(rot.x(), rot.y(), wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() != ptSLA);
|
||||
#endif // ENABLE_AUTO_CONSTRAINED_CAMERA
|
||||
|
||||
m_dirty = true;
|
||||
}
|
||||
|
@ -3560,6 +3575,15 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
|
|||
float z = 0.0f;
|
||||
const Vec3d& cur_pos = _mouse_to_3d(pos, &z);
|
||||
Vec3d orig = _mouse_to_3d(m_mouse.drag.start_position_2D, &z);
|
||||
#if ENABLE_AUTO_CONSTRAINED_CAMERA
|
||||
if (wxGetApp().app_config->get("use_free_camera") != "1")
|
||||
// Forces camera right vector to be parallel to XY plane in case it has been misaligned using the 3D mouse free rotation.
|
||||
// It is cheaper to call this function right away instead of testing wxGetApp().plater()->get_mouse3d_controller().connected(),
|
||||
// which checks an atomics (flushes CPU caches).
|
||||
// See GH issue #3816.
|
||||
m_camera.recover_from_free_camera();
|
||||
#endif // ENABLE_AUTO_CONSTRAINED_CAMERA
|
||||
|
||||
m_camera.set_target(m_camera.get_target() + orig - cur_pos);
|
||||
m_dirty = true;
|
||||
}
|
||||
|
@ -4184,7 +4208,7 @@ void GLCanvas3D::_render_thumbnail_internal(ThumbnailData& thumbnail_data, bool
|
|||
if (!vol->is_modifier && !vol->is_wipe_tower && (!parts_only || (vol->composite_id.volume_id >= 0)))
|
||||
{
|
||||
if (!printable_only || is_visible(*vol))
|
||||
visible_volumes.push_back(vol);
|
||||
visible_volumes.emplace_back(vol);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4888,7 +4912,7 @@ void GLCanvas3D::_picking_pass() const
|
|||
}
|
||||
if ((0 <= volume_id) && (volume_id < (int)m_volumes.volumes.size()))
|
||||
{
|
||||
m_hover_volume_idxs.push_back(volume_id);
|
||||
m_hover_volume_idxs.emplace_back(volume_id);
|
||||
m_gizmos.set_hover_id(-1);
|
||||
}
|
||||
else
|
||||
|
@ -5132,7 +5156,7 @@ void GLCanvas3D::_render_overlays() const
|
|||
if (sequential_print) {
|
||||
for (ModelObject* model_object : m_model->objects)
|
||||
for (ModelInstance* model_instance : model_object->instances) {
|
||||
sorted_instances.push_back(model_instance);
|
||||
sorted_instances.emplace_back(model_instance);
|
||||
}
|
||||
}
|
||||
m_labels.render(sorted_instances);
|
||||
|
@ -5594,29 +5618,26 @@ void GLCanvas3D::_load_print_toolpaths()
|
|||
if ((skirt_height == 0) && (print->config().brim_width.value > 0))
|
||||
skirt_height = 1;
|
||||
|
||||
// get first skirt_height layers (maybe this should be moved to a PrintObject method?)
|
||||
const PrintObject* object0 = print->objects().front();
|
||||
// Get first skirt_height layers.
|
||||
//FIXME This code is fishy. It may not work for multiple objects with different layering due to variable layer height feature.
|
||||
// This is not critical as this is just an initial preview.
|
||||
const PrintObject* highest_object = *std::max_element(print->objects().begin(), print->objects().end(), [](auto l, auto r){ return l->layers().size() < r->layers().size(); });
|
||||
std::vector<float> print_zs;
|
||||
print_zs.reserve(skirt_height * 2);
|
||||
for (size_t i = 0; i < std::min(skirt_height, object0->layers().size()); ++i)
|
||||
{
|
||||
print_zs.push_back(float(object0->layers()[i]->print_z));
|
||||
}
|
||||
//FIXME why there are support layers?
|
||||
for (size_t i = 0; i < std::min(skirt_height, object0->support_layers().size()); ++i)
|
||||
{
|
||||
print_zs.push_back(float(object0->support_layers()[i]->print_z));
|
||||
}
|
||||
for (size_t i = 0; i < std::min(skirt_height, highest_object->layers().size()); ++ i)
|
||||
print_zs.emplace_back(float(highest_object->layers()[i]->print_z));
|
||||
// Only add skirt for the raft layers.
|
||||
for (size_t i = 0; i < std::min(skirt_height, std::min(highest_object->slicing_parameters().raft_layers(), highest_object->support_layers().size())); ++ i)
|
||||
print_zs.emplace_back(float(highest_object->support_layers()[i]->print_z));
|
||||
sort_remove_duplicates(print_zs);
|
||||
if (print_zs.size() > skirt_height)
|
||||
print_zs.erase(print_zs.begin() + skirt_height, print_zs.end());
|
||||
|
||||
skirt_height = std::min(skirt_height, print_zs.size());
|
||||
print_zs.erase(print_zs.begin() + skirt_height, print_zs.end());
|
||||
|
||||
GLVolume *volume = m_volumes.new_toolpath_volume(color, VERTEX_BUFFER_RESERVE_SIZE);
|
||||
for (size_t i = 0; i < skirt_height; ++i) {
|
||||
volume->print_zs.push_back(print_zs[i]);
|
||||
volume->offsets.push_back(volume->indexed_vertex_array.quad_indices.size());
|
||||
volume->offsets.push_back(volume->indexed_vertex_array.triangle_indices.size());
|
||||
for (size_t i = 0; i < skirt_height; ++ i) {
|
||||
volume->print_zs.emplace_back(print_zs[i]);
|
||||
volume->offsets.emplace_back(volume->indexed_vertex_array.quad_indices.size());
|
||||
volume->offsets.emplace_back(volume->indexed_vertex_array.triangle_indices.size());
|
||||
if (i == 0)
|
||||
_3DScene::extrusionentity_to_verts(print->brim(), print_zs[i], Point(0, 0), *volume);
|
||||
_3DScene::extrusionentity_to_verts(print->skirt(), print_zs[i], Point(0, 0), *volume);
|
||||
|
@ -5782,10 +5803,10 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||
}
|
||||
if (ctxt.has_perimeters || ctxt.has_infill)
|
||||
for (const Layer *layer : print_object.layers())
|
||||
ctxt.layers.push_back(layer);
|
||||
ctxt.layers.emplace_back(layer);
|
||||
if (ctxt.has_support)
|
||||
for (const Layer *layer : print_object.support_layers())
|
||||
ctxt.layers.push_back(layer);
|
||||
ctxt.layers.emplace_back(layer);
|
||||
std::sort(ctxt.layers.begin(), ctxt.layers.end(), [](const Layer *l1, const Layer *l2) { return l1->print_z < l2->print_z; });
|
||||
|
||||
// Maximum size of an allocation block: 32MB / sizeof(float)
|
||||
|
@ -5854,9 +5875,9 @@ void GLCanvas3D::_load_print_object_toolpaths(const PrintObject& print_object, c
|
|||
|
||||
for (GLVolume *vol : vols)
|
||||
if (vol->print_zs.empty() || vol->print_zs.back() != layer->print_z) {
|
||||
vol->print_zs.push_back(layer->print_z);
|
||||
vol->offsets.push_back(vol->indexed_vertex_array.quad_indices.size());
|
||||
vol->offsets.push_back(vol->indexed_vertex_array.triangle_indices.size());
|
||||
vol->print_zs.emplace_back(layer->print_z);
|
||||
vol->offsets.emplace_back(vol->indexed_vertex_array.quad_indices.size());
|
||||
vol->offsets.emplace_back(vol->indexed_vertex_array.triangle_indices.size());
|
||||
}
|
||||
for (const PrintInstance &instance : *ctxt.shifted_copies) {
|
||||
const Point © = instance.shift;
|
||||
|
@ -6012,9 +6033,9 @@ void GLCanvas3D::_load_wipe_tower_toolpaths(const std::vector<std::string>& str_
|
|||
for (size_t i = 0; i < vols.size(); ++i) {
|
||||
GLVolume &vol = *vols[i];
|
||||
if (vol.print_zs.empty() || vol.print_zs.back() != layer.front().print_z) {
|
||||
vol.print_zs.push_back(layer.front().print_z);
|
||||
vol.offsets.push_back(vol.indexed_vertex_array.quad_indices.size());
|
||||
vol.offsets.push_back(vol.indexed_vertex_array.triangle_indices.size());
|
||||
vol.print_zs.emplace_back(layer.front().print_z);
|
||||
vol.offsets.emplace_back(vol.indexed_vertex_array.quad_indices.size());
|
||||
vol.offsets.emplace_back(vol.indexed_vertex_array.triangle_indices.size());
|
||||
}
|
||||
}
|
||||
for (const WipeTower::ToolChangeResult &extrusions : layer) {
|
||||
|
@ -6227,9 +6248,9 @@ void GLCanvas3D::_load_gcode_extrusion_paths(const GCodePreviewData& preview_dat
|
|||
assert(it_filter != filters.end() && key.first == it_filter->first);
|
||||
|
||||
GLVolume& vol = *it_filter->second;
|
||||
vol.print_zs.push_back(layer.z);
|
||||
vol.offsets.push_back(vol.indexed_vertex_array.quad_indices.size());
|
||||
vol.offsets.push_back(vol.indexed_vertex_array.triangle_indices.size());
|
||||
vol.print_zs.emplace_back(layer.z);
|
||||
vol.offsets.emplace_back(vol.indexed_vertex_array.quad_indices.size());
|
||||
vol.offsets.emplace_back(vol.indexed_vertex_array.triangle_indices.size());
|
||||
|
||||
_3DScene::extrusionentity_to_verts(path.polyline, path.width, path.height, layer.z, vol);
|
||||
}
|
||||
|
@ -6301,9 +6322,9 @@ inline void travel_paths_internal(
|
|||
assert(it != by_type.end() && it->first == func_value(polyline));
|
||||
|
||||
GLVolume& vol = *it->second;
|
||||
vol.print_zs.push_back(unscale<double>(polyline.polyline.bounding_box().min(2)));
|
||||
vol.offsets.push_back(vol.indexed_vertex_array.quad_indices.size());
|
||||
vol.offsets.push_back(vol.indexed_vertex_array.triangle_indices.size());
|
||||
vol.print_zs.emplace_back(unscale<double>(polyline.polyline.bounding_box().min(2)));
|
||||
vol.offsets.emplace_back(vol.indexed_vertex_array.quad_indices.size());
|
||||
vol.offsets.emplace_back(vol.indexed_vertex_array.triangle_indices.size());
|
||||
|
||||
_3DScene::polyline3_to_verts(polyline.polyline, preview_data.travel.width, preview_data.travel.height, vol);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue