Cleanup: name macros w/ matching BEGIN/END
authorCampbell Barton <ideasman42@gmail.com>
Fri, 30 Nov 2018 04:08:47 +0000 (15:08 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 30 Nov 2018 04:08:47 +0000 (15:08 +1100)
15 files changed:
source/blender/blenkernel/BKE_fcurve.h
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/fcurve.c
source/blender/blenkernel/intern/library_query.c
source/blender/blenkernel/intern/object.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/versioning_270.c
source/blender/blenloader/intern/writefile.c
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/editors/animation/anim_filter.c
source/blender/editors/armature/armature_relations.c
source/blender/editors/space_outliner/outliner_tree.c
source/gameengine/Converter/BL_ShapeDeformer.cpp

index 055a3d40aba276e3ade722bbec749081beaf18b9..f8ba646fd5743e61da839f87c878dc0f66d72bc2 100644 (file)
@@ -72,14 +72,14 @@ void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple *bezt);
  */
 
 /* convenience looper over ALL driver targets for a given variable (even the unused ones) */
-#define DRIVER_TARGETS_LOOPER(dvar) \
+#define DRIVER_TARGETS_LOOPER_BEGIN(dvar) \
        { \
                DriverTarget *dtar = &dvar->targets[0]; \
                int tarIndex = 0; \
                for (; tarIndex < MAX_DRIVER_TARGETS; tarIndex++, dtar++)
 
 /* convenience looper over USED driver targets only */
-#define DRIVER_TARGETS_USED_LOOPER(dvar) \
+#define DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar) \
        { \
                DriverTarget *dtar = &dvar->targets[0]; \
                int tarIndex = 0; \
@@ -87,7 +87,7 @@ void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple *bezt);
 
 /* tidy up for driver targets loopers */
 #define DRIVER_TARGETS_LOOPER_END \
-}
+} ((void)0)
 
 /* ---------------------- */
 
index b17bc70c51a7ed3bb33ba20d930f8942d460cfd4..500ece2a7357a02f304e3dd45057b0443d5860ad 100644 (file)
@@ -389,13 +389,13 @@ void BKE_animdata_merge_copy(
                                DriverVar *dvar;
 
                                for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
-                                       DRIVER_TARGETS_USED_LOOPER(dvar)
+                                       DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                                        {
                                                if (dtar->id == src_id) {
                                                        dtar->id = dst_id;
                                                }
                                        }
-                                       DRIVER_TARGETS_LOOPER_END
+                                       DRIVER_TARGETS_LOOPER_END;
                                }
                        }
                }
@@ -766,7 +766,7 @@ static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix
                        /* driver variables */
                        for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
                                /* only change the used targets, since the others will need fixing manually anyway */
-                               DRIVER_TARGETS_USED_LOOPER(dvar)
+                               DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                                {
                                        /* rename RNA path */
                                        if (dtar->rna_path && dtar->id)
@@ -781,7 +781,7 @@ static void drivers_path_rename_fix(ID *owner_id, ID *ref_id, const char *prefix
                                                }
                                        }
                                }
-                               DRIVER_TARGETS_LOOPER_END
+                               DRIVER_TARGETS_LOOPER_END;
                        }
                }
        }
index 734aac8a1f7649c85b10dad0e9201319c34dfb49..15d08f5a230f4dbff142ea417006e441e364a113 100644 (file)
@@ -343,7 +343,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
                /* loop over variables to get the target relationships */
                for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
                        /* only used targets */
-                       DRIVER_TARGETS_USED_LOOPER(dvar)
+                       DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                        {
                                if (dtar->id) {
                                        /* FIXME: other data types need to be added here so that they can work! */
@@ -369,7 +369,7 @@ static void dag_add_driver_relation(AnimData *adt, DagForest *dag, DagNode *node
                                        }
                                }
                        }
-                       DRIVER_TARGETS_LOOPER_END
+                       DRIVER_TARGETS_LOOPER_END;
                }
        }
 }
index d4e69ad06ac8d3fb743d5755fa19ccd486782d3c..877f1c13da999c349ec3c0e53a76bd2a98bb89f7 100644 (file)
@@ -1317,7 +1317,7 @@ static short driver_check_valid_targets(ChannelDriver *driver, DriverVar *dvar)
 {
        short valid_targets = 0;
 
-       DRIVER_TARGETS_USED_LOOPER(dvar)
+       DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
        {
                Object *ob = (Object *)dtar_id_ensure_proxy_from(dtar->id);
 
@@ -1333,7 +1333,7 @@ static short driver_check_valid_targets(ChannelDriver *driver, DriverVar *dvar)
                        valid_targets++;
                }
        }
