Cleanup: Rename define
*_LEN follows names elsewhere in Blender more closely than "_N_"
This commit is contained in:
@@ -886,7 +886,7 @@ void BKE_curveprofile_create_samples(CurveProfile *profile,
|
||||
*/
|
||||
static void curveprofile_make_table(CurveProfile *profile)
|
||||
{
|
||||
int n_samples = PROF_N_TABLE(profile->path_len);
|
||||
int n_samples = PROF_TABLE_LEN(profile->path_len);
|
||||
CurveProfilePoint *new_table = MEM_callocN(sizeof(CurveProfilePoint) * (n_samples + 1),
|
||||
"high-res table");
|
||||
|
||||
@@ -1059,7 +1059,7 @@ void BKE_curveprofile_initialize(CurveProfile *profile, short segments_len)
|
||||
*/
|
||||
static float curveprofile_distance_to_next_table_point(const CurveProfile *profile, int i)
|
||||
{
|
||||
BLI_assert(i < PROF_N_TABLE(profile->path_len));
|
||||
BLI_assert(i < PROF_TABLE_LEN(profile->path_len));
|
||||
|
||||
return len_v2v2(&profile->table[i].x, &profile->table[i + 1].x);
|
||||
}
|
||||
@@ -1072,7 +1072,7 @@ static float curveprofile_distance_to_next_table_point(const CurveProfile *profi
|
||||
float BKE_curveprofile_total_length(const CurveProfile *profile)
|
||||
{
|
||||
float total_length = 0;
|
||||
for (int i = 0; i < PROF_N_TABLE(profile->path_len) - 1; i++) {
|
||||
for (int i = 0; i < PROF_TABLE_LEN(profile->path_len) - 1; i++) {
|
||||
total_length += len_v2v2(&profile->table[i].x, &profile->table[i + 1].x);
|
||||
}
|
||||
return total_length;
|
||||
@@ -1160,7 +1160,7 @@ void BKE_curveprofile_evaluate_length_portion(const CurveProfile *profile,
|
||||
float length_travelled = 0.0f;
|
||||
while (length_travelled < requested_length) {
|
||||
/* Check if we reached the last point before the final one. */
|
||||
if (i == PROF_N_TABLE(profile->path_len) - 2) {
|
||||
if (i == PROF_TABLE_LEN(profile->path_len) - 2) {
|
||||
break;
|
||||
}
|
||||
float new_length = curveprofile_distance_to_next_table_point(profile, i);
|
||||
|
||||
@@ -2256,12 +2256,12 @@ void ui_draw_but_CURVEPROFILE(ARegion *region,
|
||||
/* Also add the last points on the right and bottom edges to close off the fill polygon. */
|
||||
bool add_left_tri = profile->view_rect.xmin < 0.0f;
|
||||
bool add_bottom_tri = profile->view_rect.ymin < 0.0f;
|
||||
uint tot_points = (uint)PROF_N_TABLE(profile->path_len) + 1 + add_left_tri + add_bottom_tri;
|
||||
uint tot_points = (uint)PROF_TABLE_LEN(profile->path_len) + 1 + add_left_tri + add_bottom_tri;
|
||||
uint tot_triangles = tot_points - 2;
|
||||
|
||||
/* Create array of the positions of the table's points. */
|
||||
float(*table_coords)[2] = MEM_mallocN(sizeof(*table_coords) * tot_points, "table x coords");
|
||||
for (i = 0; i < (uint)PROF_N_TABLE(profile->path_len);
|
||||
for (i = 0; i < (uint)PROF_TABLE_LEN(profile->path_len);
|
||||
i++) { /* Only add the points from the table here. */
|
||||
table_coords[i][0] = pts[i].x;
|
||||
table_coords[i][1] = pts[i].y;
|
||||
|
||||
@@ -7126,7 +7126,7 @@ static int ui_do_but_CURVEPROFILE(
|
||||
dist_min_sq = square_f(U.dpi_fac * 8.0f); /* 8 pixel radius from each table point. */
|
||||
|
||||
/* Loop through the path's high resolution table and find what's near the click. */
|
||||
for (int i = 1; i <= PROF_N_TABLE(profile->path_len); i++) {
|
||||
for (int i = 1; i <= PROF_TABLE_LEN(profile->path_len); i++) {
|
||||
copy_v2_v2(f_xy_prev, f_xy);
|
||||
BLI_rctf_transform_pt_v(&but->rect, &profile->view_rect, f_xy, &table[i].x);
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
/** Number of table points per control point. */
|
||||
#define PROF_RESOL 16
|
||||
/** Dynamic size of widget's high resolution table. Input should be profile->totpoint. */
|
||||
#define PROF_N_TABLE(n_pts) min_ii(PROF_TABLE_MAX, (((n_pts - 1)) * PROF_RESOL) + 1)
|
||||
#define PROF_TABLE_LEN(n_pts) min_ii(PROF_TABLE_MAX, (((n_pts - 1)) * PROF_RESOL) + 1)
|
||||
|
||||
/**
|
||||
* Each control point that makes up the profile.
|
||||
|
||||
Reference in New Issue
Block a user