Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
| Show First 20 Lines • Show All 340 Lines • ▼ Show 20 Lines | int SCULPT_active_face_set_get(SculptSession *ss) | ||||
| return SCULPT_FACE_SET_NONE; | return SCULPT_FACE_SET_NONE; | ||||
| } | } | ||||
| void SCULPT_vertex_visible_set(SculptSession *ss, PBVHVertRef vertex, bool visible) | void SCULPT_vertex_visible_set(SculptSession *ss, PBVHVertRef vertex, bool visible) | ||||
| { | { | ||||
| switch (BKE_pbvh_type(ss->pbvh)) { | switch (BKE_pbvh_type(ss->pbvh)) { | ||||
| case PBVH_FACES: | case PBVH_FACES: | ||||
| SET_FLAG_FROM_TEST(ss->mvert[vertex.i].flag, !visible, ME_HIDE); | SET_FLAG_FROM_TEST(ss->mvert[vertex.i].flag, !visible, ME_HIDE); | ||||
| BKE_pbvh_vert_mark_update(ss->pbvh, vertex); | BKE_pbvh_vert_tag_update_normal(ss->pbvh, vertex); | ||||
| break; | break; | ||||
| case PBVH_BMESH: { | case PBVH_BMESH: { | ||||
| BMVert *v = (BMVert *)vertex.i; | BMVert *v = (BMVert *)vertex.i; | ||||
| BM_elem_flag_set(v, BM_ELEM_HIDDEN, !visible); | BM_elem_flag_set(v, BM_ELEM_HIDDEN, !visible); | ||||
| break; | break; | ||||
| } | } | ||||
| case PBVH_GRIDS: | case PBVH_GRIDS: | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | static void UNUSED_FUNCTION(sculpt_visibility_sync_vertex_to_face_sets)(SculptSession *ss, | ||||
| for (int i = 0; i < ss->pmap[vertex.i].count; i++) { | for (int i = 0; i < ss->pmap[vertex.i].count; i++) { | ||||
| if (visible) { | if (visible) { | ||||
| ss->face_sets[vert_map->indices[i]] = abs(ss->face_sets[vert_map->indices[i]]); | ss->face_sets[vert_map->indices[i]] = abs(ss->face_sets[vert_map->indices[i]]); | ||||
| } | } | ||||
| else { | else { | ||||
| ss->face_sets[vert_map->indices[i]] = -abs(ss->face_sets[vert_map->indices[i]]); | ss->face_sets[vert_map->indices[i]] = -abs(ss->face_sets[vert_map->indices[i]]); | ||||
| } | } | ||||
| } | } | ||||
| BKE_pbvh_vert_mark_update(ss->pbvh, vertex); | |||||
| } | } | ||||
| void SCULPT_visibility_sync_all_vertex_to_face_sets(SculptSession *ss) | void SCULPT_visibility_sync_all_vertex_to_face_sets(SculptSession *ss) | ||||
| { | { | ||||
| if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) { | if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) { | ||||
| for (int i = 0; i < ss->totfaces; i++) { | for (int i = 0; i < ss->totfaces; i++) { | ||||
| MPoly *poly = &ss->mpoly[i]; | MPoly *poly = &ss->mpoly[i]; | ||||
| bool poly_visible = true; | bool poly_visible = true; | ||||
| ▲ Show 20 Lines • Show All 838 Lines • ▼ Show 20 Lines | BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { | ||||
| if (orig_data.unode->type == SCULPT_UNDO_COORDS) { | if (orig_data.unode->type == SCULPT_UNDO_COORDS) { | ||||
| copy_v3_v3(vd.co, orig_data.co); | copy_v3_v3(vd.co, orig_data.co); | ||||
| if (vd.no) { | if (vd.no) { | ||||
| copy_v3_v3(vd.no, orig_data.no); | copy_v3_v3(vd.no, orig_data.no); | ||||
| } | } | ||||
| else { | else { | ||||
| copy_v3_v3(vd.fno, orig_data.no); | copy_v3_v3(vd.fno, orig_data.no); | ||||
| } | } | ||||
| if (vd.mvert) { | |||||
| BKE_pbvh_vert_tag_update_normal(ss->pbvh, vd.vertex); | |||||
| } | |||||
| } | } | ||||
| else if (orig_data.unode->type == SCULPT_UNDO_MASK) { | else if (orig_data.unode->type == SCULPT_UNDO_MASK) { | ||||
| *vd.mask = orig_data.mask; | *vd.mask = orig_data.mask; | ||||
| } | } | ||||
| else if (orig_data.unode->type == SCULPT_UNDO_COLOR) { | else if (orig_data.unode->type == SCULPT_UNDO_COLOR) { | ||||
| SCULPT_vertex_color_set(ss, vd.vertex, orig_data.col); | SCULPT_vertex_color_set(ss, vd.vertex, orig_data.col); | ||||
| } | } | ||||
| if (vd.mvert) { | |||||
| BKE_pbvh_vert_mark_update(ss->pbvh, vd.vertex); | |||||
| } | |||||
| } | } | ||||
| BKE_pbvh_vertex_iter_end; | BKE_pbvh_vertex_iter_end; | ||||
| if (orig_data.unode->type == SCULPT_UNDO_MASK) { | |||||
| BKE_pbvh_node_mark_update_mask(data->nodes[n]); | |||||
| } | |||||
| } | } | ||||
| static void paint_mesh_restore_co(Sculpt *sd, Object *ob) | static void paint_mesh_restore_co(Sculpt *sd, Object *ob) | ||||
| { | { | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| Brush *brush = BKE_paint_brush(&sd->paint); | Brush *brush = BKE_paint_brush(&sd->paint); | ||||
| PBVHNode **nodes; | PBVHNode **nodes; | ||||
| ▲ Show 20 Lines • Show All 1,608 Lines • ▼ Show 20 Lines | const float fade = SCULPT_brush_strength_factor(ss, | ||||
| vd.fno, | vd.fno, | ||||
| vd.mask ? *vd.mask : 0.0f, | vd.mask ? *vd.mask : 0.0f, | ||||
| vd.vertex, | vd.vertex, | ||||
| thread_id); | thread_id); | ||||
| mul_v3_v3fl(proxy[vd.i], offset, fade); | mul_v3_v3fl(proxy[vd.i], offset, fade); | ||||
| if (vd.mvert) { | if (vd.mvert) { | ||||
| BKE_pbvh_vert_mark_update(ss->pbvh, vd.vertex); | BKE_pbvh_vert_tag_update_normal(ss->pbvh, vd.vertex); | ||||
| } | } | ||||
| } | } | ||||
| BKE_pbvh_vertex_iter_end; | BKE_pbvh_vertex_iter_end; | ||||
| } | } | ||||
| static void do_gravity(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float bstrength) | static void do_gravity(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float bstrength) | ||||
| { | { | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| ▲ Show 20 Lines • Show All 992 Lines • Show Last 20 Lines | |||||