Cleanup: rename list count_ex -> count_at_most
authorCampbell Barton <ideasman42@gmail.com>
Tue, 3 Apr 2018 15:05:21 +0000 (17:05 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 3 Apr 2018 15:05:21 +0000 (17:05 +0200)
19 files changed:
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/paint.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenlib/BLI_listbase.h
source/blender/blenlib/intern/listbase.c
source/blender/compositor/nodes/COM_ImageNode.cpp
source/blender/editors/armature/pose_transform.c
source/blender/editors/gpencil/gpencil_data.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/space_buttons/buttons_texture.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_image/image_ops.c
source/blender/editors/space_nla/nla_edit.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/render_result.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp

index 64f25cdcf534d218fa16ea674c1447b93d89ef2c..f0b9afa15faeda6d3ea267f49cae6a286bac866b 100644 (file)
@@ -2739,7 +2739,7 @@ void BKE_image_signal(Image *ima, ImageUser *iuser, int signal)
                        if (BKE_image_has_packedfile(ima)) {
                                const int totfiles = image_num_files(ima);
 
-                               if (totfiles != BLI_listbase_count_ex(&ima->packedfiles, totfiles + 1)) {
+                               if (totfiles != BLI_listbase_count_at_most(&ima->packedfiles, totfiles + 1)) {
                                        /* in case there are new available files to be loaded */
                                        image_free_packedfiles(ima);
                                        BKE_image_packfiles(NULL, ima, ID_BLEND_PATH(G.main, &ima->id));
@@ -2894,7 +2894,7 @@ void BKE_image_multiview_index(Image *ima, ImageUser *iuser)
                        iuser->multi_index = iuser->multiview_eye;
                }
                else {
-                       if ((iuser->view < 0) || (iuser->view >= BLI_listbase_count_ex(&ima->views, iuser->view + 1))) {
+                       if ((iuser->view < 0) || (iuser->view >= BLI_listbase_count_at_most(&ima->views, iuser->view + 1))) {
                                iuser->multi_index = iuser->view = 0;
                        }
                        else {
@@ -3361,7 +3361,7 @@ static ImBuf *image_load_movie_file(Image *ima, ImageUser *iuser, int frame)
        const int totfiles = image_num_files(ima);
        int i;
 
-       if (totfiles != BLI_listbase_count_ex(&ima->anims, totfiles + 1)) {
+       if (totfiles != BLI_listbase_count_at_most(&ima->anims, totfiles + 1)) {
                image_free_anims(ima);
 
                for (i = 0; i < totfiles; i++) {
@@ -3517,7 +3517,7 @@ static ImBuf *image_load_image_file(Image *ima, ImageUser *iuser, int cfra)
 
        /* this should never happen, but just playing safe */
        if (has_packed) {
-               if (totfiles != BLI_listbase_count_ex(&ima->packedfiles, totfiles + 1)) {
+               if (totfiles != BLI_listbase_count_at_most(&ima->packedfiles, totfiles + 1)) {
                        image_free_packedfiles(ima);
                        has_packed = false;
                }
index d0bf1bed4f4e615bd631d8b1d5da452ee5c15915..bee6e7d3df0129345299e1b3ab2fa6ad003f5c0a 100644 (file)
@@ -373,7 +373,7 @@ void BKE_paint_curve_clamp_endpoint_add_index(PaintCurve *pc, const int add_inde
 /* remove colour from palette. Must be certain color is inside the palette! */
 void BKE_palette_color_remove(Palette *palette, PaletteColor *color)
 {
-       if (BLI_listbase_count_ex(&palette->colors, palette->active_color) == palette->active_color) {
+       if (BLI_listbase_count_at_most(&palette->colors, palette->active_color) == palette->active_color) {
                palette->active_color--;
        }
 
index d7e0823360150c30c70e4e21d7ad3f6fabcb1cbb..04c365eee7620e94dc8685b97b0a392696fa122f 100644 (file)
@@ -3165,7 +3165,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
 
        psys->part = BKE_particlesettings_add(NULL, DATA_("ParticleSettings"));
 
-       if (BLI_listbase_count_ex(&ob->particlesystem, 2) > 1)
+       if (BLI_listbase_count_at_most(&ob->particlesystem, 2) > 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));
index 67a64ab14330152fd8924c28f4159aa94a803cd9..095a862119125296db55bbfaf506c43ac06abe7a 100644 (file)
@@ -2955,7 +2955,7 @@ static ImBuf *seq_render_movie_strip(const SeqRenderData *context, Sequence *seq
                int totviews;
                int i;
 
-               if (totfiles != BLI_listbase_count_ex(&seq->anims, totfiles + 1))
+               if (totfiles != BLI_listbase_count_at_most(&seq->anims, totfiles + 1))
                        goto monoview_movie;
 
                totviews = BKE_scene_multiview_num_views_get(&context->scene->r);
index 6be9408ac1eda70d5bfc8e24bf60c96ed2ea6ecf..c4ad5acfe4bf3a4bf73d17500109d910153413ad 100644 (file)
@@ -74,7 +74,7 @@ void BLI_listbase_sort(struct ListBase *listbase, int (*cmp)(const void *, const
 void BLI_listbase_sort_r(ListBase *listbase, int (*cmp)(void *, const void *, const void *), void *thunk) ATTR_NONNULL(1, 2);
 bool BLI_listbase_link_move(ListBase *listbase, void *vlink, int step) ATTR_NONNULL();
 void BLI_freelist(struct ListBase *listbase) ATTR_NONNULL(1);
-int  BLI_listbase_count_ex(const struct ListBase *listbase, const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1);
+int  BLI_listbase_count_at_most(const struct ListBase *listbase, const int count_max) 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);
 
index 96c3972d80214586e125c7e499d133a02ec1ef7a..b87fed571b783f37c543636d85d3c1e7825d60f9 100644 (file)
@@ -484,7 +484,7 @@ void BLI_freelistN(ListBase *listbase)
  *
  * \note Use to avoid redundant looping.
  */
-int BLI_listbase_count_ex(const ListBase *listbase, const int count_max)
+int BLI_listbase_count_at_most(const ListBase *listbase, const int count_max)
 {
        Link *link;
        int count = 0;
index 81891d853d23206126809b6872887bdf2a00a032..1399749fc8d2a02bc615cbcebfbfe461046a0cdc 100644 (file)
@@ -105,7 +105,7 @@ void ImageNode::convertToOperations(NodeConverter &converter, const CompositorCo
                                        }
 
                                        /* returns the image view to use for the current active view */
-                                       if (BLI_listbase_count_ex(&image->rr->views, 2) > 1) {
+                                       if (BLI_listbase_count_at_most(&image->rr->views, 2) > 1) {
                                                const int view_image = imageuser->view;
                                                const bool is_allview = (view_image == 0); /* if view selected == All (0) */
 
index 4feb16813492d1c7e86d9064c6e456f85a555c4c..a44accd1cea0e111c1269da9b6203f9db5133cb9 100644 (file)
@@ -525,7 +525,7 @@ static int pose_paste_exec(bContext *C, wmOperator *op)
                return OPERATOR_CANCELLED;
        }
        /* Make sure data from this file is usable for pose paste. */
-       if (BLI_listbase_count_ex(&tmp_bmain->object, 2) != 1) {
+       if (BLI_listbase_count_at_most(&tmp_bmain->object, 2) != 1) {
                BKE_report(op->reports, RPT_ERROR, "Copy buffer is not from pose mode");
                BKE_main_free(tmp_bmain);
                return OPERATOR_CANCELLED;
index fca9a2c10f2e13e0c8e993a1babfc78bf6607bb0..9d183222c2d1fc2ff981cf2442ef451720b75a1a 100644 (file)
@@ -1062,7 +1062,7 @@ static int gp_brush_remove_exec(bContext *C, wmOperator *op)
        if (ELEM(NULL, ts, brush))
                return OPERATOR_CANCELLED;
 
-       if (BLI_listbase_count_ex(&ts->gp_brushes, 2) < 2) {
+       if (BLI_listbase_count_at_most(&ts->gp_brushes, 2) < 2) {
                BKE_report(op->reports, RPT_ERROR, "Grease Pencil needs a brush, unable to delete the last one");
                return OPERATOR_CANCELLED;
        }
@@ -1420,7 +1420,7 @@ static int gp_palette_remove_exec(bContext *C, wmOperator *op)
        if (ELEM(NULL, gpd, palette))
                return OPERATOR_CANCELLED;
 
-       if (BLI_listbase_count_ex(&gpd->palettes, 2) < 2) {
+       if (BLI_listbase_count_at_most(&gpd->palettes, 2) < 2) {
                BKE_report(op->reports, RPT_ERROR, "Grease Pencil needs a palette, unable to delete the last one");
                return OPERATOR_CANCELLED;
        }
index 3ce9257de0c69ae625e55de792a24d2758568e93..874225e96a7b309d3e67263c4da03b88a42112c4 100644 (file)
@@ -857,7 +857,7 @@ static void knife_cut_face(KnifeTool_OpData *kcd, BMFace *f, ListBase *hits)
 {
        Ref *r;
 
-       if (BLI_listbase_count_ex(hits, 2) != 2)
+       if (BLI_listbase_count_at_most(hits, 2) != 2)
                return;
 
        for (r = hits->first; r->next; r = r->next) {
index 2a6d7ded94963a1fd8a4230c3d1da9aa51a4955f..350d43e2c517e698881cb824e5af1e98d568c577 100644 (file)
@@ -1119,7 +1119,7 @@ static bool bm_vert_connect_select_history(BMesh *bm)
         * - Otherwise connect faces.
         * - If all edges have been created already, closed the loop.
         */
-       if (BLI_listbase_count_ex(&bm->selected, 2) == 2 && (bm->totvertsel > 2)) {
+       if (BLI_listbase_count_at_most(&bm->selected, 2) == 2 && (bm->totvertsel > 2)) {
                BMEditSelection *ese;
                int tot = 0;
                bool changed = false;
index 3c48f3c11116e64294f8afc32448f3b952ca948d..49bd0794a517456850b6abf72e9fd9e368822a77 100644 (file)
@@ -470,7 +470,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_listbase_count_ex(&ct->users, ct->index + 1))
+               if (ct->index >= BLI_listbase_count_at_most(&ct->users, ct->index + 1))
                        ct->index = 0;
 
                ct->user = BLI_findlink(&ct->users, ct->index);
index 20f9658020d106dc58f8991443ddafbe926d9b9e..c105f40f1d6a2a2eed31a35eb28b58058051dd24 100644 (file)
@@ -762,7 +762,7 @@ static void uiblock_layer_pass_buttons(
                }
 
                /* view */
-               if (BLI_listbase_count_ex(&rr->views, 2) > 1 &&
+               if (BLI_listbase_count_at_most(&rr->views, 2) > 1 &&
                    ((!show_stereo) || (!RE_RenderResult_is_stereo(rr))))
                {
                        rview = BLI_findlink(&rr->views, iuser->view);
index c1586964b1f804829dcf6b6c5b108e7b78cb2d72..e14e782040361922b14abab72deb02906983e4a7 100644 (file)
@@ -1851,7 +1851,7 @@ static bool save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
                /* we need renderresult for exr and rendered multiview */
                scene = CTX_data_scene(C);
                rr = BKE_image_acquire_renderresult(scene, ima);
-               bool is_mono = rr ? BLI_listbase_count_ex(&rr->views, 2) < 2 : BLI_listbase_count_ex(&ima->views, 2) < 2;
+               bool is_mono = rr ? BLI_listbase_count_at_most(&rr->views, 2) < 2 : BLI_listbase_count_at_most(&ima->views, 2) < 2;
                bool is_exr_rr = rr && ELEM(imf->imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER) && RE_HasFloatPixels(rr);
 
                /* error handling */
index 87b7599ec6634edce19aca7155e27981ff8700ea..c86e9872c0a4e5a93c1f7f30d6d8787749c7eb19 100644 (file)
@@ -1501,7 +1501,7 @@ static int nlaedit_swap_exec(bContext *C, wmOperator *op)
                        NlaStrip *mstrip = (NlaStrip *)nlt->strips.first;
                        
                        if ((mstrip->flag & NLASTRIP_FLAG_TEMP_META) &&
-                           (BLI_listbase_count_ex(&mstrip->strips, 3) == 2))
+                           (BLI_listbase_count_at_most(&mstrip->strips, 3) == 2))
                        {
                                /* remove this temp meta, so that we can see the strips inside */
                                BKE_nlastrips_clear_metas(&nlt->strips, 0, 1);
index ccd16e16760ff2d5d46ca2e11a8109c7f343f17c..773ca307a8cc7a9263e901e149a790e771941f09 100644 (file)
@@ -2701,7 +2701,7 @@ static int rna_Node_image_has_views_get(PointerRNA *ptr)
 
        if (!ima || !(ima->rr)) return 0;
 
-       return BLI_listbase_count_ex(&ima->rr->views, 2) > 1;
+       return BLI_listbase_count_at_most(&ima->rr->views, 2) > 1;
 }
 
 static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv)
index e17a503cd4ec4b1324a59779b62ccb9cfff86558..201e11aca771430a8d444d7bbcc3d649c6fe6328 100644 (file)
@@ -3349,7 +3349,7 @@ bool RE_WriteRenderViewsImage(ReportList *reports, RenderResult *rr, Scene *scen
        if (!rr)
                return false;
 
-       bool is_mono = BLI_listbase_count_ex(&rr->views, 2) < 2;
+       bool is_mono = BLI_listbase_count_at_most(&rr->views, 2) < 2;
        bool is_exr_rr = ELEM(rd->im_format.imtype, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER) &&
                         RE_HasFloatPixels(rr);
 
@@ -3466,7 +3466,7 @@ bool RE_WriteRenderViewsMovie(
        if (!rr)
                return false;
 
-       is_mono = BLI_listbase_count_ex(&rr->views, 2) < 2;
+       is_mono = BLI_listbase_count_at_most(&rr->views, 2) < 2;
 
        if (is_mono || (scene->r.im_format.views_format == R_IMF_VIEWS_INDIVIDUAL)) {
                int view_id;
@@ -4067,7 +4067,7 @@ bool RE_WriteEnvmapResult(struct ReportList *reports, Scene *scene, EnvMap *env,
 /* Used in the interface to decide whether to show layers or passes. */
 bool RE_layers_have_name(struct RenderResult *rr)
 {
-       switch (BLI_listbase_count_ex(&rr->layers, 2)) {
+       switch (BLI_listbase_count_at_most(&rr->layers, 2)) {
                case 0:
                        return false;
                case 1:
index 542c737348b817640f02dee1faeb7470c1773fd2..25377fb4f7e5badaf1982140414f7fe018112513 100644 (file)
@@ -753,7 +753,7 @@ void render_result_views_new(RenderResult *rr, RenderData *rd)
        }
 
        /* we always need at least one view */
-       if (BLI_listbase_count_ex(&rr->views, 1) == 0) {
+       if (BLI_listbase_count_at_most(&rr->views, 1) == 0) {
                render_result_view_new(rr, "");
        }
 }
index 8ba39e288cae329711a5bd4aec6592efe9253764..a12437befaa49dd69d67e859cc23a4db69d26f30 100644 (file)
@@ -1540,7 +1540,7 @@ static KX_GameObject *gameobject_from_blenderobject(
                gameobj->AddMesh(meshobj);
 
                // gather levels of detail
-               if (BLI_listbase_count_ex(&ob->lodlevels, 2) > 1) {
+               if (BLI_listbase_count_at_most(&ob->lodlevels, 2) > 1) {
                        LodLevel *lod = ((LodLevel*)ob->lodlevels.first)->next;
                        Mesh* lodmesh = mesh;
                        Object* lodmatob = ob;