Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_boundary.c
| Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | typedef struct BoundaryInitialVertexFloodFillData { | ||||
| float radius_sq; | float radius_sq; | ||||
| } BoundaryInitialVertexFloodFillData; | } BoundaryInitialVertexFloodFillData; | ||||
| static bool boundary_initial_vertex_floodfill_cb( | static bool boundary_initial_vertex_floodfill_cb( | ||||
| SculptSession *ss, int from_v, int to_v, bool is_duplicate, void *userdata) | SculptSession *ss, int from_v, int to_v, bool is_duplicate, void *userdata) | ||||
| { | { | ||||
| BoundaryInitialVertexFloodFillData *data = userdata; | BoundaryInitialVertexFloodFillData *data = userdata; | ||||
| if (!SCULPT_vertex_visible_get(ss, to_v)) { | |||||
| return false; | |||||
| } | |||||
| if (!is_duplicate) { | if (!is_duplicate) { | ||||
| data->floodfill_steps[to_v] = data->floodfill_steps[from_v] + 1; | data->floodfill_steps[to_v] = data->floodfill_steps[from_v] + 1; | ||||
| } | } | ||||
| else { | else { | ||||
| data->floodfill_steps[to_v] = data->floodfill_steps[from_v]; | data->floodfill_steps[to_v] = data->floodfill_steps[from_v]; | ||||
| } | } | ||||
| if (SCULPT_vertex_is_boundary(ss, to_v)) { | if (SCULPT_vertex_is_boundary(ss, to_v)) { | ||||
| ▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | |||||
| /** | /** | ||||
| * This function is used to check where the propagation should stop when calculating the boundary, | * This function is used to check where the propagation should stop when calculating the boundary, | ||||
| * as well as to check if the initial vertex is valid. | * as well as to check if the initial vertex is valid. | ||||
| */ | */ | ||||
| static bool sculpt_boundary_is_vertex_in_editable_boundary(SculptSession *ss, | static bool sculpt_boundary_is_vertex_in_editable_boundary(SculptSession *ss, | ||||
| const int initial_vertex) | const int initial_vertex) | ||||
| { | { | ||||
| if (!SCULPT_vertex_visible_get(ss, initial_vertex)) { | |||||
| return false; | |||||
| } | |||||
| int neighbor_count = 0; | int neighbor_count = 0; | ||||
| int boundary_vertex_count = 0; | int boundary_vertex_count = 0; | ||||
| SculptVertexNeighborIter ni; | SculptVertexNeighborIter ni; | ||||
| SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, initial_vertex, ni) { | SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, initial_vertex, ni) { | ||||
| if (SCULPT_vertex_visible_get(ss, ni.index)) { | |||||
| neighbor_count++; | neighbor_count++; | ||||
| if (SCULPT_vertex_is_boundary(ss, ni.index)) { | if (SCULPT_vertex_is_boundary(ss, ni.index)) { | ||||
| boundary_vertex_count++; | boundary_vertex_count++; | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); | SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); | ||||
| /* Corners are ambiguous as it can't be decide which boundary should be active. The flood fill | /* Corners are ambiguous as it can't be decide which boundary should be active. The flood fill | ||||
| * should also stop at corners. */ | * should also stop at corners. */ | ||||
| if (neighbor_count <= 2) { | if (neighbor_count <= 2) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | while (true) { | ||||
| } | } | ||||
| while (!BLI_gsqueue_is_empty(current_iteration)) { | while (!BLI_gsqueue_is_empty(current_iteration)) { | ||||
| int from_v; | int from_v; | ||||
| BLI_gsqueue_pop(current_iteration, &from_v); | BLI_gsqueue_pop(current_iteration, &from_v); | ||||
| SculptVertexNeighborIter ni; | SculptVertexNeighborIter ni; | ||||
| SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) { | SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) { | ||||
| if (boundary->edit_info[ni.index].num_propagation_steps == BOUNDARY_STEPS_NONE) { | const bool is_visible = SCULPT_vertex_visible_get(ss, ni.index); | ||||
| if (is_visible && | |||||
| boundary->edit_info[ni.index].num_propagation_steps == BOUNDARY_STEPS_NONE) { | |||||
| boundary->edit_info[ni.index].original_vertex = | boundary->edit_info[ni.index].original_vertex = | ||||
| boundary->edit_info[from_v].original_vertex; | boundary->edit_info[from_v].original_vertex; | ||||
| BLI_BITMAP_ENABLE(visited_vertices, ni.index); | BLI_BITMAP_ENABLE(visited_vertices, ni.index); | ||||
| if (ni.is_duplicate) { | if (ni.is_duplicate) { | ||||
| /* Grids duplicates handling. */ | /* Grids duplicates handling. */ | ||||
| boundary->edit_info[ni.index].num_propagation_steps = | boundary->edit_info[ni.index].num_propagation_steps = | ||||
| ▲ Show 20 Lines • Show All 604 Lines • Show Last 20 Lines | |||||