[Bf-blender-cvs] [4ab8a84d0e5] greasepencil-object: GPencil: Version Bump and prepare versioning code

Antonio Vazquez noreply at git.blender.org
Thu Mar 5 10:46:57 CET 2020


Commit: 4ab8a84d0e58de8cfd54bfa3c90bd99cc02a8e27
Author: Antonio Vazquez
Date:   Thu Mar 5 10:46:45 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rB4ab8a84d0e58de8cfd54bfa3c90bd99cc02a8e27

GPencil: Version Bump and prepare versioning code

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

M	source/blender/blenkernel/BKE_blender_version.h
M	source/blender/blenloader/intern/versioning_280.c

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

diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 9e4453d21fe..233c385c247 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -27,7 +27,7 @@
  * \note Use #STRINGIFY() rather than defining with quotes.
  */
 #define BLENDER_VERSION 283
-#define BLENDER_SUBVERSION 6
+#define BLENDER_SUBVERSION 7
 /** Several breakages with 280, e.g. collections vs layers. */
 #define BLENDER_MINVERSION 280
 #define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index c4b0674d03c..1def32d6f02 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4344,55 +4344,170 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
         }
       }
     }
+  }
 
-    /* Init new Grease Pencil Paint tools. */
-    {
-      for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
-        if (brush->gpencil_settings != NULL) {
-          brush->gpencil_vertex_tool = brush->gpencil_settings->brush_type;
-          brush->gpencil_sculpt_tool = brush->gpencil_settings->brush_type;
-          brush->gpencil_weight_tool = brush->gpencil_settings->brush_type;
+  if (!MAIN_VERSION_ATLEAST(bmain, 283, 3)) {
+
+    /* Sequencer Tool region */
+    do_versions_area_ensure_tool_region(bmain, SPACE_SEQ, RGN_FLAG_HIDDEN);
+
+    /* Cloth internal springs */
+    for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+      for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+        if (md->type == eModifierType_Cloth) {
+          ClothModifierData *clmd = (ClothModifierData *)md;
+
+          clmd->sim_parms->internal_tension = 15.0f;
+          clmd->sim_parms->max_internal_tension = 15.0f;
+          clmd->sim_parms->internal_compression = 15.0f;
+          clmd->sim_parms->max_internal_compression = 15.0f;
+          clmd->sim_parms->internal_spring_max_diversion = M_PI / 4.0f;
         }
       }
+    }
 
-      BKE_paint_toolslots_init_from_main(bmain);
+    /* Add primary tile to images. */
+    if (!DNA_struct_elem_find(fd->filesdna, "Image", "ListBase", "tiles")) {
+      for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
+        ImageTile *tile = MEM_callocN(sizeof(ImageTile), "Image Tile");
+        tile->ok = 1;
+        tile->tile_number = 1001;
+        BLI_addtail(&ima->tiles, tile);
+      }
     }
 
-    /* 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) {
-              if (sl->spacetype == SPACE_VIEW3D) {
-                View3D *v3d = (View3D *)sl;
-                v3d->overlay.gpencil_vertex_paint_opacity = 1.0f;
-              }
+    /* UDIM Image Editor change. */
+    if (!DNA_struct_elem_find(fd->filesdna, "SpaceImage", "int", "tile_grid_shape[2]")) {
+      for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+        for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+          for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+            if (sl->spacetype == SPACE_IMAGE) {
+              SpaceImage *sima = (SpaceImage *)sl;
+              sima->tile_grid_shape[0] = 1;
+              sima->tile_grid_shape[1] = 1;
             }
           }
         }
       }
     }
 
