From 7d040d2a088ec425550da4242650f1ff75680e0d Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 16 Nov 2014 13:57:58 +0100 Subject: Cleanup: use BLI_listbase_*** prefix for count,sort,sort_r --- source/blender/blenfont/intern/blf_dir.c | 2 +- source/blender/blenkernel/intern/DerivedMesh.c | 2 +- source/blender/blenkernel/intern/action.c | 2 +- source/blender/blenkernel/intern/armature.c | 4 ++-- source/blender/blenkernel/intern/boids.c | 2 +- source/blender/blenkernel/intern/context.c | 2 +- source/blender/blenkernel/intern/deform.c | 4 ++-- source/blender/blenkernel/intern/freestyle.c | 2 +- source/blender/blenkernel/intern/ipo.c | 2 +- source/blender/blenkernel/intern/key.c | 4 ++-- source/blender/blenkernel/intern/mask.c | 6 ++--- source/blender/blenkernel/intern/mask_rasterize.c | 6 ++--- source/blender/blenkernel/intern/nla.c | 2 +- source/blender/blenkernel/intern/node.c | 4 ++-- source/blender/blenkernel/intern/object.c | 8 +++---- source/blender/blenkernel/intern/object_deform.c | 4 ++-- source/blender/blenkernel/intern/object_dupli.c | 2 +- source/blender/blenkernel/intern/paint.c | 4 ++-- source/blender/blenkernel/intern/particle.c | 6 ++--- source/blender/blenkernel/intern/rigidbody.c | 4 ++-- source/blender/blenkernel/intern/scene.c | 2 +- source/blender/blenkernel/intern/sequencer.c | 2 +- source/blender/blenkernel/intern/softbody.c | 2 +- source/blender/blenkernel/intern/tracking.c | 18 +++++++-------- source/blender/blenkernel/intern/tracking_solver.c | 2 +- source/blender/blenlib/BLI_listbase.h | 6 ++--- source/blender/blenlib/intern/listbase.c | 6 ++--- source/blender/blenlib/intern/scanfill.c | 2 +- source/blender/blenlib/intern/scanfill_utils.c | 2 +- source/blender/blenloader/intern/versioning_270.c | 2 +- .../blender/blenloader/intern/versioning_legacy.c | 2 +- source/blender/bmesh/intern/bmesh_log.c | 2 +- source/blender/bmesh/intern/bmesh_mesh_conv.c | 2 +- source/blender/bmesh/operators/bmo_connect_pair.c | 2 +- source/blender/bmesh/tools/bmesh_region_match.c | 6 ++--- source/blender/collada/ArmatureExporter.cpp | 2 +- source/blender/collada/ControllerExporter.cpp | 2 +- source/blender/editors/animation/keyingsets.c | 8 +++---- source/blender/editors/armature/armature_edit.c | 2 +- .../blender/editors/armature/armature_skinning.c | 2 +- .../editors/armature/editarmature_retarget.c | 12 +++++----- .../blender/editors/armature/editarmature_sketch.c | 2 +- source/blender/editors/armature/pose_edit.c | 4 ++-- source/blender/editors/armature/pose_group.c | 2 +- source/blender/editors/armature/pose_lib.c | 4 ++-- source/blender/editors/armature/pose_select.c | 2 +- source/blender/editors/armature/reeb.c | 26 +++++++++++----------- source/blender/editors/curve/editcurve_add.c | 2 +- source/blender/editors/curve/editfont.c | 2 +- .../blender/editors/interface/interface_layout.c | 4 ++-- source/blender/editors/mesh/editmesh_knife.c | 14 ++++++------ source/blender/editors/object/object_bake.c | 2 +- source/blender/editors/object/object_constraint.c | 2 +- source/blender/editors/object/object_vgroup.c | 20 ++++++++--------- source/blender/editors/render/render_shading.c | 2 +- source/blender/editors/screen/screen_ops.c | 6 ++--- source/blender/editors/sculpt_paint/paint_vertex.c | 6 ++--- .../editors/space_buttons/buttons_texture.c | 6 ++--- source/blender/editors/space_console/console_ops.c | 4 ++-- source/blender/editors/space_image/image_buttons.c | 8 +++---- source/blender/editors/space_image/image_ops.c | 2 +- source/blender/editors/space_logic/logic_window.c | 8 +++---- source/blender/editors/space_nla/nla_edit.c | 2 +- source/blender/editors/space_node/node_draw.c | 2 +- source/blender/editors/space_node/node_edit.c | 2 +- .../editors/space_node/node_relationships.c | 4 ++-- source/blender/editors/space_node/node_templates.c | 2 +- source/blender/editors/space_node/space_node.c | 2 +- .../blender/editors/space_outliner/outliner_edit.c | 4 ++-- source/blender/editors/space_text/text_draw.c | 6 ++--- source/blender/editors/space_view3d/drawobject.c | 2 +- source/blender/editors/space_view3d/view3d_draw.c | 2 +- .../editors/transform/transform_conversions.c | 4 ++-- .../editors/transform/transform_orientations.c | 2 +- source/blender/editors/transform/transform_snap.c | 2 +- source/blender/editors/util/ed_transverts.c | 4 ++-- source/blender/makesdna/DNA_key_types.h | 2 +- source/blender/makesrna/intern/rna_action.c | 2 +- source/blender/makesrna/intern/rna_animation.c | 4 ++-- source/blender/makesrna/intern/rna_boid.c | 4 ++-- source/blender/makesrna/intern/rna_dynamicpaint.c | 2 +- source/blender/makesrna/intern/rna_object.c | 6 ++--- source/blender/makesrna/intern/rna_object_force.c | 2 +- source/blender/makesrna/intern/rna_particle.c | 4 ++-- source/blender/makesrna/intern/rna_pose.c | 4 ++-- source/blender/makesrna/intern/rna_rna.c | 2 +- source/blender/makesrna/intern/rna_scene.c | 10 ++++----- source/blender/modifiers/intern/MOD_mask.c | 2 +- .../composite/nodes/node_composite_outputFile.c | 2 +- .../blender/python/bmesh/bmesh_py_types_select.c | 2 +- source/blender/python/intern/bpy_driver.c | 2 +- source/blender/python/intern/gpu.c | 4 ++-- .../blender/render/intern/source/renderdatabase.c | 2 +- source/blender/windowmanager/intern/wm.c | 2 +- .../Converter/BL_BlenderDataConversion.cpp | 2 +- source/gameengine/Converter/BL_SkinDeformer.cpp | 2 +- 96 files changed, 194 insertions(+), 194 deletions(-) (limited to 'source') diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c index 4a36ae03bed..f493aa9af74 100644 --- a/source/blender/blenfont/intern/blf_dir.c +++ b/source/blender/blenfont/intern/blf_dir.c @@ -103,7 +103,7 @@ char **BLF_dir_get(int *ndir) char *path; int i, count; - count = BLI_countlist(&global_font_dir); + count = BLI_listbase_count(&global_font_dir); if (!count) return NULL; diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 6276277be28..affb8550570 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1221,7 +1221,7 @@ static void calc_weightpaint_vert_array(Object *ob, DerivedMesh *dm, int const d unsigned int i; /* variables for multipaint */ - const int defbase_tot = BLI_countlist(&ob->defbase); + const int defbase_tot = BLI_listbase_count(&ob->defbase); const int defbase_act = ob->actdef - 1; int defbase_sel_tot = 0; diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index c6dcca576fb..e753a7f7948 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -966,7 +966,7 @@ bActionGroup *BKE_pose_add_group(bPose *pose, const char *name) BLI_addtail(&pose->agroups, grp); BLI_uniquename(&pose->agroups, grp, name, '.', offsetof(bActionGroup, name), sizeof(grp->name)); - pose->active_group = BLI_countlist(&pose->agroups); + pose->active_group = BLI_listbase_count(&pose->agroups); return grp; } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index afc0ff726ce..d3dcb2b72a0 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -840,7 +840,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float /* bone defmats are already in the channels, chan_mat */ /* initialize B_bone matrices and dual quaternions */ - totchan = BLI_countlist(&armOb->pose->chanbase); + totchan = BLI_listbase_count(&armOb->pose->chanbase); if (use_quaternion) { dualquats = MEM_callocN(sizeof(DualQuat) * totchan, "dualquats"); @@ -866,7 +866,7 @@ void armature_deform_verts(Object *armOb, Object *target, DerivedMesh *dm, float armature_def_nr = defgroup_name_index(target, defgrp_name); if (ELEM(target->type, OB_MESH, OB_LATTICE)) { - defbase_tot = BLI_countlist(&target->defbase); + defbase_tot = BLI_listbase_count(&target->defbase); if (target->type == OB_MESH) { Mesh *me = target->data; diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c index 5731455fc01..4a564614ff3 100644 --- a/source/blender/blenkernel/intern/boids.c +++ b/source/blender/blenkernel/intern/boids.c @@ -995,7 +995,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa) case eBoidRulesetType_Random: { /* use random rule for each particle (allways same for same particle though) */ - rule = BLI_findlink(&state->rules, rand % BLI_countlist(&state->rules)); + rule = BLI_findlink(&state->rules, rand % BLI_listbase_count(&state->rules)); apply_boid_rule(bbd, rule, &val, pa, -1.0); break; diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index de285f87444..4b0adafef4b 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -588,7 +588,7 @@ int ctx_data_list_count(const bContext *C, int (*func)(const bContext *, ListBas ListBase list; if (func(C, &list)) { - int tot = BLI_countlist(&list); + int tot = BLI_listbase_count(&list); BLI_freelistN(&list); return tot; } diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 528ff2d7b19..d3148dbc8e9 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -441,7 +441,7 @@ int defgroup_name_index(Object *ob, const char *name) /* note, must be freed */ int *defgroup_flip_map(Object *ob, int *flip_map_len, const bool use_default) { - int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase); + int defbase_tot = *flip_map_len = BLI_listbase_count(&ob->defbase); if (defbase_tot == 0) { return NULL; @@ -480,7 +480,7 @@ int *defgroup_flip_map(Object *ob, int *flip_map_len, const bool use_default) /* note, must be freed */ int *defgroup_flip_map_single(Object *ob, int *flip_map_len, const bool use_default, int defgroup) { - int defbase_tot = *flip_map_len = BLI_countlist(&ob->defbase); + int defbase_tot = *flip_map_len = BLI_listbase_count(&ob->defbase); if (defbase_tot == 0) { return NULL; diff --git a/source/blender/blenkernel/intern/freestyle.c b/source/blender/blenkernel/intern/freestyle.c index 4aa1b49ea13..cc9ad63d451 100644 --- a/source/blender/blenkernel/intern/freestyle.c +++ b/source/blender/blenkernel/intern/freestyle.c @@ -181,7 +181,7 @@ static FreestyleLineSet *alloc_lineset(void) FreestyleLineSet *BKE_freestyle_lineset_add(FreestyleConfig *config, const char *name) { - int lineset_index = BLI_countlist(&config->linesets); + int lineset_index = BLI_listbase_count(&config->linesets); FreestyleLineSet *lineset = alloc_lineset(); BLI_addtail(&config->linesets, (void *)lineset); diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index 51cf26063c7..34877c7559c 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -1523,7 +1523,7 @@ static void ipo_to_animdata(ID *id, Ipo *ipo, char actname[], char constname[], if (G.debug & G_DEBUG) { printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s seqname:%s curves:%d\n", id->name + 2, ipo->id.name + 2, (actname) ? actname : "", (constname) ? constname : "", (seq) ? (seq->name + 2) : "", - BLI_countlist(&ipo->curve)); + BLI_listbase_count(&ipo->curve)); } /* Convert curves to animato system (separated into separate lists of F-Curves for animation and drivers), diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c index 69b375fba58..28a77b74cdf 100644 --- a/source/blender/blenkernel/intern/key.c +++ b/source/blender/blenkernel/intern/key.c @@ -1086,7 +1086,7 @@ static float *get_weights_array(Object *ob, char *vgroup, WeightsArrayCache *cac if (cache) { if (cache->defgroup_weights == NULL) { - int num_defgroup = BLI_countlist(&ob->defbase); + int num_defgroup = BLI_listbase_count(&ob->defbase); cache->defgroup_weights = MEM_callocN(sizeof(*cache->defgroup_weights) * num_defgroup, "cached defgroup weights"); @@ -1518,7 +1518,7 @@ KeyBlock *BKE_keyblock_add(Key *key, const char *name) BLI_addtail(&key->block, kb); kb->type = KEY_CARDINAL; - tot = BLI_countlist(&key->block); + tot = BLI_listbase_count(&key->block); if (name) { BLI_strncpy(kb->name, name, sizeof(kb->name)); } diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 83ad2f1b2d2..b05634f5fe5 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1457,7 +1457,7 @@ void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const bool d { if (found == 1) { #if 0 - printf("%s: exact %d %d (%d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes), + printf("%s: exact %d %d (%d)\n", __func__, (int)ctime, BLI_listbase_count(&masklay->splines_shapes), masklay_shape_a->frame); #endif @@ -1466,7 +1466,7 @@ void BKE_mask_layer_evaluate(MaskLayer *masklay, const float ctime, const bool d else if (found == 2) { float w = masklay_shape_b->frame - masklay_shape_a->frame; #if 0 - printf("%s: tween %d %d (%d %d)\n", __func__, (int)ctime, BLI_countlist(&masklay->splines_shapes), + printf("%s: tween %d %d (%d %d)\n", __func__, (int)ctime, BLI_listbase_count(&masklay->splines_shapes), masklay_shape_a->frame, masklay_shape_b->frame); #endif BKE_mask_layer_shape_to_mask_interp(masklay, masklay_shape_a, masklay_shape_b, @@ -1833,7 +1833,7 @@ static int mask_layer_shape_sort_cb(const void *masklay_shape_a_ptr, const void void BKE_mask_layer_shape_sort(MaskLayer *masklay) { - BLI_sortlist(&masklay->splines_shapes, mask_layer_shape_sort_cb); + BLI_listbase_sort(&masklay->splines_shapes, mask_layer_shape_sort_cb); } bool BKE_mask_layer_shape_spline_from_index(MaskLayer *masklay, int index, diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 4dc8ed21463..387d093051e 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -572,7 +572,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas unsigned int masklay_index; MemArena *sf_arena; - mr_handle->layers_tot = (unsigned int)BLI_countlist(&mask->masklayers); + mr_handle->layers_tot = (unsigned int)BLI_listbase_count(&mask->masklayers); mr_handle->layers = MEM_mallocN(sizeof(MaskRasterLayer) * mr_handle->layers_tot, "MaskRasterLayer"); BLI_rctf_init_minmax(&mr_handle->bounds); @@ -608,7 +608,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas continue; } - tot_splines = (unsigned int)BLI_countlist(&masklay->splines); + tot_splines = (unsigned int)BLI_listbase_count(&masklay->splines); open_spline_ranges = MEM_callocN(sizeof(*open_spline_ranges) * tot_splines, __func__); BLI_scanfill_begin_arena(&sf_ctx, sf_arena); @@ -956,7 +956,7 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas &isect_remvertbase, &isect_remedgebase))) { - unsigned int sf_vert_tot_isect = (unsigned int)BLI_countlist(&sf_ctx.fillvertbase); + unsigned int sf_vert_tot_isect = (unsigned int)BLI_listbase_count(&sf_ctx.fillvertbase); unsigned int i = sf_vert_tot; face_coords = MEM_reallocN(face_coords, sizeof(float[3]) * (sf_vert_tot + sf_vert_tot_isect)); diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 19e45142960..d89c4877dea 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -268,7 +268,7 @@ NlaTrack *add_nlatrack(AnimData *adt, NlaTrack *prev) /* set settings requiring the track to not be part of the stack yet */ nlt->flag = NLATRACK_SELECTED; - nlt->index = BLI_countlist(&adt->nla_tracks); + nlt->index = BLI_listbase_count(&adt->nla_tracks); /* add track to stack, and make it the active one */ if (prev) diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 3a7bfb03e07..db27e559a4f 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -2559,8 +2559,8 @@ bool BKE_node_clipboard_validate(void) /* lists must be aligned */ - BLI_assert(BLI_countlist(&node_clipboard.nodes) == - BLI_countlist(&node_clipboard.nodes_extra_info)); + BLI_assert(BLI_listbase_count(&node_clipboard.nodes) == + BLI_listbase_count(&node_clipboard.nodes_extra_info)); for (node = node_clipboard.nodes.first, node_info = node_clipboard.nodes_extra_info.first; node; diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index f2400c958fe..95dfc8a3e4b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1078,14 +1078,14 @@ static int lod_cmp(const void *a, const void *b) void BKE_object_lod_sort(Object *ob) { - BLI_sortlist(&ob->lodlevels, lod_cmp); + BLI_listbase_sort(&ob->lodlevels, lod_cmp); } bool BKE_object_lod_remove(Object *ob, int level) { LodLevel *rem; - if (level < 1 || level > BLI_countlist(&ob->lodlevels) - 1) + if (level < 1 || level > BLI_listbase_count(&ob->lodlevels) - 1) return false; rem = BLI_findlink(&ob->lodlevels, level); @@ -1098,7 +1098,7 @@ bool BKE_object_lod_remove(Object *ob, int level) MEM_freeN(rem); /* If there are no user defined lods, remove the base lod as well */ - if (BLI_countlist(&ob->lodlevels) == 1) { + if (BLI_listbase_count(&ob->lodlevels) == 1) { LodLevel *base = ob->lodlevels.first; BLI_remlink(&ob->lodlevels, base); MEM_freeN(base); @@ -3299,7 +3299,7 @@ int BKE_object_insert_ptcache(Object *ob) LinkData *link = NULL; int i = 0; - BLI_sortlist(&ob->pc_ids, pc_cmp); + BLI_listbase_sort(&ob->pc_ids, pc_cmp); for (link = ob->pc_ids.first, i = 0; link; link = link->next, i++) { int index = GET_INT_FROM_POINTER(link->data); diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c index e53bd26b9a2..a3f5e56f4dc 100644 --- a/source/blender/blenkernel/intern/object_deform.c +++ b/source/blender/blenkernel/intern/object_deform.c @@ -50,7 +50,7 @@ bool *BKE_objdef_lock_flags_get(Object *ob, const int defbase_tot) { bool is_locked = false; int i; - //int defbase_tot = BLI_countlist(&ob->defbase); + //int defbase_tot = BLI_listbase_count(&ob->defbase); bool *lock_flags = MEM_mallocN(defbase_tot * sizeof(bool), "defflags"); bDeformGroup *defgroup; @@ -73,7 +73,7 @@ bool *BKE_objdef_validmap_get(Object *ob, const int defbase_tot) bool *vgroup_validmap; GHash *gh; int i, step1 = 1; - //int defbase_tot = BLI_countlist(&ob->defbase); + //int defbase_tot = BLI_listbase_count(&ob->defbase); VirtualModifierData virtualModifierData; if (BLI_listbase_is_empty(&ob->defbase)) { diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c index 0d82c6e89a1..2bee6b76ad6 100644 --- a/source/blender/blenkernel/intern/object_dupli.c +++ b/source/blender/blenkernel/intern/object_dupli.c @@ -1240,7 +1240,7 @@ int count_duplilist(Object *ob) DupliApplyData *duplilist_apply(Object *ob, ListBase *duplilist) { DupliApplyData *apply_data = NULL; - int num_objects = BLI_countlist(duplilist); + int num_objects = BLI_listbase_count(duplilist); if (num_objects > 0) { DupliObject *dob; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index d16575d80c8..312dcd32301 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -316,7 +316,7 @@ void BKE_paint_curve_set(Brush *br, PaintCurve *pc) void BKE_palette_color_remove(Palette *palette, PaletteColor *color) { if (color) { - int numcolors = BLI_countlist(&palette->colors); + int numcolors = BLI_listbase_count(&palette->colors); if ((numcolors == palette->active_color + 1) && (numcolors != 1)) palette->active_color--; @@ -352,7 +352,7 @@ PaletteColor *BKE_palette_color_add(Palette *palette) { PaletteColor *color = MEM_callocN(sizeof(*color), "Pallete Color"); BLI_addtail(&palette->colors, color); - palette->active_color = BLI_countlist(&palette->colors) - 1; + palette->active_color = BLI_listbase_count(&palette->colors) - 1; return color; } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index e1b21794f83..a17d0cae323 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3513,8 +3513,8 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n psys->part = psys_new_settings(DATA_("ParticleSettings"), NULL); - if (BLI_countlist(&ob->particlesystem) > 1) - BLI_snprintf(psys->name, sizeof(psys->name), DATA_("ParticleSystem %i"), BLI_countlist(&ob->particlesystem)); + if (BLI_listbase_count(&ob->particlesystem) > 1) + BLI_snprintf(psys->name, sizeof(psys->name), DATA_("ParticleSystem %i"), BLI_listbase_count(&ob->particlesystem)); else BLI_strncpy(psys->name, DATA_("ParticleSystem"), sizeof(psys->name)); @@ -3523,7 +3523,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n if (name) BLI_strncpy_utf8(md->name, name, sizeof(md->name)); else - BLI_snprintf(md->name, sizeof(md->name), DATA_("ParticleSystem %i"), BLI_countlist(&ob->particlesystem)); + BLI_snprintf(md->name, sizeof(md->name), DATA_("ParticleSystem %i"), BLI_listbase_count(&ob->particlesystem)); modifier_unique_name(&ob->modifiers, md); psmd = (ParticleSystemModifierData *) md; diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 2f6ac6cf162..4b8f60d7446 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1158,7 +1158,7 @@ static void rigidbody_update_ob_array(RigidBodyWorld *rbw) GroupObject *go; int i, n; - n = BLI_countlist(&rbw->group->gobject); + n = BLI_listbase_count(&rbw->group->gobject); if (rbw->numbodies != n) { rbw->numbodies = n; @@ -1499,7 +1499,7 @@ void BKE_rigidbody_rebuild_world(Scene *scene, float ctime) cache = rbw->pointcache; /* flag cache as outdated if we don't have a world or number of objects in the simulation has changed */ - if (rbw->physics_world == NULL || rbw->numbodies != BLI_countlist(&rbw->group->gobject)) { + if (rbw->physics_world == NULL || rbw->numbodies != BLI_listbase_count(&rbw->group->gobject)) { cache->flag |= PTCACHE_OUTDATED; } diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 073de219649..168fa9ad120 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1103,7 +1103,7 @@ bool BKE_scene_validate_setscene(Main *bmain, Scene *sce) int a, totscene; if (sce->set == NULL) return 1; - totscene = BLI_countlist(&bmain->scene); + totscene = BLI_listbase_count(&bmain->scene); for (a = 0, sce_iter = sce; sce_iter->set; sce_iter = sce_iter->set, a++) { /* more iterations than scenes means we have a cycle */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 1d7830ca5ae..9a144ec8e44 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3096,7 +3096,7 @@ ImBuf *BKE_sequencer_give_ibuf(const SeqRenderData *context, float cfra, int cha if (ed == NULL) return NULL; if ((chanshown < 0) && !BLI_listbase_is_empty(&ed->metastack)) { - int count = BLI_countlist(&ed->metastack); + int count = BLI_listbase_count(&ed->metastack); count = max_ii(count + chanshown, 0); seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep; } diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index a680d8d2db2..de95653f659 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -3561,7 +3561,7 @@ static void curve_surf_to_softbody(Scene *scene, Object *ob) if (ob->softflag & OB_SB_EDGES) { if (ob->type==OB_CURVE) { - totspring= totvert - BLI_countlist(&cu->nurb); + totspring= totvert - BLI_listbase_count(&cu->nurb); } } diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c index 40d9dc0d7e0..1613b0c5a78 100644 --- a/source/blender/blenkernel/intern/tracking.c +++ b/source/blender/blenkernel/intern/tracking.c @@ -1475,7 +1475,7 @@ MovieTrackingObject *BKE_tracking_object_add(MovieTracking *tracking, const char BLI_addtail(&tracking->objects, object); tracking->tot_object++; - tracking->objectnr = BLI_countlist(&tracking->objects) - 1; + tracking->objectnr = BLI_listbase_count(&tracking->objects) - 1; object->scale = 1.0f; object->keyframe1 = 1; @@ -2410,30 +2410,30 @@ static void tracking_dopesheet_channels_sort(MovieTracking *tracking, int sort_m if (inverse) { if (sort_method == TRACKING_DOPE_SORT_NAME) { - BLI_sortlist(&dopesheet->channels, channels_alpha_inverse_sort); + BLI_listbase_sort(&dopesheet->channels, channels_alpha_inverse_sort); } else if (sort_method == TRACKING_DOPE_SORT_LONGEST) { - BLI_sortlist(&dopesheet->channels, channels_longest_segment_inverse_sort); + BLI_listbase_sort(&dopesheet->channels, channels_longest_segment_inverse_sort); } else if (sort_method == TRACKING_DOPE_SORT_TOTAL) { - BLI_sortlist(&dopesheet->channels, channels_total_track_inverse_sort); + BLI_listbase_sort(&dopesheet->channels, channels_total_track_inverse_sort); } else if (sort_method == TRACKING_DOPE_SORT_AVERAGE_ERROR) { - BLI_sortlist(&dopesheet->channels, channels_average_error_inverse_sort); + BLI_listbase_sort(&dopesheet->channels, channels_average_error_inverse_sort); } } else { if (sort_method == TRACKING_DOPE_SORT_NAME) { - BLI_sortlist(&dopesheet->channels, channels_alpha_sort); + BLI_listbase_sort(&dopesheet->channels, channels_alpha_sort); } else if (sort_method == TRACKING_DOPE_SORT_LONGEST) { - BLI_sortlist(&dopesheet->channels, channels_longest_segment_sort); + BLI_listbase_sort(&dopesheet->channels, channels_longest_segment_sort); } else if (sort_method == TRACKING_DOPE_SORT_TOTAL) { - BLI_sortlist(&dopesheet->channels, channels_total_track_sort); + BLI_listbase_sort(&dopesheet->channels, channels_total_track_sort); } else if (sort_method == TRACKING_DOPE_SORT_AVERAGE_ERROR) { - BLI_sortlist(&dopesheet->channels, channels_average_error_sort); + BLI_listbase_sort(&dopesheet->channels, channels_average_error_sort); } } } diff --git a/source/blender/blenkernel/intern/tracking_solver.c b/source/blender/blenkernel/intern/tracking_solver.c index 056220e27d8..6d4e7efa815 100644 --- a/source/blender/blenkernel/intern/tracking_solver.c +++ b/source/blender/blenkernel/intern/tracking_solver.c @@ -356,7 +356,7 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieClip *clip MovieReconstructContext *context = MEM_callocN(sizeof(MovieReconstructContext), "MovieReconstructContext data"); ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, object); float aspy = 1.0f / tracking->camera.pixel_aspect; - int num_tracks = BLI_countlist(tracksbase); + int num_tracks = BLI_listbase_count(tracksbase); int sfra = INT_MAX, efra = INT_MIN; MovieTrackingTrack *track; diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index 3f03c4e3845..543a662c5e5 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -67,10 +67,10 @@ void *BLI_poptail(ListBase *listbase) ATTR_NONNULL(1); void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1); void BLI_insertlinkbefore(struct ListBase *listbase, void *vnextlink, void *vnewlink) ATTR_NONNULL(1); void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1); -void BLI_sortlist(struct ListBase *listbase, int (*cmp)(const void *, const void *)) ATTR_NONNULL(1, 2); -void BLI_sortlist_r(ListBase *listbase, void *thunk, int (*cmp)(void *, const void *, const void *)) ATTR_NONNULL(1, 3); +void BLI_listbase_sort(struct ListBase *listbase, int (*cmp)(const void *, const void *)) ATTR_NONNULL(1, 2); +void BLI_listbase_sort_r(ListBase *listbase, void *thunk, int (*cmp)(void *, const void *, const void *)) ATTR_NONNULL(1, 3); void BLI_freelist(struct ListBase *listbase) ATTR_NONNULL(1); -int BLI_countlist(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); +int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1); void BLI_listbase_swaplinks(struct ListBase *listbase, void *vlinka, void *vlinkb) ATTR_NONNULL(1, 2); diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index 6fcc5888382..cd2e343560f 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -211,7 +211,7 @@ void BLI_freelinkN(ListBase *listbase, void *vlink) * (which should return 1 iff its first arg should come after its second arg). * This uses insertion sort, so NOT ok for large list. */ -void BLI_sortlist(ListBase *listbase, int (*cmp)(const void *, const void *)) +void BLI_listbase_sort(ListBase *listbase, int (*cmp)(const void *, const void *)) { Link *current = NULL; Link *previous = NULL; @@ -233,7 +233,7 @@ void BLI_sortlist(ListBase *listbase, int (*cmp)(const void *, const void *)) } } -void BLI_sortlist_r(ListBase *listbase, void *thunk, int (*cmp)(void *, const void *, const void *)) +void BLI_listbase_sort_r(ListBase *listbase, void *thunk, int (*cmp)(void *, const void *, const void *)) { Link *current = NULL; Link *previous = NULL; @@ -376,7 +376,7 @@ void BLI_freelistN(ListBase *listbase) /** * Returns the number of elements in \a listbase. */ -int BLI_countlist(const ListBase *listbase) +int BLI_listbase_count(const ListBase *listbase) { Link *link; int count = 0; diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index cf0d8cff870..1653ba5ae6e 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -807,7 +807,7 @@ unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, const int flag, const #if 0 if (flag & BLI_SCANFILL_CALC_QUADTRI_FASTPATH) { - const int totverts = BLI_countlist(&sf_ctx->fillvertbase); + const int totverts = BLI_listbase_count(&sf_ctx->fillvertbase); if (totverts == 3) { eve = sf_ctx->fillvertbase.first; diff --git a/source/blender/blenlib/intern/scanfill_utils.c b/source/blender/blenlib/intern/scanfill_utils.c index 9fc1db1f1e4..029e98bad5e 100644 --- a/source/blender/blenlib/intern/scanfill_utils.c +++ b/source/blender/blenlib/intern/scanfill_utils.c @@ -265,7 +265,7 @@ static bool scanfill_preprocess_self_isect( } if (BLI_listbase_is_single(e_ls) == false) { - BLI_sortlist_r(e_ls, eed->v2->co, edge_isect_ls_sort_cb); + BLI_listbase_sort_r(e_ls, eed->v2->co, edge_isect_ls_sort_cb); } /* move original edge to filledgebase and add replacement diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c index 31b14692354..fb442f164b0 100644 --- a/source/blender/blenloader/intern/versioning_270.c +++ b/source/blender/blenloader/intern/versioning_270.c @@ -310,7 +310,7 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main) { Scene *scene; for (scene = main->scene.first; scene; scene = scene->id.next) { - int num_layers = BLI_countlist(&scene->r.layers); + int num_layers = BLI_listbase_count(&scene->r.layers); scene->r.actlay = min_ff(scene->r.actlay, num_layers - 1); } } diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 557cc147f19..d16d5130909 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -3085,7 +3085,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main) BLI_addtail(&ob->particlesystem, psys); md = modifier_new(eModifierType_ParticleSystem); - BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem)); + BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_listbase_count(&ob->particlesystem)); psmd = (ParticleSystemModifierData*) md; psmd->psys = psys; BLI_addtail(&ob->modifiers, md); diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index 709a174731f..158c2aa4263 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/source/blender/bmesh/intern/bmesh_log.c @@ -582,7 +582,7 @@ void BM_log_free(BMLog *log) /* Get the number of log entries */ int BM_log_length(const BMLog *log) { - return BLI_countlist(&log->entries); + return BLI_listbase_count(&log->entries); } /* Apply a consistent ordering to BMesh vertices */ diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c index 05f3ff5b60b..8c96cc9addf 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_conv.c +++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c @@ -788,7 +788,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, bool do_tessface) { BMEditSelection *selected; - me->totselect = BLI_countlist(&(bm->selected)); + me->totselect = BLI_listbase_count(&(bm->selected)); if (me->mselect) MEM_freeN(me->mselect); diff --git a/source/blender/bmesh/operators/bmo_connect_pair.c b/source/blender/bmesh/operators/bmo_connect_pair.c index 80ed287b4bf..418e75b7ac3 100644 --- a/source/blender/bmesh/operators/bmo_connect_pair.c +++ b/source/blender/bmesh/operators/bmo_connect_pair.c @@ -496,7 +496,7 @@ void bmo_connect_vert_pair_exec(BMesh *bm, BMOperator *op) PathLinkState *state, *state_next; found_all = true; #ifdef DEBUG_PRINT - printf("\n%s: stepping %d\n", __func__, BLI_countlist(&pc.state_lb)); + printf("\n%s: stepping %d\n", __func__, BLI_listbase_count(&pc.state_lb)); #endif for (state = pc.state_lb.first; state; state = state_next) { state_next = state->next; diff --git a/source/blender/bmesh/tools/bmesh_region_match.c b/source/blender/bmesh/tools/bmesh_region_match.c index 4e714f8fbe9..562f123ef4b 100644 --- a/source/blender/bmesh/tools/bmesh_region_match.c +++ b/source/blender/bmesh/tools/bmesh_region_match.c @@ -656,7 +656,7 @@ static bool bm_uuidwalk_facestep_begin( bool ok = false; BLI_assert(BLI_ghash_size(uuidwalk->cache.faces_from_uuid) == 0); - BLI_assert(BLI_countlist(&fstep->items) == 0); + BLI_assert(BLI_listbase_count(&fstep->items) == 0); f_link_prev_p = &fstep->faces; for (f_link = fstep->faces; f_link; f_link = f_link_next) { @@ -695,7 +695,7 @@ static bool bm_uuidwalk_facestep_begin( BLI_ghash_clear(uuidwalk->cache.faces_from_uuid, NULL, NULL); - BLI_sortlist(&fstep->items, facestep_sort); + BLI_listbase_sort(&fstep->items, facestep_sort); return ok; } @@ -781,7 +781,7 @@ static BMFace **bm_mesh_region_match_pair( UUIDFaceStep *fstep_src = w_src->faces_step.first; UUIDFaceStep *fstep_dst = w_dst->faces_step.first; - BLI_assert(BLI_countlist(&w_src->faces_step) == BLI_countlist(&w_dst->faces_step)); + BLI_assert(BLI_listbase_count(&w_src->faces_step) == BLI_listbase_count(&w_dst->faces_step)); while (fstep_src) { diff --git a/source/blender/collada/ArmatureExporter.cpp b/source/blender/collada/ArmatureExporter.cpp index 2e92cd9c147..e50cd6ff289 100644 --- a/source/blender/collada/ArmatureExporter.cpp +++ b/source/blender/collada/ArmatureExporter.cpp @@ -168,7 +168,7 @@ void ArmatureExporter::add_bone_node(Bone *bone, Object *ob_arm, Scene *sce, node.setNodeSid(node_sid); #if 0 - if (BLI_listbase_is_empty(&bone->childbase) || BLI_countlist(&(bone->childbase)) >= 2) { + if (BLI_listbase_is_empty(&bone->childbase) || BLI_listbase_count(&(bone->childbase)) >= 2) { add_blender_leaf_bone( bone, ob_arm, node); } else { diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index bc1c4172f46..25fd9c81535 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -556,7 +556,7 @@ std::string ControllerExporter::add_inv_bind_mats_source(Object *ob_arm, ListBas COLLADASW::FloatSourceF source(mSW); source.setId(source_id); source.setArrayId(source_id + ARRAY_ID_SUFFIX); - source.setAccessorCount(totjoint); //BLI_countlist(defbase)); + source.setAccessorCount(totjoint); //BLI_listbase_count(defbase)); source.setAccessorStride(16); source.setParameterTypeName(&COLLADASW::CSWC::CSW_VALUE_TYPE_FLOAT4x4); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 027c669a01d..a5c0eee8d3b 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -127,7 +127,7 @@ static int add_default_keyingset_exec(bContext *C, wmOperator *UNUSED(op)) /* call the API func, and set the active keyingset index */ BKE_keyingset_add(&scene->keyingsets, NULL, NULL, flag, keyingflag); - scene->active_keyingset = BLI_countlist(&scene->keyingsets); + scene->active_keyingset = BLI_listbase_count(&scene->keyingsets); /* send notifiers */ WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL); @@ -216,7 +216,7 @@ static int add_empty_ks_path_exec(bContext *C, wmOperator *op) /* don't use the API method for this, since that checks on values... */ ksp = MEM_callocN(sizeof(KS_Path), "KeyingSetPath Empty"); BLI_addtail(&ks->paths, ksp); - ks->active_path = BLI_countlist(&ks->paths); + ks->active_path = BLI_listbase_count(&ks->paths); ksp->groupmode = KSP_GROUP_KSNAME; // XXX? ksp->idtype = ID_OB; @@ -316,7 +316,7 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) /* call the API func, and set the active keyingset index */ ks = BKE_keyingset_add(&scene->keyingsets, "ButtonKeyingSet", "Button Keying Set", flag, keyingflag); - scene->active_keyingset = BLI_countlist(&scene->keyingsets); + scene->active_keyingset = BLI_listbase_count(&scene->keyingsets); } else if (scene->active_keyingset < 0) { BKE_report(op->reports, RPT_ERROR, "Cannot add property to built in keying set"); @@ -347,7 +347,7 @@ static int add_keyingset_button_exec(bContext *C, wmOperator *op) /* add path to this setting */ BKE_keyingset_add_path(ks, ptr.id.data, NULL, path, index, pflag, KSP_GROUP_KSNAME); - ks->active_path = BLI_countlist(&ks->paths); + ks->active_path = BLI_listbase_count(&ks->paths); success = 1; /* free the temp path created */ diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 8bcee52baab..7f7843a6d1d 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -569,7 +569,7 @@ static int armature_fill_bones_exec(bContext *C, wmOperator *op) * 2) between the two joints (order is dependent on active-bone/hierarchy) * 3+) error (a smarter method involving finding chains needs to be worked out */ - count = BLI_countlist(&points); + count = BLI_listbase_count(&points); if (count == 0) { BKE_report(op->reports, RPT_ERROR, "No joints selected"); diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index 5ff15b84284..15f75ada060 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -428,7 +428,7 @@ void create_vgroups_from_armature(ReportList *reports, Scene *scene, Object *ob, bArmature *arm = par->data; if (mode == ARM_GROUPS_NAME) { - const int defbase_tot = BLI_countlist(&ob->defbase); + const int defbase_tot = BLI_listbase_count(&ob->defbase); int defbase_add; /* Traverse the bone list, trying to create empty vertex * groups corresponding to the bone. diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index 647b640ee61..d1cab01a2f6 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -1205,7 +1205,7 @@ static void RIG_arcFromBoneChain(RigGraph *rg, ListBase *list, EditBone *root_bo static void RIG_findHead(RigGraph *rg) { if (rg->head == NULL) { - if (BLI_countlist(&rg->arcs) == 1) { + if (BLI_listbase_count(&rg->arcs) == 1) { RigArc *arc = rg->arcs.first; rg->head = (RigNode *)arc->head; @@ -1958,7 +1958,7 @@ static void retargetArctoArcAggresive(bContext *C, RigGraph *rigg, RigArc *iarc, #endif float *vec0, *vec1; int *best_positions; - int nb_edges = BLI_countlist(&iarc->edges); + int nb_edges = BLI_listbase_count(&iarc->edges); int nb_joints = nb_edges - 1; RetargetMethod method = METHOD_MEMOIZE; int i; @@ -2152,7 +2152,7 @@ void exec_retargetArctoArc(TaskPool *UNUSED(pool), void *taskdata, int UNUSED(th RigNode *inode_start = p->inode_start; ReebArc *earc = iarc->link_mesh; - if (BLI_countlist(&iarc->edges) == 1) { + if (BLI_listbase_count(&iarc->edges) == 1) { RigEdge *edge = iarc->edges.first; if (testFlipArc(iarc, inode_start)) { @@ -2454,7 +2454,7 @@ const char *RIG_nameBone(RigGraph *rg, int arc_index, int bone_index) return "None"; } - if (bone_index == BLI_countlist(&arc->edges)) { + if (bone_index == BLI_listbase_count(&arc->edges)) { return "Last joint"; } @@ -2476,10 +2476,10 @@ int RIG_nbJoints(RigGraph *rg) RigArc *arc; int total = 0; - total += BLI_countlist(&rg->nodes); + total += BLI_listbase_count(&rg->nodes); for (arc = rg->arcs.first; arc; arc = arc->next) { - total += BLI_countlist(&arc->edges) - 1; /* -1 because end nodes are already counted */ + total += BLI_listbase_count(&arc->edges) - 1; /* -1 because end nodes are already counted */ } return total; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 737f901a055..912fbc36d5d 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -1575,7 +1575,7 @@ static int sk_getIntersections(bContext *C, ListBase *list, SK_Sketch *sketch, S added = MAX2(s_added, added); } - BLI_sortlist(list, cmpIntersections); + BLI_listbase_sort(list, cmpIntersections); return added; } diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index 193ba6397fb..d8a32f085bc 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -381,14 +381,14 @@ static void pose_copy_menu(Scene *scene) * but for constraints (just add local constraints) */ if (pose_has_protected_selected(ob, 0)) { - i = BLI_countlist(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */ + i = BLI_listbase_count(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */ if (i < 25) nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|Constraints... %x5"); else nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4"); } else { - i = BLI_countlist(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */ + i = BLI_listbase_count(&(pchanact->constraints)); /* if there are 24 or less, allow for the user to select constraints */ if (i < 25) nr = pupmenu("Copy Pose Attributes %t|Local Location %x1|Local Rotation %x2|Local Size %x3|%l|Visual Location %x9|Visual Rotation %x10|Visual Size %x11|%l|Constraints (All) %x4|Constraints... %x5|%l|Transform Locks %x6|IK Limits %x7|Bone Shape %x8"); else diff --git a/source/blender/editors/armature/pose_group.c b/source/blender/editors/armature/pose_group.c index 2b605443beb..9c27fe5218a 100644 --- a/source/blender/editors/armature/pose_group.c +++ b/source/blender/editors/armature/pose_group.c @@ -387,7 +387,7 @@ static int group_sort_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; /* create temporary array with bone groups and indices */ - agrp_count = BLI_countlist(&pose->agroups); + agrp_count = BLI_listbase_count(&pose->agroups); agrp_array = MEM_mallocN(sizeof(tSortActionGroup) * agrp_count, "sort bone groups"); for (agrp = pose->agroups.first, i = 0; agrp; agrp = agrp->next, i++) { BLI_assert(i < agrp_count); diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index b8373b00368..15e70980425 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -472,7 +472,7 @@ static int poselib_add_exec(bContext *C, wmOperator *op) ANIM_apply_keyingset(C, NULL, act, ks, MODIFYKEY_MODE_INSERT, (float)frame); /* store new 'active' pose number */ - act->active_marker = BLI_countlist(&act->markers); + act->active_marker = BLI_listbase_count(&act->markers); /* done */ return OPERATOR_FINISHED; @@ -1348,7 +1348,7 @@ static int poselib_preview_handle_event(bContext *UNUSED(C), wmOperator *op, con else { /* change to last pose */ pld->marker = pld->act->markers.last; - pld->act->active_marker = BLI_countlist(&pld->act->markers); + pld->act->active_marker = BLI_listbase_count(&pld->act->markers); pld->redraw = PL_PREVIEW_REDRAWALL; } diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index ba5ef4f3b5d..5d5a9bf363c 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -642,7 +642,7 @@ static bool pose_select_same_group(bContext *C, Object *ob, bool extend) return 0; /* count the number of groups */ - numGroups = BLI_countlist(&pose->agroups); + numGroups = BLI_listbase_count(&pose->agroups); if (numGroups == 0) return 0; diff --git a/source/blender/editors/armature/reeb.c b/source/blender/editors/armature/reeb.c index 8cc6059e87b..dd2212745e0 100644 --- a/source/blender/editors/armature/reeb.c +++ b/source/blender/editors/armature/reeb.c @@ -107,7 +107,7 @@ static VertexData *allocVertexData(EditMesh *em) EditVert *eve; int totvert, index; - totvert = BLI_countlist(&em->verts); + totvert = BLI_listbase_count(&em->verts); data = MEM_callocN(sizeof(VertexData) * totvert, "VertexData"); @@ -1141,7 +1141,7 @@ static int compareNodesWeight(void *vnode1, void *vnode2) void sortNodes(ReebGraph *rg) { - BLI_sortlist(&rg->nodes, compareNodesWeight); + BLI_listbase_sort(&rg->nodes, compareNodesWeight); } static int compareArcsWeight(void *varc1, void *varc2) @@ -1166,7 +1166,7 @@ static int compareArcsWeight(void *varc1, void *varc2) void sortArcs(ReebGraph *rg) { - BLI_sortlist(&rg->arcs, compareArcsWeight); + BLI_listbase_sort(&rg->arcs, compareArcsWeight); } /******************************************* JOINING ***************************************************/ @@ -1512,7 +1512,7 @@ static int filterInternalExternalReebGraph(ReebGraph *rg, float threshold_intern ReebArc *arc = NULL, *nextArc = NULL; int value = 0; - BLI_sortlist(&rg->arcs, compareArcs); + BLI_listbase_sort(&rg->arcs, compareArcs); for (arc = rg->arcs.first; arc; arc = nextArc) { nextArc = arc->next; @@ -1632,7 +1632,7 @@ int filterSmartReebGraph(ReebGraph *UNUSED(rg), float UNUSED(threshold)) #if 0 //XXX ReebArc *arc = NULL, *nextArc = NULL; - BLI_sortlist(&rg->arcs, compareArcs); + BLI_listbase_sort(&rg->arcs, compareArcs); #ifdef DEBUG_REEB { @@ -1867,7 +1867,7 @@ static void spreadWeight(EditMesh *em) { EditVert **verts, *eve; float lastWeight = 0.0f; - int totvert = BLI_countlist(&em->verts); + int totvert = BLI_listbase_count(&em->verts); int i; int work_needed = 1; @@ -2399,9 +2399,9 @@ ReebGraph *generateReebGraph(EditMesh *em, int subdivisions) rg->resolution = subdivisions; - /*totvert = BLI_countlist(&em->verts);*/ /*UNUSED*/ + /*totvert = BLI_listbase_count(&em->verts);*/ /*UNUSED*/ #ifdef DEBUG_REEB - totfaces = BLI_countlist(&em->faces); + totfaces = BLI_listbase_count(&em->faces); #endif renormalizeWeight(em, 1.0f); @@ -2460,7 +2460,7 @@ void renormalizeWeight(EditMesh *em, float newmax) EditVert *eve; float minimum, maximum, range; - if (em == NULL || BLI_countlist(&em->verts) == 0) + if (em == NULL || BLI_listbase_count(&em->verts) == 0) return; /* First pass, determine maximum and minimum */ @@ -2486,7 +2486,7 @@ int weightFromLoc(EditMesh *em, int axis) { EditVert *eve; - if (em == NULL || BLI_countlist(&em->verts) == 0 || axis < 0 || axis > 2) + if (em == NULL || BLI_listbase_count(&em->verts) == 0 || axis < 0 || axis > 2) return 0; /* Copy coordinate in weight */ @@ -2738,7 +2738,7 @@ static void buildIndexedEdges(EditMesh *em, EdgeIndex *indexed_edges) int tot_indexed = 0; int offset = 0; - totvert = BLI_countlist(&em->verts); + totvert = BLI_listbase_count(&em->verts); indexed_edges->offset = MEM_callocN(totvert * sizeof(int), "EdgeIndex offset"); @@ -2791,13 +2791,13 @@ int weightFromDistance(EditMesh *em, EdgeIndex *indexed_edges) int totvert = 0; int vCount = 0; - totvert = BLI_countlist(&em->verts); + totvert = BLI_listbase_count(&em->verts); if (em == NULL || totvert == 0) { return 0; } - totedge = BLI_countlist(&em->edges); + totedge = BLI_listbase_count(&em->edges); if (totedge == 0) { return 0; diff --git a/source/blender/editors/curve/editcurve_add.c b/source/blender/editors/curve/editcurve_add.c index 662a7eb811a..c9a961d1a4d 100644 --- a/source/blender/editors/curve/editcurve_add.c +++ b/source/blender/editors/curve/editcurve_add.c @@ -460,7 +460,7 @@ Nurb *add_nurbs_primitive(bContext *C, Object *obedit, float mat[4][4], int type if (nu) { /* should always be set */ nu->flag |= CU_SMOOTH; - cu->actnu = BLI_countlist(editnurb); + cu->actnu = BLI_listbase_count(editnurb); cu->actvert = CU_ACT_NONE; BKE_nurb_test2D(nu); diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 31c67fbca52..108166109b8 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -668,7 +668,7 @@ void ED_text_to_object(bContext *C, Text *text, const bool split_lines) offset[1] = 0.0f; offset[2] = 0.0f; - txt_add_object(C, text->lines.first, BLI_countlist(&text->lines), offset); + txt_add_object(C, text->lines.first, BLI_listbase_count(&text->lines), offset); } } diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 0e0c6d920e7..4cc159d144d 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1518,7 +1518,7 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, const char *s } RNA_PROP_END; - BLI_sortlist(items_list, sort_search_items_list); + BLI_listbase_sort(items_list, sort_search_items_list); /* add search items from temporary list */ for (cis = items_list->first; cis; cis = cis->next) { @@ -2512,7 +2512,7 @@ static void ui_litem_layout_split(uiLayout *litem) uiLayoutItemSplit *split = (uiLayoutItemSplit *)litem; uiItem *item; float percentage; - const int tot = BLI_countlist(&litem->items); + const int tot = BLI_listbase_count(&litem->items); int itemh, x, y, w, colw = 0; if (tot == 0) diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index b1fc18e1ab9..dccb1f14af6 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -753,7 +753,7 @@ static void knife_cut_face(KnifeTool_OpData *kcd, BMFace *f, ListBase *hits) (void) kcd; - n = BLI_countlist(hits); + n = BLI_listbase_count(hits); if (n < 2) return; @@ -2108,7 +2108,7 @@ static ListBase *find_chain(KnifeTool_OpData *kcd, ListBase *fedges) break; } if (ans) { - BLI_assert(BLI_countlist(ans) > 0); + BLI_assert(BLI_listbase_count(ans) > 0); for (r = ans->first; r; r = r->next) { ref = find_ref(fedges, r->ref); BLI_assert(ref != NULL); @@ -2216,7 +2216,7 @@ static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, L int besti[2], bestj[2]; float dist_sq, dist_best_sq; - nh = BLI_countlist(hole); + nh = BLI_listbase_count(hole); nf = f->len; if (nh < 2 || nf < 3) return false; @@ -2393,7 +2393,7 @@ static void knife_make_chain_cut(KnifeTool_OpData *kcd, BMFace *f, ListBase *cha KnifeVert *kfv, *kfvprev; BMLoop *l_new, *l_iter; int i; - int nco = BLI_countlist(chain) - 1; + int nco = BLI_listbase_count(chain) - 1; float (*cos)[3] = BLI_array_alloca(cos, nco); KnifeVert **kverts = BLI_array_alloca(kverts, nco); @@ -2466,7 +2466,7 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe Ref *ref, *refnext; int count, oldcount; - oldcount = BLI_countlist(kfedges); + oldcount = BLI_listbase_count(kfedges); while ((chain = find_chain(kcd, kfedges)) != NULL) { ListBase fnew_kfedges; knife_make_chain_cut(kcd, f, chain, &fnew); @@ -2495,7 +2495,7 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe /* find_chain should always remove edges if it returns true, * but guard against infinite loop anyway */ - count = BLI_countlist(kfedges); + count = BLI_listbase_count(kfedges); if (count >= oldcount) { BLI_assert(!"knife find_chain infinite loop"); return; @@ -2563,7 +2563,7 @@ static void knife_make_face_cuts(KnifeTool_OpData *kcd, BMFace *f, ListBase *kfe break; /* find_hole should always remove edges if it returns true, * but guard against infinite loop anyway */ - count = BLI_countlist(kfedges); + count = BLI_listbase_count(kfedges); if (count >= oldcount) { BLI_assert(!"knife find_hole infinite loop"); return; diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index b8957514159..1f1bdbe55e5 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -438,7 +438,7 @@ static void multiresbake_startjob(void *bkv, short *stop, short *do_update, floa MultiresBakeJob *bkj = bkv; int baked_objects = 0, tot_obj; - tot_obj = BLI_countlist(&bkj->data); + tot_obj = BLI_listbase_count(&bkj->data); if (bkj->bake_clear) { /* clear images */ for (data = bkj->data.first; data; data = data->next) { diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 674fb176a8f..2596ea0a064 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -233,7 +233,7 @@ static void set_constraint_nth_target(bConstraint *con, Object *target, const ch if (cti && cti->get_constraint_targets) { cti->get_constraint_targets(con, &targets); - num_targets = BLI_countlist(&targets); + num_targets = BLI_listbase_count(&targets); if (index < 0) { if (abs(index) < num_targets) diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 9dd79ddf995..49c77770467 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -145,7 +145,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, const char *name) defgroup = BKE_defgroup_new(ob, name); - ob->actdef = BLI_countlist(&ob->defbase); + ob->actdef = BLI_listbase_count(&ob->defbase); return defgroup; } @@ -501,8 +501,8 @@ bool ED_vgroup_array_copy(Object *ob, Object *ob_from) int dvert_tot_from; int dvert_tot; int i; - int defbase_tot_from = BLI_countlist(&ob_from->defbase); - int defbase_tot = BLI_countlist(&ob->defbase); + int defbase_tot_from = BLI_listbase_count(&ob_from->defbase); + int defbase_tot = BLI_listbase_count(&ob->defbase); bool new_vgroup = false; if (ob == ob_from) @@ -1476,7 +1476,7 @@ static void vgroup_duplicate(Object *ob) BLI_addtail(&ob->defbase, cdg); idg = (ob->actdef - 1); - ob->actdef = BLI_countlist(&ob->defbase); + ob->actdef = BLI_listbase_count(&ob->defbase); icdg = (ob->actdef - 1); /* TODO, we might want to allow only copy selected verts here? - campbell */ @@ -1504,7 +1504,7 @@ static void vgroup_duplicate(Object *ob) bool *ED_vgroup_subset_from_select_type(Object *ob, eVGroupSelect subset_type, int *r_vgroup_tot, int *r_subset_count) { bool *vgroup_validmap = NULL; - *r_vgroup_tot = BLI_countlist(&ob->defbase); + *r_vgroup_tot = BLI_listbase_count(&ob->defbase); switch (subset_type) { case WT_VGROUP_ACTIVE: @@ -2051,7 +2051,7 @@ static void vgroup_normalize_all(Object *ob, ED_vgroup_parray_alloc(ob->data, &dvert_array, &dvert_tot, use_vert_sel); if (dvert_array) { - const int defbase_tot = BLI_countlist(&ob->defbase); + const int defbase_tot = BLI_listbase_count(&ob->defbase); bool *lock_flags = BKE_objdef_lock_flags_get(ob, defbase_tot); if ((lock_active == true) && @@ -2766,7 +2766,7 @@ static void vgroup_remap_update_users(Object *ob, int *map) static void vgroup_delete_update_users(Object *ob, int id) { - int i, defbase_tot = BLI_countlist(&ob->defbase) + 1; + int i, defbase_tot = BLI_listbase_count(&ob->defbase) + 1; int *map = MEM_mallocN(sizeof(int) * defbase_tot, "vgroup del"); map[id] = map[0] = 0; @@ -4237,7 +4237,7 @@ void OBJECT_OT_vertex_group_set_active(wmOperatorType *ot) static char *vgroup_init_remap(Object *ob) { bDeformGroup *def; - int defbase_tot = BLI_countlist(&ob->defbase); + int defbase_tot = BLI_listbase_count(&ob->defbase); char *name_array = MEM_mallocN(MAX_VGROUP_NAME * sizeof(char) * defbase_tot, "sort vgroups"); char *name; @@ -4254,7 +4254,7 @@ static int vgroup_do_remap(Object *ob, const char *name_array, wmOperator *op) { MDeformVert *dvert = NULL; bDeformGroup *def; - int defbase_tot = BLI_countlist(&ob->defbase); + int defbase_tot = BLI_listbase_count(&ob->defbase); /* needs a dummy index at the start*/ int *sort_map_update = MEM_mallocN(sizeof(int) * (defbase_tot + 1), "sort vgroups"); @@ -4378,7 +4378,7 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op) /*sort vgroup names*/ switch (sort_type) { case SORT_TYPE_NAME: - BLI_sortlist(&ob->defbase, vgroup_sort_name); + BLI_listbase_sort(&ob->defbase, vgroup_sort_name); break; case SORT_TYPE_BONEHIERARCHY: vgroup_sort_bone_hierarchy(ob, NULL); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index b4114126b8a..eaa7cf40aca 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -558,7 +558,7 @@ static int render_layer_add_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene = CTX_data_scene(C); BKE_scene_add_render_layer(scene, NULL); - scene->r.actlay = BLI_countlist(&scene->r.layers) - 1; + scene->r.actlay = BLI_listbase_count(&scene->r.layers) - 1; DAG_id_tag_update(&scene->id, 0); WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 35d9b764043..454bb3b7ca3 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2320,7 +2320,7 @@ static int screen_set_exec(bContext *C, wmOperator *op) bScreen *screen_prev = screen; ScrArea *sa = CTX_wm_area(C); - int tot = BLI_countlist(&bmain->screen); + int tot = BLI_listbase_count(&bmain->screen); int delta = RNA_int_get(op->ptr, "delta"); /* temp screens are for userpref or render display */ @@ -2795,7 +2795,7 @@ static int spacedata_cleanup_exec(bContext *C, wmOperator *op) SpaceLink *sl = sa->spacedata.first; BLI_remlink(&sa->spacedata, sl); - tot += BLI_countlist(&sa->spacedata); + tot += BLI_listbase_count(&sa->spacedata); BKE_spacedata_freelist(&sa->spacedata); BLI_addtail(&sa->spacedata, sl); } @@ -2853,7 +2853,7 @@ static int repeat_history_invoke(bContext *C, wmOperator *op, const wmEvent *UNU uiLayout *layout; int items, i; - items = BLI_countlist(&wm->operators); + items = BLI_listbase_count(&wm->operators); if (items == 0) return OPERATOR_CANCELLED; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 431dd54b3c0..75bef040d2e 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -382,7 +382,7 @@ static int wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active) mirrdef = defgroup_name_index(ob, name_flip); if (mirrdef == -1) { if (BKE_defgroup_new(ob, name_flip)) { - mirrdef = BLI_countlist(&ob->defbase) - 1; + mirrdef = BLI_listbase_count(&ob->defbase) - 1; } } @@ -1177,7 +1177,7 @@ static EnumPropertyItem *weight_paint_sample_enum_itemf(bContext *C, PointerRNA me = BKE_mesh_from_object(vc.obact); if (me && me->dvert && vc.v3d && vc.rv3d && vc.obact->defbase.first) { - const int defbase_tot = BLI_countlist(&vc.obact->defbase); + const int defbase_tot = BLI_listbase_count(&vc.obact->defbase); const int use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0; int *groups = MEM_callocN(defbase_tot * sizeof(int), "groups"); bool found = false; @@ -2235,7 +2235,7 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float UN /* set up auto-normalize, and generate map for detecting which * vgroups affect deform bones */ - wpd->defbase_tot = BLI_countlist(&ob->defbase); + wpd->defbase_tot = BLI_listbase_count(&ob->defbase); wpd->lock_flags = BKE_objdef_lock_flags_get(ob, wpd->defbase_tot); if (ts->auto_normalize || ts->multipaint || wpd->lock_flags) { wpd->vgroup_validmap = BKE_objdef_validmap_get(ob, wpd->defbase_tot); diff --git a/source/blender/editors/space_buttons/buttons_texture.c b/source/blender/editors/space_buttons/buttons_texture.c index cfdb5b0f8ba..c8cbf0f5794 100644 --- a/source/blender/editors/space_buttons/buttons_texture.c +++ b/source/blender/editors/space_buttons/buttons_texture.c @@ -256,7 +256,7 @@ static void buttons_texture_user_property_add(ListBase *users, ID *id, user->category = category; user->icon = icon; user->name = name; - user->index = BLI_countlist(users); + user->index = BLI_listbase_count(users); BLI_addtail(users, user); } @@ -273,7 +273,7 @@ static void buttons_texture_user_node_add(ListBase *users, ID *id, user->category = category; user->icon = icon; user->name = name; - user->index = BLI_countlist(users); + user->index = BLI_listbase_count(users); BLI_addtail(users, user); } @@ -468,7 +468,7 @@ void buttons_texture_context_compute(const bContext *C, SpaceButs *sbuts) } else { /* set one user as active based on active index */ - if (ct->index >= BLI_countlist(&ct->users)) + if (ct->index >= BLI_listbase_count(&ct->users)) ct->index = 0; ct->user = BLI_findlink(&ct->users, ct->index); diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index b44e942527c..2d5e5c6e0f2 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -95,7 +95,7 @@ static void console_scrollback_limit(SpaceConsole *sc) if (U.scrollback < 32) U.scrollback = 256; // XXX - save in user defaults - for (tot = BLI_countlist(&sc->scrollback); tot > U.scrollback; tot--) + for (tot = BLI_listbase_count(&sc->scrollback); tot > U.scrollback; tot--) console_scrollback_free(sc, sc->scrollback.first); } @@ -136,7 +136,7 @@ static void console_lb_debug__internal(ListBase *lb) { ConsoleLine *cl; - printf("%d: ", BLI_countlist(lb)); + printf("%d: ", BLI_listbase_count(lb)); for (cl = lb->first; cl; cl = cl->next) printf("<%s> ", cl->line); printf("\n"); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index c6fcf746220..be65cdb2d4f 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -347,7 +347,7 @@ static void ui_imageuser_layer_menu(bContext *UNUSED(C), uiLayout *layout, void 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0, ""); uiItemS(layout); - nr = BLI_countlist(&rr->layers) - 1; + nr = BLI_listbase_count(&rr->layers) - 1; fake_name = ui_imageuser_layer_fake_name(rr); if (fake_name) { @@ -414,7 +414,7 @@ static void ui_imageuser_pass_menu(bContext *UNUSED(C), uiLayout *layout, void * uiItemS(layout); - nr = (rl ? BLI_countlist(&rl->passes) : 0) - 1; + nr = (rl ? BLI_listbase_count(&rl->passes) : 0) - 1; fake_name = ui_imageuser_pass_fake_name(rl); if (fake_name) { @@ -452,7 +452,7 @@ static void image_multi_inclay_cb(bContext *C, void *rr_v, void *iuser_v) { RenderResult *rr = rr_v; ImageUser *iuser = iuser_v; - int tot = BLI_countlist(&rr->layers); + int tot = BLI_listbase_count(&rr->layers); if (rr->rectf || rr->rect32) tot++; /* fake compo/sequencer layer */ @@ -480,7 +480,7 @@ static void image_multi_incpass_cb(bContext *C, void *rr_v, void *iuser_v) RenderLayer *rl = BLI_findlink(&rr->layers, iuser->layer); if (rl) { - int tot = BLI_countlist(&rl->passes); + int tot = BLI_listbase_count(&rl->passes); if (rr->rectf || rr->rect32) tot++; /* fake compo/sequencer layer */ diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 1b86b608a7c..836ff25bddc 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1024,7 +1024,7 @@ static int image_sequence_get_len(ListBase *frames, int *ofs) { ImageFrame *frame; - BLI_sortlist(frames, image_cmp_frame); + BLI_listbase_sort(frames, image_cmp_frame); frame = frames->first; if (frame) { diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 504256179c8..5464449a94e 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -126,10 +126,10 @@ void make_unique_prop_names(bContext *C, char *str) /* count total names */ for (a=0; aprop); - propcount+= BLI_countlist(&ob->sensors); - propcount+= BLI_countlist(&ob->controllers); - propcount+= BLI_countlist(&ob->actuators); + propcount+= BLI_listbase_count(&ob->prop); + propcount+= BLI_listbase_count(&ob->sensors); + propcount+= BLI_listbase_count(&ob->controllers); + propcount+= BLI_listbase_count(&ob->actuators); } if (propcount==0) { if (idar) MEM_freeN(idar); diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 1085bcfc20b..37efe1afcf5 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1436,7 +1436,7 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op) if (BLI_listbase_is_empty(&nlt->strips) == false) { NlaStrip *mstrip = (NlaStrip *)nlt->strips.first; - if ((mstrip->flag & NLASTRIP_FLAG_TEMP_META) && (BLI_countlist(&mstrip->strips) == 2)) { + if ((mstrip->flag & NLASTRIP_FLAG_TEMP_META) && (BLI_listbase_count(&mstrip->strips) == 2)) { /* remove this temp meta, so that we can see the strips inside */ BKE_nlastrips_clear_metas(&nlt->strips, 0, 1); } diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index b64dc0eb03f..42259a37f45 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -214,7 +214,7 @@ void ED_node_sort(bNodeTree *ntree) { /* merge sort is the algorithm of choice here */ bNode *first_a, *first_b, *node_a, *node_b, *tmp; - int totnodes = BLI_countlist(&ntree->nodes); + int totnodes = BLI_listbase_count(&ntree->nodes); int k, a, b; k = 1; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index ca13d87d632..a16adb09b4f 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -695,7 +695,7 @@ void ED_node_set_active(Main *bmain, bNodeTree *ntree, bNode *node) for (scene = bmain->scene.first; scene; scene = scene->id.next) { if (scene->nodetree && scene->use_nodes && ntreeHasTree(scene->nodetree, ntree)) { if (node->id == NULL || node->id == (ID *)scene) { - int num_layers = BLI_countlist(&scene->r.layers); + int num_layers = BLI_listbase_count(&scene->r.layers); scene->r.actlay = node->custom1; /* Clamp the value, because it might have come from a different * scene which could have more render layers than new one. diff --git a/source/blender/editors/space_node/node_relationships.c b/source/blender/editors/space_node/node_relationships.c index 8ec5ad1f631..8dfc2ac8e83 100644 --- a/source/blender/editors/space_node/node_relationships.c +++ b/source/blender/editors/space_node/node_relationships.c @@ -203,7 +203,7 @@ static void snode_autoconnect(SpaceNode *snode, const bool allow_multiple, const } /* sort nodes left to right */ - BLI_sortlist(nodelist, sort_nodes_locx); + BLI_listbase_sort(nodelist, sort_nodes_locx); for (nli = nodelist->first; nli; nli = nli->next) { bNode *node_fr, *node_to; @@ -236,7 +236,7 @@ static void snode_autoconnect(SpaceNode *snode, const bool allow_multiple, const if (!has_selected_inputs) { /* no selected inputs, connect by finding suitable match */ - int num_inputs = BLI_countlist(&node_to->inputs); + int num_inputs = BLI_listbase_count(&node_to->inputs); for (i = 0; i < num_inputs; i++) { diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index 692aebb9072..ab0619604a9 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -300,7 +300,7 @@ static void ui_node_link_items(NodeLinkArg *arg, int in_out, NodeLinkItem **r_it for (ngroup = arg->bmain->nodetree.first; ngroup; ngroup = ngroup->id.next) { ListBase *lb = ((in_out == SOCK_IN) ? &ngroup->inputs : &ngroup->outputs); - totitems += BLI_countlist(lb); + totitems += BLI_listbase_count(lb); } if (totitems > 0) { diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index ccaeae34927..e28c775ad88 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -152,7 +152,7 @@ void ED_node_tree_pop(SpaceNode *snode) int ED_node_tree_depth(SpaceNode *snode) { - return BLI_countlist(&snode->treepath); + return BLI_listbase_count(&snode->treepath); } bNodeTree *ED_node_tree_get(SpaceNode *snode, int level) diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 3f1f8be379c..ab7b1583275 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1305,7 +1305,7 @@ static KeyingSet *verify_active_keyingset(Scene *scene, short add) // XXX the default settings have yet to evolve if ((add) && (ks == NULL)) { ks = BKE_keyingset_add(&scene->keyingsets, NULL, NULL, KEYINGSET_ABSOLUTE, 0); - scene->active_keyingset = BLI_countlist(&scene->keyingsets); + scene->active_keyingset = BLI_listbase_count(&scene->keyingsets); } return ks; @@ -1347,7 +1347,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa /* TODO: what do we do with group name? * for now, we don't supply one, and just let this use the KeyingSet name */ BKE_keyingset_add_path(ks, id, NULL, path, array_index, flag, groupmode); - ks->active_path = BLI_countlist(&ks->paths); + ks->active_path = BLI_listbase_count(&ks->paths); break; } case KEYINGSET_EDITMODE_REMOVE: diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 1123145bad5..c8ca4e1a7da 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -518,7 +518,7 @@ static void text_drawcache_init(SpaceText *st) DrawCache *drawcache = MEM_callocN(sizeof(DrawCache), "text draw cache"); drawcache->winx = -1; - drawcache->nlines = BLI_countlist(&st->text->lines); + drawcache->nlines = BLI_listbase_count(&st->text->lines); drawcache->text_id[0] = '\0'; st->drawcache = drawcache; @@ -559,7 +559,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar) int lineno = 0, size, lines_count; int *fp = drawcache->line_height, *new_tail, *old_tail; - nlines = BLI_countlist(&txt->lines); + nlines = BLI_listbase_count(&txt->lines); size = sizeof(int) * nlines; if (fp) fp = MEM_reallocN(fp, size); @@ -604,7 +604,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar) } if (full_update || drawcache->update_flag) { - nlines = BLI_countlist(&txt->lines); + nlines = BLI_listbase_count(&txt->lines); if (st->showlinenrs) st->linenrs_tot = (int)floor(log10((float)nlines)) + 1; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index ecedf35dde2..7bcc95e9871 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2496,7 +2496,7 @@ static void draw_dm_edges_weight_interp(BMEditMesh *em, DerivedMesh *dm, const c data.bm = em->bm; data.cd_dvert_offset = CustomData_get_offset(&em->bm->vdata, CD_MDEFORMVERT); - data.defgroup_tot = BLI_countlist(&ob->defbase); + data.defgroup_tot = BLI_listbase_count(&ob->defbase); data.vgroup_index = ob->actdef - 1; data.weight_user = weight_user; UI_GetThemeColor3fv(TH_VERTEX_UNREFERENCED, data.alert_color); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 77df6d3d51a..e921a436c85 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2003,7 +2003,7 @@ static void draw_dupli_objects_color( tbase.flag = OB_FROMDUPLI | base->flag; lb = object_duplilist(G.main->eval_ctx, scene, base->object); - // BLI_sortlist(lb, dupli_ob_sort); /* might be nice to have if we have a dupli list with mixed objects. */ + // BLI_listbase_sort(lb, dupli_ob_sort); /* might be nice to have if we have a dupli list with mixed objects. */ apply_data = duplilist_apply(base->object, lb); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index dc0b8403e4f..e16a7155fe6 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3150,7 +3150,7 @@ static void posttrans_gpd_clean(bGPdata *gpd) bGPDframe *gpf, *gpfn; bool is_double = false; - BLI_sortlist_r(&gpl->frames, &is_double, gpf_cmp_frame); + BLI_listbase_sort_r(&gpl->frames, &is_double, gpf_cmp_frame); if (is_double) { for (gpf = gpl->frames.first; gpf; gpf = gpfn) { @@ -3177,7 +3177,7 @@ static void posttrans_mask_clean(Mask *mask) MaskLayerShape *masklay_shape, *masklay_shape_next; bool is_double = false; - BLI_sortlist_r(&masklay->splines_shapes, &is_double, masklay_shape_cmp_frame); + BLI_listbase_sort_r(&masklay->splines_shapes, &is_double, masklay_shape_cmp_frame); if (is_double) { for (masklay_shape = masklay->splines_shapes.first; masklay_shape; masklay_shape = masklay_shape_next) { diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index c7d63da8281..ba93d4463b7 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -392,7 +392,7 @@ void BIF_selectTransformOrientationValue(bContext *C, int orientation) int BIF_countTransformOrientation(const bContext *C) { ListBase *transform_spaces = &CTX_data_scene(C)->transform_spaces; - return BLI_countlist(transform_spaces); + return BLI_listbase_count(transform_spaces); } bool applyTransformOrientation(const bContext *C, float mat[3][3], char *r_name) diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index a3e2ab3907b..cd636591212 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -2267,7 +2267,7 @@ static bool peelObjects(Scene *scene, View3D *v3d, ARegion *ar, Object *obedit, } } - BLI_sortlist(depth_peels, cmpPeel); + BLI_listbase_sort(depth_peels, cmpPeel); removeDoublesPeel(depth_peels); return retval; diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c index 104b628c25a..c3eef94f4bb 100644 --- a/source/blender/editors/util/ed_transverts.c +++ b/source/blender/editors/util/ed_transverts.c @@ -310,7 +310,7 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, Object *obedit, const } else if (obedit->type == OB_ARMATURE) { bArmature *arm = obedit->data; - int totmalloc = BLI_countlist(arm->edbo); + int totmalloc = BLI_listbase_count(arm->edbo); totmalloc *= 2; /* probably overkill but bones can have 2 trans verts each */ @@ -441,7 +441,7 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, Object *obedit, const } else if (obedit->type == OB_MBALL) { MetaBall *mb = obedit->data; - int totmalloc = BLI_countlist(mb->editelems); + int totmalloc = BLI_listbase_count(mb->editelems); tv = tvs->transverts = MEM_callocN(totmalloc * sizeof(TransVert), __func__); diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h index f5ce3c8d8c1..16e40fa52e1 100644 --- a/source/blender/makesdna/DNA_key_types.h +++ b/source/blender/makesdna/DNA_key_types.h @@ -92,7 +92,7 @@ typedef struct Key { ID *from; short type; /* absolute or relative shape key */ - short totkey; /* (totkey == BLI_countlist(&key->block)) */ + short totkey; /* (totkey == BLI_listbase_count(&key->block)) */ short slurph; /* quaint feature to delay moving points based on their order (Key->type == KEY_NORMAL) only */ short flag; diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 4cac5d413ea..8d7a05896a3 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -197,7 +197,7 @@ static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min, bAction *act = (bAction *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&act->markers) - 1); + *max = max_ii(0, BLI_listbase_count(&act->markers) - 1); } diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index f2881bf2541..12fa754e636 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -414,7 +414,7 @@ static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, i KeyingSet *ks = (KeyingSet *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&ks->paths) - 1); + *max = max_ii(0, BLI_listbase_count(&ks->paths) - 1); } static PointerRNA rna_KeyingSet_typeinfo_get(PointerRNA *ptr) @@ -445,7 +445,7 @@ static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset, ReportList *report /* if data is valid, call the API function for this */ if (keyingset) { ksp = BKE_keyingset_add_path(keyingset, id, group_name, rna_path, index, flag, group_method); - keyingset->active_path = BLI_countlist(&keyingset->paths); + keyingset->active_path = BLI_listbase_count(&keyingset->paths); } else { BKE_report(reports, RPT_ERROR, "Keying set path could not be added"); diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 6233649fb12..33048a7196b 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -169,7 +169,7 @@ static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min { BoidState *state = (BoidState *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&state->rules) - 1); + *max = max_ii(0, BLI_listbase_count(&state->rules) - 1); } static int rna_BoidState_active_boid_rule_index_get(PointerRNA *ptr) @@ -235,7 +235,7 @@ static void rna_BoidSettings_active_boid_state_index_range(PointerRNA *ptr, int { BoidSettings *boids = (BoidSettings *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&boids->states) - 1); + *max = max_ii(0, BLI_listbase_count(&boids->states) - 1); } static int rna_BoidSettings_active_boid_state_index_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 4288bf2dddb..229cdaa6005 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -203,7 +203,7 @@ static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max, DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data; *min = 0; - *max = BLI_countlist(&canvas->surfaces) - 1; + *max = BLI_listbase_count(&canvas->surfaces) - 1; } /* uvlayer */ diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index b57c3689d05..8ebeeafbc58 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -583,7 +583,7 @@ static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min Object *ob = (Object *)ptr->id.data; *min = 0; - *max = max_ii(0, BLI_countlist(&ob->defbase) - 1); + *max = max_ii(0, BLI_listbase_count(&ob->defbase) - 1); } void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index) @@ -736,7 +736,7 @@ static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int * { Object *ob = (Object *)ptr->id.data; *min = 0; - *max = max_ii(0, BLI_countlist(&ob->particlesystem) - 1); + *max = max_ii(0, BLI_listbase_count(&ob->particlesystem) - 1); } static int rna_Object_active_particle_system_index_get(PointerRNA *ptr) @@ -1241,7 +1241,7 @@ static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, i *min = 0; if (key) { - *max = BLI_countlist(&key->block) - 1; + *max = BLI_listbase_count(&key->block) - 1; if (*max < 0) *max = 0; } else { diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index 8da869417ff..cd28c608667 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -243,7 +243,7 @@ static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min, for (pid = pidlist.first; pid; pid = pid->next) { if (pid->cache == cache) { - *max = max_ii(0, BLI_countlist(pid->ptcaches) - 1); + *max = max_ii(0, BLI_listbase_count(pid->ptcaches) - 1); break; } } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 47d8263d71f..dd32bb189e2 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -892,7 +892,7 @@ static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *pt { ParticleSystem *psys = (ParticleSystem *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&psys->targets) - 1); + *max = max_ii(0, BLI_listbase_count(&psys->targets) - 1); } static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr) @@ -1015,7 +1015,7 @@ static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min { ParticleSettings *part = (ParticleSettings *)ptr->id.data; *min = 0; - *max = max_ii(0, BLI_countlist(&part->dupliweights) - 1); + *max = max_ii(0, BLI_listbase_count(&part->dupliweights) - 1); } static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index f9d0e86183e..f72f97b1681 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -421,7 +421,7 @@ static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, in bPose *pose = (ob) ? ob->pose : NULL; *min = 0; - *max = pose ? max_ii(0, BLI_countlist(&pose->agroups) - 1) : 0; + *max = pose ? max_ii(0, BLI_listbase_count(&pose->agroups) - 1) : 0; } static PointerRNA rna_Pose_active_bone_group_get(PointerRNA *ptr) @@ -454,7 +454,7 @@ static void rna_Pose_active_bone_group_index_range(PointerRNA *ptr, int *min, in bPose *pose = (bPose *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&pose->agroups) - 1); + *max = max_ii(0, BLI_listbase_count(&pose->agroups) - 1); } #if 0 diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 8f2537105c1..4f51ec5468c 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -984,7 +984,7 @@ static void rna_BlenderRNA_structs_begin(CollectionPropertyIterator *iter, Point /* optional, for faster lookups */ static int rna_BlenderRNA_structs_length(PointerRNA *ptr) { - return BLI_countlist(&((BlenderRNA *)ptr->data)->structs); + return BLI_listbase_count(&((BlenderRNA *)ptr->data)->structs); } static int rna_BlenderRNA_structs_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr) { diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 70ce87ab68b..519a52b04e2 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1063,7 +1063,7 @@ static int rna_RenderSettings_active_layer_index_get(PointerRNA *ptr) static void rna_RenderSettings_active_layer_index_set(PointerRNA *ptr, int value) { RenderData *rd = (RenderData *)ptr->data; - int num_layers = BLI_countlist(&rd->layers); + int num_layers = BLI_listbase_count(&rd->layers); rd->actlay = min_ff(value, num_layers - 1); } @@ -1073,7 +1073,7 @@ static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *mi RenderData *rd = (RenderData *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&rd->layers) - 1); + *max = max_ii(0, BLI_listbase_count(&rd->layers) - 1); } static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr) @@ -1228,7 +1228,7 @@ static char *rna_SceneRenderLayer_path(PointerRNA *ptr) static int rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) { - return (BLI_countlist(&R_engines) > 1); + return (BLI_listbase_count(&R_engines) > 1); } static int rna_RenderSettings_use_shading_nodes_get(PointerRNA *ptr) @@ -1485,7 +1485,7 @@ static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, cons ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0); if (ks) { - sce->active_keyingset = BLI_countlist(&sce->keyingsets); + sce->active_keyingset = BLI_listbase_count(&sce->keyingsets); return ks; } else { @@ -1645,7 +1645,7 @@ static void rna_FreestyleSettings_active_lineset_index_range(PointerRNA *ptr, in FreestyleConfig *config = (FreestyleConfig *)ptr->data; *min = 0; - *max = max_ii(0, BLI_countlist(&config->linesets) - 1); + *max = max_ii(0, BLI_listbase_count(&config->linesets) - 1); } static int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr) diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c index 838336a8f8a..5cb9feb4fac 100644 --- a/source/blender/modifiers/intern/MOD_mask.c +++ b/source/blender/modifiers/intern/MOD_mask.c @@ -150,7 +150,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, bDeformGroup *def; bool *bone_select_array; int bone_select_tot = 0; - const int defbase_tot = BLI_countlist(&ob->defbase); + const int defbase_tot = BLI_listbase_count(&ob->defbase); /* check that there is armature object with bones to use, otherwise return original mesh */ if (ELEM(NULL, oba, oba->pose, ob->defbase.first)) diff --git a/source/blender/nodes/composite/nodes/node_composite_outputFile.c b/source/blender/nodes/composite/nodes/node_composite_outputFile.c index 76101409ba7..57c39b082b4 100644 --- a/source/blender/nodes/composite/nodes/node_composite_outputFile.c +++ b/source/blender/nodes/composite/nodes/node_composite_outputFile.c @@ -140,7 +140,7 @@ int ntreeCompositOutputFileRemoveActiveSocket(bNodeTree *ntree, bNode *node) { NodeImageMultiFile *nimf = node->storage; bNodeSocket *sock = BLI_findlink(&node->inputs, nimf->active_input); - int totinputs = BLI_countlist(&node->inputs); + int totinputs = BLI_listbase_count(&node->inputs); if (!sock) return 0; diff --git a/source/blender/python/bmesh/bmesh_py_types_select.c b/source/blender/python/bmesh/bmesh_py_types_select.c index 3c72112e7ce..71ca8440962 100644 --- a/source/blender/python/bmesh/bmesh_py_types_select.c +++ b/source/blender/python/bmesh/bmesh_py_types_select.c @@ -165,7 +165,7 @@ static Py_ssize_t bpy_bmeditselseq_length(BPy_BMEditSelSeq *self) { BPY_BM_CHECK_INT(self); - return BLI_countlist(&self->bm->selected); + return BLI_listbase_count(&self->bm->selected); } static PyObject *bpy_bmeditselseq_subscript_int(BPy_BMEditSelSeq *self, int keynum) diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index b51de01103c..df848f6b60c 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -245,7 +245,7 @@ float BPY_driver_exec(ChannelDriver *driver, const float evaltime) expr_vars = PyTuple_GET_ITEM(((PyObject *)driver->expr_comp), 1); Py_XDECREF(expr_vars); - expr_vars = PyTuple_New(BLI_countlist(&driver->variables)); + expr_vars = PyTuple_New(BLI_listbase_count(&driver->variables)); PyTuple_SET_ITEM(((PyObject *)driver->expr_comp), 1, expr_vars); for (dvar = driver->variables.first, i = 0; dvar; dvar = dvar->next) { diff --git a/source/blender/python/intern/gpu.c b/source/blender/python/intern/gpu.c index 26e3bde57a3..1002293ee0a 100644 --- a/source/blender/python/intern/gpu.c +++ b/source/blender/python/intern/gpu.c @@ -200,7 +200,7 @@ static PyObject *GPU_export_shader(PyObject *UNUSED(self), PyObject *args, PyObj if (shader->vertex) { PY_DICT_ADD_STRING(result, shader, vertex); } - seq = PyList_New(BLI_countlist(&shader->uniforms)); + seq = PyList_New(BLI_listbase_count(&shader->uniforms)); for (i = 0, uniform = shader->uniforms.first; uniform; uniform = uniform->next, i++) { dict = PyDict_New(); PY_DICT_ADD_STRING(dict, uniform, varname); @@ -229,7 +229,7 @@ static PyObject *GPU_export_shader(PyObject *UNUSED(self), PyObject *args, PyObj PyDict_SetItemString(result, "uniforms", seq); Py_DECREF(seq); - seq = PyList_New(BLI_countlist(&shader->attributes)); + seq = PyList_New(BLI_listbase_count(&shader->attributes)); for (i = 0, attribute = shader->attributes.first; attribute; attribute = attribute->next, i++) { dict = PyDict_New(); PY_DICT_ADD_STRING(dict, attribute, varname); diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 46c504aaabf..803da070e15 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -1394,7 +1394,7 @@ void RE_makeRenderInstances(Render *re) int tot; /* convert list of object instances to an array for index based lookup */ - tot= BLI_countlist(&re->instancetable); + tot= BLI_listbase_count(&re->instancetable); re->objectinstance= MEM_callocN(sizeof(ObjectInstanceRen)*tot, "ObjectInstance"); re->totinstance= tot; newlist.first= newlist.last= NULL; diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index d05cc572c45..7222447ac55 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -155,7 +155,7 @@ void wm_operator_register(bContext *C, wmOperator *op) int tot; BLI_addtail(&wm->operators, op); - tot = BLI_countlist(&wm->operators); + tot = BLI_listbase_count(&wm->operators); while (tot > MAX_OP_REGISTERED) { wmOperator *opt = wm->operators.first; diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 87b64582e11..246d823ce90 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -1568,7 +1568,7 @@ static KX_GameObject *gameobject_from_blenderobject( gameobj->AddMesh(meshobj); // gather levels of detail - if (BLI_countlist(&ob->lodlevels) > 1) { + if (BLI_listbase_count(&ob->lodlevels) > 1) { LodLevel *lod = ((LodLevel*)ob->lodlevels.first)->next; Mesh* lodmesh = mesh; Object* lodmatob = ob; diff --git a/source/gameengine/Converter/BL_SkinDeformer.cpp b/source/gameengine/Converter/BL_SkinDeformer.cpp index e7137a5c379..bf5e3860e16 100644 --- a/source/gameengine/Converter/BL_SkinDeformer.cpp +++ b/source/gameengine/Converter/BL_SkinDeformer.cpp @@ -200,7 +200,7 @@ void BL_SkinDeformer::BGEDeformVerts() Object *par_arma = m_armobj->GetArmatureObject(); MDeformVert *dverts = m_bmesh->dvert; bDeformGroup *dg; - int defbase_tot = BLI_countlist(&m_objMesh->defbase); + int defbase_tot = BLI_listbase_count(&m_objMesh->defbase); Eigen::Matrix4f pre_mat, post_mat, chan_mat, norm_chan_mat; if (!dverts) -- cgit v1.2.3