-       DRIVER_TARGETS_LOOPER_END
+       DRIVER_TARGETS_LOOPER_END;
 
        return valid_targets;
 }
@@ -1420,7 +1420,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
 
        /* SECOND PASS: get two location values */
        /* NOTE: for now, these are all just worldspace */
-       DRIVER_TARGETS_USED_LOOPER(dvar)
+       DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
        {
                /* get pointer to loc values to store in */
                Object *ob = (Object *)dtar_id_ensure_proxy_from(dtar->id);
@@ -1491,7 +1491,7 @@ static float dvar_eval_locDiff(ChannelDriver *driver, DriverVar *dvar)
                        copy_v3_v3(loc1, tmp_loc);
                }
        }
-       DRIVER_TARGETS_LOOPER_END
+       DRIVER_TARGETS_LOOPER_END;
 
 
        /* if we're still here, there should now be two targets to use,
@@ -1676,13 +1676,13 @@ void driver_free_variable(ListBase *variables, DriverVar *dvar)
         *   currently, since there may be some lingering RNA paths from
         *   previous users needing freeing
         */
-       DRIVER_TARGETS_LOOPER(dvar)
+       DRIVER_TARGETS_LOOPER_BEGIN(dvar)
        {
                /* free RNA path if applicable */
                if (dtar->rna_path)
                        MEM_freeN(dtar->rna_path);
        }
-       DRIVER_TARGETS_LOOPER_END
+       DRIVER_TARGETS_LOOPER_END;
 
        /* remove the variable from the driver */
        BLI_freelinkN(variables, dvar);
@@ -1709,13 +1709,13 @@ void driver_variables_copy(ListBase *dst_vars, const ListBase *src_vars)
 
        for (DriverVar *dvar = dst_vars->first; dvar; dvar = dvar->next) {
                /* need to go over all targets so that we don't leave any dangling paths */
-               DRIVER_TARGETS_LOOPER(dvar)
+               DRIVER_TARGETS_LOOPER_BEGIN(dvar)
                {
                        /* make a copy of target's rna path if available */
                        if (dtar->rna_path)
                                dtar->rna_path = MEM_dupallocN(dtar->rna_path);
                }
-               DRIVER_TARGETS_LOOPER_END
+               DRIVER_TARGETS_LOOPER_END;
        }
 }
 
@@ -1735,7 +1735,7 @@ void driver_change_variable_type(DriverVar *dvar, int type)
        /* make changes to the targets based on the defines for these types
         * NOTE: only need to make sure the ones we're using here are valid...
         */
-       DRIVER_TARGETS_USED_LOOPER(dvar)
+       DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
        {
                short flags = dvti->target_flags[tarIndex];
 
@@ -1746,7 +1746,7 @@ void driver_change_variable_type(DriverVar *dvar, int type)
                if ((flags & DTAR_FLAG_ID_OB_ONLY) || (dtar->idtype == 0))
                        dtar->idtype = ID_OB;
        }
-       DRIVER_TARGETS_LOOPER_END
+       DRIVER_TARGETS_LOOPER_END;
 }
 
 /* Validate driver name (after being renamed) */
index d59658a2a078e271ec65a816b5d80a093783d2b4..3292f0d6640a4af7cdefecc444245d732e3227e2 100644 (file)
@@ -265,11 +265,11 @@ static void library_foreach_animationData(LibraryForeachIDData *data, AnimData *
 
                for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
                        /* only used targets */
-                       DRIVER_TARGETS_USED_LOOPER(dvar)
+                       DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                        {
                                FOREACH_CALLBACK_INVOKE_ID(data, dtar->id, IDWALK_CB_NOP);
                        }
-                       DRIVER_TARGETS_LOOPER_END
+                       DRIVER_TARGETS_LOOPER_END;
                }
        }
 
index add7c1fd992142de301fe26f20fa07b2daa0290e..82c86747af8d31e824c2cf2df1fce3764f7689fc 100644 (file)
@@ -1303,7 +1303,7 @@ void BKE_object_copy_proxy_drivers(Object *ob, Object *target)
 
                        for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
                                /* all drivers */
-                               DRIVER_TARGETS_LOOPER(dvar)
+                               DRIVER_TARGETS_LOOPER_BEGIN(dvar)
                                {
                                        if (dtar->id) {
                                                if ((Object *)dtar->id == target)
@@ -1317,7 +1317,7 @@ void BKE_object_copy_proxy_drivers(Object *ob, Object *target)
                                                }
                                        }
                                }
