Cleanup: uppercase macros for sculpt iterators, add to clang-format
Also use sculpt prefix for SCULPT_CLAY_STABILIZER_LEN.
This commit is contained in:
@@ -248,6 +248,8 @@ ForEachMacros:
|
|||||||
- RNA_PROP_BEGIN
|
- RNA_PROP_BEGIN
|
||||||
- RNA_STRUCT_BEGIN
|
- RNA_STRUCT_BEGIN
|
||||||
- RNA_STRUCT_BEGIN_SKIP_RNA_TYPE
|
- RNA_STRUCT_BEGIN_SKIP_RNA_TYPE
|
||||||
|
- SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN
|
||||||
|
- SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN
|
||||||
- SEQP_BEGIN
|
- SEQP_BEGIN
|
||||||
- SEQ_BEGIN
|
- SEQ_BEGIN
|
||||||
- foreach
|
- foreach
|
||||||
|
@@ -857,8 +857,7 @@ void SCULPT_floodfill_execute(
|
|||||||
int from_v;
|
int from_v;
|
||||||
BLI_gsqueue_pop(flood->queue, &from_v);
|
BLI_gsqueue_pop(flood->queue, &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) {
|
||||||
{
|
|
||||||
const int to_v = ni.index;
|
const int to_v = ni.index;
|
||||||
if (flood->visited_vertices[to_v] == 0 && SCULPT_vertex_visible_get(ss, to_v)) {
|
if (flood->visited_vertices[to_v] == 0 && SCULPT_vertex_visible_get(ss, to_v)) {
|
||||||
flood->visited_vertices[to_v] = 1;
|
flood->visited_vertices[to_v] = 1;
|
||||||
@@ -868,7 +867,7 @@ void SCULPT_floodfill_execute(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1683,13 +1682,12 @@ static float *sculpt_boundary_edges_automasking_init(Object *ob,
|
|||||||
for (int i = 0; i < totvert; i++) {
|
for (int i = 0; i < totvert; i++) {
|
||||||
if (edge_distance[i] == EDGE_DISTANCE_INF) {
|
if (edge_distance[i] == EDGE_DISTANCE_INF) {
|
||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, i, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, i, ni) {
|
||||||
{
|
|
||||||
if (edge_distance[ni.index] == propagation_it) {
|
if (edge_distance[ni.index] == propagation_it) {
|
||||||
edge_distance[i] = propagation_it + 1;
|
edge_distance[i] = propagation_it + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2866,12 +2864,11 @@ static void SCULPT_neighbor_coords_average(SculptSession *ss, float result[3], i
|
|||||||
int total = 0;
|
int total = 0;
|
||||||
|
|
||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, index, ni) {
|
||||||
{
|
|
||||||
add_v3_v3(avg, SCULPT_vertex_co_get(ss, ni.index));
|
add_v3_v3(avg, SCULPT_vertex_co_get(ss, ni.index));
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
|
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
mul_v3_v3fl(result, avg, 1.0f / (float)total);
|
mul_v3_v3fl(result, avg, 1.0f / (float)total);
|
||||||
@@ -2887,12 +2884,11 @@ static float grids_neighbor_average_mask(SculptSession *ss, int index)
|
|||||||
int total = 0;
|
int total = 0;
|
||||||
|
|
||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, index, ni) {
|
||||||
{
|
|
||||||
avg += SCULPT_vertex_mask_get(ss, ni.index);
|
avg += SCULPT_vertex_mask_get(ss, ni.index);
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
|
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
return avg / (float)total;
|
return avg / (float)total;
|
||||||
@@ -3289,12 +3285,11 @@ static void surface_smooth_displace_step(SculptSession *ss,
|
|||||||
float b_current_vertex[3];
|
float b_current_vertex[3];
|
||||||
int total = 0;
|
int total = 0;
|
||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, v_index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, v_index, ni) {
|
||||||
{
|
|
||||||
add_v3_v3(b_avg, laplacian_disp[ni.index]);
|
add_v3_v3(b_avg, laplacian_disp[ni.index]);
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
mul_v3_v3fl(b_current_vertex, b_avg, (1.0f - beta) / (float)total);
|
mul_v3_v3fl(b_current_vertex, b_avg, (1.0f - beta) / (float)total);
|
||||||
madd_v3_v3fl(b_current_vertex, laplacian_disp[v_index], beta);
|
madd_v3_v3fl(b_current_vertex, laplacian_disp[v_index], beta);
|
||||||
@@ -3786,8 +3781,7 @@ static void do_topology_slide_task_cb_ex(void *__restrict userdata,
|
|||||||
normalize_v3_v3(current_disp_norm, current_disp);
|
normalize_v3_v3(current_disp_norm, current_disp);
|
||||||
mul_v3_v3fl(current_disp, current_disp_norm, ss->cache->bstrength);
|
mul_v3_v3fl(current_disp, current_disp_norm, ss->cache->bstrength);
|
||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, vd.index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd.index, ni) {
|
||||||
{
|
|
||||||
float vertex_disp[3];
|
float vertex_disp[3];
|
||||||
float vertex_disp_norm[3];
|
float vertex_disp_norm[3];
|
||||||
sub_v3_v3v3(vertex_disp, SCULPT_vertex_co_get(ss, ni.index), vd.co);
|
sub_v3_v3v3(vertex_disp, SCULPT_vertex_co_get(ss, ni.index), vd.co);
|
||||||
@@ -3796,7 +3790,7 @@ static void do_topology_slide_task_cb_ex(void *__restrict userdata,
|
|||||||
madd_v3_v3fl(final_disp, vertex_disp_norm, dot_v3v3(current_disp, vertex_disp));
|
madd_v3_v3fl(final_disp, vertex_disp_norm, dot_v3v3(current_disp, vertex_disp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
|
|
||||||
mul_v3_v3fl(proxy[vd.i], final_disp, fade);
|
mul_v3_v3fl(proxy[vd.i], final_disp, fade);
|
||||||
|
|
||||||
@@ -3820,15 +3814,14 @@ void SCULPT_relax_vertex(SculptSession *ss,
|
|||||||
zero_v3(smooth_pos);
|
zero_v3(smooth_pos);
|
||||||
|
|
||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, vd->index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd->index, ni) {
|
||||||
{
|
|
||||||
if (!filter_boundary_face_sets ||
|
if (!filter_boundary_face_sets ||
|
||||||
(filter_boundary_face_sets && !sculpt_vertex_has_unique_face_set(ss, ni.index))) {
|
(filter_boundary_face_sets && !sculpt_vertex_has_unique_face_set(ss, ni.index))) {
|
||||||
add_v3_v3(smooth_pos, SCULPT_vertex_co_get(ss, ni.index));
|
add_v3_v3(smooth_pos, SCULPT_vertex_co_get(ss, ni.index));
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
|
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
mul_v3_fl(smooth_pos, 1.0f / (float)count);
|
mul_v3_fl(smooth_pos, 1.0f / (float)count);
|
||||||
@@ -5770,10 +5763,10 @@ static void do_clay_thumb_brush_task_cb_ex(void *__restrict userdata,
|
|||||||
static float sculpt_clay_thumb_get_stabilized_pressure(StrokeCache *cache)
|
static float sculpt_clay_thumb_get_stabilized_pressure(StrokeCache *cache)
|
||||||
{
|
{
|
||||||
float final_pressure = 0.0f;
|
float final_pressure = 0.0f;
|
||||||
for (int i = 0; i < CLAY_STABILIZER_LEN; i++) {
|
for (int i = 0; i < SCULPT_CLAY_STABILIZER_LEN; i++) {
|
||||||
final_pressure += cache->clay_pressure_stabilizer[i];
|
final_pressure += cache->clay_pressure_stabilizer[i];
|
||||||
}
|
}
|
||||||
return final_pressure / (float)CLAY_STABILIZER_LEN;
|
return final_pressure / (float)SCULPT_CLAY_STABILIZER_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_clay_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
static void do_clay_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode)
|
||||||
@@ -7248,7 +7241,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, Po
|
|||||||
/* Clay stabilized pressure. */
|
/* Clay stabilized pressure. */
|
||||||
if (brush->sculpt_tool == SCULPT_TOOL_CLAY_THUMB) {
|
if (brush->sculpt_tool == SCULPT_TOOL_CLAY_THUMB) {
|
||||||
if (ss->cache->first_time) {
|
if (ss->cache->first_time) {
|
||||||
for (int i = 0; i < CLAY_STABILIZER_LEN; i++) {
|
for (int i = 0; i < SCULPT_CLAY_STABILIZER_LEN; i++) {
|
||||||
ss->cache->clay_pressure_stabilizer[i] = 0.0f;
|
ss->cache->clay_pressure_stabilizer[i] = 0.0f;
|
||||||
}
|
}
|
||||||
ss->cache->clay_pressure_stabilizer_index = 0;
|
ss->cache->clay_pressure_stabilizer_index = 0;
|
||||||
@@ -7256,7 +7249,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob, Po
|
|||||||
else {
|
else {
|
||||||
cache->clay_pressure_stabilizer[cache->clay_pressure_stabilizer_index] = cache->pressure;
|
cache->clay_pressure_stabilizer[cache->clay_pressure_stabilizer_index] = cache->pressure;
|
||||||
cache->clay_pressure_stabilizer_index += 1;
|
cache->clay_pressure_stabilizer_index += 1;
|
||||||
if (cache->clay_pressure_stabilizer_index >= CLAY_STABILIZER_LEN) {
|
if (cache->clay_pressure_stabilizer_index >= SCULPT_CLAY_STABILIZER_LEN) {
|
||||||
cache->clay_pressure_stabilizer_index = 0;
|
cache->clay_pressure_stabilizer_index = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9029,12 +9022,11 @@ static void sample_detail_voxel(bContext *C, ViewContext *vc, int mx, int my)
|
|||||||
float edge_length = 0.0f;
|
float edge_length = 0.0f;
|
||||||
int tot = 0;
|
int tot = 0;
|
||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, active_vertex, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, active_vertex, ni) {
|
||||||
{
|
|
||||||
edge_length += len_v3v3(active_vertex_co, SCULPT_vertex_co_get(ss, ni.index));
|
edge_length += len_v3v3(active_vertex_co, SCULPT_vertex_co_get(ss, ni.index));
|
||||||
tot += 1;
|
tot += 1;
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
if (tot > 0) {
|
if (tot > 0) {
|
||||||
mesh->remesh_voxel_size = edge_length / (float)tot;
|
mesh->remesh_voxel_size = edge_length / (float)tot;
|
||||||
}
|
}
|
||||||
@@ -9385,10 +9377,10 @@ static EnumPropertyItem prop_mesh_filter_deform_axis_items[] = {
|
|||||||
static bool sculpt_mesh_filter_needs_pmap(int filter_type, bool use_face_sets)
|
static bool sculpt_mesh_filter_needs_pmap(int filter_type, bool use_face_sets)
|
||||||
{
|
{
|
||||||
return use_face_sets || ELEM(filter_type,
|
return use_face_sets || ELEM(filter_type,
|
||||||
MESH_FILTER_SMOOTH,
|
MESH_FILTER_SMOOTH,
|
||||||
MESH_FILTER_RELAX,
|
MESH_FILTER_RELAX,
|
||||||
MESH_FILTER_RELAX_FACE_SETS,
|
MESH_FILTER_RELAX_FACE_SETS,
|
||||||
MESH_FILTER_SURFACE_SMOOTH);
|
MESH_FILTER_SURFACE_SMOOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mesh_filter_task_cb(void *__restrict userdata,
|
static void mesh_filter_task_cb(void *__restrict userdata,
|
||||||
@@ -9865,26 +9857,24 @@ static void mask_filter_task_cb(void *__restrict userdata,
|
|||||||
}
|
}
|
||||||
case MASK_FILTER_GROW:
|
case MASK_FILTER_GROW:
|
||||||
max = 0.0f;
|
max = 0.0f;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, vd.index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd.index, ni) {
|
||||||
{
|
|
||||||
float vmask_f = data->prev_mask[ni.index];
|
float vmask_f = data->prev_mask[ni.index];
|
||||||
if (vmask_f > max) {
|
if (vmask_f > max) {
|
||||||
max = vmask_f;
|
max = vmask_f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
*vd.mask = max;
|
*vd.mask = max;
|
||||||
break;
|
break;
|
||||||
case MASK_FILTER_SHRINK:
|
case MASK_FILTER_SHRINK:
|
||||||
min = 1.0f;
|
min = 1.0f;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, vd.index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd.index, ni) {
|
||||||
{
|
|
||||||
float vmask_f = data->prev_mask[ni.index];
|
float vmask_f = data->prev_mask[ni.index];
|
||||||
if (vmask_f < min) {
|
if (vmask_f < min) {
|
||||||
min = vmask_f;
|
min = vmask_f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
*vd.mask = min;
|
*vd.mask = min;
|
||||||
break;
|
break;
|
||||||
case MASK_FILTER_CONTRAST_INCREASE:
|
case MASK_FILTER_CONTRAST_INCREASE:
|
||||||
@@ -10035,15 +10025,14 @@ static float neighbor_dirty_mask(SculptSession *ss, PBVHVertexIter *vd)
|
|||||||
zero_v3(avg);
|
zero_v3(avg);
|
||||||
|
|
||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, vd->index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd->index, ni) {
|
||||||
{
|
|
||||||
float normalized[3];
|
float normalized[3];
|
||||||
sub_v3_v3v3(normalized, SCULPT_vertex_co_get(ss, ni.index), vd->co);
|
sub_v3_v3v3(normalized, SCULPT_vertex_co_get(ss, ni.index), vd->co);
|
||||||
normalize_v3(normalized);
|
normalize_v3(normalized);
|
||||||
add_v3_v3(avg, normalized);
|
add_v3_v3(avg, normalized);
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
|
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
mul_v3_fl(avg, 1.0f / total);
|
mul_v3_fl(avg, 1.0f / total);
|
||||||
@@ -10592,11 +10581,10 @@ static int sculpt_mask_expand_invoke(bContext *C, wmOperator *op, const wmEvent
|
|||||||
for (int i = 0; i < vertex_count; i++) {
|
for (int i = 0; i < vertex_count; i++) {
|
||||||
float avg = 0.0f;
|
float avg = 0.0f;
|
||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, i, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, i, ni) {
|
||||||
{
|
|
||||||
avg += ss->filter_cache->normal_factor[ni.index];
|
avg += ss->filter_cache->normal_factor[ni.index];
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
ss->filter_cache->normal_factor[i] = avg / ni.size;
|
ss->filter_cache->normal_factor[i] = avg / ni.size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10721,8 +10709,7 @@ void SCULPT_geometry_preview_lines_update(bContext *C, SculptSession *ss, float
|
|||||||
int from_v;
|
int from_v;
|
||||||
BLI_gsqueue_pop(not_visited_vertices, &from_v);
|
BLI_gsqueue_pop(not_visited_vertices, &from_v);
|
||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, from_v, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, from_v, ni) {
|
||||||
{
|
|
||||||
if (totpoints + (ni.size * 2) < max_preview_vertices) {
|
if (totpoints + (ni.size * 2) < max_preview_vertices) {
|
||||||
int to_v = ni.index;
|
int to_v = ni.index;
|
||||||
ss->preview_vert_index_list[totpoints] = from_v;
|
ss->preview_vert_index_list[totpoints] = from_v;
|
||||||
@@ -10738,7 +10725,7 @@ void SCULPT_geometry_preview_lines_update(bContext *C, SculptSession *ss, float
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
}
|
}
|
||||||
|
|
||||||
BLI_gsqueue_free(not_visited_vertices);
|
BLI_gsqueue_free(not_visited_vertices);
|
||||||
|
@@ -145,12 +145,11 @@ static void do_cloth_brush_build_constraints_task_cb_ex(
|
|||||||
int tot_indices = 0;
|
int tot_indices = 0;
|
||||||
build_indices[tot_indices] = vd.index;
|
build_indices[tot_indices] = vd.index;
|
||||||
tot_indices++;
|
tot_indices++;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, vd.index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd.index, ni) {
|
||||||
{
|
|
||||||
build_indices[tot_indices] = ni.index;
|
build_indices[tot_indices] = ni.index;
|
||||||
tot_indices++;
|
tot_indices++;
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
|
|
||||||
/* As we don't know the order of the neighbor vertices, we create all possible combinations
|
/* As we don't know the order of the neighbor vertices, we create all possible combinations
|
||||||
* between the neighbor and the original vertex as length constraints. */
|
* between the neighbor and the original vertex as length constraints. */
|
||||||
|
@@ -102,7 +102,7 @@ void SCULPT_vertex_neighbors_get(struct SculptSession *ss,
|
|||||||
SculptVertexNeighborIter *iter);
|
SculptVertexNeighborIter *iter);
|
||||||
|
|
||||||
/* Iterator over neighboring vertices. */
|
/* Iterator over neighboring vertices. */
|
||||||
#define sculpt_vertex_neighbors_iter_begin(ss, v_index, neighbor_iterator) \
|
#define SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN(ss, v_index, neighbor_iterator) \
|
||||||
SCULPT_vertex_neighbors_get(ss, v_index, false, &neighbor_iterator); \
|
SCULPT_vertex_neighbors_get(ss, v_index, false, &neighbor_iterator); \
|
||||||
for (neighbor_iterator.i = 0; neighbor_iterator.i < neighbor_iterator.size; \
|
for (neighbor_iterator.i = 0; neighbor_iterator.i < neighbor_iterator.size; \
|
||||||
neighbor_iterator.i++) { \
|
neighbor_iterator.i++) { \
|
||||||
@@ -110,7 +110,7 @@ void SCULPT_vertex_neighbors_get(struct SculptSession *ss,
|
|||||||
|
|
||||||
/* Iterate over neighboring and duplicate vertices (for PBVH_GRIDS). Duplicates come
|
/* Iterate over neighboring and duplicate vertices (for PBVH_GRIDS). Duplicates come
|
||||||
* first since they are nearest for floodfill. */
|
* first since they are nearest for floodfill. */
|
||||||
#define sculpt_vertex_duplicates_and_neighbors_iter_begin(ss, v_index, neighbor_iterator) \
|
#define SCULPT_VERTEX_DUPLICATES_AND_NEIGHBORS_ITER_BEGIN(ss, v_index, neighbor_iterator) \
|
||||||
SCULPT_vertex_neighbors_get(ss, v_index, true, &neighbor_iterator); \
|
SCULPT_vertex_neighbors_get(ss, v_index, true, &neighbor_iterator); \
|
||||||
for (neighbor_iterator.i = neighbor_iterator.size - 1; neighbor_iterator.i >= 0; \
|
for (neighbor_iterator.i = neighbor_iterator.size - 1; neighbor_iterator.i >= 0; \
|
||||||
neighbor_iterator.i--) { \
|
neighbor_iterator.i--) { \
|
||||||
@@ -118,7 +118,7 @@ void SCULPT_vertex_neighbors_get(struct SculptSession *ss,
|
|||||||
neighbor_iterator.is_duplicate = (ni.i >= \
|
neighbor_iterator.is_duplicate = (ni.i >= \
|
||||||
neighbor_iterator.size - neighbor_iterator.num_duplicates);
|
neighbor_iterator.size - neighbor_iterator.num_duplicates);
|
||||||
|
|
||||||
#define sculpt_vertex_neighbors_iter_end(neighbor_iterator) \
|
#define SCULPT_VERTEX_NEIGHBORS_ITER_END(neighbor_iterator) \
|
||||||
} \
|
} \
|
||||||
if (neighbor_iterator.neighbors != neighbor_iterator.neighbors_fixed) { \
|
if (neighbor_iterator.neighbors != neighbor_iterator.neighbors_fixed) { \
|
||||||
MEM_freeN(neighbor_iterator.neighbors); \
|
MEM_freeN(neighbor_iterator.neighbors); \
|
||||||
@@ -517,7 +517,7 @@ bool SCULPT_pbvh_calc_area_normal(const struct Brush *brush,
|
|||||||
* For descriptions of these settings, check the operator properties.
|
* For descriptions of these settings, check the operator properties.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CLAY_STABILIZER_LEN 10
|
#define SCULPT_CLAY_STABILIZER_LEN 10
|
||||||
|
|
||||||
typedef struct StrokeCache {
|
typedef struct StrokeCache {
|
||||||
/* Invariants */
|
/* Invariants */
|
||||||
@@ -608,7 +608,7 @@ typedef struct StrokeCache {
|
|||||||
/* Angle of the front tilting plane of the brush to simulate clay accumulation. */
|
/* Angle of the front tilting plane of the brush to simulate clay accumulation. */
|
||||||
float clay_thumb_front_angle;
|
float clay_thumb_front_angle;
|
||||||
/* Stores pressure samples to get an stabilized strength and radius variation. */
|
/* Stores pressure samples to get an stabilized strength and radius variation. */
|
||||||
float clay_pressure_stabilizer[CLAY_STABILIZER_LEN];
|
float clay_pressure_stabilizer[SCULPT_CLAY_STABILIZER_LEN];
|
||||||
int clay_pressure_stabilizer_index;
|
int clay_pressure_stabilizer_index;
|
||||||
|
|
||||||
/* Cloth brush */
|
/* Cloth brush */
|
||||||
|
@@ -209,12 +209,11 @@ static void pose_brush_grow_factor_task_cb_ex(void *__restrict userdata,
|
|||||||
float max = 0.0f;
|
float max = 0.0f;
|
||||||
|
|
||||||
/* Grow the factor. */
|
/* Grow the factor. */
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, vd.index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd.index, ni) {
|
||||||
{
|
|
||||||
float vmask_f = data->prev_mask[ni.index];
|
float vmask_f = data->prev_mask[ni.index];
|
||||||
max = MAX2(vmask_f, max);
|
max = MAX2(vmask_f, max);
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
|
|
||||||
/* Keep the count of the vertices that where added to the factors in this grow iteration. */
|
/* Keep the count of the vertices that where added to the factors in this grow iteration. */
|
||||||
if (max > data->prev_mask[vd.index]) {
|
if (max > data->prev_mask[vd.index]) {
|
||||||
@@ -442,12 +441,11 @@ static void pose_brush_init_task_cb_ex(void *__restrict userdata,
|
|||||||
SculptVertexNeighborIter ni;
|
SculptVertexNeighborIter ni;
|
||||||
float avg = 0.0f;
|
float avg = 0.0f;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
sculpt_vertex_neighbors_iter_begin(ss, vd.index, ni)
|
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vd.index, ni) {
|
||||||
{
|
|
||||||
avg += data->pose_factor[ni.index];
|
avg += data->pose_factor[ni.index];
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
sculpt_vertex_neighbors_iter_end(ni);
|
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
|
||||||
|
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
data->pose_factor[vd.index] = avg / total;
|
data->pose_factor[vd.index] = avg / total;
|
||||||
|
Reference in New Issue
Block a user