Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 286 Lines • ▼ Show 20 Lines | static void SCULPT_face_sets_visibility_invert(SculptSession *ss) | ||||
| } | } | ||||
| } | } | ||||
| static void SCULPT_face_sets_visibility_all_set(SculptSession *ss, bool visible) | static void SCULPT_face_sets_visibility_all_set(SculptSession *ss, bool visible) | ||||
| { | { | ||||
| switch (BKE_pbvh_type(ss->pbvh)) { | switch (BKE_pbvh_type(ss->pbvh)) { | ||||
| case PBVH_FACES: | case PBVH_FACES: | ||||
| for (int i = 0; i < ss->totpoly; i++) { | for (int i = 0; i < ss->totpoly; i++) { | ||||
| if (ss->face_sets[i] == SCULPT_FACE_SET_NONE) { | |||||
jbakker: Perhaps add a comment for this one. It isn't clear why this is done. | |||||
| ss->face_sets[i] = 1; | |||||
| } | |||||
| if (visible) { | if (visible) { | ||||
| ss->face_sets[i] = abs(ss->face_sets[i]); | ss->face_sets[i] = abs(ss->face_sets[i]); | ||||
| } | } | ||||
| else { | else { | ||||
| ss->face_sets[i] = -abs(ss->face_sets[i]); | ss->face_sets[i] = -abs(ss->face_sets[i]); | ||||
| } | } | ||||
| } | } | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 10,688 Lines • ▼ Show 20 Lines | if (totnode == 0) { | ||||
| MEM_SAFE_FREE(nodes); | MEM_SAFE_FREE(nodes); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_FACE_SETS); | SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_FACE_SETS); | ||||
| if (mode == SCULPT_FACE_SET_VISIBILITY_TOGGLE) { | if (mode == SCULPT_FACE_SET_VISIBILITY_TOGGLE) { | ||||
| bool hidden_vertex = false; | bool hidden_vertex = false; | ||||
| /* This can fail with regular meshes with non-manifold geometry as the visibility state can't | |||||
| * be synced from face sets to non-manifold vertices. */ | |||||
| if (BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS) { | |||||
| for (int i = 0; i < tot_vert; i++) { | for (int i = 0; i < tot_vert; i++) { | ||||
| if (!SCULPT_vertex_visible_get(ss, i)) { | if (!SCULPT_vertex_visible_get(ss, i)) { | ||||
| hidden_vertex = true; | hidden_vertex = true; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| for (int i = 0; i < ss->totpoly; i++) { | for (int i = 0; i < ss->totpoly; i++) { | ||||
| if (ss->face_sets[i] < 0) { | if (ss->face_sets[i] <= 0) { | ||||
| hidden_vertex = true; | hidden_vertex = true; | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| if (hidden_vertex) { | if (hidden_vertex) { | ||||
| SCULPT_face_sets_visibility_all_set(ss, true); | SCULPT_face_sets_visibility_all_set(ss, true); | ||||
| } | } | ||||
| else { | else { | ||||
| SCULPT_face_sets_visibility_all_set(ss, false); | SCULPT_face_sets_visibility_all_set(ss, false); | ||||
| SCULPT_face_set_visibility_set(ss, active_face_set, true); | SCULPT_face_set_visibility_set(ss, active_face_set, true); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 163 Lines • Show Last 20 Lines | |||||
Perhaps add a comment for this one. It isn't clear why this is done.