[Bf-blender-cvs] [b4d7c6b0b86] greasepencil-object: GPencil: Cleanup Versioning loops

Antonio Vazquez noreply at git.blender.org
Thu Mar 5 11:07:41 CET 2020


Commit: b4d7c6b0b8655376a8e9a97f98cae4923b5126e5
Author: Antonio Vazquez
Date:   Thu Mar 5 11:07:25 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rBb4d7c6b0b8655376a8e9a97f98cae4923b5126e5

GPencil: Cleanup Versioning loops

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

M	source/blender/blenloader/intern/versioning_280.c

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

diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 1def32d6f02..1d0ac204080 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4470,9 +4470,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
     /* Init default Grease Pencil Vertex paint mix factor for Viewport. */
     if (!DNA_struct_elem_find(
             fd->filesdna, "View3DOverlay", "float", "gpencil_vertex_paint_opacity")) {
-      for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
-        for (ScrArea *area = screen->areabase.first; area; area = area->next) {
-          for (SpaceLink *sl = area->spacedata.first; sl; sl = sl->next) {
+      LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
+        LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+          LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
             if (sl->spacetype == SPACE_VIEW3D) {
               View3D *v3d = (View3D *)sl;
               v3d->overlay.gpencil_vertex_paint_opacity = 1.0f;
@@ -4482,22 +4482,13 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
       }
     }
 
-    /* Init default Grease Pencil Vertex paint layer mix factor. */
-    if (!DNA_struct_elem_find(fd->filesdna, "bGPDlayer", "float", "vertex_paint_opacity")) {
-      for (bGPdata *gpd = bmain->gpencils.first; gpd; gpd = gpd->id.next) {
-        LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
-          gpl->vertex_paint_opacity = 1.0f;
-        }
-      }
-    }
-
     /* Update Grease Pencil after drawing engine and code refactor.
      * It uses the seed variable of Array modifier to avoid double patching for
      * files created with a development version. */
     if (!DNA_struct_elem_find(fd->filesdna, "ArrayGpencilModifierData", "int", "seed")) {
       /* Init new Grease Pencil Paint tools. */
       {
-        for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
+        LISTBASE_FOREACH (Brush *, brush, &bmain->brushes) {
           if (brush->gpencil_settings != NULL) {
             brush->gpencil_vertex_tool = brush->gpencil_settings->brush_type;
             brush->gpencil_sculpt_tool = brush->gpencil_settings->brush_type;
@@ -4650,6 +4641,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
         LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
           gpl->flag |= GP_LAYER_USE_LIGHTS;
           srgb_to_linearrgb_v4(gpl->tintcolor, gpl->tintcolor);
+          gpl->vertex_paint_opacity = 1.0f;
 
           LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
             LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {



More information about the Bf-blender-cvs mailing list