Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_expand.c')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_expand.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_expand.c b/source/blender/editors/sculpt_paint/sculpt_expand.c
index 7c4c47261b3..4aafeacfbff 100644
--- a/source/blender/editors/sculpt_paint/sculpt_expand.c
+++ b/source/blender/editors/sculpt_paint/sculpt_expand.c
@@ -351,13 +351,13 @@ static float sculpt_expand_gradient_value_get(SculptSession *ss,
static BLI_bitmap *sculpt_expand_bitmap_from_enabled(SculptSession *ss, ExpandCache *expand_cache)
{
const int totvert = SCULPT_vertex_count_get(ss);
- BLI_bitmap *enabled_vertices = BLI_BITMAP_NEW(totvert, "enabled vertices");
+ BLI_bitmap *enabled_verts = BLI_BITMAP_NEW(totvert, "enabled verts");
for (int i = 0; i < totvert; i++) {
const bool enabled = sculpt_expand_state_get(
ss, expand_cache, BKE_pbvh_index_to_vertex(ss->pbvh, i));
- BLI_BITMAP_SET(enabled_vertices, i, enabled);
+ BLI_BITMAP_SET(enabled_verts, i, enabled);
}
- return enabled_vertices;
+ return enabled_verts;
}
/**
@@ -366,13 +366,13 @@ static BLI_bitmap *sculpt_expand_bitmap_from_enabled(SculptSession *ss, ExpandCa
* vertex that is not enabled.
*/
static BLI_bitmap *sculpt_expand_boundary_from_enabled(SculptSession *ss,
- const BLI_bitmap *enabled_vertices,
+ const BLI_bitmap *enabled_verts,
const bool use_mesh_boundary)
{
const int totvert = SCULPT_vertex_count_get(ss);
- BLI_bitmap *boundary_vertices = BLI_BITMAP_NEW(totvert, "boundary vertices");
+ BLI_bitmap *boundary_verts = BLI_BITMAP_NEW(totvert, "boundary verts");
for (int i = 0; i < totvert; i++) {
- if (!BLI_BITMAP_TEST(enabled_vertices, i)) {
+ if (!BLI_BITMAP_TEST(enabled_verts, i)) {
continue;
}
@@ -381,7 +381,7 @@ static BLI_bitmap *sculpt_expand_boundary_from_enabled(SculptSession *ss,
bool is_expand_boundary = false;
SculptVertexNeighborIter ni;
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vertex, ni) {
- if (!BLI_BITMAP_TEST(enabled_vertices, ni.index)) {
+ if (!BLI_BITMAP_TEST(enabled_verts, ni.index)) {
is_expand_boundary = true;
}
}
@@ -391,10 +391,10 @@ static BLI_bitmap *sculpt_expand_boundary_from_enabled(SculptSession *ss,
is_expand_boundary = true;
}
- BLI_BITMAP_SET(boundary_vertices, i, is_expand_boundary);
+ BLI_BITMAP_SET(boundary_verts, i, is_expand_boundary);
}
- return boundary_vertices;
+ return boundary_verts;
}
/* Functions implementing different algorithms for initializing falloff values. */
@@ -596,7 +596,7 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const P
SculptSession *ss = ob->sculpt;
const int totvert = SCULPT_vertex_count_get(ss);
float *dists = MEM_calloc_arrayN(totvert, sizeof(float), "spherical dist");
- BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(totvert, "visited vertices");
+ BLI_bitmap *visited_verts = BLI_BITMAP_NEW(totvert, "visited verts");
GSQueue *queue = BLI_gsqueue_new(sizeof(PBVHVertRef));
/* Search and initialize a boundary per symmetry pass, then mark those vertices as visited. */
@@ -614,9 +614,9 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const P
continue;
}
- for (int i = 0; i < boundary->num_vertices; i++) {
- BLI_gsqueue_push(queue, &boundary->vertices[i]);
- BLI_BITMAP_ENABLE(visited_vertices, boundary->vertices_i[i]);
+ for (int i = 0; i < boundary->verts_num; i++) {
+ BLI_gsqueue_push(queue, &boundary->verts[i]);
+ BLI_BITMAP_ENABLE(visited_verts, boundary->verts_i[i]);
}
SCULPT_boundary_data_free(boundary);
}
@@ -635,18 +635,18 @@ static float *sculpt_expand_boundary_topology_falloff_create(Object *ob, const P
SculptVertexNeighborIter ni;
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, v_next, ni) {
- if (BLI_BITMAP_TEST(visited_vertices, ni.index)) {
+ if (BLI_BITMAP_TEST(visited_verts, ni.index)) {
continue;
}
dists[ni.index] = dists[v_next_i] + 1.0f;
- BLI_BITMAP_ENABLE(visited_vertices, ni.index);
+ BLI_BITMAP_ENABLE(visited_verts, ni.index);
BLI_gsqueue_push(queue, &ni.vertex);
}
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
}
BLI_gsqueue_free(queue);
- MEM_freeN(visited_vertices);
+ MEM_freeN(visited_verts);
return dists;
}
@@ -669,7 +669,7 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const PBVHVertR
}
/* Search and mask as visited the initial vertices using the enabled symmetry passes. */
- BLI_bitmap *visited_vertices = BLI_BITMAP_NEW(totvert, "visited vertices");
+ BLI_bitmap *visited_verts = BLI_BITMAP_NEW(totvert, "visited verts");
GSQueue *queue = BLI_gsqueue_new(sizeof(PBVHVertRef));
const char symm = SCULPT_mesh_symmetry_xyz_get(ob);
for (char symm_it = 0; symm_it <= symm; symm_it++) {
@@ -682,7 +682,7 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const PBVHVertR
int symm_vertex_i = BKE_pbvh_vertex_to_index(ss->pbvh, symm_vertex);
BLI_gsqueue_push(queue, &symm_vertex);
- BLI_BITMAP_ENABLE(visited_vertices, symm_vertex_i);
+ BLI_BITMAP_ENABLE(visited_verts, symm_vertex_i);
}
if (BLI_gsqueue_is_empty(queue)) {
@@ -700,18 +700,18 @@ static float *sculpt_expand_diagonals_falloff_create(Object *ob, const PBVHVertR
const MPoly *p = &ss->mpoly[ss->pmap[v_next_i].indices[j]];
for (int l = 0; l < p->totloop; l++) {
const PBVHVertRef neighbor_v = BKE_pbvh_make_vref(ss->mloop[p->loopstart + l].v);
- if (BLI_BITMAP_TEST(visited_vertices, neighbor_v.i)) {
+ if (BLI_BITMAP_TEST(visited_verts, neighbor_v.i)) {
continue;
}
dists[neighbor_v.i] = dists[v_next_i] + 1.0f;
- BLI_BITMAP_ENABLE(visited_vertices, neighbor_v.i);
+ BLI_BITMAP_ENABLE(visited_verts, neighbor_v.i);
BLI_gsqueue_push(queue, &neighbor_v);
}
}
}
BLI_gsqueue_free(queue);
- MEM_freeN(visited_vertices);
+ MEM_freeN(visited_verts);
return dists;
}
@@ -842,27 +842,27 @@ static void sculpt_expand_mesh_face_falloff_from_vertex_falloff(SculptSession *s
*/
static void sculpt_expand_geodesics_from_state_boundary(Object *ob,
ExpandCache *expand_cache,
- BLI_bitmap *enabled_vertices)
+ BLI_bitmap *enabled_verts)
{
SculptSession *ss = ob->sculpt;
BLI_assert(BKE_pbvh_type(ss->pbvh) == PBVH_FACES);
- GSet *initial_vertices = BLI_gset_int_new("initial_vertices");
- BLI_bitmap *boundary_vertices = sculpt_expand_boundary_from_enabled(ss, enabled_vertices, false);
+ GSet *initial_verts = BLI_gset_int_new("initial_verts");
+ BLI_bitmap *boundary_verts = sculpt_expand_boundary_from_enabled(ss, enabled_verts, false);
const int totvert = SCULPT_vertex_count_get(ss);
for (int i = 0; i < totvert; i++) {
- if (!BLI_BITMAP_TEST(boundary_vertices, i)) {
+ if (!BLI_BITMAP_TEST(boundary_verts, i)) {
continue;
}
- BLI_gset_add(initial_vertices, POINTER_FROM_INT(i));
+ BLI_gset_add(initial_verts, POINTER_FROM_INT(i));
}
- MEM_freeN(boundary_vertices);
+ MEM_freeN(boundary_verts);
MEM_SAFE_FREE(expand_cache->vert_falloff);
MEM_SAFE_FREE(expand_cache->face_falloff);
- expand_cache->vert_falloff = SCULPT_geodesic_distances_create(ob, initial_vertices, FLT_MAX);
- BLI_gset_free(initial_vertices, NULL);
+ expand_cache->vert_falloff = SCULPT_geodesic_distances_create(ob, initial_verts, FLT_MAX);
+ BLI_gset_free(initial_verts, NULL);
}
/**
@@ -871,7 +871,7 @@ static void sculpt_expand_geodesics_from_state_boundary(Object *ob,
*/
static void sculpt_expand_topology_from_state_boundary(Object *ob,
ExpandCache *expand_cache,
- BLI_bitmap *enabled_vertices)
+ BLI_bitmap *enabled_verts)
{
MEM_SAFE_FREE(expand_cache->vert_falloff);
MEM_SAFE_FREE(expand_cache->face_falloff);
@@ -880,19 +880,19 @@ static void sculpt_expand_topology_from_state_boundary(Object *ob,
const int totvert = SCULPT_vertex_count_get(ss);
float *dists = MEM_calloc_arrayN(totvert, sizeof(float), "topology dist");
- BLI_bitmap *boundary_vertices = sculpt_expand_boundary_from_enabled(ss, enabled_vertices, false);
+ BLI_bitmap *boundary_verts = sculpt_expand_boundary_from_enabled(ss, enabled_verts, false);
SculptFloodFill flood;
SCULPT_floodfill_init(ss, &flood);
for (int i = 0; i < totvert; i++) {
- if (!BLI_BITMAP_TEST(boundary_vertices, i)) {
+ if (!BLI_BITMAP_TEST(boundary_verts, i)) {
continue;
}
PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i);
SCULPT_floodfill_add_and_skip_initial(&flood, vertex);
}
- MEM_freeN(boundary_vertices);
+ MEM_freeN(boundary_verts);
ExpandFloodFillData fdata;
fdata.dists = dists;
@@ -914,7 +914,7 @@ static void sculpt_expand_resursion_step_add(Object *ob,
return;
}
- BLI_bitmap *enabled_vertices = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
+ BLI_bitmap *enabled_verts = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
/* Each time a new recursion step is created, reset the distortion strength. This is the expected
* result from the recursion, as otherwise the new falloff will render with undesired distortion
@@ -923,10 +923,10 @@ static void sculpt_expand_resursion_step_add(Object *ob,
switch (recursion_type) {
case SCULPT_EXPAND_RECURSION_GEODESICS:
- sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_vertices);
+ sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_verts);
break;
case SCULPT_EXPAND_RECURSION_TOPOLOGY:
- sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_vertices);
+ sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_verts);
break;
}
@@ -936,7 +936,7 @@ static void sculpt_expand_resursion_step_add(Object *ob,
sculpt_expand_update_max_face_falloff_factor(ss, expand_cache);
}
- MEM_freeN(enabled_vertices);
+ MEM_freeN(enabled_verts);
}
/* Face Set Boundary falloff. */
@@ -953,7 +953,7 @@ static void sculpt_expand_initialize_from_face_set_boundary(Object *ob,
SculptSession *ss = ob->sculpt;
const int totvert = SCULPT_vertex_count_get(ss);
- BLI_bitmap *enabled_vertices = BLI_BITMAP_NEW(totvert, "enabled vertices");
+ BLI_bitmap *enabled_verts = BLI_BITMAP_NEW(totvert, "enabled verts");
for (int i = 0; i < totvert; i++) {
PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i);
@@ -963,17 +963,17 @@ static void sculpt_expand_initialize_from_face_set_boundary(Object *ob,
if (!SCULPT_vertex_has_face_set(ss, vertex, active_face_set)) {
continue;
}
- BLI_BITMAP_ENABLE(enabled_vertices, i);
+ BLI_BITMAP_ENABLE(enabled_verts, i);
}
if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES) {
- sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_vertices);
+ sculpt_expand_geodesics_from_state_boundary(ob, expand_cache, enabled_verts);
}
else {
- sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_vertices);
+ sculpt_expand_topology_from_state_boundary(ob, expand_cache, enabled_verts);
}
- MEM_freeN(enabled_vertices);
+ MEM_freeN(enabled_verts);
if (internal_falloff) {
for (int i = 0; i < totvert; i++) {
@@ -1086,7 +1086,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss,
expand_cache->snap = false;
expand_cache->invert = false;
- BLI_bitmap *enabled_vertices = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
+ BLI_bitmap *enabled_verts = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
const int totface = ss->totfaces;
for (int i = 0; i < totface; i++) {
@@ -1099,7 +1099,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss,
bool any_disabled = false;
for (int l = 0; l < poly->totloop; l++) {
const MLoop *loop = &ss->mloop[l + poly->loopstart];
- if (!BLI_BITMAP_TEST(enabled_vertices, loop->v)) {
+ if (!BLI_BITMAP_TEST(enabled_verts, loop->v)) {
any_disabled = true;
break;
}
@@ -1110,7 +1110,7 @@ static void sculpt_expand_snap_initialize_from_enabled(SculptSession *ss,
}
}
- MEM_freeN(enabled_vertices);
+ MEM_freeN(enabled_verts);
expand_cache->snap = prev_snap_state;
expand_cache->invert = prev_invert_state;
}
@@ -1514,7 +1514,7 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache
const bool initial_invert_state = expand_cache->invert;
expand_cache->invert = false;
- BLI_bitmap *enabled_vertices = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
+ BLI_bitmap *enabled_verts = sculpt_expand_bitmap_from_enabled(ss, expand_cache);
/* For boundary topology, position the pivot using only the boundary of the enabled vertices,
* without taking mesh boundary into account. This allows to create deformations like bending the
@@ -1522,8 +1522,8 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache
const float use_mesh_boundary = expand_cache->falloff_type !=
SCULPT_EXPAND_FALLOFF_BOUNDARY_TOPOLOGY;
- BLI_bitmap *boundary_vertices = sculpt_expand_boundary_from_enabled(
- ss, enabled_vertices, use_mesh_boundary);
+ BLI_bitmap *boundary_verts = sculpt_expand_boundary_from_enabled(
+ ss, enabled_verts, use_mesh_boundary);
/* Ignore invert state, as this is the expected behavior in most cases and mask are created in
* inverted state by default. */
@@ -1537,7 +1537,7 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache
for (int i = 0; i < totvert; i++) {
PBVHVertRef vertex = BKE_pbvh_index_to_vertex(ss->pbvh, i);
- if (!BLI_BITMAP_TEST(boundary_vertices, i)) {
+ if (!BLI_BITMAP_TEST(boundary_verts, i)) {
continue;
}
@@ -1555,8 +1555,8 @@ static void sculpt_expand_reposition_pivot(bContext *C, Object *ob, ExpandCache
total++;
}
- MEM_freeN(enabled_vertices);
- MEM_freeN(boundary_vertices);
+ MEM_freeN(enabled_verts);
+ MEM_freeN(boundary_verts);
if (total > 0) {
mul_v3_v3fl(ss->pivot_pos, avg, 1.0f / total);