From 47ce7bbecc57bf5a6e648d18db035d2ee78f43e7 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 8 Jun 2023 14:45:18 +0200 Subject: [PATCH] Fix: Face loop select toggle behaviour in paint mode As pointed out by @pablovazquez the selection behavior of the face loop selection in paint modes was missing the toggle feature. The logic goes like this: If any of the 2 adjacent faces to the selected edge are selected, deselect instead of select. There is still an inconsistency which I left in for this patch, but is up to discussion. CTRL+ALT+SHIFT click does an actual deselect in paint mode. In edit mode it does toggle as well, just as ALT+SHIFT click I can remove that feature if it isn't wanted Pull Request: https://projects.blender.org/blender/blender/pulls/108753 --- source/blender/editors/mesh/editface.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/mesh/editface.cc b/source/blender/editors/mesh/editface.cc index 6b0d972e9e4..0dd635458f8 100644 --- a/source/blender/editors/mesh/editface.cc +++ b/source/blender/editors/mesh/editface.cc @@ -517,7 +517,11 @@ void paintface_select_loop(bContext *C, Object *ob, const int mval[2], const boo bke::SpanAttributeWriter select_poly = attributes.lookup_or_add_for_write_span( ".select_poly", ATTR_DOMAIN_FACE); - select_poly.span.fill_indices(polys_to_select.as_span(), select); + /* Toggling behavior. When one of the faces of the picked edge is already selected, + * it deselects the loop instead. */ + const bool select_toggle = select && !(select_poly.span[polys_to_closest_edge[0]] || + select_poly.span[polys_to_closest_edge[1]]); + select_poly.span.fill_indices(polys_to_select.as_span(), select_toggle); select_poly.finish(); paintface_flush_flags(C, ob, true, false);