Cut WIP: Add only needed modifiers
This commit is contained in:
parent
a8919b1e91
commit
5ec84adb14
@ -1380,10 +1380,6 @@ indexed_triangle_set ModelObject::get_connector_mesh(CutConnectorAttributes conn
|
|||||||
|
|
||||||
void ModelObject::apply_cut_connectors(const std::string& name)
|
void ModelObject::apply_cut_connectors(const std::string& name)
|
||||||
{
|
{
|
||||||
// discard old connector markers for volumes
|
|
||||||
for (ModelVolume* volume : volumes)
|
|
||||||
volume->cut_info.discard();
|
|
||||||
|
|
||||||
if (cut_connectors.empty())
|
if (cut_connectors.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1517,6 +1513,8 @@ ModelObjectPtrs ModelObject::cut(size_t instance, const Vec3d& cut_center, const
|
|||||||
|
|
||||||
if (!volume->is_model_part()) {
|
if (!volume->is_model_part()) {
|
||||||
if (volume->cut_info.is_connector) {
|
if (volume->cut_info.is_connector) {
|
||||||
|
volume->cut_info.discard();
|
||||||
|
|
||||||
// ! Don't apply instance transformation for the conntectors.
|
// ! Don't apply instance transformation for the conntectors.
|
||||||
// This transformation is already there
|
// This transformation is already there
|
||||||
if (attributes.has(ModelObjectCutAttribute::KeepUpper)) {
|
if (attributes.has(ModelObjectCutAttribute::KeepUpper)) {
|
||||||
@ -1559,10 +1557,12 @@ ModelObjectPtrs ModelObject::cut(size_t instance, const Vec3d& cut_center, const
|
|||||||
// to the modifier volume transformation to preserve their shape properly.
|
// to the modifier volume transformation to preserve their shape properly.
|
||||||
volume->set_transformation(Geometry::Transformation(instance_matrix * volume_matrix));
|
volume->set_transformation(Geometry::Transformation(instance_matrix * volume_matrix));
|
||||||
|
|
||||||
// #ysFIXME - add logic for the negative volumes/connectors
|
// Some logic for the negative volumes/connectors. Add only needed modifiers
|
||||||
if (attributes.has(ModelObjectCutAttribute::KeepUpper))
|
auto bb = volume->mesh().transformed_bounding_box(cut_matrix * volume->get_matrix());
|
||||||
|
bool is_crossed_by_cut = bb.min[Z] <= 0 && bb.max[Z] >= 0;
|
||||||
|
if (attributes.has(ModelObjectCutAttribute::KeepUpper) && (bb.min[Z] >= 0 || is_crossed_by_cut))
|
||||||
upper->add_volume(*volume);
|
upper->add_volume(*volume);
|
||||||
if (attributes.has(ModelObjectCutAttribute::KeepLower))
|
if (attributes.has(ModelObjectCutAttribute::KeepLower) && (bb.max[Z] <= 0 || is_crossed_by_cut))
|
||||||
lower->add_volume(*volume);
|
lower->add_volume(*volume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2918,6 +2918,7 @@ bool ObjectList::delete_from_model_and_list(const ItemType type, const int obj_i
|
|||||||
update_lock_icons_for_model();
|
update_lock_icons_for_model();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else if (del_subobject_from_object(obj_idx, sub_obj_idx, type)) {
|
else if (del_subobject_from_object(obj_idx, sub_obj_idx, type)) {
|
||||||
type == itVolume ? delete_volume_from_list(obj_idx, sub_obj_idx) :
|
type == itVolume ? delete_volume_from_list(obj_idx, sub_obj_idx) :
|
||||||
@ -2942,7 +2943,7 @@ bool ObjectList::delete_from_model_and_list(const std::vector<ItemForDelete>& it
|
|||||||
if (item->type&itObject) {
|
if (item->type&itObject) {
|
||||||
bool was_cut = object(item->obj_idx)->is_cut();
|
bool was_cut = object(item->obj_idx)->is_cut();
|
||||||
if (!del_object(item->obj_idx))
|
if (!del_object(item->obj_idx))
|
||||||
continue;
|
return false;// continue;
|
||||||
m_objects_model->Delete(m_objects_model->GetItemById(item->obj_idx));
|
m_objects_model->Delete(m_objects_model->GetItemById(item->obj_idx));
|
||||||
if (was_cut)
|
if (was_cut)
|
||||||
update_lock_icons_for_model();
|
update_lock_icons_for_model();
|
||||||
|
@ -77,7 +77,7 @@ class GLGizmoCut3D : public GLGizmoBase
|
|||||||
bool m_keep_upper{ true };
|
bool m_keep_upper{ true };
|
||||||
bool m_keep_lower{ true };
|
bool m_keep_lower{ true };
|
||||||
bool m_place_on_cut_upper{ true };
|
bool m_place_on_cut_upper{ true };
|
||||||
bool m_place_on_cut_lower{ true };
|
bool m_place_on_cut_lower{ false };
|
||||||
bool m_rotate_upper{ false };
|
bool m_rotate_upper{ false };
|
||||||
bool m_rotate_lower{ false };
|
bool m_rotate_lower{ false };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user