mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 06:04:01 -06:00
Fixed conflicts after merge with master
This commit is contained in:
commit
39ec1a6318
192 changed files with 7204 additions and 2296 deletions
|
@ -683,7 +683,8 @@ void Selection::translate(const Vec3d& displacement, bool local)
|
|||
synchronize_unselected_volumes();
|
||||
#endif // !DISABLE_INSTANCES_SYNCH
|
||||
|
||||
this->set_bounding_boxes_dirty();
|
||||
ensure_not_below_bed();
|
||||
set_bounding_boxes_dirty();
|
||||
}
|
||||
|
||||
// Rotate an object around one of the axes. Only one rotation component is expected to be changing.
|
||||
|
@ -1148,6 +1149,7 @@ void Selection::erase()
|
|||
}
|
||||
|
||||
wxGetApp().obj_list()->delete_from_model_and_list(items);
|
||||
ensure_not_below_bed();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1712,7 +1714,7 @@ void Selection::calc_unscaled_instance_bounding_box() const
|
|||
if (volume.is_modifier)
|
||||
continue;
|
||||
Transform3d trafo = volume.get_instance_transformation().get_matrix(false, false, true, false) * volume.get_volume_transformation().get_matrix();
|
||||
trafo.translation()(2) += volume.get_sla_shift_z();
|
||||
trafo.translation().z() += volume.get_sla_shift_z();
|
||||
unscaled_instance_bounding_box->merge(volume.transformed_convex_hull_bounding_box(trafo));
|
||||
}
|
||||
}
|
||||
|
@ -1729,7 +1731,7 @@ void Selection::calc_scaled_instance_bounding_box() const
|
|||
if (volume.is_modifier)
|
||||
continue;
|
||||
Transform3d trafo = volume.get_instance_transformation().get_matrix(false, false, false, false) * volume.get_volume_transformation().get_matrix();
|
||||
trafo.translation()(2) += volume.get_sla_shift_z();
|
||||
trafo.translation().z() += volume.get_sla_shift_z();
|
||||
scaled_instance_bounding_box->merge(volume.transformed_convex_hull_bounding_box(trafo));
|
||||
}
|
||||
}
|
||||
|
@ -2134,6 +2136,44 @@ void Selection::ensure_on_bed()
|
|||
}
|
||||
}
|
||||
|
||||
void Selection::ensure_not_below_bed()
|
||||
{
|
||||
typedef std::map<std::pair<int, int>, double> InstancesToZMap;
|
||||
InstancesToZMap instances_max_z;
|
||||
|
||||
for (size_t i = 0; i < m_volumes->size(); ++i) {
|
||||
GLVolume* volume = (*m_volumes)[i];
|
||||
if (!volume->is_wipe_tower && !volume->is_modifier) {
|
||||
const double max_z = volume->transformed_convex_hull_bounding_box().max.z();
|
||||
std::pair<int, int> instance = std::make_pair(volume->object_idx(), volume->instance_idx());
|
||||
InstancesToZMap::iterator it = instances_max_z.find(instance);
|
||||
if (it == instances_max_z.end())
|
||||
it = instances_max_z.insert(InstancesToZMap::value_type(instance, -DBL_MAX)).first;
|
||||
|
||||
it->second = std::max(it->second, max_z);
|
||||
}
|
||||
}
|
||||
|
||||
if (is_any_volume()) {
|
||||
for (unsigned int i : m_list) {
|
||||
GLVolume& volume = *(*m_volumes)[i];
|
||||
std::pair<int, int> instance = std::make_pair(volume.object_idx(), volume.instance_idx());
|
||||
InstancesToZMap::iterator it = instances_max_z.find(instance);
|
||||
double z_shift = SINKING_MIN_Z_THRESHOLD - it->second;
|
||||
if (it != instances_max_z.end() && z_shift > 0.0)
|
||||
volume.set_volume_offset(Z, volume.get_volume_offset(Z) + z_shift);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (GLVolume* volume : *m_volumes) {
|
||||
std::pair<int, int> instance = std::make_pair(volume->object_idx(), volume->instance_idx());
|
||||
InstancesToZMap::iterator it = instances_max_z.find(instance);
|
||||
if (it != instances_max_z.end() && it->second < SINKING_MIN_Z_THRESHOLD)
|
||||
volume->set_instance_offset(Z, volume->get_instance_offset(Z) + SINKING_MIN_Z_THRESHOLD - it->second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Selection::is_from_fully_selected_instance(unsigned int volume_idx) const
|
||||
{
|
||||
struct SameInstance
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue