[Bf-blender-cvs] [4427a67c864] master: Cleanup: use macro for comparing file versions

Campbell Barton noreply at git.blender.org
Sat Oct 10 13:45:52 CEST 2020


Commit: 4427a67c86450a704bd35b0f7539c0adf152fea2
Author: Campbell Barton
Date:   Sat Oct 10 22:40:38 2020 +1100
Branches: master
https://developer.blender.org/rB4427a67c86450a704bd35b0f7539c0adf152fea2

Cleanup: use macro for comparing file versions

Already done in most of the versioning code.

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

M	source/blender/blenloader/intern/versioning_250.c
M	source/blender/blenloader/intern/versioning_260.c
M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/blenloader/intern/versioning_legacy.c

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

diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c
index b1a76c65ce9..5046ee6aab1 100644
--- a/source/blender/blenloader/intern/versioning_250.c
+++ b/source/blender/blenloader/intern/versioning_250.c
@@ -781,7 +781,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 1)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 1)) {
     Object *ob;
     Tex *tex;
     Scene *sce;
@@ -849,7 +849,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 2)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 2)) {
     Object *ob;
 
     for (ob = bmain->objects.first; ob; ob = ob->id.next) {
@@ -859,7 +859,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 4)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 4)) {
     Scene *sce;
     Object *ob;
     ParticleSettings *part;
@@ -951,7 +951,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 6)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 6)) {
     Object *ob;
 
     /* New variables for axis-angle rotations and/or quaternion rotations were added,
@@ -973,7 +973,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 7)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 7)) {
     Mesh *me;
     Nurb *nu;
     Lattice *lt;
@@ -1041,7 +1041,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 8)) {
     {
       Scene *sce = bmain->scenes.first;
       while (sce) {
@@ -1139,7 +1139,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 9)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 9)) {
     Scene *sce;
     Mesh *me;
     Object *ob;
@@ -1169,7 +1169,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 10)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 10)) {
     Object *ob;
 
     /* properly initialize hair clothsim data on old files */
@@ -1225,7 +1225,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 11)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 11)) {
     {
       /* fix for new view type in sequencer */
       bScreen *screen;
@@ -1271,7 +1271,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 12)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 12)) {
     Object *ob;
     Brush *brush;
 
@@ -1333,7 +1333,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 13)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 13)) {
     /* NOTE: if you do more conversion, be sure to do it outside of this and
      * increase subversion again, otherwise it will not be correct */
     Object *ob;
@@ -1359,7 +1359,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 14)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 14)) {
     /* fix for bad View2D extents for Animation Editors */
     bScreen *screen;
     ScrArea *area;
@@ -1391,7 +1391,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 17)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 250, 17)) {
     Scene *sce;
     Sequence *seq;
 
@@ -1482,7 +1482,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 1)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 252, 1)) {
     Brush *brush;
     Object *ob;
     Scene *scene;
@@ -1540,7 +1540,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
   }
 
   /* old-track -> constraints (this time we're really doing it!) */
-  if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 2)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 252, 2)) {
     Object *ob;
 
     for (ob = bmain->objects.first; ob; ob = ob->id.next) {
@@ -1548,7 +1548,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 252, 5)) {
     bScreen *screen;
 
     /* Image editor scopes */
@@ -1745,7 +1745,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
       }
 
       /* New Settings */
-      if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) {
+      if (!MAIN_VERSION_ATLEAST(bmain, 252, 5)) {
         brush->flag |= BRUSH_SPACE_ATTEN;  // explicitly enable adaptive space
 
         /* spacing was originally in pixels, convert it to percentage for new version
@@ -1786,7 +1786,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 253 || (bmain->versionfile == 253 && bmain->subversionfile < 1)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 253, 1)) {
     Object *ob;
 
     for (ob = bmain->objects.first; ob; ob = ob->id.next) {
@@ -1832,7 +1832,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 1)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 255, 1)) {
     Brush *br;
     ParticleSettings *part;
     bScreen *screen;
@@ -1881,7 +1881,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 255 || (bmain->versionfile == 255 && bmain->subversionfile < 3)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 255, 3)) {
     Object *ob;
 
     /* ocean res is now squared, reset old ones - will be massive */
@@ -1934,7 +1934,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 1)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 256, 1)) {
     /* fix for bones that didn't have arm_roll before */
     bArmature *arm;
     Bone *bone;
@@ -1958,7 +1958,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 2)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 256, 2)) {
     bNodeTree *ntree;
     bNode *node;
     bNodeSocket *sock, *gsock;
@@ -2041,7 +2041,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 3)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 256, 3)) {
     bScreen *screen;
     Brush *brush;
     Object *ob;
@@ -2086,7 +2086,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
   }
 
   if (0) {
-    if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 6)) {
+    if (!MAIN_VERSION_ATLEAST(bmain, 256, 6)) {
       for (Mesh *me = bmain->meshes.first; me; me = me->id.next) {
         /* Vertex normal calculation from legacy 'MFace' has been removed.
          * update after calculating polygons in file reading code instead. */
@@ -2094,7 +2094,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 2)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 256, 2)) {
     /* update blur area sizes from 0..1 range to 0..100 percentage */
     Scene *scene;
     bNode *node;
@@ -2111,7 +2111,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 258 || (bmain->versionfile == 258 && bmain->subversionfile < 1)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 258, 1)) {
     /* screen view2d settings were not properly initialized T27164.
      * v2d->scroll caused the bug but best reset other values too
      * which are in old blend files only.
@@ -2158,7 +2158,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 1)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 259, 1)) {
     {
       Scene *scene;
       Sequence *seq;
@@ -2247,7 +2247,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 2)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 259, 2)) {
     {
       /* Convert default socket values from bNodeStack */
       FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
@@ -2288,7 +2288,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain)
     }
   }
 
-  if (bmain->versionfile < 259 || (bmain->versionfile == 259 && bmain->subversionfile < 4)) {
+  if (!MAIN_VERSION_ATLEAST(bmain, 259, 4)) {
     {
       /* Adaptive time step for particle systems */
       ParticleSettings *part;
@@ -2339,7 +2339,7 @@ static void lib_node_do_versions_group_indices(bNode *gnode)
 
 void do_versions_after_linking_250(Main *bmain)
 {
-  if (bmain->versionfile < 256 || (bmain->versionfile == 256 && bmain->subversionfile < 2)) {
+  

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list