-                               DRIVER_TARGETS_LOOPER_END
+                               DRIVER_TARGETS_LOOPER_END;
                        }
                }
        }
index 2e07143c5239e4b1162f0647ad23338d3cd57cfd..d689b871a642b57bc7cf61abed4bdf274b482004 100644 (file)
@@ -2462,7 +2462,7 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list)
                        DriverVar *dvar;
 
                        for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
-                               DRIVER_TARGETS_LOOPER(dvar)
+                               DRIVER_TARGETS_LOOPER_BEGIN(dvar)
                                {
                                        /* only relink if still used */
                                        if (tarIndex < dvar->num_targets)
@@ -2470,7 +2470,7 @@ static void lib_link_fcurves(FileData *fd, ID *id, ListBase *list)
                                        else
                                                dtar->id = NULL;
                                }
-                               DRIVER_TARGETS_LOOPER_END
+                               DRIVER_TARGETS_LOOPER_END;
                        }
                }
 
@@ -2564,7 +2564,7 @@ static void direct_link_fcurves(FileData *fd, ListBase *list)
                        /* relink variables, targets and their paths */
                        link_list(fd, &driver->variables);
                        for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
-                               DRIVER_TARGETS_LOOPER(dvar)
+                               DRIVER_TARGETS_LOOPER_BEGIN(dvar)
                                {
                                        /* only relink the targets being used */
                                        if (tarIndex < dvar->num_targets)
@@ -2572,7 +2572,7 @@ static void direct_link_fcurves(FileData *fd, ListBase *list)
                                        else
                                                dtar->rna_path = NULL;
                                }
-                               DRIVER_TARGETS_LOOPER_END
+                               DRIVER_TARGETS_LOOPER_END;
                        }
                }
 
@@ -9082,12 +9082,12 @@ static void expand_fcurves(FileData *fd, Main *mainvar, ListBase *list)
                        DriverVar *dvar;
 
                        for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
-                               DRIVER_TARGETS_LOOPER(dvar)
+                               DRIVER_TARGETS_LOOPER_BEGIN(dvar)
                                {
                                        // TODO: only expand those that are going to get used?
                                        expand_doit(fd, mainvar, dtar->id);
                                }
-                               DRIVER_TARGETS_LOOPER_END
+                               DRIVER_TARGETS_LOOPER_END;
                        }
                }
 
index 13b3040f8df9468093bcc2f2c26225ec9f877d56..61aa1fc1a024f2b9f221ca8cefbd59b561de78a4 100644 (file)
@@ -330,7 +330,7 @@ static void do_version_bbone_easing_fcurve_fix(ID *UNUSED(id), FCurve *fcu, void
        /* Driver -> Driver Vars (for bbone_in/out) */
        if (fcu->driver) {
                for (DriverVar *dvar = fcu->driver->variables.first; dvar; dvar = dvar->next) {
-                       DRIVER_TARGETS_LOOPER(dvar)
+                       DRIVER_TARGETS_LOOPER_BEGIN(dvar)
                        {
                                if (dtar->rna_path) {
                                        dtar->rna_path = replace_bbone_easing_rnapath(dtar->rna_path);
index 6c9d9958dee6e5234c3240265f54b5b69d9721f4..71a98efd25b78b40ab05543d1d7dbf23729f9b07 100644 (file)
@@ -818,13 +818,13 @@ static void write_fcurves(WriteData *wd, ListBase *fcurves)
                        /* variables */
                        writelist(wd, DATA, DriverVar, &driver->variables);
                        for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
-                               DRIVER_TARGETS_USED_LOOPER(dvar)
+                               DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                                {
                                        if (dtar->rna_path) {
                                                writedata(wd, DATA, strlen(dtar->rna_path) + 1, dtar->rna_path);
                                        }
                                }
-                               DRIVER_TARGETS_LOOPER_END
+                               DRIVER_TARGETS_LOOPER_END;
                        }
                }
 
index 953c8db0b3be0d3eba3dff3a87a8a8a80ef231df..92640718b034019c37ecc6dae7945eb81f37bb4d 100644 (file)
@@ -562,12 +562,12 @@ void DepsgraphNodeBuilder::build_driver_variables(ID * id, FCurve *fcurve)
 {
        build_driver_id_property(id, fcurve->rna_path);
        LISTBASE_FOREACH (DriverVar *, dvar, &fcurve->driver->variables) {
-               DRIVER_TARGETS_USED_LOOPER(dvar)
+               DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                {
                        build_id(dtar->id);
                        build_driver_id_property(dtar->id, dtar->rna_path);
                }
-               DRIVER_TARGETS_LOOPER_END
+               DRIVER_TARGETS_LOOPER_END;
        }
 }
 
index a3eac1120db0e3631a2a30225bd0225b4b524844..19bf29830335f6473f82708b25413c09d2a9aace 100644 (file)
@@ -1139,7 +1139,7 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
 
        LISTBASE_FOREACH (DriverVar *, dvar, &driver->variables) {
                /* Only used targets. */
-               DRIVER_TARGETS_USED_LOOPER(dvar)
+               DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                {
                        if (dtar->id == NULL) {
                                continue;
@@ -1206,7 +1206,7 @@ void DepsgraphRelationBuilder::build_driver_variables(ID *id, FCurve *fcu)
                                add_relation(target_key, driver_key, "RNA Target -> Driver");
                        }
                }
-               DRIVER_TARGETS_LOOPER_END
+               DRIVER_TARGETS_LOOPER_END;
        }
 }
 
index fdfe08e03b6e5df256cc6d1dfa02850e6bf77a09..e7430b5283c74b4cc64eb8ec75890fe48dc6c2a7 100644 (file)
@@ -1145,12 +1145,12 @@ static bool fcurve_has_errors(FCurve *fcu)
                /* check variables for other things that need linting... */
                // TODO: maybe it would be more efficient just to have a quick flag for this?
                for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
-                       DRIVER_TARGETS_USED_LOOPER(dvar)
+                       DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                        {
                                if (dtar->flag & DTAR_FLAG_INVALID)
                                        return true;
                        }
-                       DRIVER_TARGETS_LOOPER_END
+                       DRIVER_TARGETS_LOOPER_END;
                }
        }
 
