Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_face_set.c
| Show First 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | static int sculpt_face_set_create_exec(bContext *C, wmOperator *op) | ||||
| PBVHNode **nodes; | PBVHNode **nodes; | ||||
| int totnode; | int totnode; | ||||
| BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); | BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); | ||||
| if (!nodes) { | if (!nodes) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| SCULPT_undo_push_begin("face set change"); | SCULPT_undo_push_begin(ob, "face set change"); | ||||
| SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_FACE_SETS); | SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_FACE_SETS); | ||||
| const int next_face_set = SCULPT_face_set_next_available_get(ss); | const int next_face_set = SCULPT_face_set_next_available_get(ss); | ||||
| if (mode == SCULPT_FACE_SET_MASKED) { | if (mode == SCULPT_FACE_SET_MASKED) { | ||||
| for (int i = 0; i < tot_vert; i++) { | for (int i = 0; i < tot_vert; i++) { | ||||
| if (SCULPT_vertex_mask_get(ss, i) >= threshold && SCULPT_vertex_visible_get(ss, i)) { | if (SCULPT_vertex_mask_get(ss, i) >= threshold && SCULPT_vertex_visible_get(ss, i)) { | ||||
| SCULPT_vertex_face_set_set(ss, i, next_face_set); | SCULPT_vertex_face_set_set(ss, i, next_face_set); | ||||
| ▲ Show 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | static int sculpt_face_set_init_exec(bContext *C, wmOperator *op) | ||||
| PBVHNode **nodes; | PBVHNode **nodes; | ||||
| int totnode; | int totnode; | ||||
| BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); | BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); | ||||
| if (!nodes) { | if (!nodes) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| SCULPT_undo_push_begin("face set change"); | SCULPT_undo_push_begin(ob, "face set change"); | ||||
| SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_FACE_SETS); | SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_FACE_SETS); | ||||
| const float threshold = RNA_float_get(op->ptr, "threshold"); | const float threshold = RNA_float_get(op->ptr, "threshold"); | ||||
| switch (mode) { | switch (mode) { | ||||
| case SCULPT_FACE_SETS_FROM_LOOSE_PARTS: | case SCULPT_FACE_SETS_FROM_LOOSE_PARTS: | ||||
| sculpt_face_sets_init_flood_fill(ob, sculpt_face_sets_init_loose_parts_test, threshold); | sculpt_face_sets_init_flood_fill(ob, sculpt_face_sets_init_loose_parts_test, threshold); | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Lines | static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op) | ||||
| } | } | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); | BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); | ||||
| const int tot_vert = SCULPT_vertex_count_get(ss); | const int tot_vert = SCULPT_vertex_count_get(ss); | ||||
| const int mode = RNA_enum_get(op->ptr, "mode"); | const int mode = RNA_enum_get(op->ptr, "mode"); | ||||
| const int active_face_set = SCULPT_active_face_set_get(ss); | const int active_face_set = SCULPT_active_face_set_get(ss); | ||||
| SCULPT_undo_push_begin("Hide area"); | SCULPT_undo_push_begin(ob, "Hide area"); | ||||
| PBVH *pbvh = ob->sculpt->pbvh; | PBVH *pbvh = ob->sculpt->pbvh; | ||||
| PBVHNode **nodes; | PBVHNode **nodes; | ||||
| int totnode; | int totnode; | ||||
| BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); | BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); | ||||
| if (totnode == 0) { | if (totnode == 0) { | ||||
| ▲ Show 20 Lines • Show All 430 Lines • ▼ Show 20 Lines | static void sculpt_face_set_edit_modify_face_sets(Object *ob, | ||||
| PBVH *pbvh = ob->sculpt->pbvh; | PBVH *pbvh = ob->sculpt->pbvh; | ||||
| PBVHNode **nodes; | PBVHNode **nodes; | ||||
| int totnode; | int totnode; | ||||
| BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); | BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode); | ||||
| if (!nodes) { | if (!nodes) { | ||||
| return; | return; | ||||
| } | } | ||||
| SCULPT_undo_push_begin("face set edit"); | SCULPT_undo_push_begin(ob, "face set edit"); | ||||
| SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_FACE_SETS); | SCULPT_undo_push_node(ob, nodes[0], SCULPT_UNDO_FACE_SETS); | ||||
| sculpt_face_set_apply_edit(ob, abs(active_face_set), mode, modify_hidden); | sculpt_face_set_apply_edit(ob, abs(active_face_set), mode, modify_hidden); | ||||
| SCULPT_undo_push_end(); | SCULPT_undo_push_end(); | ||||
| face_set_edit_do_post_visibility_updates(ob, nodes, totnode); | face_set_edit_do_post_visibility_updates(ob, nodes, totnode); | ||||
| MEM_freeN(nodes); | MEM_freeN(nodes); | ||||
| } | } | ||||
| static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEvent *event) | static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| ▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines | |||||