Changed logic to detect sinking objects while using scale gizmo
This commit is contained in:
parent
5aff44debe
commit
a3a99567ad
2 changed files with 8 additions and 17 deletions
|
@ -1005,8 +1005,8 @@ bool GLVolumeCollection::check_outside_state(const DynamicPrintConfig* config, b
|
|||
if (opt == nullptr)
|
||||
return false;
|
||||
|
||||
BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
|
||||
BoundingBoxf3 print_volume(Vec3d(unscale<double>(bed_box_2D.min(0)), unscale<double>(bed_box_2D.min(1)), 0.0), Vec3d(unscale<double>(bed_box_2D.max(0)), unscale<double>(bed_box_2D.max(1)), config->opt_float("max_print_height")));
|
||||
const BoundingBox bed_box_2D = get_extents(Polygon::new_scale(opt->values));
|
||||
BoundingBoxf3 print_volume(Vec3d(unscale<double>(bed_box_2D.min.x()), unscale<double>(bed_box_2D.min.y()), 0.0), Vec3d(unscale<double>(bed_box_2D.max.x()), unscale<double>(bed_box_2D.max.y()), config->opt_float("max_print_height")));
|
||||
// Allow the objects to protrude below the print bed
|
||||
print_volume.min(2) = -1e10;
|
||||
print_volume.min(0) -= BedEpsilon;
|
||||
|
|
|
@ -836,17 +836,8 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
|
|||
if (!m_valid)
|
||||
return;
|
||||
|
||||
bool is_any_volume_sinking = false;
|
||||
bool is_sla = wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptSLA;
|
||||
|
||||
for (unsigned int i : m_list) {
|
||||
GLVolume &v = *(*m_volumes)[i];
|
||||
if (!is_sla) {
|
||||
if (v.is_modifier)
|
||||
is_any_volume_sinking = true;
|
||||
else
|
||||
is_any_volume_sinking |= std::find(m_cache.sinking_volumes.begin(), m_cache.sinking_volumes.end(), i) != m_cache.sinking_volumes.end();
|
||||
}
|
||||
if (is_single_full_instance()) {
|
||||
if (transformation_type.relative()) {
|
||||
Transform3d m = Geometry::assemble_transform(Vec3d::Zero(), Vec3d::Zero(), scale);
|
||||
|
@ -901,11 +892,9 @@ void Selection::scale(const Vec3d& scale, TransformationType transformation_type
|
|||
else if (m_mode == Volume)
|
||||
synchronize_unselected_volumes();
|
||||
#endif // !DISABLE_INSTANCES_SYNCH
|
||||
|
||||
if (!is_any_volume_sinking)
|
||||
ensure_on_bed();
|
||||
|
||||
this->set_bounding_boxes_dirty();
|
||||
ensure_on_bed();
|
||||
set_bounding_boxes_dirty();
|
||||
}
|
||||
|
||||
void Selection::scale_to_fit_print_volume(const DynamicPrintConfig& config)
|
||||
|
@ -2125,8 +2114,10 @@ void Selection::ensure_on_bed()
|
|||
typedef std::map<std::pair<int, int>, double> InstancesToZMap;
|
||||
InstancesToZMap instances_min_z;
|
||||
|
||||
for (GLVolume* volume : *m_volumes) {
|
||||
if (!volume->is_wipe_tower && !volume->is_modifier) {
|
||||
for (size_t i = 0; i < m_volumes->size(); ++i) {
|
||||
GLVolume* volume = (*m_volumes)[i];
|
||||
if (!volume->is_wipe_tower && !volume->is_modifier &&
|
||||
std::find(m_cache.sinking_volumes.begin(), m_cache.sinking_volumes.end(), i) == m_cache.sinking_volumes.end()) {
|
||||
const double min_z = volume->transformed_convex_hull_bounding_box().min.z();
|
||||
std::pair<int, int> instance = std::make_pair(volume->object_idx(), volume->instance_idx());
|
||||
InstancesToZMap::iterator it = instances_min_z.find(instance);
|
||||
|
|
Loading…
Add table
Reference in a new issue