Changed detection of sinking objects into ObjectList::update_info_items()
This commit is contained in:
parent
1659e4c77f
commit
dc21fb1100
3 changed files with 15 additions and 4 deletions
|
@ -3497,13 +3497,14 @@ void GLCanvas3D::do_rotate(const std::string& snapshot_type)
|
||||||
// Fixes sinking/flying instances
|
// Fixes sinking/flying instances
|
||||||
for (const std::pair<int, int>& i : done) {
|
for (const std::pair<int, int>& i : done) {
|
||||||
ModelObject* m = m_model->objects[i.first];
|
ModelObject* m = m_model->objects[i.first];
|
||||||
double shift_z = m->get_instance_min_z(i.second);
|
const double shift_z = m->get_instance_min_z(i.second);
|
||||||
// leave sinking instances as sinking
|
// leave sinking instances as sinking
|
||||||
if (min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) {
|
if (min_zs.empty() || min_zs.find({ i.first, i.second })->second >= SINKING_Z_THRESHOLD || shift_z > SINKING_Z_THRESHOLD) {
|
||||||
Vec3d shift(0.0, 0.0, -shift_z);
|
const Vec3d shift(0.0, 0.0, -shift_z);
|
||||||
m_selection.translate(i.first, i.second, shift);
|
m_selection.translate(i.first, i.second, shift);
|
||||||
m->translate_instance(i.second, shift);
|
m->translate_instance(i.second, shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(i.first));
|
wxGetApp().obj_list()->update_info_items(static_cast<size_t>(i.first));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3861,6 +3862,15 @@ void GLCanvas3D::update_sequential_clearance()
|
||||||
set_sequential_print_clearance_polygons(polygons);
|
set_sequential_print_clearance_polygons(polygons);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GLCanvas3D::is_object_sinking(int object_idx) const
|
||||||
|
{
|
||||||
|
for (const GLVolume* v : m_volumes.volumes) {
|
||||||
|
if (v->object_idx() == object_idx && v->is_sinking())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool GLCanvas3D::_is_shown_on_screen() const
|
bool GLCanvas3D::_is_shown_on_screen() const
|
||||||
{
|
{
|
||||||
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;
|
return (m_canvas != nullptr) ? m_canvas->IsShownOnScreen() : false;
|
||||||
|
|
|
@ -875,6 +875,8 @@ public:
|
||||||
|
|
||||||
void reset_old_size() { m_old_size = { 0, 0 }; }
|
void reset_old_size() { m_old_size = { 0, 0 }; }
|
||||||
|
|
||||||
|
bool is_object_sinking(int object_idx) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _is_shown_on_screen() const;
|
bool _is_shown_on_screen() const;
|
||||||
|
|
||||||
|
|
|
@ -2558,9 +2558,8 @@ void ObjectList::update_info_items(size_t obj_idx)
|
||||||
break;
|
break;
|
||||||
case InfoItemType::Sinking:
|
case InfoItemType::Sinking:
|
||||||
{
|
{
|
||||||
const BoundingBoxf3& box = model_object->bounding_box();
|
|
||||||
should_show = printer_technology() == ptFFF &&
|
should_show = printer_technology() == ptFFF &&
|
||||||
box.min.z() < SINKING_Z_THRESHOLD && box.max.z() > SINKING_Z_THRESHOLD;
|
wxGetApp().plater()->canvas3D()->is_object_sinking(obj_idx);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue