Fixed sinking objects popping-up when deleting modifiers
This commit is contained in:
parent
a3cf0277be
commit
a8552512cf
@ -1602,14 +1602,17 @@ void GLCanvas3D::delete_selected()
|
||||
m_selection.erase();
|
||||
}
|
||||
|
||||
void GLCanvas3D::ensure_on_bed(unsigned int object_idx)
|
||||
void GLCanvas3D::ensure_on_bed(unsigned int object_idx, bool allow_negative_z)
|
||||
{
|
||||
if (allow_negative_z)
|
||||
return;
|
||||
|
||||
typedef std::map<std::pair<int, int>, double> InstancesToZMap;
|
||||
InstancesToZMap instances_min_z;
|
||||
|
||||
for (GLVolume* volume : m_volumes.volumes) {
|
||||
if (volume->object_idx() == (int)object_idx && !volume->is_modifier) {
|
||||
double min_z = volume->transformed_convex_hull_bounding_box().min(2);
|
||||
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);
|
||||
if (it == instances_min_z.end())
|
||||
|
@ -702,7 +702,7 @@ public:
|
||||
void select_all();
|
||||
void deselect_all();
|
||||
void delete_selected();
|
||||
void ensure_on_bed(unsigned int object_idx);
|
||||
void ensure_on_bed(unsigned int object_idx, bool allow_negative_z);
|
||||
|
||||
bool is_gcode_legend_enabled() const { return m_gcode_viewer.is_legend_enabled(); }
|
||||
GCodeViewer::EViewType get_gcode_view_type() const { return m_gcode_viewer.get_view_type(); }
|
||||
|
@ -2708,7 +2708,7 @@ void ObjectList::delete_from_model_and_list(const std::vector<ItemForDelete>& it
|
||||
if (obj->get_mesh_errors_count() == 0)
|
||||
m_objects_model->DeleteWarningIcon(parent);
|
||||
}
|
||||
wxGetApp().plater()->canvas3D()->ensure_on_bed(item->obj_idx);
|
||||
wxGetApp().plater()->canvas3D()->ensure_on_bed(item->obj_idx, printer_technology() != ptSLA);
|
||||
}
|
||||
else
|
||||
m_objects_model->Delete(m_objects_model->GetItemByInstanceId(item->obj_idx, item->sub_obj_idx));
|
||||
@ -4075,7 +4075,7 @@ void ObjectList::set_extruder_for_selected_items(const int extruder) const
|
||||
const int obj_idx = type & itObject ? m_objects_model->GetIdByItem(item) :
|
||||
m_objects_model->GetIdByItem(m_objects_model->GetTopParent(item));
|
||||
|
||||
wxGetApp().plater()->canvas3D()->ensure_on_bed(obj_idx);
|
||||
wxGetApp().plater()->canvas3D()->ensure_on_bed(obj_idx, printer_technology() != ptSLA);
|
||||
}
|
||||
|
||||
// update scene
|
||||
|
Loading…
Reference in New Issue
Block a user