index 5d582a24f1c3061a20edc1d53c55ab820b31095c..e4ce1d58208fc7b692ef1e75a12f4938c653059d 100644 (file)
@@ -163,7 +163,7 @@ static void joined_armature_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data
                /* Fix driver references to invalid ID's */
                for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
                        /* only change the used targets, since the others will need fixing manually anyway */
-                       DRIVER_TARGETS_USED_LOOPER(dvar)
+                       DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                        {
                                /* change the ID's used... */
                                if (dtar->id == src_id) {
@@ -196,7 +196,7 @@ static void joined_armature_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data
                                        }
                                }
                        }
-                       DRIVER_TARGETS_LOOPER_END
+                       DRIVER_TARGETS_LOOPER_END;
                }
        }
 }
index e8106f8038eb2ed770593a88fb5aeb8c655bd9eb..ebd6904fa564e7980c55e98a6d9558c561fc47a8 100644 (file)
@@ -988,7 +988,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
 
                                        for (dvar = driver->variables.first; dvar; dvar = dvar->next) {
                                                /* loop over all targets used here */
-                                               DRIVER_TARGETS_USED_LOOPER(dvar)
+                                               DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                                                {
                                                        if (lastadded != dtar->id) {
                                                                // XXX this lastadded check is rather lame, and also fails quite badly...
@@ -996,7 +996,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                                                                lastadded = dtar->id;
                                                        }
                                                }
-                                               DRIVER_TARGETS_LOOPER_END
+                                               DRIVER_TARGETS_LOOPER_END;
                                        }
                                }
                        }
index 7653bb3f99b3d03a1cbbeeeb6e31914b6aaee315..ca32e49ef5dbe88e3f3487a098cacd0682238003 100644 (file)
@@ -137,14 +137,14 @@ bool BL_ShapeDeformer::LoadShapeDrivers(KX_GameObject* parent)
 
                        DriverVar *dvar;
                        for (dvar = (DriverVar*)fcu->driver->variables.first; dvar; dvar = (DriverVar*)dvar->next) {
-                               DRIVER_TARGETS_USED_LOOPER(dvar)
+                               DRIVER_TARGETS_USED_LOOPER_BEGIN(dvar)
                                {
                                        if (dtar->id) {
                                                if ((Object*)dtar->id == arma->GetOrigArmatureObject())
                                                        dtar->id = (ID*)arma->GetArmatureObject();
                                        }
                                }
-                               DRIVER_TARGETS_LOOPER_END
+                               DRIVER_TARGETS_LOOPER_END;
                        }
                }
        }