Cleanup: use count or num instead of nbr
Follow conventions from T85728.
This commit is contained in:
parent
c594cfbe50
commit
4d46fac65d
|
@ -73,7 +73,7 @@ void BLF_thumb_preview(const char *filepath,
|
|||
for (int i = 0; i < draw_str_lines; i++) {
|
||||
const char *draw_str_i18n = i18n_draw_str[i] != NULL ? i18n_draw_str[i] : draw_str[i];
|
||||
const size_t draw_str_i18n_len = strlen(draw_str_i18n);
|
||||
int draw_str_i18n_nbr = 0;
|
||||
int draw_str_i18_count = 0;
|
||||
|
||||
CLAMP_MIN(font_size_curr, font_size_min);
|
||||
if (!blf_font_size(font, (float)font_size_curr, dpi)) {
|
||||
|
@ -91,8 +91,8 @@ void BLF_thumb_preview(const char *filepath,
|
|||
* since many fonts will then show nothing but ugly 'missing char' in their preview).
|
||||
* Does not handle all cases, but much better than nothing.
|
||||
*/
|
||||
if (blf_font_count_missing_chars(font, draw_str_i18n, draw_str_i18n_len, &draw_str_i18n_nbr) >
|
||||
(draw_str_i18n_nbr / 2)) {
|
||||
if (blf_font_count_missing_chars(font, draw_str_i18n, draw_str_i18n_len, &draw_str_i18_count) >
|
||||
(draw_str_i18_count / 2)) {
|
||||
blf_font_draw_buffer(font, draw_str[i], strlen(draw_str[i]), NULL);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -225,7 +225,7 @@ bool BKE_scene_remove_render_view(struct Scene *scene, struct SceneRenderView *s
|
|||
/* Render profile. */
|
||||
|
||||
int get_render_subsurf_level(const struct RenderData *r, int lvl, bool for_render);
|
||||
int get_render_child_particle_number(const struct RenderData *r, int num, bool for_render);
|
||||
int get_render_child_particle_number(const struct RenderData *r, int child_num, bool for_render);
|
||||
|
||||
bool BKE_scene_use_shading_nodes_custom(struct Scene *scene);
|
||||
bool BKE_scene_use_spherical_stereo(struct Scene *scene);
|
||||
|
|
|
@ -1022,16 +1022,16 @@ void BKE_appdir_app_templates(ListBase *templates)
|
|||
continue;
|
||||
}
|
||||
|
||||
struct direntry *dir;
|
||||
uint totfile = BLI_filelist_dir_contents(subdir, &dir);
|
||||
for (int f = 0; f < totfile; f++) {
|
||||
if (!FILENAME_IS_CURRPAR(dir[f].relname) && S_ISDIR(dir[f].type)) {
|
||||
char *template = BLI_strdup(dir[f].relname);
|
||||
struct direntry *dirs;
|
||||
const uint dir_num = BLI_filelist_dir_contents(subdir, &dirs);
|
||||
for (int f = 0; f < dir_num; f++) {
|
||||
if (!FILENAME_IS_CURRPAR(dirs[f].relname) && S_ISDIR(dirs[f].type)) {
|
||||
char *template = BLI_strdup(dirs[f].relname);
|
||||
BLI_addtail(templates, BLI_genericNodeN(template));
|
||||
}
|
||||
}
|
||||
|
||||
BLI_filelist_free(dir, totfile);
|
||||
BLI_filelist_free(dirs, dir_num);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3113,14 +3113,15 @@ bool BKE_image_get_tile_info(char *filepath, ListBase *tiles, int *tile_start, i
|
|||
int max_udim = 0;
|
||||
int id;
|
||||
|
||||
struct direntry *dir;
|
||||
uint totfile = BLI_filelist_dir_contents(dirname, &dir);
|
||||
for (int i = 0; i < totfile; i++) {
|
||||
if (!(dir[i].type & S_IFREG)) {
|
||||
struct direntry *dirs;
|
||||
const uint dirs_num = BLI_filelist_dir_contents(dirname, &dirs);
|
||||
for (int i = 0; i < dirs_num; i++) {
|
||||
if (!(dirs[i].type & S_IFREG)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!BKE_image_get_tile_number_from_filepath(dir[i].relname, udim_pattern, tile_format, &id)) {
|
||||
if (!BKE_image_get_tile_number_from_filepath(
|
||||
dirs[i].relname, udim_pattern, tile_format, &id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3133,7 +3134,7 @@ bool BKE_image_get_tile_info(char *filepath, ListBase *tiles, int *tile_start, i
|
|||
min_udim = min_ii(min_udim, id);
|
||||
max_udim = max_ii(max_udim, id);
|
||||
}
|
||||
BLI_filelist_free(dir, totfile);
|
||||
BLI_filelist_free(dirs, dirs_num);
|
||||
MEM_SAFE_FREE(udim_pattern);
|
||||
|
||||
if (is_udim && min_udim <= IMA_UDIM_MAX) {
|
||||
|
@ -3350,15 +3351,15 @@ bool BKE_image_tile_filepath_exists(const char *filepath)
|
|||
char *udim_pattern = BKE_image_get_tile_strformat(filepath, &tile_format);
|
||||
|
||||
bool found = false;
|
||||
struct direntry *dir;
|
||||
uint totfile = BLI_filelist_dir_contents(dirname, &dir);
|
||||
for (int i = 0; i < totfile; i++) {
|
||||
if (!(dir[i].type & S_IFREG)) {
|
||||
struct direntry *dirs;
|
||||
const uint dirs_num = BLI_filelist_dir_contents(dirname, &dirs);
|
||||
for (int i = 0; i < dirs_num; i++) {
|
||||
if (!(dirs[i].type & S_IFREG)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int id;
|
||||
if (!BKE_image_get_tile_number_from_filepath(dir[i].path, udim_pattern, tile_format, &id)) {
|
||||
if (!BKE_image_get_tile_number_from_filepath(dirs[i].path, udim_pattern, tile_format, &id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3369,7 +3370,7 @@ bool BKE_image_tile_filepath_exists(const char *filepath)
|
|||
found = true;
|
||||
break;
|
||||
}
|
||||
BLI_filelist_free(dir, totfile);
|
||||
BLI_filelist_free(dirs, dirs_num);
|
||||
MEM_SAFE_FREE(udim_pattern);
|
||||
|
||||
return found;
|
||||
|
|
|
@ -561,7 +561,7 @@ void BKE_mesh_origindex_map_create_looptri(MeshElemMap **r_map,
|
|||
typedef bool (*MeshRemap_CheckIslandBoundary)(const struct MPoly *mpoly,
|
||||
const struct MLoop *mloop,
|
||||
const struct MEdge *medge,
|
||||
const int nbr_edge_users,
|
||||
const int edge_user_count,
|
||||
const struct MPoly *mpoly_array,
|
||||
const struct MeshElemMap *edge_poly_map,
|
||||
void *user_data);
|
||||
|
@ -764,14 +764,14 @@ static void poly_edge_loop_islands_calc(const MEdge *medge,
|
|||
static bool poly_is_island_boundary_smooth_cb(const MPoly *mp,
|
||||
const MLoop *UNUSED(ml),
|
||||
const MEdge *me,
|
||||
const int nbr_edge_users,
|
||||
const int edge_user_count,
|
||||
const MPoly *mpoly_array,
|
||||
const MeshElemMap *edge_poly_map,
|
||||
void *UNUSED(user_data))
|
||||
{
|
||||
/* Edge is sharp if one of its polys is flat, or edge itself is sharp,
|
||||
* or edge is not used by exactly two polygons. */
|
||||
if ((mp->flag & ME_SMOOTH) && !(me->flag & ME_SHARP) && (nbr_edge_users == 2)) {
|
||||
if ((mp->flag & ME_SMOOTH) && !(me->flag & ME_SHARP) && (edge_user_count == 2)) {
|
||||
/* In that case, edge appears to be smooth, but we need to check its other poly too. */
|
||||
const MPoly *mp_other = (mp == &mpoly_array[edge_poly_map->indices[0]]) ?
|
||||
&mpoly_array[edge_poly_map->indices[1]] :
|
||||
|
@ -935,7 +935,7 @@ typedef struct MeshCheckIslandBoundaryUv {
|
|||
static bool mesh_check_island_boundary_uv(const MPoly *UNUSED(mp),
|
||||
const MLoop *ml,
|
||||
const MEdge *me,
|
||||
const int UNUSED(nbr_edge_users),
|
||||
const int UNUSED(edge_user_count),
|
||||
const MPoly *UNUSED(mpoly_array),
|
||||
const MeshElemMap *UNUSED(edge_poly_map),
|
||||
void *user_data)
|
||||
|
|
|
@ -613,19 +613,19 @@ void BKE_lnor_space_define(MLoopNorSpace *lnor_space,
|
|||
/* Compute ref alpha, average angle of all available edge vectors to lnor. */
|
||||
if (edge_vectors) {
|
||||
float alpha = 0.0f;
|
||||
int nbr = 0;
|
||||
int count = 0;
|
||||
while (!BLI_stack_is_empty(edge_vectors)) {
|
||||
const float *vec = (const float *)BLI_stack_peek(edge_vectors);
|
||||
alpha += saacosf(dot_v3v3(vec, lnor));
|
||||
BLI_stack_discard(edge_vectors);
|
||||
nbr++;
|
||||
count++;
|
||||
}
|
||||
/* NOTE: In theory, this could be `nbr > 2`,
|
||||
/* NOTE: In theory, this could be `count > 2`,
|
||||
* but there is one case where we only have two edges for two loops:
|
||||
* a smooth vertex with only two edges and two faces (our Monkey's nose has that, e.g.).
|
||||
*/
|
||||
BLI_assert(nbr >= 2); /* This piece of code shall only be called for more than one loop. */
|
||||
lnor_space->ref_alpha = alpha / (float)nbr;
|
||||
BLI_assert(count >= 2); /* This piece of code shall only be called for more than one loop. */
|
||||
lnor_space->ref_alpha = alpha / (float)count;
|
||||
}
|
||||
else {
|
||||
lnor_space->ref_alpha = (saacosf(dot_v3v3(vec_ref, lnor)) +
|
||||
|
@ -1134,7 +1134,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
|
|||
/* We validate clnors data on the fly - cheapest way to do! */
|
||||
int clnors_avg[2] = {0, 0};
|
||||
short(*clnor_ref)[2] = nullptr;
|
||||
int clnors_nbr = 0;
|
||||
int clnors_count = 0;
|
||||
bool clnors_invalid = false;
|
||||
|
||||
/* Temp loop normal stack. */
|
||||
|
@ -1194,7 +1194,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
|
|||
if (clnors_data) {
|
||||
/* Accumulate all clnors, if they are not all equal we have to fix that! */
|
||||
short(*clnor)[2] = &clnors_data[mlfan_vert_index];
|
||||
if (clnors_nbr) {
|
||||
if (clnors_count) {
|
||||
clnors_invalid |= ((*clnor_ref)[0] != (*clnor)[0] || (*clnor_ref)[1] != (*clnor)[1]);
|
||||
}
|
||||
else {
|
||||
|
@ -1202,7 +1202,7 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
|
|||
}
|
||||
clnors_avg[0] += (*clnor)[0];
|
||||
clnors_avg[1] += (*clnor)[1];
|
||||
clnors_nbr++;
|
||||
clnors_count++;
|
||||
/* We store here a pointer to all custom lnors processed. */
|
||||
BLI_SMALLSTACK_PUSH(clnors, (short *)*clnor);
|
||||
}
|
||||
|
@ -1262,8 +1262,8 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
|
|||
if (clnors_invalid) {
|
||||
short *clnor;
|
||||
|
||||
clnors_avg[0] /= clnors_nbr;
|
||||
clnors_avg[1] /= clnors_nbr;
|
||||
clnors_avg[0] /= clnors_count;
|
||||
clnors_avg[1] /= clnors_count;
|
||||
/* Fix/update all clnors of this fan with computed average value. */
|
||||
if (G.debug & G_DEBUG) {
|
||||
printf("Invalid clnors in this fan!\n");
|
||||
|
@ -1952,7 +1952,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
BLI_BITMAP_DISABLE(done_loops, i);
|
||||
}
|
||||
else {
|
||||
int nbr_nors = 0;
|
||||
int avg_nor_count = 0;
|
||||
float avg_nor[3];
|
||||
short clnor_data_tmp[2], *clnor_data;
|
||||
|
||||
|
@ -1962,7 +1962,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
const int nidx = use_vertices ? (int)mloops[lidx].v : lidx;
|
||||
float *nor = r_custom_loopnors[nidx];
|
||||
|
||||
nbr_nors++;
|
||||
avg_nor_count++;
|
||||
add_v3_v3(avg_nor, nor);
|
||||
BLI_SMALLSTACK_PUSH(clnors_data, (short *)r_clnors_data[lidx]);
|
||||
|
||||
|
@ -1970,7 +1970,7 @@ static void mesh_normals_loop_custom_set(const MVert *mverts,
|
|||
BLI_BITMAP_DISABLE(done_loops, lidx);
|
||||
}
|
||||
|
||||
mul_v3_fl(avg_nor, 1.0f / (float)nbr_nors);
|
||||
mul_v3_fl(avg_nor, 1.0f / (float)avg_nor_count);
|
||||
BKE_lnor_space_custom_normal_to_data(lnors_spacearr.lspacearr[i], avg_nor, clnor_data_tmp);
|
||||
|
||||
while ((clnor_data = (short *)BLI_SMALLSTACK_POP(clnors_data))) {
|
||||
|
@ -2088,8 +2088,8 @@ void BKE_mesh_normals_loop_to_vertex(const int numVerts,
|
|||
const float (*clnors)[3],
|
||||
float (*r_vert_clnors)[3])
|
||||
{
|
||||
int *vert_loops_nbr = (int *)MEM_calloc_arrayN(
|
||||
(size_t)numVerts, sizeof(*vert_loops_nbr), __func__);
|
||||
int *vert_loops_count = (int *)MEM_calloc_arrayN(
|
||||
(size_t)numVerts, sizeof(*vert_loops_count), __func__);
|
||||
|
||||
copy_vn_fl((float *)r_vert_clnors, 3 * numVerts, 0.0f);
|
||||
|
||||
|
@ -2099,14 +2099,14 @@ void BKE_mesh_normals_loop_to_vertex(const int numVerts,
|
|||
const uint v = ml->v;
|
||||
|
||||
add_v3_v3(r_vert_clnors[v], clnors[i]);
|
||||
vert_loops_nbr[v]++;
|
||||
vert_loops_count[v]++;
|
||||
}
|
||||
|
||||
for (i = 0; i < numVerts; i++) {
|
||||
mul_v3_fl(r_vert_clnors[i], 1.0f / (float)vert_loops_nbr[i]);
|
||||
mul_v3_fl(r_vert_clnors[i], 1.0f / (float)vert_loops_count[i]);
|
||||
}
|
||||
|
||||
MEM_freeN(vert_loops_nbr);
|
||||
MEM_freeN(vert_loops_count);
|
||||
}
|
||||
|
||||
#undef LNOR_SPACE_TRIGO_THRESHOLD
|
||||
|
|
|
@ -577,7 +577,8 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
|
|||
else if (mp->loopstart + mp->totloop > totloop) {
|
||||
/* Invalid loop data. */
|
||||
PRINT_ERR(
|
||||
"\tPoly %u uses loops out of range (loopstart: %d, loopend: %d, max nbr of loops: %u)",
|
||||
"\tPoly %u uses loops out of range "
|
||||
"(loopstart: %d, loopend: %d, max number of loops: %u)",
|
||||
sp->index,
|
||||
mp->loopstart,
|
||||
mp->loopstart + mp->totloop - 1,
|
||||
|
|
|
@ -280,20 +280,20 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart)
|
|||
|
||||
int psys_get_child_number(Scene *scene, ParticleSystem *psys, const bool use_render_params)
|
||||
{
|
||||
int nbr;
|
||||
int child_num;
|
||||
|
||||
if (!psys->part->childtype) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (use_render_params) {
|
||||
nbr = psys->part->ren_child_nbr;
|
||||
child_num = psys->part->ren_child_nbr;
|
||||
}
|
||||
else {
|
||||
nbr = psys->part->child_nbr;
|
||||
child_num = psys->part->child_nbr;
|
||||
}
|
||||
|
||||
return get_render_child_particle_number(&scene->r, nbr, use_render_params);
|
||||
return get_render_child_particle_number(&scene->r, child_num, use_render_params);
|
||||
}
|
||||
|
||||
int psys_get_tot_child(Scene *scene, ParticleSystem *psys, const bool use_render_params)
|
||||
|
|
|
@ -2751,17 +2751,17 @@ int get_render_subsurf_level(const RenderData *r, int lvl, bool for_render)
|
|||
return lvl;
|
||||
}
|
||||
|
||||
int get_render_child_particle_number(const RenderData *r, int num, bool for_render)
|
||||
int get_render_child_particle_number(const RenderData *r, int child_num, bool for_render)
|
||||
{
|
||||
if (r->mode & R_SIMPLIFY) {
|
||||
if (for_render) {
|
||||
return (int)(r->simplify_particles_render * num);
|
||||
return (int)(r->simplify_particles_render * child_num);
|
||||
}
|
||||
|
||||
return (int)(r->simplify_particles * num);
|
||||
return (int)(r->simplify_particles * child_num);
|
||||
}
|
||||
|
||||
return num;
|
||||
return child_num;
|
||||
}
|
||||
|
||||
Base *_setlooper_base_step(Scene **sce_iter, ViewLayer *view_layer, Base *base)
|
||||
|
|
|
@ -1166,18 +1166,18 @@ static void studiolight_add_files_from_datafolder(const int folder_id,
|
|||
const char *subfolder,
|
||||
int flag)
|
||||
{
|
||||
struct direntry *dir;
|
||||
struct direntry *dirs;
|
||||
const char *folder = BKE_appdir_folder_id(folder_id, subfolder);
|
||||
if (folder) {
|
||||
uint totfile = BLI_filelist_dir_contents(folder, &dir);
|
||||
const uint dirs_num = BLI_filelist_dir_contents(folder, &dirs);
|
||||
int i;
|
||||
for (i = 0; i < totfile; i++) {
|
||||
if (dir[i].type & S_IFREG) {
|
||||
studiolight_add_file(dir[i].path, flag);
|
||||
for (i = 0; i < dirs_num; i++) {
|
||||
if (dirs[i].type & S_IFREG) {
|
||||
studiolight_add_file(dirs[i].path, flag);
|
||||
}
|
||||
}
|
||||
BLI_filelist_free(dir, totfile);
|
||||
dir = NULL;
|
||||
BLI_filelist_free(dirs, dirs_num);
|
||||
dirs = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
*
|
||||
* \param n: the dimension of the vectors (and hence, of the covariance matrix to compute).
|
||||
* \param cos_vn: the nD points to compute covariance from.
|
||||
* \param nbr_cos_vn: the number of nD coordinates in cos_vn.
|
||||
* \param cos_vn_num: the number of nD coordinates in cos_vn.
|
||||
* \param center: the center (or mean point) of cos_vn. If NULL,
|
||||
* it is assumed cos_vn is already centered.
|
||||
* \param use_sample_correction: whether to apply sample correction
|
||||
|
@ -37,7 +37,7 @@ extern "C" {
|
|||
*/
|
||||
void BLI_covariance_m_vn_ex(int n,
|
||||
const float *cos_vn,
|
||||
int nbr_cos_vn,
|
||||
int cos_vn_num,
|
||||
const float *center,
|
||||
bool use_sample_correction,
|
||||
float *r_covmat);
|
||||
|
@ -45,12 +45,12 @@ void BLI_covariance_m_vn_ex(int n,
|
|||
* \brief Compute the covariance matrix of given set of 3D coordinates.
|
||||
*
|
||||
* \param cos_v3: the 3D points to compute covariance from.
|
||||
* \param nbr_cos_v3: the number of 3D coordinates in cos_v3.
|
||||
* \param cos_v3_num: the number of 3D coordinates in cos_v3.
|
||||
* \return r_covmat the computed covariance matrix.
|
||||
* \return r_center the computed center (mean) of 3D points (may be NULL).
|
||||
*/
|
||||
void BLI_covariance_m3_v3n(const float (*cos_v3)[3],
|
||||
int nbr_cos_v3,
|
||||
int cos_vn_num,
|
||||
bool use_sample_correction,
|
||||
float r_covmat[3][3],
|
||||
float r_center[3]);
|
||||
|
|
|
@ -389,7 +389,7 @@ void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float
|
|||
void mid_v2_v2v2v2(float v[2], const float v1[2], const float v2[2], const float v3[2]);
|
||||
void mid_v3_v3v3v3v3(
|
||||
float v[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3]);
|
||||
void mid_v3_v3_array(float r[3], const float (*vec_arr)[3], unsigned int nbr);
|
||||
void mid_v3_v3_array(float r[3], const float (*vec_arr)[3], unsigned int vec_arr_num);
|
||||
|
||||
/**
|
||||
* Specialized function for calculating normals.
|
||||
|
@ -660,7 +660,10 @@ void minmax_v4v4_v4(float min[4], float max[4], const float vec[4]);
|
|||
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3]);
|
||||
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2]);
|
||||
|
||||
void minmax_v3v3_v3_array(float r_min[3], float r_max[3], const float (*vec_arr)[3], int nbr);
|
||||
void minmax_v3v3_v3_array(float r_min[3],
|
||||
float r_max[3],
|
||||
const float (*vec_arr)[3],
|
||||
int var_arr_num);
|
||||
|
||||
/** ensure \a v1 is \a dist from \a v2 */
|
||||
void dist_ensure_v3_v3fl(float v1[3], const float v2[3], float dist);
|
||||
|
|
|
@ -97,8 +97,8 @@ static int bli_compare(struct direntry *entry1, struct direntry *entry2)
|
|||
}
|
||||
|
||||
struct BuildDirCtx {
|
||||
struct direntry *files; /* array[nrfiles] */
|
||||
int nrfiles;
|
||||
struct direntry *files; /* array[files_num] */
|
||||
int files_num;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -154,7 +154,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
if (newnum) {
|
||||
if (dir_ctx->files) {
|
||||
void *const tmp = MEM_reallocN(dir_ctx->files,
|
||||
(dir_ctx->nrfiles + newnum) * sizeof(struct direntry));
|
||||
(dir_ctx->files_num + newnum) * sizeof(struct direntry));
|
||||
if (tmp) {
|
||||
dir_ctx->files = (struct direntry *)tmp;
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
|
||||
if (dir_ctx->files) {
|
||||
struct dirlink *dlink = (struct dirlink *)dirbase.first;
|
||||
struct direntry *file = &dir_ctx->files[dir_ctx->nrfiles];
|
||||
struct direntry *file = &dir_ctx->files[dir_ctx->files_num];
|
||||
while (dlink) {
|
||||
char fullname[PATH_MAX];
|
||||
memset(file, 0, sizeof(struct direntry));
|
||||
|
@ -186,7 +186,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
* does not support stat on '\\SERVER\foo\..', sigh... */
|
||||
file->type |= S_IFDIR;
|
||||
}
|
||||
dir_ctx->nrfiles++;
|
||||
dir_ctx->files_num++;
|
||||
file++;
|
||||
dlink = dlink->next;
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname)
|
|||
BLI_freelist(&dirbase);
|
||||
if (dir_ctx->files) {
|
||||
qsort(dir_ctx->files,
|
||||
dir_ctx->nrfiles,
|
||||
dir_ctx->files_num,
|
||||
sizeof(struct direntry),
|
||||
(int (*)(const void *, const void *))bli_compare);
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **r_
|
|||
{
|
||||
struct BuildDirCtx dir_ctx;
|
||||
|
||||
dir_ctx.nrfiles = 0;
|
||||
dir_ctx.files_num = 0;
|
||||
dir_ctx.files = NULL;
|
||||
|
||||
bli_builddir(&dir_ctx, dirname);
|
||||
|
@ -233,7 +233,7 @@ unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **r_
|
|||
*r_filelist = MEM_mallocN(sizeof(**r_filelist), __func__);
|
||||
}
|
||||
|
||||
return dir_ctx.nrfiles;
|
||||
return dir_ctx.files_num;
|
||||
}
|
||||
|
||||
void BLI_filelist_entry_size_to_string(const struct stat *st,
|
||||
|
|
|
@ -382,9 +382,9 @@ static bool delete_recursive(const char *dir)
|
|||
{
|
||||
struct direntry *filelist, *fl;
|
||||
bool err = false;
|
||||
uint nbr, i;
|
||||
uint filelist_num, i;
|
||||
|
||||
i = nbr = BLI_filelist_dir_contents(dir, &filelist);
|
||||
i = filelist_num = BLI_filelist_dir_contents(dir, &filelist);
|
||||
fl = filelist;
|
||||
while (i--) {
|
||||
const char *file = BLI_path_basename(fl->path);
|
||||
|
@ -415,7 +415,7 @@ static bool delete_recursive(const char *dir)
|
|||
err = true;
|
||||
}
|
||||
|
||||
BLI_filelist_free(filelist, nbr);
|
||||
BLI_filelist_free(filelist, filelist_num);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ typedef struct CovarianceData {
|
|||
float *r_covmat;
|
||||
float covfac;
|
||||
int n;
|
||||
int nbr_cos_vn;
|
||||
int cos_vn_num;
|
||||
} CovarianceData;
|
||||
|
||||
static void covariance_m_vn_ex_task_cb(void *__restrict userdata,
|
||||
|
@ -33,7 +33,7 @@ static void covariance_m_vn_ex_task_cb(void *__restrict userdata,
|
|||
const float *center = data->center;
|
||||
float *r_covmat = data->r_covmat;
|
||||
const int n = data->n;
|
||||
const int nbr_cos_vn = data->nbr_cos_vn;
|
||||
const int cos_vn_num = data->cos_vn_num;
|
||||
|
||||
int k;
|
||||
|
||||
|
@ -55,12 +55,12 @@ static void covariance_m_vn_ex_task_cb(void *__restrict userdata,
|
|||
}
|
||||
|
||||
if (center) {
|
||||
for (k = 0; k < nbr_cos_vn; k++) {
|
||||
for (k = 0; k < cos_vn_num; k++) {
|
||||
r_covmat[a] += (cos_vn[k * n + i] - center[i]) * (cos_vn[k * n + j] - center[j]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (k = 0; k < nbr_cos_vn; k++) {
|
||||
for (k = 0; k < cos_vn_num; k++) {
|
||||
r_covmat[a] += cos_vn[k * n + i] * cos_vn[k * n + j];
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ static void covariance_m_vn_ex_task_cb(void *__restrict userdata,
|
|||
|
||||
void BLI_covariance_m_vn_ex(const int n,
|
||||
const float *cos_vn,
|
||||
const int nbr_cos_vn,
|
||||
const int cos_vn_num,
|
||||
const float *center,
|
||||
const bool use_sample_correction,
|
||||
float *r_covmat)
|
||||
|
@ -81,7 +81,7 @@ void BLI_covariance_m_vn_ex(const int n,
|
|||
/* Note about that division: see https://en.wikipedia.org/wiki/Bessel%27s_correction.
|
||||
* In a nutshell, it must be 1 / (n - 1) for 'sample data', and 1 / n for 'population data'...
|
||||
*/
|
||||
const float covfac = 1.0f / (float)(use_sample_correction ? nbr_cos_vn - 1 : nbr_cos_vn);
|
||||
const float covfac = 1.0f / (float)(use_sample_correction ? cos_vn_num - 1 : cos_vn_num);
|
||||
|
||||
memset(r_covmat, 0, sizeof(*r_covmat) * (size_t)(n * n));
|
||||
|
||||
|
@ -91,27 +91,27 @@ void BLI_covariance_m_vn_ex(const int n,
|
|||
.r_covmat = r_covmat,
|
||||
.covfac = covfac,
|
||||
.n = n,
|
||||
.nbr_cos_vn = nbr_cos_vn,
|
||||
.cos_vn_num = cos_vn_num,
|
||||
};
|
||||
|
||||
TaskParallelSettings settings;
|
||||
BLI_parallel_range_settings_defaults(&settings);
|
||||
settings.use_threading = ((nbr_cos_vn * n * n) >= 10000);
|
||||
settings.use_threading = ((cos_vn_num * n * n) >= 10000);
|
||||
BLI_task_parallel_range(0, n * n, &data, covariance_m_vn_ex_task_cb, &settings);
|
||||
}
|
||||
|
||||
void BLI_covariance_m3_v3n(const float (*cos_v3)[3],
|
||||
const int nbr_cos_v3,
|
||||
const int cos_v3_num,
|
||||
const bool use_sample_correction,
|
||||
float r_covmat[3][3],
|
||||
float r_center[3])
|
||||
{
|
||||
float center[3];
|
||||
const float mean_fac = 1.0f / (float)nbr_cos_v3;
|
||||
const float mean_fac = 1.0f / (float)cos_v3_num;
|
||||
int i;
|
||||
|
||||
zero_v3(center);
|
||||
for (i = 0; i < nbr_cos_v3; i++) {
|
||||
for (i = 0; i < cos_v3_num; i++) {
|
||||
/* Applying mean_fac here rather than once at the end reduce compute errors... */
|
||||
madd_v3_v3fl(center, cos_v3[i], mean_fac);
|
||||
}
|
||||
|
@ -121,5 +121,5 @@ void BLI_covariance_m3_v3n(const float (*cos_v3)[3],
|
|||
}
|
||||
|
||||
BLI_covariance_m_vn_ex(
|
||||
3, (const float *)cos_v3, nbr_cos_v3, center, use_sample_correction, (float *)r_covmat);
|
||||
3, (const float *)cos_v3, cos_v3_num, center, use_sample_correction, (float *)r_covmat);
|
||||
}
|
||||
|
|
|
@ -268,12 +268,12 @@ void mid_v3_v3v3v3v3(
|
|||
v[2] = (v1[2] + v2[2] + v3[2] + v4[2]) / 4.0f;
|
||||
}
|
||||
|
||||
void mid_v3_v3_array(float r[3], const float (*vec_arr)[3], const uint nbr)
|
||||
void mid_v3_v3_array(float r[3], const float (*vec_arr)[3], const uint vec_arr_num)
|
||||
{
|
||||
const float factor = 1.0f / (float)nbr;
|
||||
const float factor = 1.0f / (float)vec_arr_num;
|
||||
zero_v3(r);
|
||||
|
||||
for (uint i = 0; i < nbr; i++) {
|
||||
for (uint i = 0; i < vec_arr_num; i++) {
|
||||
madd_v3_v3fl(r, vec_arr[i], factor);
|
||||
}
|
||||
}
|
||||
|
@ -904,9 +904,12 @@ void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
|
|||
}
|
||||
}
|
||||
|
||||
void minmax_v3v3_v3_array(float r_min[3], float r_max[3], const float (*vec_arr)[3], int nbr)
|
||||
void minmax_v3v3_v3_array(float r_min[3],
|
||||
float r_max[3],
|
||||
const float (*vec_arr)[3],
|
||||
int var_arr_num)
|
||||
{
|
||||
while (nbr--) {
|
||||
while (var_arr_num--) {
|
||||
minmax_v3v3_v3(r_min, r_max, *vec_arr++);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,17 +177,17 @@ TEST(ghash, TextMurmur2a)
|
|||
|
||||
/* Int: uniform 100M first integers. */
|
||||
|
||||
static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr)
|
||||
static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int count)
|
||||
{
|
||||
printf("\n========== STARTING %s ==========\n", id);
|
||||
|
||||
{
|
||||
unsigned int i = nbr;
|
||||
unsigned int i = count;
|
||||
|
||||
TIMEIT_START(int_insert);
|
||||
|
||||
#ifdef GHASH_RESERVE
|
||||
BLI_ghash_reserve(ghash, nbr);
|
||||
BLI_ghash_reserve(ghash, count);
|
||||
#endif
|
||||
|
||||
while (i--) {
|
||||
|
@ -200,7 +200,7 @@ static void int_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr
|
|||
PRINTF_GHASH_STATS(ghash);
|
||||
|
||||
{
|
||||
unsigned int i = nbr;
|
||||
unsigned int i = count;
|
||||
|
||||
TIMEIT_START(int_lookup);
|
||||
|
||||
|
@ -266,17 +266,17 @@ TEST(ghash, IntMurmur2a100000000)
|
|||
|
||||
/* Int: random 50M integers. */
|
||||
|
||||
static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr)
|
||||
static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int count)
|
||||
{
|
||||
printf("\n========== STARTING %s ==========\n", id);
|
||||
|
||||
unsigned int *data = (unsigned int *)MEM_mallocN(sizeof(*data) * (size_t)nbr, __func__);
|
||||
unsigned int *data = (unsigned int *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__);
|
||||
unsigned int *dt;
|
||||
unsigned int i;
|
||||
|
||||
{
|
||||
RNG *rng = BLI_rng_new(1);
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
for (i = count, dt = data; i--; dt++) {
|
||||
*dt = BLI_rng_get_uint(rng);
|
||||
}
|
||||
BLI_rng_free(rng);
|
||||
|
@ -286,10 +286,10 @@ static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int
|
|||
TIMEIT_START(int_insert);
|
||||
|
||||
#ifdef GHASH_RESERVE
|
||||
BLI_ghash_reserve(ghash, nbr);
|
||||
BLI_ghash_reserve(ghash, count);
|
||||
#endif
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
for (i = count, dt = data; i--; dt++) {
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(*dt), POINTER_FROM_UINT(*dt));
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ static void randint_ghash_tests(GHash *ghash, const char *id, const unsigned int
|
|||
{
|
||||
TIMEIT_START(int_lookup);
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
for (i = count, dt = data; i--; dt++) {
|
||||
void *v = BLI_ghash_lookup(ghash, POINTER_FROM_UINT(*dt));
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), *dt);
|
||||
}
|
||||
|
@ -375,18 +375,18 @@ TEST(ghash, Int4NoHash50000000)
|
|||
|
||||
/* Int_v4: 20M of randomly-generated integer vectors. */
|
||||
|
||||
static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr)
|
||||
static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int count)
|
||||
{
|
||||
printf("\n========== STARTING %s ==========\n", id);
|
||||
|
||||
void *data_v = MEM_mallocN(sizeof(unsigned int[4]) * (size_t)nbr, __func__);
|
||||
void *data_v = MEM_mallocN(sizeof(unsigned int[4]) * (size_t)count, __func__);
|
||||
unsigned int(*data)[4] = (unsigned int(*)[4])data_v;
|
||||
unsigned int(*dt)[4];
|
||||
unsigned int i, j;
|
||||
|
||||
{
|
||||
RNG *rng = BLI_rng_new(1);
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
for (i = count, dt = data; i--; dt++) {
|
||||
for (j = 4; j--;) {
|
||||
(*dt)[j] = BLI_rng_get_uint(rng);
|
||||
}
|
||||
|
@ -398,10 +398,10 @@ static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int nb
|
|||
TIMEIT_START(int_v4_insert);
|
||||
|
||||
#ifdef GHASH_RESERVE
|
||||
BLI_ghash_reserve(ghash, nbr);
|
||||
BLI_ghash_reserve(ghash, count);
|
||||
#endif
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
for (i = count, dt = data; i--; dt++) {
|
||||
BLI_ghash_insert(ghash, *dt, POINTER_FROM_UINT(i));
|
||||
}
|
||||
|
||||
|
@ -413,7 +413,7 @@ static void int4_ghash_tests(GHash *ghash, const char *id, const unsigned int nb
|
|||
{
|
||||
TIMEIT_START(int_v4_lookup);
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
for (i = count, dt = data; i--; dt++) {
|
||||
void *v = BLI_ghash_lookup(ghash, (void *)(*dt));
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), i);
|
||||
}
|
||||
|
@ -483,25 +483,25 @@ TEST(ghash, Int2NoHash50000000)
|
|||
/* MultiSmall: create and manipulate a lot of very small ghash's
|
||||
* (90% < 10 items, 9% < 100 items, 1% < 1000 items). */
|
||||
|
||||
static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned int nbr)
|
||||
static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned int count)
|
||||
{
|
||||
unsigned int *data = (unsigned int *)MEM_mallocN(sizeof(*data) * (size_t)nbr, __func__);
|
||||
unsigned int *data = (unsigned int *)MEM_mallocN(sizeof(*data) * (size_t)count, __func__);
|
||||
unsigned int *dt;
|
||||
unsigned int i;
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
for (i = count, dt = data; i--; dt++) {
|
||||
*dt = BLI_rng_get_uint(rng);
|
||||
}
|
||||
|
||||
#ifdef GHASH_RESERVE
|
||||
BLI_ghash_reserve(ghash, nbr);
|
||||
BLI_ghash_reserve(ghash, count);
|
||||
#endif
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
for (i = count, dt = data; i--; dt++) {
|
||||
BLI_ghash_insert(ghash, POINTER_FROM_UINT(*dt), POINTER_FROM_UINT(*dt));
|
||||
}
|
||||
|
||||
for (i = nbr, dt = data; i--; dt++) {
|
||||
for (i = count, dt = data; i--; dt++) {
|
||||
void *v = BLI_ghash_lookup(ghash, POINTER_FROM_UINT(*dt));
|
||||
EXPECT_EQ(POINTER_AS_UINT(v), *dt);
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ static void multi_small_ghash_tests_one(GHash *ghash, RNG *rng, const unsigned i
|
|||
MEM_freeN(data);
|
||||
}
|
||||
|
||||
static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned int nbr)
|
||||
static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned int count)
|
||||
{
|
||||
printf("\n========== STARTING %s ==========\n", id);
|
||||
|
||||
|
@ -518,22 +518,22 @@ static void multi_small_ghash_tests(GHash *ghash, const char *id, const unsigned
|
|||
|
||||
TIMEIT_START(multi_small_ghash);
|
||||
|
||||
unsigned int i = nbr;
|
||||
unsigned int i = count;
|
||||
while (i--) {
|
||||
const int nbr = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) *
|
||||
(!(i % 100) ? 100 : (!(i % 10) ? 10 : 1));
|
||||
multi_small_ghash_tests_one(ghash, rng, nbr);
|
||||
const int count = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) *
|
||||
(!(i % 100) ? 100 : (!(i % 10) ? 10 : 1));
|
||||
multi_small_ghash_tests_one(ghash, rng, count);
|
||||
}
|
||||
|
||||
TIMEIT_END(multi_small_ghash);
|
||||
|
||||
TIMEIT_START(multi_small2_ghash);
|
||||
|
||||
unsigned int i = nbr;
|
||||
unsigned int i = count;
|
||||
while (i--) {
|
||||
const int nbr = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) / 2 *
|
||||
(!(i % 100) ? 100 : (!(i % 10) ? 10 : 1));
|
||||
multi_small_ghash_tests_one(ghash, rng, nbr);
|
||||
const int count = 1 + (BLI_rng_get_int(rng) % TESTCASE_SIZE_SMALL) / 2 *
|
||||
(!(i % 100) ? 100 : (!(i % 10) ? 10 : 1));
|
||||
multi_small_ghash_tests_one(ghash, rng, count);
|
||||
}
|
||||
|
||||
TIMEIT_END(multi_small2_ghash);
|
||||
|
|
|
@ -135,17 +135,17 @@ static void task_listbase_test_do(ListBase *list,
|
|||
NUM_RUN_AVERAGED);
|
||||
}
|
||||
|
||||
static void task_listbase_test(const char *id, const int nbr, const bool use_threads)
|
||||
static void task_listbase_test(const char *id, const int count, const bool use_threads)
|
||||
{
|
||||
printf("\n========== STARTING %s ==========\n", id);
|
||||
|
||||
ListBase list = {nullptr, nullptr};
|
||||
LinkData *items_buffer = (LinkData *)MEM_calloc_arrayN(nbr, sizeof(*items_buffer), __func__);
|
||||
LinkData *items_buffer = (LinkData *)MEM_calloc_arrayN(count, sizeof(*items_buffer), __func__);
|
||||
|
||||
BLI_threadapi_init();
|
||||
|
||||
int num_items = 0;
|
||||
for (int i = 0; i < nbr; i++) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
BLI_addtail(&list, &items_buffer[i]);
|
||||
num_items++;
|
||||
}
|
||||
|
|
|
@ -580,7 +580,7 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
/* We validate clnors data on the fly - cheapest way to do! */
|
||||
int clnors_avg[2] = {0, 0};
|
||||
const short(*clnor_ref)[2] = NULL;
|
||||
int clnors_nbr = 0;
|
||||
int clnors_count = 0;
|
||||
bool clnors_invalid = false;
|
||||
|
||||
const float *co_pivot = vcos ? vcos[BM_elem_index_get(v_pivot)] : v_pivot->co;
|
||||
|
@ -649,7 +649,7 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
const short(*clnor)[2] = clnors_data ? &clnors_data[lfan_pivot_index] :
|
||||
(const void *)BM_ELEM_CD_GET_VOID_P(
|
||||
lfan_pivot, cd_loop_clnors_offset);
|
||||
if (clnors_nbr) {
|
||||
if (clnors_count) {
|
||||
clnors_invalid |= ((*clnor_ref)[0] != (*clnor)[0] || (*clnor_ref)[1] != (*clnor)[1]);
|
||||
}
|
||||
else {
|
||||
|
@ -657,7 +657,7 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
}
|
||||
clnors_avg[0] += (*clnor)[0];
|
||||
clnors_avg[1] += (*clnor)[1];
|
||||
clnors_nbr++;
|
||||
clnors_count++;
|
||||
/* We store here a pointer to all custom lnors processed. */
|
||||
BLI_SMALLSTACK_PUSH(clnors, (short *)*clnor);
|
||||
}
|
||||
|
@ -706,8 +706,8 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
if (clnors_invalid) {
|
||||
short *clnor;
|
||||
|
||||
clnors_avg[0] /= clnors_nbr;
|
||||
clnors_avg[1] /= clnors_nbr;
|
||||
clnors_avg[0] /= clnors_count;
|
||||
clnors_avg[1] /= clnors_count;
|
||||
/* Fix/update all clnors of this fan with computed average value. */
|
||||
|
||||
/* Prints continuously when merge custom normals, so commenting. */
|
||||
|
@ -1517,7 +1517,7 @@ static void bm_mesh_loops_assign_normal_data(BMesh *bm,
|
|||
BLI_BITMAP_ENABLE(done_loops, i);
|
||||
}
|
||||
else {
|
||||
int nbr_nors = 0;
|
||||
int avg_nor_count = 0;
|
||||
float avg_nor[3];
|
||||
short clnor_data_tmp[2], *clnor_data;
|
||||
|
||||
|
@ -1530,7 +1530,7 @@ static void bm_mesh_loops_assign_normal_data(BMesh *bm,
|
|||
short *clnor = r_clnors_data ? &r_clnors_data[lidx] :
|
||||
BM_ELEM_CD_GET_VOID_P(ml, cd_loop_clnors_offset);
|
||||
|
||||
nbr_nors++;
|
||||
avg_nor_count++;
|
||||
add_v3_v3(avg_nor, nor);
|
||||
BLI_SMALLSTACK_PUSH(clnors_data, clnor);
|
||||
|
||||
|
@ -1538,7 +1538,7 @@ static void bm_mesh_loops_assign_normal_data(BMesh *bm,
|
|||
BLI_BITMAP_ENABLE(done_loops, lidx);
|
||||
}
|
||||
|
||||
mul_v3_fl(avg_nor, 1.0f / (float)nbr_nors);
|
||||
mul_v3_fl(avg_nor, 1.0f / (float)avg_nor_count);
|
||||
BKE_lnor_space_custom_normal_to_data(
|
||||
lnors_spacearr->lspacearr[i], avg_nor, clnor_data_tmp);
|
||||
|
||||
|
|
|
@ -468,8 +468,8 @@ void DebugInfo::delete_operation_exports()
|
|||
const std::string dir = get_operations_export_dir();
|
||||
if (BLI_exists(dir.c_str())) {
|
||||
struct direntry *file_list;
|
||||
int num_files = BLI_filelist_dir_contents(dir.c_str(), &file_list);
|
||||
for (int i = 0; i < num_files; i++) {
|
||||
int file_list_num = BLI_filelist_dir_contents(dir.c_str(), &file_list);
|
||||
for (int i = 0; i < file_list_num; i++) {
|
||||
direntry *file = &file_list[i];
|
||||
const eFileAttributes file_attrs = BLI_file_attributes(file->path);
|
||||
if (file_attrs & FILE_ATTR_ANY_LINK) {
|
||||
|
@ -480,7 +480,7 @@ void DebugInfo::delete_operation_exports()
|
|||
BLI_delete(file->path, false, false);
|
||||
}
|
||||
}
|
||||
BLI_filelist_free(file_list, num_files);
|
||||
BLI_filelist_free(file_list, file_list_num);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ static void eevee_shadow_cascade_setup(EEVEE_LightsInfo *linfo,
|
|||
EEVEE_ShadowCascade *csm_data = linfo->shadow_cascade_data + (int)shdw_data->type_data_id;
|
||||
EEVEE_ShadowCascadeRender *csm_render = linfo->shadow_cascade_render +
|
||||
(int)shdw_data->type_data_id;
|
||||
int cascade_nbr = csm_render->cascade_count;
|
||||
int cascade_count = csm_render->cascade_count;
|
||||
float cascade_fade = csm_render->cascade_fade;
|
||||
float cascade_max_dist = csm_render->cascade_max_dist;
|
||||
float cascade_exponent = csm_render->cascade_exponent;
|
||||
|
@ -223,19 +223,19 @@ static void eevee_shadow_cascade_setup(EEVEE_LightsInfo *linfo,
|
|||
float p[4] = {1.0f, 1.0f, csm_end, 1.0f};
|
||||
/* TODO: we don't need full m4 multiply here */
|
||||
mul_m4_v4(vp_projmat, p);
|
||||
splits_end_ndc[cascade_nbr - 1] = p[2];
|
||||
splits_end_ndc[cascade_count - 1] = p[2];
|
||||
if (is_persp) {
|
||||
splits_end_ndc[cascade_nbr - 1] /= p[3];
|
||||
splits_end_ndc[cascade_count - 1] /= p[3];
|
||||
}
|
||||
}
|
||||
|
||||
csm_data->split_start[0] = csm_start;
|
||||
csm_data->split_end[cascade_nbr - 1] = csm_end;
|
||||
csm_data->split_end[cascade_count - 1] = csm_end;
|
||||
|
||||
for (int c = 1; c < cascade_nbr; c++) {
|
||||
for (int c = 1; c < cascade_count; c++) {
|
||||
/* View Space */
|
||||
float linear_split = interpf(csm_end, csm_start, c / (float)cascade_nbr);
|
||||
float exp_split = csm_start * powf(csm_end / csm_start, c / (float)cascade_nbr);
|
||||
float linear_split = interpf(csm_end, csm_start, c / (float)cascade_count);
|
||||
float exp_split = csm_start * powf(csm_end / csm_start, c / (float)cascade_count);
|
||||
|
||||
if (is_persp) {
|
||||
csm_data->split_start[c] = interpf(exp_split, linear_split, cascade_exponent);
|
||||
|
@ -276,13 +276,13 @@ static void eevee_shadow_cascade_setup(EEVEE_LightsInfo *linfo,
|
|||
}
|
||||
|
||||
/* Set last cascade split fade distance into the first split_start. */
|
||||
float prev_split = (cascade_nbr > 1) ? csm_data->split_end[cascade_nbr - 2] :
|
||||
csm_data->split_start[0];
|
||||
float prev_split = (cascade_count > 1) ? csm_data->split_end[cascade_count - 2] :
|
||||
csm_data->split_start[0];
|
||||
csm_data->split_start[0] = interpf(
|
||||
prev_split, csm_data->split_end[cascade_nbr - 1], cascade_fade);
|
||||
prev_split, csm_data->split_end[cascade_count - 1], cascade_fade);
|
||||
|
||||
/* For each cascade */
|
||||
for (int c = 0; c < cascade_nbr; c++) {
|
||||
for (int c = 0; c < cascade_count; c++) {
|
||||
float(*projmat)[4] = csm_render->projmat[c];
|
||||
/* Given 8 frustum corners */
|
||||
float corners[8][3] = {
|
||||
|
|
|
@ -494,15 +494,15 @@ struct AssetLibraryIndex {
|
|||
return;
|
||||
}
|
||||
struct direntry *dir_entries = nullptr;
|
||||
int num_entries = BLI_filelist_dir_contents(index_path, &dir_entries);
|
||||
for (int i = 0; i < num_entries; i++) {
|
||||
const int dir_entries_num = BLI_filelist_dir_contents(index_path, &dir_entries);
|
||||
for (int i = 0; i < dir_entries_num; i++) {
|
||||
struct direntry *entry = &dir_entries[i];
|
||||
if (BLI_str_endswith(entry->relname, ".index.json")) {
|
||||
unused_file_indices.add_as(std::string(entry->path));
|
||||
}
|
||||
}
|
||||
|
||||
BLI_filelist_free(dir_entries, num_entries);
|
||||
BLI_filelist_free(dir_entries, dir_entries_num);
|
||||
}
|
||||
|
||||
void mark_as_used(const std::string &filename)
|
||||
|
|
|
@ -207,7 +207,7 @@ typedef struct tGpTimingData {
|
|||
int seed;
|
||||
|
||||
/* Data set from points, used to compute final timing FCurve */
|
||||
int num_points, cur_point;
|
||||
int points_num, cur_point;
|
||||
|
||||
/* Distances */
|
||||
float *dists;
|
||||
|
@ -229,29 +229,29 @@ typedef struct tGpTimingData {
|
|||
/* Init point buffers for timing data.
|
||||
* Note this assumes we only grow those arrays!
|
||||
*/
|
||||
static void gpencil_timing_data_set_nbr(tGpTimingData *gtd, const int nbr)
|
||||
static void gpencil_timing_data_set_num(tGpTimingData *gtd, const int num)
|
||||
{
|
||||
float *tmp;
|
||||
|
||||
BLI_assert(nbr > gtd->num_points);
|
||||
BLI_assert(num > gtd->points_num);
|
||||
|
||||
/* distances */
|
||||
tmp = gtd->dists;
|
||||
gtd->dists = MEM_callocN(sizeof(float) * nbr, __func__);
|
||||
gtd->dists = MEM_callocN(sizeof(float) * num, __func__);
|
||||
if (tmp) {
|
||||
memcpy(gtd->dists, tmp, sizeof(float) * gtd->num_points);
|
||||
memcpy(gtd->dists, tmp, sizeof(float) * gtd->points_num);
|
||||
MEM_freeN(tmp);
|
||||
}
|
||||
|
||||
/* times */
|
||||
tmp = gtd->times;
|
||||
gtd->times = MEM_callocN(sizeof(float) * nbr, __func__);
|
||||
gtd->times = MEM_callocN(sizeof(float) * num, __func__);
|
||||
if (tmp) {
|
||||
memcpy(gtd->times, tmp, sizeof(float) * gtd->num_points);
|
||||
memcpy(gtd->times, tmp, sizeof(float) * gtd->points_num);
|
||||
MEM_freeN(tmp);
|
||||
}
|
||||
|
||||
gtd->num_points = nbr;
|
||||
gtd->points_num = num;
|
||||
}
|
||||
|
||||
/* add stroke point to timing buffers */
|
||||
|
@ -297,15 +297,15 @@ static void gpencil_timing_data_add_point(tGpTimingData *gtd,
|
|||
static int gpencil_find_end_of_stroke_idx(tGpTimingData *gtd,
|
||||
RNG *rng,
|
||||
const int idx,
|
||||
const int nbr_gaps,
|
||||
int *nbr_done_gaps,
|
||||
const int gaps_count,
|
||||
int *gaps_done_count,
|
||||
const float tot_gaps_time,
|
||||
const float delta_time,
|
||||
float *next_delta_time)
|
||||
{
|
||||
int j;
|
||||
|
||||
for (j = idx + 1; j < gtd->num_points; j++) {
|
||||
for (j = idx + 1; j < gtd->points_num; j++) {
|
||||
if (gtd->times[j] < 0) {
|
||||
gtd->times[j] = -gtd->times[j];
|
||||
if (gtd->mode == GP_STROKECONVERT_TIMING_CUSTOMGAP) {
|
||||
|
@ -316,7 +316,7 @@ static int gpencil_find_end_of_stroke_idx(tGpTimingData *gtd,
|
|||
/* We want gaps that are in gtd->gap_duration +/- gtd->gap_randomness range,
|
||||
* and which sum to exactly tot_gaps_time...
|
||||
*/
|
||||
int rem_gaps = nbr_gaps - (*nbr_done_gaps);
|
||||
int rem_gaps = gaps_count - (*gaps_done_count);
|
||||
if (rem_gaps < 2) {
|
||||
/* Last gap, just give remaining time! */
|
||||
*next_delta_time = tot_gaps_time;
|
||||
|
@ -327,7 +327,7 @@ static int gpencil_find_end_of_stroke_idx(tGpTimingData *gtd,
|
|||
/* This code ensures that if the first gaps
|
||||
* have been shorter than average gap_duration, next gaps
|
||||
* will tend to be longer (i.e. try to recover the lateness), and vice-versa! */
|
||||
delta = delta_time - (gtd->gap_duration * (*nbr_done_gaps));
|
||||
delta = delta_time - (gtd->gap_duration * (*gaps_done_count));
|
||||
|
||||
/* Clamp min between [-gap_randomness, 0.0], with lower delta giving higher min */
|
||||
min = -gtd->gap_randomness - delta;
|
||||
|
@ -343,7 +343,7 @@ static int gpencil_find_end_of_stroke_idx(tGpTimingData *gtd,
|
|||
*next_delta_time += gtd->gap_duration;
|
||||
}
|
||||
}
|
||||
(*nbr_done_gaps)++;
|
||||
(*gaps_done_count)++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -353,14 +353,14 @@ static int gpencil_find_end_of_stroke_idx(tGpTimingData *gtd,
|
|||
|
||||
static void gpencil_stroke_path_animation_preprocess_gaps(tGpTimingData *gtd,
|
||||
RNG *rng,
|
||||
int *nbr_gaps,
|
||||
int *gaps_count,
|
||||
float *r_tot_gaps_time)
|
||||
{
|
||||
float delta_time = 0.0f;
|
||||
|
||||
for (int i = 0; i < gtd->num_points; i++) {
|
||||
for (int i = 0; i < gtd->points_num; i++) {
|
||||
if (gtd->times[i] < 0 && i) {
|
||||
(*nbr_gaps)++;
|
||||
(*gaps_count)++;
|
||||
gtd->times[i] = -gtd->times[i] - delta_time;
|
||||
delta_time += gtd->times[i] - gtd->times[i - 1];
|
||||
gtd->times[i] = -gtd->times[i - 1]; /* Temp marker, values *have* to be different! */
|
||||
|
@ -371,7 +371,7 @@ static void gpencil_stroke_path_animation_preprocess_gaps(tGpTimingData *gtd,
|
|||
}
|
||||
gtd->tot_time -= delta_time;
|
||||
|
||||
*r_tot_gaps_time = (float)(*nbr_gaps) * gtd->gap_duration;
|
||||
*r_tot_gaps_time = (float)(*gaps_count) * gtd->gap_duration;
|
||||
gtd->tot_time += *r_tot_gaps_time;
|
||||
if (gtd->gap_randomness > 0.0f) {
|
||||
BLI_rng_srandom(rng, gtd->seed);
|
||||
|
@ -387,7 +387,7 @@ static void gpencil_stroke_path_animation_add_keyframes(ReportList *reports,
|
|||
tGpTimingData *gtd,
|
||||
RNG *rng,
|
||||
const float time_range,
|
||||
const int nbr_gaps,
|
||||
const int gaps_count,
|
||||
const float tot_gaps_time)
|
||||
{
|
||||
/* Use actual recorded timing! */
|
||||
|
@ -399,20 +399,20 @@ static void gpencil_stroke_path_animation_add_keyframes(ReportList *reports,
|
|||
|
||||
/* CustomGaps specific */
|
||||
float delta_time = 0.0f, next_delta_time = 0.0f;
|
||||
int nbr_done_gaps = 0;
|
||||
int gaps_done_count = 0;
|
||||
|
||||
/* This is a bit tricky, as:
|
||||
* - We can't add arbitrarily close points on FCurve (in time).
|
||||
* - We *must* have all "caps" points of all strokes in FCurve, as much as possible!
|
||||
*/
|
||||
for (int i = 0; i < gtd->num_points; i++) {
|
||||
for (int i = 0; i < gtd->points_num; i++) {
|
||||
/* If new stroke... */
|
||||
if (i > end_stroke_idx) {
|
||||
start_stroke_idx = i;
|
||||
delta_time = next_delta_time;
|
||||
/* find end of that new stroke */
|
||||
end_stroke_idx = gpencil_find_end_of_stroke_idx(
|
||||
gtd, rng, i, nbr_gaps, &nbr_done_gaps, tot_gaps_time, delta_time, &next_delta_time);
|
||||
gtd, rng, i, gaps_count, &gaps_done_count, tot_gaps_time, delta_time, &next_delta_time);
|
||||
/* This one should *never* be negative! */
|
||||
end_stroke_time = time_start +
|
||||
((gtd->times[end_stroke_idx] + delta_time) / gtd->tot_time * time_range);
|
||||
|
@ -502,7 +502,7 @@ static void gpencil_stroke_path_animation(bContext *C,
|
|||
FCurve *fcu;
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop = NULL;
|
||||
int nbr_gaps = 0;
|
||||
int gaps_count = 0;
|
||||
|
||||
if (gtd->mode == GP_STROKECONVERT_TIMING_NONE) {
|
||||
return;
|
||||
|
@ -571,7 +571,7 @@ static void gpencil_stroke_path_animation(bContext *C,
|
|||
|
||||
/* Pre-process gaps, in case we don't want to keep their original timing */
|
||||
if (gtd->mode == GP_STROKECONVERT_TIMING_CUSTOMGAP) {
|
||||
gpencil_stroke_path_animation_preprocess_gaps(gtd, rng, &nbr_gaps, &tot_gaps_time);
|
||||
gpencil_stroke_path_animation_preprocess_gaps(gtd, rng, &gaps_count, &tot_gaps_time);
|
||||
}
|
||||
|
||||
if (gtd->realtime) {
|
||||
|
@ -582,7 +582,7 @@ static void gpencil_stroke_path_animation(bContext *C,
|
|||
}
|
||||
|
||||
gpencil_stroke_path_animation_add_keyframes(
|
||||
reports, ptr, prop, depsgraph, fcu, cu, gtd, rng, time_range, nbr_gaps, tot_gaps_time);
|
||||
reports, ptr, prop, depsgraph, fcu, cu, gtd, rng, time_range, gaps_count, tot_gaps_time);
|
||||
|
||||
BLI_rng_free(rng);
|
||||
}
|
||||
|
@ -684,7 +684,7 @@ static void gpencil_stroke_to_path(bContext *C,
|
|||
}
|
||||
|
||||
if (do_gtd) {
|
||||
gpencil_timing_data_set_nbr(gtd, nu->pntsu);
|
||||
gpencil_timing_data_set_num(gtd, nu->pntsu);
|
||||
}
|
||||
|
||||
/* If needed, make the link between both strokes with two zero-radius additional points */
|
||||
|
@ -929,7 +929,7 @@ static void gpencil_stroke_to_bezier(bContext *C,
|
|||
}
|
||||
|
||||
if (do_gtd) {
|
||||
gpencil_timing_data_set_nbr(gtd, nu->pntsu);
|
||||
gpencil_timing_data_set_num(gtd, nu->pntsu);
|
||||
}
|
||||
|
||||
tot = gps->totpoints;
|
||||
|
@ -1536,7 +1536,7 @@ static int gpencil_convert_layer_exec(bContext *C, wmOperator *op)
|
|||
gtd.gap_randomness = RNA_float_get(op->ptr, "gap_randomness");
|
||||
gtd.gap_randomness = min_ff(gtd.gap_randomness, gtd.gap_duration);
|
||||
gtd.seed = RNA_int_get(op->ptr, "seed");
|
||||
gtd.num_points = gtd.cur_point = 0;
|
||||
gtd.points_num = gtd.cur_point = 0;
|
||||
gtd.dists = gtd.times = NULL;
|
||||
gtd.tot_dist = gtd.tot_time = gtd.gap_tot_time = 0.0f;
|
||||
gtd.inittime = 0.0;
|
||||
|
|
|
@ -4238,28 +4238,28 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu
|
|||
|
||||
int totitems = 0;
|
||||
int categories = 0;
|
||||
int nbr_entries_nosepr = 0;
|
||||
int entries_nosepr_count = 0;
|
||||
for (const EnumPropertyItem *item = item_array; item->identifier; item++, totitems++) {
|
||||
if (!item->identifier[0]) {
|
||||
/* inconsistent, but menus with categories do not look good flipped */
|
||||
if (item->name) {
|
||||
block->flag |= UI_BLOCK_NO_FLIP;
|
||||
categories++;
|
||||
nbr_entries_nosepr++;
|
||||
entries_nosepr_count++;
|
||||
}
|
||||
/* We do not want simple separators in nbr_entries_nosepr count */
|
||||
/* We do not want simple separators in `entries_nosepr_count`. */
|
||||
continue;
|
||||
}
|
||||
nbr_entries_nosepr++;
|
||||
entries_nosepr_count++;
|
||||
}
|
||||
|
||||
/* Columns and row estimation. Ignore simple separators here. */
|
||||
int columns = (nbr_entries_nosepr + 20) / 20;
|
||||
int columns = (entries_nosepr_count + 20) / 20;
|
||||
if (columns < 1) {
|
||||
columns = 1;
|
||||
}
|
||||
if (columns > 8) {
|
||||
columns = (nbr_entries_nosepr + 25) / 25;
|
||||
columns = (entries_nosepr_count + 25) / 25;
|
||||
}
|
||||
|
||||
int rows = totitems / columns;
|
||||
|
|
|
@ -546,13 +546,13 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region),
|
|||
|
||||
#undef HISTOGRAM_TOT_GRID_LINES
|
||||
|
||||
static void waveform_draw_one(float *waveform, int nbr, const float col[3])
|
||||
static void waveform_draw_one(float *waveform, int waveform_num, const float col[3])
|
||||
{
|
||||
GPUVertFormat format = {0};
|
||||
const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
|
||||
GPU_vertbuf_data_alloc(vbo, nbr);
|
||||
GPU_vertbuf_data_alloc(vbo, waveform_num);
|
||||
|
||||
GPU_vertbuf_attr_fill(vbo, pos_id, waveform);
|
||||
|
||||
|
|
|
@ -1056,10 +1056,10 @@ void filelist_tag_needs_filtering(FileList *filelist)
|
|||
void filelist_filter(FileList *filelist)
|
||||
{
|
||||
int num_filtered = 0;
|
||||
const int num_files = filelist->filelist.nbr_entries;
|
||||
const int num_files = filelist->filelist.entries_num;
|
||||
FileListInternEntry **filtered_tmp, *file;
|
||||
|
||||
if (ELEM(filelist->filelist.nbr_entries, FILEDIR_NBR_ENTRIES_UNSET, 0)) {
|
||||
if (ELEM(filelist->filelist.entries_num, FILEDIR_NBR_ENTRIES_UNSET, 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1099,8 +1099,8 @@ void filelist_filter(FileList *filelist)
|
|||
memcpy(filelist->filelist_intern.filtered,
|
||||
filtered_tmp,
|
||||
sizeof(*filelist->filelist_intern.filtered) * (size_t)num_filtered);
|
||||
filelist->filelist.nbr_entries_filtered = num_filtered;
|
||||
// printf("Filetered: %d over %d entries\n", num_filtered, filelist->filelist.nbr_entries);
|
||||
filelist->filelist.entries_filtered_num = num_filtered;
|
||||
// printf("Filetered: %d over %d entries\n", num_filtered, filelist->filelist.entries_num);
|
||||
|
||||
filelist_cache_clear(&filelist->filelist_cache, filelist->filelist_cache.size);
|
||||
filelist->flags &= ~FL_NEED_FILTERING;
|
||||
|
@ -1552,8 +1552,8 @@ static void filelist_direntryarr_free(FileDirEntryArr *array)
|
|||
#else
|
||||
BLI_assert(BLI_listbase_is_empty(&array->entries));
|
||||
#endif
|
||||
array->nbr_entries = FILEDIR_NBR_ENTRIES_UNSET;
|
||||
array->nbr_entries_filtered = FILEDIR_NBR_ENTRIES_UNSET;
|
||||
array->entries_num = FILEDIR_NBR_ENTRIES_UNSET;
|
||||
array->entries_filtered_num = FILEDIR_NBR_ENTRIES_UNSET;
|
||||
}
|
||||
|
||||
static void filelist_intern_entry_free(FileListInternEntry *entry)
|
||||
|
@ -1874,7 +1874,7 @@ FileList *filelist_new(short type)
|
|||
filelist_cache_init(&p->filelist_cache, FILELIST_ENTRYCACHESIZE_DEFAULT);
|
||||
|
||||
p->selection_state = BLI_ghash_new(BLI_ghashutil_inthash_p, BLI_ghashutil_intcmp, __func__);
|
||||
p->filelist.nbr_entries = FILEDIR_NBR_ENTRIES_UNSET;
|
||||
p->filelist.entries_num = FILEDIR_NBR_ENTRIES_UNSET;
|
||||
filelist_settype(p, type);
|
||||
|
||||
return p;
|
||||
|
@ -1979,9 +1979,9 @@ static void filelist_clear_main_files(FileList *filelist,
|
|||
|
||||
const int removed_files = filelist_intern_free_main_files(&filelist->filelist_intern);
|
||||
|
||||
filelist->filelist.nbr_entries -= removed_files;
|
||||
filelist->filelist.nbr_entries_filtered = FILEDIR_NBR_ENTRIES_UNSET;
|
||||
BLI_assert(filelist->filelist.nbr_entries > FILEDIR_NBR_ENTRIES_UNSET);
|
||||
filelist->filelist.entries_num -= removed_files;
|
||||
filelist->filelist.entries_filtered_num = FILEDIR_NBR_ENTRIES_UNSET;
|
||||
BLI_assert(filelist->filelist.entries_num > FILEDIR_NBR_ENTRIES_UNSET);
|
||||
|
||||
if (do_selection && filelist->selection_state) {
|
||||
BLI_ghash_clear(filelist->selection_state, NULL, NULL);
|
||||
|
@ -2167,7 +2167,7 @@ int filelist_files_ensure(FileList *filelist)
|
|||
filelist_filter(filelist);
|
||||
}
|
||||
|
||||
return filelist->filelist.nbr_entries_filtered;
|
||||
return filelist->filelist.entries_filtered_num;
|
||||
}
|
||||
|
||||
static FileDirEntry *filelist_file_create_entry(FileList *filelist, const int index)
|
||||
|
@ -2226,7 +2226,7 @@ FileDirEntry *filelist_file_ex(struct FileList *filelist, const int index, const
|
|||
const size_t cache_size = cache->size;
|
||||
int old_index;
|
||||
|
||||
if ((index < 0) || (index >= filelist->filelist.nbr_entries_filtered)) {
|
||||
if ((index < 0) || (index >= filelist->filelist.entries_filtered_num)) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -2274,7 +2274,7 @@ FileDirEntry *filelist_file(struct FileList *filelist, int index)
|
|||
|
||||
int filelist_file_find_path(struct FileList *filelist, const char *filename)
|
||||
{
|
||||
if (filelist->filelist.nbr_entries_filtered == FILEDIR_NBR_ENTRIES_UNSET) {
|
||||
if (filelist->filelist.entries_filtered_num == FILEDIR_NBR_ENTRIES_UNSET) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2282,7 +2282,7 @@ int filelist_file_find_path(struct FileList *filelist, const char *filename)
|
|||
* This is only used to find again renamed entry,
|
||||
* annoying but looks hairy to get rid of it currently. */
|
||||
|
||||
for (int fidx = 0; fidx < filelist->filelist.nbr_entries_filtered; fidx++) {
|
||||
for (int fidx = 0; fidx < filelist->filelist.entries_filtered_num; fidx++) {
|
||||
FileListInternEntry *entry = filelist->filelist_intern.filtered[fidx];
|
||||
if (STREQ(entry->relpath, filename)) {
|
||||
return fidx;
|
||||
|
@ -2294,11 +2294,11 @@ int filelist_file_find_path(struct FileList *filelist, const char *filename)
|
|||
|
||||
int filelist_file_find_id(const FileList *filelist, const ID *id)
|
||||
{
|
||||
if (filelist->filelist.nbr_entries_filtered == FILEDIR_NBR_ENTRIES_UNSET) {
|
||||
if (filelist->filelist.entries_filtered_num == FILEDIR_NBR_ENTRIES_UNSET) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int fidx = 0; fidx < filelist->filelist.nbr_entries_filtered; fidx++) {
|
||||
for (int fidx = 0; fidx < filelist->filelist.entries_filtered_num; fidx++) {
|
||||
FileListInternEntry *entry = filelist->filelist_intern.filtered[fidx];
|
||||
if (entry->local_data.id == id) {
|
||||
return fidx;
|
||||
|
@ -2408,23 +2408,23 @@ bool filelist_file_cache_block(struct FileList *filelist, const int index)
|
|||
FileListEntryCache *cache = &filelist->filelist_cache;
|
||||
const size_t cache_size = cache->size;
|
||||
|
||||
const int nbr_entries = filelist->filelist.nbr_entries_filtered;
|
||||
const int entries_num = filelist->filelist.entries_filtered_num;
|
||||
int start_index = max_ii(0, index - (cache_size / 2));
|
||||
int end_index = min_ii(nbr_entries, index + (cache_size / 2));
|
||||
int end_index = min_ii(entries_num, index + (cache_size / 2));
|
||||
int i;
|
||||
const bool full_refresh = (filelist->flags & FL_IS_READY) == 0;
|
||||
|
||||
if ((index < 0) || (index >= nbr_entries)) {
|
||||
// printf("Wrong index %d ([%d:%d])", index, 0, nbr_entries);
|
||||
if ((index < 0) || (index >= entries_num)) {
|
||||
// printf("Wrong index %d ([%d:%d])", index, 0, entries_num);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Maximize cached range! */
|
||||
if ((end_index - start_index) < cache_size) {
|
||||
if (start_index == 0) {
|
||||
end_index = min_ii(nbr_entries, start_index + cache_size);
|
||||
end_index = min_ii(entries_num, start_index + cache_size);
|
||||
}
|
||||
else if (end_index == nbr_entries) {
|
||||
else if (end_index == entries_num) {
|
||||
start_index = max_ii(0, end_index - cache_size);
|
||||
}
|
||||
}
|
||||
|
@ -2861,7 +2861,7 @@ int ED_file_extension_icon(const char *path)
|
|||
|
||||
int filelist_needs_reading(FileList *filelist)
|
||||
{
|
||||
return (filelist->filelist.nbr_entries == FILEDIR_NBR_ENTRIES_UNSET) ||
|
||||
return (filelist->filelist.entries_num == FILEDIR_NBR_ENTRIES_UNSET) ||
|
||||
filelist_needs_force_reset(filelist);
|
||||
}
|
||||
|
||||
|
@ -2926,8 +2926,8 @@ void filelist_entries_select_index_range_set(
|
|||
FileList *filelist, FileSelection *sel, FileSelType select, uint flag, FileCheckType check)
|
||||
{
|
||||
/* select all valid files between first and last indicated */
|
||||
if ((sel->first >= 0) && (sel->first < filelist->filelist.nbr_entries_filtered) &&
|
||||
(sel->last >= 0) && (sel->last < filelist->filelist.nbr_entries_filtered)) {
|
||||
if ((sel->first >= 0) && (sel->first < filelist->filelist.entries_filtered_num) &&
|
||||
(sel->last >= 0) && (sel->last < filelist->filelist.entries_filtered_num)) {
|
||||
int current_file;
|
||||
for (current_file = sel->first; current_file <= sel->last; current_file++) {
|
||||
filelist_entry_select_index_set(filelist, current_file, select, flag, check);
|
||||
|
@ -2963,7 +2963,7 @@ uint filelist_entry_select_index_get(FileList *filelist, const int index, FileCh
|
|||
|
||||
bool filelist_entry_is_selected(FileList *filelist, const int index)
|
||||
{
|
||||
BLI_assert(index >= 0 && index < filelist->filelist.nbr_entries_filtered);
|
||||
BLI_assert(index >= 0 && index < filelist->filelist.entries_filtered_num);
|
||||
FileListInternEntry *intern_entry = filelist->filelist_intern.filtered[index];
|
||||
|
||||
/* BLI_ghash_lookup returns NULL if not found, which gets mapped to 0, which gets mapped to
|
||||
|
@ -3030,13 +3030,13 @@ static int filelist_readjob_list_dir(const char *root,
|
|||
const bool skip_currpar)
|
||||
{
|
||||
struct direntry *files;
|
||||
int nbr_files, nbr_entries = 0;
|
||||
int entries_num = 0;
|
||||
/* Full path of the item. */
|
||||
char full_path[FILE_MAX];
|
||||
|
||||
nbr_files = BLI_filelist_dir_contents(root, &files);
|
||||
const int files_num = BLI_filelist_dir_contents(root, &files);
|
||||
if (files) {
|
||||
int i = nbr_files;
|
||||
int i = files_num;
|
||||
while (i--) {
|
||||
FileListInternEntry *entry;
|
||||
|
||||
|
@ -3110,11 +3110,11 @@ static int filelist_readjob_list_dir(const char *root,
|
|||
#endif
|
||||
|
||||
BLI_addtail(entries, entry);
|
||||
nbr_entries++;
|
||||
entries_num++;
|
||||
}
|
||||
BLI_filelist_free(files, nbr_files);
|
||||
BLI_filelist_free(files, files_num);
|
||||
}
|
||||
return nbr_entries;
|
||||
return entries_num;
|
||||
}
|
||||
|
||||
typedef enum ListLibOptions {
|
||||
|
@ -3370,13 +3370,13 @@ static void filelist_readjob_main_recursive(Main *bmain, FileList *filelist)
|
|||
if (filelist->dir[0] == 0) {
|
||||
/* make directories */
|
||||
# ifdef WITH_FREESTYLE
|
||||
filelist->filelist.nbr_entries = 27;
|
||||
filelist->filelist.entries_num = 27;
|
||||
# else
|
||||
filelist->filelist.nbr_entries = 26;
|
||||
filelist->filelist.entries_num = 26;
|
||||
# endif
|
||||
filelist_resize(filelist, filelist->filelist.nbr_entries);
|
||||
filelist_resize(filelist, filelist->filelist.entries_num);
|
||||
|
||||
for (a = 0; a < filelist->filelist.nbr_entries; a++) {
|
||||
for (a = 0; a < filelist->filelist.entries_num; a++) {
|
||||
filelist->filelist.entries[a].typeflag |= FILE_TYPE_DIR;
|
||||
}
|
||||
|
||||
|
@ -3419,20 +3419,20 @@ static void filelist_readjob_main_recursive(Main *bmain, FileList *filelist)
|
|||
return;
|
||||
}
|
||||
|
||||
filelist->filelist.nbr_entries = 0;
|
||||
filelist->filelist.entries_num = 0;
|
||||
for (id = lb->first; id; id = id->next) {
|
||||
if (!(filelist->filter_data.flags & FLF_HIDE_DOT) || id->name[2] != '.') {
|
||||
filelist->filelist.nbr_entries++;
|
||||
filelist->filelist.entries_num++;
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX TODO: if data-browse or append/link #FLF_HIDE_PARENT has to be set. */
|
||||
if (!(filelist->filter_data.flags & FLF_HIDE_PARENT)) {
|
||||
filelist->filelist.nbr_entries++;
|
||||
filelist->filelist.entries_num++;
|
||||
}
|
||||
|
||||
if (filelist->filelist.nbr_entries > 0) {
|
||||
filelist_resize(filelist, filelist->filelist.nbr_entries);
|
||||
if (filelist->filelist.entries_num > 0) {
|
||||
filelist_resize(filelist, filelist->filelist.entries_num);
|
||||
}
|
||||
|
||||
files = filelist->filelist.entries;
|
||||
|
@ -3538,11 +3538,11 @@ typedef struct FileListReadJob {
|
|||
|
||||
static void filelist_readjob_append_entries(FileListReadJob *job_params,
|
||||
ListBase *from_entries,
|
||||
int nbr_from_entries,
|
||||
int from_entries_num,
|
||||
short *do_update)
|
||||
{
|
||||
BLI_assert(BLI_listbase_count(from_entries) == nbr_from_entries);
|
||||
if (nbr_from_entries <= 0) {
|
||||
BLI_assert(BLI_listbase_count(from_entries) == from_entries_num);
|
||||
if (from_entries_num <= 0) {
|
||||
*do_update = false;
|
||||
return;
|
||||
}
|
||||
|
@ -3550,7 +3550,7 @@ static void filelist_readjob_append_entries(FileListReadJob *job_params,
|
|||
FileList *filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */
|
||||
BLI_mutex_lock(&job_params->lock);
|
||||
BLI_movelisttolist(&filelist->filelist.entries, from_entries);
|
||||
filelist->filelist.nbr_entries += nbr_from_entries;
|
||||
filelist->filelist.entries_num += from_entries_num;
|
||||
BLI_mutex_unlock(&job_params->lock);
|
||||
|
||||
*do_update = true;
|
||||
|
@ -3606,7 +3606,7 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
|
|||
char filter_glob[FILE_MAXFILE];
|
||||
const char *root = filelist->filelist.root;
|
||||
const int max_recursion = filelist->max_recursion;
|
||||
int nbr_done_dirs = 0, nbr_todo_dirs = 1;
|
||||
int dirs_done_count = 0, dirs_todo_count = 1;
|
||||
|
||||
todo_dirs = BLI_stack_new(sizeof(*td_dir), __func__);
|
||||
td_dir = BLI_stack_push_r(todo_dirs);
|
||||
|
@ -3626,7 +3626,7 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
|
|||
|
||||
while (!BLI_stack_is_empty(todo_dirs) && !(*stop)) {
|
||||
FileListInternEntry *entry;
|
||||
int nbr_entries = 0;
|
||||
int entries_num = 0;
|
||||
|
||||
char *subdir;
|
||||
char rel_subdir[FILE_MAX_LIBEXTRA];
|
||||
|
@ -3666,15 +3666,15 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
|
|||
if (filelist->asset_library_ref) {
|
||||
list_lib_options |= LIST_LIB_ASSETS_ONLY;
|
||||
}
|
||||
nbr_entries = filelist_readjob_list_lib(
|
||||
entries_num = filelist_readjob_list_lib(
|
||||
subdir, &entries, list_lib_options, &indexer_runtime);
|
||||
if (nbr_entries > 0) {
|
||||
if (entries_num > 0) {
|
||||
is_lib = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_lib) {
|
||||
nbr_entries = filelist_readjob_list_dir(
|
||||
entries_num = filelist_readjob_list_dir(
|
||||
subdir, &entries, filter_glob, do_lib, job_params->main_name, skip_currpar);
|
||||
}
|
||||
|
||||
|
@ -3698,14 +3698,14 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
|
|||
td_dir = BLI_stack_push_r(todo_dirs);
|
||||
td_dir->level = recursion_level + 1;
|
||||
td_dir->dir = BLI_strdup(dir);
|
||||
nbr_todo_dirs++;
|
||||
dirs_todo_count++;
|
||||
}
|
||||
}
|
||||
|
||||
filelist_readjob_append_entries(job_params, &entries, nbr_entries, do_update);
|
||||
filelist_readjob_append_entries(job_params, &entries, entries_num, do_update);
|
||||
|
||||
nbr_done_dirs++;
|
||||
*progress = (float)nbr_done_dirs / (float)nbr_todo_dirs;
|
||||
dirs_done_count++;
|
||||
*progress = (float)dirs_done_count / (float)dirs_todo_count;
|
||||
MEM_freeN(subdir);
|
||||
}
|
||||
|
||||
|
@ -3738,10 +3738,10 @@ static void filelist_readjob_do(const bool do_lib,
|
|||
|
||||
// BLI_assert(filelist->filtered == NULL);
|
||||
BLI_assert(BLI_listbase_is_empty(&filelist->filelist.entries) &&
|
||||
(filelist->filelist.nbr_entries == FILEDIR_NBR_ENTRIES_UNSET));
|
||||
(filelist->filelist.entries_num == FILEDIR_NBR_ENTRIES_UNSET));
|
||||
|
||||
/* A valid, but empty directory from now. */
|
||||
filelist->filelist.nbr_entries = 0;
|
||||
filelist->filelist.entries_num = 0;
|
||||
|
||||
filelist_readjob_recursive_dir_add_items(do_lib, job_params, stop, do_update, progress);
|
||||
}
|
||||
|
@ -3812,7 +3812,7 @@ static void filelist_readjob_main_assets_add_items(FileListReadJob *job_params,
|
|||
FileListInternEntry *entry;
|
||||
ListBase tmp_entries = {0};
|
||||
ID *id_iter;
|
||||
int nbr_entries = 0;
|
||||
int entries_num = 0;
|
||||
|
||||
/* Make sure no IDs are added/removed/reallocated in the main thread while this is running in
|
||||
* parallel. */
|
||||
|
@ -3835,19 +3835,19 @@ static void filelist_readjob_main_assets_add_items(FileListReadJob *job_params,
|
|||
entry->local_data.preview_image = BKE_asset_metadata_preview_get_from_id(id_iter->asset_data,
|
||||
id_iter);
|
||||
entry->local_data.id = id_iter;
|
||||
nbr_entries++;
|
||||
entries_num++;
|
||||
BLI_addtail(&tmp_entries, entry);
|
||||
}
|
||||
FOREACH_MAIN_ID_END;
|
||||
|
||||
BKE_main_unlock(job_params->current_main);
|
||||
|
||||
if (nbr_entries) {
|
||||
if (entries_num) {
|
||||
*do_update = true;
|
||||
|
||||
BLI_movelisttolist(&filelist->filelist.entries, &tmp_entries);
|
||||
filelist->filelist.nbr_entries += nbr_entries;
|
||||
filelist->filelist.nbr_entries_filtered = -1;
|
||||
filelist->filelist.entries_num += entries_num;
|
||||
filelist->filelist.entries_filtered_num = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3872,10 +3872,10 @@ static void filelist_readjob_asset_library(FileListReadJob *job_params,
|
|||
FileList *filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */
|
||||
|
||||
BLI_assert(BLI_listbase_is_empty(&filelist->filelist.entries) &&
|
||||
(filelist->filelist.nbr_entries == FILEDIR_NBR_ENTRIES_UNSET));
|
||||
(filelist->filelist.entries_num == FILEDIR_NBR_ENTRIES_UNSET));
|
||||
|
||||
/* A valid, but empty file-list from now. */
|
||||
filelist->filelist.nbr_entries = 0;
|
||||
filelist->filelist.entries_num = 0;
|
||||
|
||||
/* NOP if already read. */
|
||||
filelist_readjob_load_asset_library_data(job_params, do_update);
|
||||
|
@ -3904,12 +3904,12 @@ static void filelist_readjob_main_assets(FileListReadJob *job_params,
|
|||
{
|
||||
FileList *filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */
|
||||
BLI_assert(BLI_listbase_is_empty(&filelist->filelist.entries) &&
|
||||
(filelist->filelist.nbr_entries == FILEDIR_NBR_ENTRIES_UNSET));
|
||||
(filelist->filelist.entries_num == FILEDIR_NBR_ENTRIES_UNSET));
|
||||
|
||||
filelist_readjob_load_asset_library_data(job_params, do_update);
|
||||
|
||||
/* A valid, but empty file-list from now. */
|
||||
filelist->filelist.nbr_entries = 0;
|
||||
filelist->filelist.entries_num = 0;
|
||||
|
||||
filelist_readjob_main_assets_add_items(job_params, stop, do_update, progress);
|
||||
}
|
||||
|
@ -3932,7 +3932,7 @@ static void filelist_readjob_startjob(void *flrjv, short *stop, short *do_update
|
|||
FileListReadJob *flrj = flrjv;
|
||||
|
||||
// printf("START filelist reading (%d files, main thread: %d)\n",
|
||||
// flrj->filelist->filelist.nbr_entries, BLI_thread_is_main());
|
||||
// flrj->filelist->filelist.entries_num, BLI_thread_is_main());
|
||||
|
||||
BLI_mutex_lock(&flrj->lock);
|
||||
|
||||
|
@ -3941,7 +3941,7 @@ static void filelist_readjob_startjob(void *flrjv, short *stop, short *do_update
|
|||
flrj->tmp_filelist = MEM_dupallocN(flrj->filelist);
|
||||
|
||||
BLI_listbase_clear(&flrj->tmp_filelist->filelist.entries);
|
||||
flrj->tmp_filelist->filelist.nbr_entries = FILEDIR_NBR_ENTRIES_UNSET;
|
||||
flrj->tmp_filelist->filelist.entries_num = FILEDIR_NBR_ENTRIES_UNSET;
|
||||
|
||||
flrj->tmp_filelist->filelist_intern.filtered = NULL;
|
||||
BLI_listbase_clear(&flrj->tmp_filelist->filelist_intern.entries);
|
||||
|
@ -3973,18 +3973,18 @@ static void filelist_readjob_update(void *flrjv)
|
|||
FileListReadJob *flrj = flrjv;
|
||||
FileListIntern *fl_intern = &flrj->filelist->filelist_intern;
|
||||
ListBase new_entries = {NULL};
|
||||
int nbr_entries, new_nbr_entries = 0;
|
||||
int entries_num, new_entries_num = 0;
|
||||
|
||||
BLI_movelisttolist(&new_entries, &fl_intern->entries);
|
||||
nbr_entries = flrj->filelist->filelist.nbr_entries;
|
||||
entries_num = flrj->filelist->filelist.entries_num;
|
||||
|
||||
BLI_mutex_lock(&flrj->lock);
|
||||
|
||||
if (flrj->tmp_filelist->filelist.nbr_entries > 0) {
|
||||
if (flrj->tmp_filelist->filelist.entries_num > 0) {
|
||||
/* We just move everything out of 'thread context' into final list. */
|
||||
new_nbr_entries = flrj->tmp_filelist->filelist.nbr_entries;
|
||||
new_entries_num = flrj->tmp_filelist->filelist.entries_num;
|
||||
BLI_movelisttolist(&new_entries, &flrj->tmp_filelist->filelist.entries);
|
||||
flrj->tmp_filelist->filelist.nbr_entries = 0;
|
||||
flrj->tmp_filelist->filelist.entries_num = 0;
|
||||
}
|
||||
|
||||
if (flrj->tmp_filelist->asset_library) {
|
||||
|
@ -3998,7 +3998,7 @@ static void filelist_readjob_update(void *flrjv)
|
|||
|
||||
BLI_mutex_unlock(&flrj->lock);
|
||||
|
||||
if (new_nbr_entries) {
|
||||
if (new_entries_num) {
|
||||
/* Do not clear selection cache, we can assume already 'selected' UIDs are still valid! Keep
|
||||
* the asset library data we just read. */
|
||||
filelist_clear_ex(flrj->filelist, false, true, false);
|
||||
|
@ -4006,9 +4006,9 @@ static void filelist_readjob_update(void *flrjv)
|
|||
flrj->filelist->flags |= (FL_NEED_SORTING | FL_NEED_FILTERING);
|
||||
}
|
||||
|
||||
/* if no new_nbr_entries, this is NOP */
|
||||
/* if no new_entries_num, this is NOP */
|
||||
BLI_movelisttolist(&fl_intern->entries, &new_entries);
|
||||
flrj->filelist->filelist.nbr_entries = MAX2(nbr_entries, 0) + new_nbr_entries;
|
||||
flrj->filelist->filelist.entries_num = MAX2(entries_num, 0) + new_entries_num;
|
||||
}
|
||||
|
||||
static void filelist_readjob_endjob(void *flrjv)
|
||||
|
@ -4026,11 +4026,11 @@ static void filelist_readjob_free(void *flrjv)
|
|||
{
|
||||
FileListReadJob *flrj = flrjv;
|
||||
|
||||
// printf("END filelist reading (%d files)\n", flrj->filelist->filelist.nbr_entries);
|
||||
// printf("END filelist reading (%d files)\n", flrj->filelist->filelist.entries_num);
|
||||
|
||||
if (flrj->tmp_filelist) {
|
||||
/* tmp_filelist shall never ever be filtered! */
|
||||
BLI_assert(flrj->tmp_filelist->filelist.nbr_entries == 0);
|
||||
BLI_assert(flrj->tmp_filelist->filelist.entries_num == 0);
|
||||
BLI_assert(BLI_listbase_is_empty(&flrj->tmp_filelist->filelist.entries));
|
||||
|
||||
filelist_freelib(flrj->tmp_filelist);
|
||||
|
|
|
@ -968,13 +968,13 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
|
|||
/* Check gvfs shares. */
|
||||
const char *const xdg_runtime_dir = BLI_getenv("XDG_RUNTIME_DIR");
|
||||
if (xdg_runtime_dir != NULL) {
|
||||
struct direntry *dir;
|
||||
struct direntry *dirs;
|
||||
char name[FILE_MAX];
|
||||
BLI_join_dirfile(name, sizeof(name), xdg_runtime_dir, "gvfs/");
|
||||
const uint dir_len = BLI_filelist_dir_contents(name, &dir);
|
||||
for (uint i = 0; i < dir_len; i++) {
|
||||
if (dir[i].type & S_IFDIR) {
|
||||
const char *dirname = dir[i].relname;
|
||||
const uint dirs_num = BLI_filelist_dir_contents(name, &dirs);
|
||||
for (uint i = 0; i < dirs_num; i++) {
|
||||
if (dirs[i].type & S_IFDIR) {
|
||||
const char *dirname = dirs[i].relname;
|
||||
if (dirname[0] != '.') {
|
||||
/* Dir names contain a lot of unwanted text.
|
||||
* Assuming every entry ends with the share name */
|
||||
|
@ -992,7 +992,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
|
|||
}
|
||||
}
|
||||
}
|
||||
BLI_filelist_free(dir, dir_len);
|
||||
BLI_filelist_free(dirs, dirs_num);
|
||||
}
|
||||
# endif
|
||||
|
||||
|
|
|
@ -1140,8 +1140,8 @@ typedef struct FileDirEntry {
|
|||
#
|
||||
typedef struct FileDirEntryArr {
|
||||
ListBase entries;
|
||||
int nbr_entries;
|
||||
int nbr_entries_filtered;
|
||||
int entries_num;
|
||||
int entries_filtered_num;
|
||||
|
||||
/** FILE_MAX. */
|
||||
char root[1024];
|
||||
|
|
|
@ -450,18 +450,18 @@ static Frame **collect_hull_frames(
|
|||
{
|
||||
SkinNode *f;
|
||||
Frame **hull_frames;
|
||||
int nbr, i;
|
||||
int hull_frames_num, i;
|
||||
|
||||
(*tothullframe) = emap[v].count;
|
||||
hull_frames = MEM_calloc_arrayN(
|
||||
(*tothullframe), sizeof(Frame *), "hull_from_frames.hull_frames");
|
||||
i = 0;
|
||||
for (nbr = 0; nbr < emap[v].count; nbr++) {
|
||||
const MEdge *e = &medge[emap[v].indices[nbr]];
|
||||
hull_frames_num = 0;
|
||||
for (i = 0; i < emap[v].count; i++) {
|
||||
const MEdge *e = &medge[emap[v].indices[i]];
|
||||
f = &frames[BKE_mesh_edge_other_vert(e, v)];
|
||||
/* Can't have adjacent branch nodes yet */
|
||||
if (f->totframe) {
|
||||
hull_frames[i++] = &f->frames[0];
|
||||
hull_frames[hull_frames_num++] = &f->frames[0];
|
||||
}
|
||||
else {
|
||||
(*tothullframe)--;
|
||||
|
|
|
@ -160,10 +160,11 @@ static DiskCacheFile *seq_disk_cache_add_file_to_list(SeqDiskCache *disk_cache,
|
|||
static void seq_disk_cache_get_files(SeqDiskCache *disk_cache, char *path)
|
||||
{
|
||||
struct direntry *filelist, *fl;
|
||||
uint nbr, i;
|
||||
uint i;
|
||||
disk_cache->size_total = 0;
|
||||
|
||||
i = nbr = BLI_filelist_dir_contents(path, &filelist);
|
||||
const int filelist_num = BLI_filelist_dir_contents(path, &filelist);
|
||||
i = filelist_num;
|
||||
fl = filelist;
|
||||
while (i--) {
|
||||
/* Don't follow links. */
|
||||
|
@ -194,7 +195,7 @@ static void seq_disk_cache_get_files(SeqDiskCache *disk_cache, char *path)
|
|||
}
|
||||
fl++;
|
||||
}
|
||||
BLI_filelist_free(filelist, nbr);
|
||||
BLI_filelist_free(filelist, filelist_num);
|
||||
}
|
||||
|
||||
static DiskCacheFile *seq_disk_cache_get_oldest_file(SeqDiskCache *disk_cache)
|
||||
|
|
Loading…
Reference in New Issue