Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2022-02-19 17:04:32 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2022-07-09 10:39:53 +0300
commite3801a2bd417b63f8b30c4c2dfa19b2efdbf9ce7 (patch)
tree2b1273c871750974c9d711e2ba665f9c3443b202 /source/blender/editors/mesh
parentd9e00fbbf613dda92f3e635e0c13094749447cae (diff)
Weight & Vertex Paint: always respect edit mode hiding on faces.
In some cases it is mandatory to be able to hide parts of the mesh in order to paint certain areas. The Mask modifier doesn't work in weight paint, and edit mode hiding requires using selection, which is not always convenient. This makes the weight and vertex paint modes always respect edit mode hiding like sculpt mode. The change in behavior affects drawing and building paint PBVH. Thus it affects brushes, but not menu operators like Smooth or Normalize. In addition, this makes the Alt-H shortcut available even without any selection enabled, and implements Hide for vertex selection. Differential Revision: https://developer.blender.org/D14163
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editface.cc51
1 files changed, 51 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editface.cc b/source/blender/editors/mesh/editface.cc
index 69fe69fe117..b69cd8b8606 100644
--- a/source/blender/editors/mesh/editface.cc
+++ b/source/blender/editors/mesh/editface.cc
@@ -551,3 +551,54 @@ void paintvert_select_ungrouped(Object *ob, bool extend, bool flush_flags)
paintvert_flush_flags(ob);
}
}
+
+void paintvert_hide(bContext *C, Object *ob, const bool unselected)
+{
+ Mesh *const me = BKE_mesh_from_object(ob);
+
+ if (me == NULL || me->totvert == 0) {
+ return;
+ }
+
+ for (int i = 0; i < me->totvert; i++) {
+ MVert *const mvert = &me->mvert[i];
+
+ if ((mvert->flag & ME_HIDE) == 0) {
+ if (((mvert->flag & SELECT) == 0) == unselected) {
+ mvert->flag |= ME_HIDE;
+ }
+ }
+
+ if (mvert->flag & ME_HIDE) {
+ mvert->flag &= ~SELECT;
+ }
+ }
+
+ BKE_mesh_flush_hidden_from_verts(me);
+
+ paintvert_flush_flags(ob);
+ paintvert_tag_select_update(C, ob);
+}
+
+void paintvert_reveal(bContext *C, Object *ob, const bool select)
+{
+ Mesh *const me = BKE_mesh_from_object(ob);
+
+ if (me == NULL || me->totvert == 0) {
+ return;
+ }
+
+ for (int i = 0; i < me->totvert; i++) {
+ MVert *const mvert = &me->mvert[i];
+
+ if (mvert->flag & ME_HIDE) {
+ SET_FLAG_FROM_TEST(mvert->flag, select, SELECT);
+ mvert->flag &= ~ME_HIDE;
+ }
+ }
+
+ BKE_mesh_flush_hidden_from_verts(me);
+
+ paintvert_flush_flags(ob);
+ paintvert_tag_select_update(C, ob);
+}