Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
| Show First 20 Lines • Show All 5,316 Lines • ▼ Show 20 Lines | static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSettings *ups) | ||||
| } | } | ||||
| /* Draw Face Sets in draw mode makes a single undo push, in alt-smooth mode deforms the | /* Draw Face Sets in draw mode makes a single undo push, in alt-smooth mode deforms the | ||||
| * vertices and uses regular coords undo. */ | * vertices and uses regular coords undo. */ | ||||
| /* It also assigns the paint_face_set here as it needs to be done regardless of the stroke type | /* It also assigns the paint_face_set here as it needs to be done regardless of the stroke type | ||||
| * and the number of nodes under the brush influence. */ | * and the number of nodes under the brush influence. */ | ||||
| if (brush->sculpt_tool == SCULPT_TOOL_DRAW_FACE_SETS && ss->cache->first_time && | if (brush->sculpt_tool == SCULPT_TOOL_DRAW_FACE_SETS && ss->cache->first_time && | ||||
| ss->cache->mirror_symmetry_pass == 0 && !ss->cache->alt_smooth) { | ss->cache->mirror_symmetry_pass == 0 && !ss->cache->alt_smooth) { | ||||
| /* Do not push Face Sets to the undo stack with Dyntopo active. */ | |||||
sergey: Usually comment answers "why", not :"what". Surely, in some cases of non-trivial optimized code… | |||||
| if (BKE_pbvh_type(ss->pbvh) != PBVH_BMESH) { | |||||
| SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_FACE_SETS); | SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_FACE_SETS); | ||||
| } | |||||
| if (ss->cache->invert) { | if (ss->cache->invert) { | ||||
| /* When inverting the brush, pick the paint face mask ID from the mesh. */ | /* When inverting the brush, pick the paint face mask ID from the mesh. */ | ||||
| ss->cache->paint_face_set = SCULPT_active_face_set_get(ss); | ss->cache->paint_face_set = SCULPT_active_face_set_get(ss); | ||||
| } | } | ||||
| else { | else { | ||||
| /* By default create a new Face Sets. */ | /* By default create a new Face Sets. */ | ||||
| ss->cache->paint_face_set = SCULPT_face_set_next_available_get(ss); | ss->cache->paint_face_set = SCULPT_face_set_next_available_get(ss); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 2,576 Lines • Show Last 20 Lines | |||||
Usually comment answers "why", not :"what". Surely, in some cases of non-trivial optimized code having answer for "what" question adds a lot of value, and sometimes it also helps to split up code visually.
Here it definitely deserved to be a "why" answer, since it's clear that you skip undo for dyntopo, but it is not clear why.
But also read non-inlined comment.