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
This commit is contained in:
Christoph Lendenfeld
2023-06-08 14:45:18 +02:00
committed by Christoph Lendenfeld
parent 319b68763f
commit 47ce7bbecc

View File

@@ -517,7 +517,11 @@ void paintface_select_loop(bContext *C, Object *ob, const int mval[2], const boo
bke::SpanAttributeWriter<bool> select_poly = attributes.lookup_or_add_for_write_span<bool>(
".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);