Cleanup: use _BEGIN suffix for group iterators
authorCampbell Barton <ideasman42@gmail.com>
Wed, 7 Mar 2018 09:46:27 +0000 (20:46 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 7 Mar 2018 09:46:27 +0000 (20:46 +1100)
17 files changed:
source/blender/blenkernel/BKE_group.h
source/blender/blenkernel/intern/collision.c
source/blender/blenkernel/intern/group.c
source/blender/blenkernel/intern/library_query.c
source/blender/blenkernel/intern/object_dupli.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/rigidbody.c
source/blender/blenkernel/intern/scene.c
source/blender/blenloader/intern/writefile.c
source/blender/collada/SceneExporter.cpp
source/blender/editors/object/object_relations.c
source/blender/editors/space_outliner/outliner_select.c
source/blender/editors/space_outliner/outliner_tools.c
source/blender/editors/space_view3d/view3d_ops.c
source/blender/render/intern/source/convertblender.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Ketsji/KX_Scene.cpp

index 74255cfc94169a25d02dabff29e2a5755d41dc40..6f7ced403a23a2fed160bc15ba88cd7e35b690d5 100644 (file)
@@ -62,7 +62,7 @@ void BKE_group_eval_view_layers(const struct EvaluationContext *eval_ctx,
 
 /* Helper macros. */
 
-#define FOREACH_GROUP_BASE(_group, _base)                         \
+#define FOREACH_GROUP_BASE_BEGIN(_group, _base)                   \
        for (Base *_base = (Base *)(_group)->view_layer->object_bases.first; \
             _base;                                                   \
             _base = _base->next)                                     \
@@ -71,7 +71,7 @@ void BKE_group_eval_view_layers(const struct EvaluationContext *eval_ctx,
 #define FOREACH_GROUP_BASE_END                                    \
        }
 
-#define FOREACH_GROUP_OBJECT(_group, _object)                     \
+#define FOREACH_GROUP_OBJECT_BEGIN(_group, _object)               \
        for (Base *_base = (Base *)(_group)->view_layer->object_bases.first; \
             _base;                                                   \
             _base = _base->next)                                     \
index 21945f07a10de67bef15e584966c8c1ebe619090..55ded96fe0134e158fe4e6665a7e19464366f67f 100644 (file)
@@ -506,7 +506,7 @@ static void add_collision_object(Object ***objs, unsigned int *numobj, unsigned
                Group *group= ob->dup_group;
 
                /* add objects */
-               FOREACH_GROUP_OBJECT(group, object)
+               FOREACH_GROUP_OBJECT_BEGIN(group, object)
                {
                        add_collision_object(objs, numobj, maxobj, object, self, level+1, modifier_type);
                }
@@ -527,7 +527,7 @@ Object **get_collisionobjects_ext(Scene *scene, Object *self, Group *group, unsi
        /* gather all collision objects */
        if (group) {
                /* use specified group */
-               FOREACH_GROUP_OBJECT(group, object)
+               FOREACH_GROUP_OBJECT_BEGIN(group, object)
                {
                        add_collision_object(&objs, &numobj, &maxobj, object, self, level, modifier_type);
                }
@@ -584,7 +584,7 @@ static void add_collider_cache_object(ListBase **objs, Object *ob, Object *self,
                Group *group= ob->dup_group;
 
                /* add objects */
-               FOREACH_GROUP_OBJECT(group, object)
+               FOREACH_GROUP_OBJECT_BEGIN(group, object)
                {
                        add_collider_cache_object(objs, object, self, level+1);
                }
@@ -598,7 +598,7 @@ ListBase *get_collider_cache(Scene *scene, Object *self, Group *group)
        
        /* add object in same layer in scene */
        if (group) {
-               FOREACH_GROUP_OBJECT(group, object)
+               FOREACH_GROUP_OBJECT_BEGIN(group, object)
                {
                        add_collider_cache_object(&objs, object, self, 0);
                }
index 8fa8da8b0ca1d955a9371fc402e4806e9e360bb1..c5cea750b53250703041f2e3f7eaec4577bb4efe 100644 (file)
@@ -213,7 +213,7 @@ static bool group_object_cyclic_check_internal(Object *object, Group *group)
                if (dup_group == group)
                        return true;
                else {
-                       FOREACH_GROUP_OBJECT(dup_group, group_object)
+                       FOREACH_GROUP_OBJECT_BEGIN(dup_group, group_object)
                        {
                                if (group_object_cyclic_check_internal(group_object, dup_group)) {
                                        return true;
@@ -278,7 +278,7 @@ Group *BKE_group_object_find(Group *group, Object *ob)
 
 bool BKE_group_is_animated(Group *group, Object *UNUSED(parent))
 {
-       FOREACH_GROUP_OBJECT(group, object)
+       FOREACH_GROUP_OBJECT_BEGIN(group, object)
        {
                if (object->proxy) {
                        return true;
@@ -369,7 +369,7 @@ void BKE_group_handle_recalc_and_update(const struct EvaluationContext *eval_ctx
 #endif
        {
                /* only do existing tags, as set by regular depsgraph */
-               FOREACH_GROUP_OBJECT(group, object)
+               FOREACH_GROUP_OBJECT_BEGIN(group, object)
                {
                        if (object->id.recalc & ID_RECALC_ALL) {
                                BKE_object_handle_update(eval_ctx, scene, object);
index e49c691448b81700a9abc84e32bee0336807b98a..2a5c8f955ab8128a0724ce2afc272d79a06d4ce7 100644 (file)
@@ -765,7 +765,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
                        case ID_GR:
                        {
                                Group *group = (Group *) id;
-                               FOREACH_GROUP_BASE(group, base)
+                               FOREACH_GROUP_BASE_BEGIN(group, base)
                                {
                                        CALLBACK_INVOKE(base->object, IDWALK_CB_USER_ONE);
                                }
index 2d655913b3e447bb7d1a00fa75601c464ed5a82a..391be751ae0d559e6d1e56f4f791d202254e1a68 100644 (file)
@@ -246,7 +246,7 @@ static void make_child_duplis(const DupliContext *ctx, void *userdata, MakeChild
 
        if (ctx->group) {
                int groupid = 0;
-               FOREACH_GROUP_BASE(ctx->group, base)
+               FOREACH_GROUP_BASE_BEGIN(ctx->group, base)
                {
                        Object *ob = base->object;
                        if ((base->flag & BASE_VISIBLED) && ob != ctx->obedit && is_child(ob, parent)) {
@@ -932,7 +932,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
                                        totgroup += dw->count;
                        }
                        else {
-                               FOREACH_GROUP_OBJECT(part->dup_group, object)
+                               FOREACH_GROUP_OBJECT_BEGIN(part->dup_group, object)
                                {
                                        (void) object;
                                        totgroup++;
@@ -957,7 +957,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
                        }
                        else {
                                a = 0;
-                               FOREACH_GROUP_OBJECT(part->dup_group, object)
+                               FOREACH_GROUP_OBJECT_BEGIN(part->dup_group, object)
                                {
                                        oblist[a] = object;
                                        obcopylist[a] = *object;
@@ -1057,7 +1057,7 @@ static void make_duplis_particle_system(const DupliContext *ctx, ParticleSystem
 
                        if (part->ren_as == PART_DRAW_GR && psys->part->draw & PART_DRAW_WHOLE_GR) {
                                b = 0;
-                               FOREACH_GROUP_OBJECT(part->dup_group, object)
+                               FOREACH_GROUP_OBJECT_BEGIN(part->dup_group, object)
                                {
                                        copy_m4_m4(tmat, oblist[b]->obmat);
 
index c9507ac1a363d9eeac0019554ccd45234dd623f6..e90fa299f44b918065d45f3670c06998df1f09da 100644 (file)
@@ -351,7 +351,7 @@ void psys_check_group_weights(ParticleSettings *part)
                }
 
                /* then add objects in the group to new list */
-               FOREACH_GROUP_OBJECT(part->dup_group, object)
+               FOREACH_GROUP_OBJECT_BEGIN(part->dup_group, object)
                {
                        dw = part->dupliweights.first;
                        while (dw && dw->ob != object) {
index 011971b6677fdd918636e79eee44157ea384ef59..d61cb0c9369048bad2de2b2a09abc1cbd1769dc2 100644 (file)
@@ -92,7 +92,7 @@ void BKE_rigidbody_free_world(RigidBodyWorld *rbw)
        if (rbw->physics_world) {
                /* free physics references, we assume that all physics objects in will have been added to the world */
                if (rbw->constraints) {
-                       FOREACH_GROUP_OBJECT(rbw->constraints, object)
+                       FOREACH_GROUP_OBJECT_BEGIN(rbw->constraints, object)
                        {
                                if (object->rigidbody_constraint) {
                                        RigidBodyCon *rbc = object->rigidbody_constraint;
@@ -105,7 +105,7 @@ void BKE_rigidbody_free_world(RigidBodyWorld *rbw)
                }
 
                if (rbw->group) {
-                       FOREACH_GROUP_OBJECT(rbw->group, object)
+                       FOREACH_GROUP_OBJECT_BEGIN(rbw->group, object)
                        {
                                if (object->rigidbody_object) {
                                        RigidBodyOb *rbo = object->rigidbody_object;
@@ -1148,7 +1148,7 @@ void BKE_rigidbody_remove_object(Scene *scene, Object *ob)
 
                /* remove object from rigid body constraints */
                if (rbw->constraints) {
-                       FOREACH_GROUP_OBJECT(rbw->constraints, obt)
+                       FOREACH_GROUP_OBJECT_BEGIN(rbw->constraints, obt)
                        {
                                if (obt && obt->rigidbody_constraint) {
                                        rbc = obt->rigidbody_constraint;
@@ -1201,7 +1201,7 @@ static void rigidbody_update_ob_array(RigidBodyWorld *rbw)
        }
 
        i = 0;
-       FOREACH_GROUP_OBJECT(rbw->group, object)
+       FOREACH_GROUP_OBJECT_BEGIN(rbw->group, object)
        {
                rbw->objects[i] = object;
                i++;
@@ -1332,7 +1332,7 @@ static void rigidbody_update_simulation(const struct EvaluationContext *eval_ctx
         * Memory management needs redesign here, this is just a dirty workaround.
         */
        if (rebuild && rbw->constraints) {
-               FOREACH_GROUP_OBJECT(rbw->constraints, ob)
+               FOREACH_GROUP_OBJECT_BEGIN(rbw->constraints, ob)
                {
                        RigidBodyCon *rbc = ob->rigidbody_constraint;
                        if (rbc && rbc->physics_constraint) {
@@ -1345,7 +1345,7 @@ static void rigidbody_update_simulation(const struct EvaluationContext *eval_ctx
        }
 
        /* update objects */
-       FOREACH_GROUP_OBJECT(rbw->group, ob)
+       FOREACH_GROUP_OBJECT_BEGIN(rbw->group, ob)
        {
                if (ob->type == OB_MESH) {
                        /* validate that we've got valid object set up here... */
@@ -1394,7 +1394,7 @@ static void rigidbody_update_simulation(const struct EvaluationContext *eval_ctx
        if (rbw->constraints == NULL) /* no constraints, move on */
                return;
 
-       FOREACH_GROUP_OBJECT(rbw->constraints, ob)
+       FOREACH_GROUP_OBJECT_BEGIN(rbw->constraints, ob)
        {
                /* validate that we've got valid object set up here... */
                RigidBodyCon *rbc = ob->rigidbody_constraint;
@@ -1427,7 +1427,7 @@ static void rigidbody_update_simulation(const struct EvaluationContext *eval_ctx
 
 static void rigidbody_update_simulation_post_step(RigidBodyWorld *rbw)
 {
-       FOREACH_GROUP_BASE(rbw->group, base)
+       FOREACH_GROUP_BASE_BEGIN(rbw->group, base)
        {
                Object *ob = base->object;
                RigidBodyOb *rbo = ob->rigidbody_object;
index 512ce79e21ca1bb157390b1b641b9d8e030bcb79..9a570ad0e46cf25a8a5716636ffad0575b0b384a 100644 (file)
@@ -961,7 +961,7 @@ void BKE_scene_set_background(Main *bmain, Scene *scene)
 
        /* group flags again */
        for (group = bmain->group.first; group; group = group->id.next) {
-               FOREACH_GROUP_OBJECT(group, object)
+               FOREACH_GROUP_OBJECT_BEGIN(group, object)
                {
                        object->flag |= OB_FROMGROUP;
                }
index c09b6d627ff50cbd3a422c7fc1fcbcf760ccc899..50fd2a075f01725bcd1fa24316bc1bebee20c12e 100644 (file)
@@ -1346,7 +1346,7 @@ static void write_particlesettings(WriteData *wd, ParticleSettings *part)
                        if (dw->ob != NULL) {
                                dw->index = 0;
                                if (part->dup_group) { /* can be NULL if lining fails or set to None */
-                                       FOREACH_GROUP_OBJECT(part->dup_group, object)
+                                       FOREACH_GROUP_OBJECT_BEGIN(part->dup_group, object)
                                        {
                                                if (object != dw->ob) {
                                                        dw->index++;
index 3a6386a87213f764262ca043a523ca758ec63a43..d1d0152e69a89405d92e565cc07379c9629b2cfe 100644 (file)
@@ -175,7 +175,7 @@ void SceneExporter::writeNodes(const EvaluationContext *eval_ctx, Object *ob, Sc
                if ((ob->transflag & OB_DUPLIGROUP) == OB_DUPLIGROUP && ob->dup_group) {
                        Group *group = ob->dup_group;
                        /* printf("group detected '%s'\n", group->id.name + 2); */
-                       FOREACH_GROUP_OBJECT(group, object)
+                       FOREACH_GROUP_OBJECT_BEGIN(group, object)
                        {
                                printf("\t%s\n", object->id.name);
                        }
index 32753c91a042bcf0e1c01acc4006b8b3e47fafeb..3575601973d653c08c3a4a0aa3aa96d32047e5c6 100644 (file)
@@ -400,7 +400,7 @@ static const EnumPropertyItem *proxy_group_object_itemf(bContext *C, PointerRNA
                return DummyRNA_DEFAULT_items;
 
        /* find the object to affect */
-       FOREACH_GROUP_OBJECT(ob->dup_group, object)
+       FOREACH_GROUP_OBJECT_BEGIN(ob->dup_group, object)
        {
                item_tmp.identifier = item_tmp.name = object->id.name + 2;
                item_tmp.value = i++;
@@ -1710,7 +1710,7 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
                if (copy_groups && group->view_layer->object_bases.first) {
                        bool all_duplicated = true;
 
-                       FOREACH_GROUP_OBJECT(group, object)
+                       FOREACH_GROUP_OBJECT_BEGIN(group, object)
                        {
                                if (object->id.newid == NULL) {
                                        all_duplicated = false;
@@ -1722,7 +1722,7 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in
                        if (all_duplicated) {
                                groupn = ID_NEW_SET(group, BKE_group_copy(bmain, group));
 
-                               FOREACH_GROUP_BASE(groupn, base)
+                               FOREACH_GROUP_BASE_BEGIN(groupn, base)
                                {
                                        base->object = (Object *)base->object->id.newid;
                                }
@@ -2425,7 +2425,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op)
                /* Then, we tag our 'main' object and its detected dependencies to be also overridden. */
                obact->id.tag |= LIB_TAG_DOIT;
 
-               FOREACH_GROUP_OBJECT(obgroup->dup_group, ob)
+               FOREACH_GROUP_OBJECT_BEGIN(obgroup->dup_group, ob)
                {
                        make_override_static_tag_object(obact, ob);
                }
index 16f3aeaf110dd0f2c203fa2cb6610d31e94d6836..29f5445a7a04f77457570c97023c6e6f1317ec56 100644 (file)
@@ -924,7 +924,7 @@ static void do_outliner_item_activate_tree_element(
 
                        if (extend) {
                                int sel = BA_SELECT;
-                               FOREACH_GROUP_BASE(gr, base)
+                               FOREACH_GROUP_BASE_BEGIN(gr, base)
                                {
                                        if (base->flag & BASE_SELECTED) {
                                                sel = BA_DESELECT;
@@ -933,7 +933,7 @@ static void do_outliner_item_activate_tree_element(
                                }
                                FOREACH_GROUP_BASE_END
 
-                               FOREACH_GROUP_OBJECT(gr, object)
+                               FOREACH_GROUP_OBJECT_BEGIN(gr, object)
                                {
                                        ED_object_base_select(BKE_view_layer_base_find(view_layer, object), sel);
                                }
@@ -942,7 +942,7 @@ static void do_outliner_item_activate_tree_element(
                        else {
                                BKE_view_layer_base_deselect_all(view_layer);
 
-                               FOREACH_GROUP_OBJECT(gr, object)
+                               FOREACH_GROUP_OBJECT_BEGIN(gr, object)
                                {
                                        Base *base = BKE_view_layer_base_find(view_layer, object);
                                        /* Object may not be in this scene */
index b97046d147000944a974ddd3b241a7caf7d6c3ee..4dbc7ac47ef959a7d83c8ab97b8179f3b89bd55f 100644 (file)
@@ -541,7 +541,7 @@ static void group_linkobs2scene_cb(
        Group *group = (Group *)tselem->id;
        Base *base;
 
-       FOREACH_GROUP_OBJECT(group, object)
+       FOREACH_GROUP_OBJECT_BEGIN(group, object)
        {
                base = BKE_view_layer_base_find(view_layer, object);
                if (!base) {
index 79fa9e14dc146b39f4751c13e635973bf46ddfc4..5ab0ac9464df4d5f3aaea5c4c02e5fafc7c0028b 100644 (file)
@@ -82,7 +82,7 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op)
        CTX_DATA_END;
 
        for (Group *group = bmain->group.first; group; group = group->id.next) {
-               FOREACH_GROUP_OBJECT(group, object)
+               FOREACH_GROUP_OBJECT_BEGIN(group, object)
                {
                        if (object && (object->id.tag & LIB_TAG_DOIT)) {
                                BKE_copybuffer_tag_ID(&group->id);
index 6727844d0a88f6a85b59b5fcc317f3de1d7e6ad8..5edf2a2277ca4161b6f8dd69f6ac79f7031a02c9 100644 (file)
@@ -3988,7 +3988,7 @@ static void add_lightgroup(Render *re, Group *group, int exclusive)
 #if 0
        /* it's a bit too many loops in loops... but will survive */
        /* note that 'exclusive' will remove it from the global list */
-       FOREACH_GROUP_BASE(group, base)
+       FOREACH_GROUP_BASE_BEGIN(group, base)
        {
                Object *object = base->object;
 
@@ -4946,7 +4946,7 @@ static void dupli_render_particle_set(const EvaluationContext *eval_ctx, Render
 
        if (ob->dup_group == NULL) return;
 
-       FOREACH_GROUP_OBJECT(ob->dup_group, object)
+       FOREACH_GROUP_OBJECT_BEGIN(ob->dup_group, object)
        {
                dupli_render_particle_set(eval_ctx, re, object, timeoffset, level+1, enable);
        }
@@ -4966,7 +4966,7 @@ static void add_group_render_dupli_obs(const EvaluationContext *eval_ctx, Render
 
        /* Recursively go into dupligroups to find objects with OB_RENDER_DUPLI
         * that were not created yet. */
-       FOREACH_GROUP_OBJECT(group, ob)
+       FOREACH_GROUP_OBJECT_BEGIN(group, ob)
        {
                if (ob->flag & OB_DONE) {
                        if (ob->transflag & OB_RENDER_DUPLI) {
index dda1864f07c86ded4f046bd97d5171d11ce9aa8d..ffaad615df24834cd37a73e3bebccf007aa5c39a 100644 (file)
@@ -2059,7 +2059,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie,
                        for (git=tempglist.begin(); git!=tempglist.end(); git++)
                        {
                                Group* group = *git;
-                               FOREACH_GROUP_OBJECT(group, blenderobject)
+                               FOREACH_GROUP_OBJECT_BEGIN(group, blenderobject)
                                {
                                        if (converter->FindGameObject(blenderobject) == NULL)
                                        {
index 48b50d24975344f2c9131e479e34ffc0d8e6a4d1..a521bc0c942a205cc4fd96ac2e4455d1b0ddb25a 100644 (file)
@@ -738,7 +738,7 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level)
        m_groupGameObjects.clear();
 
        group = blgroupobj->dup_group;
-       FOREACH_GROUP_BASE(group, base)
+       FOREACH_GROUP_BASE_BEGIN(group, base)
        {
                Object *blenderobj = base->object;
                if (blgroupobj == blenderobj)