-    /* 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;
+    for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
+      br->add_col[3] = 0.9f;
+      br->sub_col[3] = 0.9f;
+    }
+
+    /* Pose brush IK segments. */
+    for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
+      if (br->pose_ik_segments == 0) {
+        br->pose_ik_segments = 1;
+      }
+    }
+
+    /* Pose brush keep anchor point. */
+    for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
+      if (br->sculpt_tool == SCULPT_TOOL_POSE) {
+        br->flag2 |= BRUSH_POSE_IK_ANCHORED;
+      }
+    }
+
+    /* Tip Roundness. */
+    if (!DNA_struct_elem_find(fd->filesdna, "Brush", "float", "tip_roundness")) {
+      for (Brush *br = bmain->brushes.first; br; br = br->id.next) {
+        if (br->ob_mode & OB_MODE_SCULPT && br->sculpt_tool == SCULPT_TOOL_CLAY_STRIPS) {
+          br->tip_roundness = 0.18f;
+        }
+      }
+    }
+
+    /* EEVEE: Cascade shadow bias fix */
+    LISTBASE_FOREACH (Light *, light, &bmain->lights) {
+      if (light->type == LA_SUN) {
+        /* Should be 0.0004 but for practical reason we make it bigger.
+         * Correct factor is scene dependent. */
+        light->bias *= 0.002f;
+      }
+    }
+  }
+
+  if (!MAIN_VERSION_ATLEAST(bmain, 283, 5)) {
+    /* Alembic Transform Cache changed from world to local space. */
+    LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
+      LISTBASE_FOREACH (bConstraint *, con, &ob->constraints) {
+        if (con->type == CONSTRAINT_TYPE_TRANSFORM_CACHE) {
+          con->ownspace = CONSTRAINT_SPACE_LOCAL;
+        }
+      }
+    }
+
+    /* Add 2D transform to UV Warp modifier. */
+    if (!DNA_struct_elem_find(fd->filesdna, "UVWarpModifierData", "float", "scale[2]")) {
+      for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+        for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
+          if (md->type == eModifierType_UVWarp) {
+            UVWarpModifierData *umd = (UVWarpModifierData *)md;
+            copy_v2_fl(umd->scale, 1.0f);
+          }
+        }
+      }
+    }
+
+    /* Add Lookdev blur property. */
+    if (!DNA_struct_elem_find(fd->filesdna, "View3DShading", "float", "studiolight_blur")) {
+      for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+        for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+          for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+            if (sl->spacetype == SPACE_VIEW3D) {
+              View3D *v3d = (View3D *)sl;
+              v3d->shading.studiolight_blur = 0.5f;
+            }
           }
         }
       }
     }
   }
 
-  if (!MAIN_VERSION_ATLEAST(bmain, 283, 0)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 283, 7)) {
+    /* 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) {
+            if (sl->spacetype == SPACE_VIEW3D) {
+              View3D *v3d = (View3D *)sl;
+              v3d->overlay.gpencil_vertex_paint_opacity = 1.0f;
+            }
+          }
+        }
+      }
+    }
+
+    /* 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 refactor.
+    /* 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) {
+          if (brush->gpencil_settings != NULL) {
+            brush->gpencil_vertex_tool = brush->gpencil_settings->brush_type;
+            brush->gpencil_sculpt_tool = brush->gpencil_settings->brush_type;
+            brush->gpencil_weight_tool = brush->gpencil_settings->brush_type;
+          }
+        }
+
+        BKE_paint_toolslots_init_from_main(bmain);
+      }
+
       LISTBASE_FOREACH (Material *, mat, &bmain->materials) {
         MaterialGPencilStyle *gp_style = mat->gp_style;
         if (gp_style == NULL) {
@@ -4498,6 +4613,13 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
               srgb_to_linearrgb_v3_v3(mmd->rgb, mmd->rgb);
               break;
             }
+            case eGpencilModifierType_Thick: {
+              if (!DNA_struct_elem_find(
+                      fd->filesdna, "ThickGpencilModifierData", "float", "thickness_fac")) {
+                ThickGpencilModifierData *mmd = (ThickGpencilModifierData *)md;
+                mmd->thickness_fac = mmd->thickness;
+              }
+            }
             case eGpencilModifierType_Subdiv: {
               const short simple = (1 << 0);
               SubdivGpencilModifierData *mmd = (SubdivGpencilModifierData *)md;
@@ -4550,126 +4672,6 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
     }
   }
 
-  if (!MAIN_VERSION_ATLEAST(bmain, 283, 3)) {
-
-    /* Sequencer Tool region */
-    do_versions_area_ensure_tool_region(bmain, SPACE_SEQ, RGN_FLAG_HIDDEN);
-
-    /* Cloth internal springs */
-    for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
-      for (ModifierData *md = ob->modifiers.first; md; md = md->next) {
-        if (md->type == eModifierType_Cloth) {
-          ClothModifierData 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list