[Bf-blender-cvs] [3edadc47bf3] temp-gpencil-eval: Cleanup: Use LISTBASE_FOREACH

Antonio Vazquez noreply at git.blender.org
Thu Jan 16 10:24:51 CET 2020


Commit: 3edadc47bf3247ac7f50075762c1f14a4f6bc26f
Author: Antonio Vazquez
Date:   Thu Jan 16 10:24:43 2020 +0100
Branches: temp-gpencil-eval
https://developer.blender.org/rB3edadc47bf3247ac7f50075762c1f14a4f6bc26f

Cleanup: Use LISTBASE_FOREACH

===================================================================

M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenkernel/intern/gpencil_modifier.c

===================================================================

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 6cb8e13813e..0b76d8cf23c 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -3842,9 +3842,9 @@ void BKE_gpencil_visible_stroke_iter(
 static void gpencil_prepare_filling(const Object *ob)
 {
   bGPdata *gpd = (bGPdata *)ob->data;
-  for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
-    for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
-      for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
+    LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
+      LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
         MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get((Object *)ob,
                                                                            gps->mat_nr + 1);
         if (gp_style) {
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 3991f4b0747..78ba52555de 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -871,7 +871,7 @@ void BKE_gpencil_prepare_eval_data(Depsgraph *depsgraph, Scene *scene, Object *o
       ob->data = ob->runtime.gpd_eval;
 
       int layer_index = -1;
-      for (bGPDlayer *gpl_orig = gpd_orig->layers.first; gpl_orig; gpl_orig = gpl_orig->next) {
+      LISTBASE_FOREACH (bGPDlayer *, gpl_orig, &gpd_orig->layers) {
         layer_index++;
 
         int remap_cfra = gpencil_remap_time_get(depsgraph, scene, ob, gpl_orig);
@@ -938,7 +938,7 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
   BKE_gpencil_lattice_init(ob);
 
   /* Loop all layers and apply modifiers. */
-  for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
     /* Remap frame (Time modifier) */
     int remap_cfra = gpencil_remap_time_get(depsgraph, scene, ob, gpl);
     bGPDframe *gpf = BKE_gpencil_layer_frame_get(gpl, remap_cfra, GP_GETFRAME_USE_PREV);
@@ -953,7 +953,7 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
     }
 
     /* Apply deform modifiers (only change geometry). */
-    for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+    LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
       /* Apply modifiers that only deform geometry */
       BKE_gpencil_stroke_modifiers(depsgraph, ob, gpl, gpf, gps, is_render);
     }
@@ -961,7 +961,7 @@ void BKE_gpencil_modifiers_calc(Depsgraph *depsgraph, Scene *scene, Object *ob)
     /* Review triangulation for filling after applying modifiers and verify if any updated is
      * required.
      * This is needed if some modifiers tagged the stroke triangulation to be recalc. */
-    for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
+    LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
       MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
       if (gp_style) {
         BKE_gpencil_recalc_geometry_caches(ob, gpl, gp_style, gps);



More information about the Bf-blender-cvs mailing list