[Bf-blender-cvs] [602822a8462] greasepencil-refactor: GPencil: Cleanup some loops

Antonio Vazquez noreply at git.blender.org
Fri Jan 24 16:24:53 CET 2020


Commit: 602822a8462747f56e1c8776b01e42544c51be85
Author: Antonio Vazquez
Date:   Fri Jan 24 16:24:35 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB602822a8462747f56e1c8776b01e42544c51be85

GPencil: Cleanup some loops

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

M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/gpencil/gpencil_data.c

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 79edaaa5f2b..83319505bf0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7234,9 +7234,6 @@ static void lib_link_gpencil(FileData *fd, Main *main)
 /* relinks grease-pencil data - used for direct_link and old file linkage */
 static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
 {
-  bGPDlayer *gpl;
-  bGPDframe *gpf;
-  bGPDstroke *gps;
   bGPDpalette *palette;
 
   /* we must firstly have some grease-pencil data to link! */
@@ -7269,7 +7266,7 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
   /* relink layers */
   link_list(fd, &gpd->layers);
 
-  for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+  LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
     /* relink frames */
     link_list(fd, &gpl->frames);
 
@@ -7277,11 +7274,11 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
 
     gpl->runtime.icon_id = 0;
 
-    for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
+    LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
       /* relink strokes (and their points) */
       link_list(fd, &gpf->strokes);
 
-      for (gps = gpf->strokes.first; gps; gps = gps->next) {
+      LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
         /* relink stroke points array */
         gps->points = newdataadr(fd, gps->points);
         /* Relink geometry*/
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index b609bd9c4bd..0e17b8745c3 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -644,7 +644,7 @@ static int gp_frame_duplicate_exec(bContext *C, wmOperator *op)
     BKE_gpencil_frame_addcopy(gpl, CFRA);
   }
   else {
-    for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+    LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
       if ((gpl->flag & GP_LAYER_LOCKED) == 0) {
         BKE_gpencil_frame_addcopy(gpl, CFRA);
       }
@@ -2531,7 +2531,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op)
           defgroup_unique_name(vgroup, ob_active);
           BLI_addtail(&ob_active->defbase, vgroup);
           /* update vertex groups in strokes in original data */
-          for (bGPDlayer *gpl_src = gpd->layers.first; gpl_src; gpl_src = gpl_src->next) {
+          LISTBASE_FOREACH (bGPDlayer *, gpl_src, &gpd->layers) {
             LISTBASE_FOREACH (bGPDframe *, gpf, &gpl_src->frames) {
               LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
                 MDeformVert *dvert;



More information about the Bf-blender-cvs mailing list