[Bf-blender-cvs] [316ea9e0807] tracking_tools: Clip Editor: Proper do-version for tool header

Sergey Sharybin noreply at git.blender.org
Fri Mar 25 12:45:57 CET 2022


Commit: 316ea9e08075b925fe941292c8209c90f0825dec
Author: Sergey Sharybin
Date:   Fri Mar 25 12:45:05 2022 +0100
Branches: tracking_tools
https://developer.blender.org/rB316ea9e08075b925fe941292c8209c90f0825dec

Clip Editor: Proper do-version for tool header

It was only added for files saved prior to 2.90.

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

M	source/blender/blenloader/intern/versioning_280.c
M	source/blender/blenloader/intern/versioning_300.c
M	source/blender/blenloader/intern/versioning_common.cc
M	source/blender/blenloader/intern/versioning_common.h

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

diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index a5c4efaae58..19f97e3edf0 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -618,16 +618,6 @@ static void do_versions_remove_regions_by_type(ListBase *regionbase, int regiont
   }
 }
 
-static ARegion *do_versions_find_region_or_null(ListBase *regionbase, int regiontype)
-{
-  LISTBASE_FOREACH (ARegion *, region, regionbase) {
-    if (region->regiontype == regiontype) {
-      return region;
-    }
-  }
-  return NULL;
-}
-
 static ARegion *do_versions_find_region(ListBase *regionbase, int regiontype)
 {
   ARegion *region = do_versions_find_region_or_null(regionbase, regiontype);
@@ -3871,7 +3861,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
                                                                  &sl->regionbase;
           /* All spaces that use tools must be eventually added. */
           ARegion *region = NULL;
-          if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_SEQ, SPACE_CLIP) &&
+          if (ELEM(sl->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_SEQ) &&
               ((region = do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER)) ==
                NULL)) {
             /* Add tool header. */
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 51b5cab1f7c..19c29bc1e54 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -2457,5 +2457,23 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
         }
       }
     }
+
+    {
+      for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+        LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
+          LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
+            ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
+                                                                   &sl->regionbase;
+            if ((sl->spacetype == SPACE_CLIP) &&
+                (do_versions_find_region_or_null(regionbase, RGN_TYPE_TOOL_HEADER) == NULL)) {
+              ARegion *region = do_versions_add_region_if_not_found(
+                  regionbase, RGN_TYPE_TOOL_HEADER, "tool header", RGN_TYPE_HEADER);
+              region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM :
+                                                                    RGN_ALIGN_TOP;
+            }
+          }
+        }
+      }
+    }
   }
 }
diff --git a/source/blender/blenloader/intern/versioning_common.cc b/source/blender/blenloader/intern/versioning_common.cc
index 281769410bd..581e41cfd00 100644
--- a/source/blender/blenloader/intern/versioning_common.cc
+++ b/source/blender/blenloader/intern/versioning_common.cc
@@ -26,6 +26,16 @@
 
 using blender::StringRef;
 
+ARegion *do_versions_find_region_or_null(ListBase *regionbase, int regiontype)
+{
+  LISTBASE_FOREACH (ARegion *, region, regionbase) {
+    if (region->regiontype == regiontype) {
+      return region;
+    }
+  }
+  return nullptr;
+}
+
 ARegion *do_versions_add_region_if_not_found(ListBase *regionbase,
                                              int region_type,
                                              const char *name,
diff --git a/source/blender/blenloader/intern/versioning_common.h b/source/blender/blenloader/intern/versioning_common.h
index 939b87823d4..dcbc9c068d4 100644
--- a/source/blender/blenloader/intern/versioning_common.h
+++ b/source/blender/blenloader/intern/versioning_common.h
@@ -15,6 +15,8 @@ struct bNodeTree;
 extern "C" {
 #endif
 
+struct ARegion *do_versions_find_region_or_null(struct ListBase *regionbase, int regiontype);
+
 struct ARegion *do_versions_add_region_if_not_found(struct ListBase *regionbase,
                                                     int region_type,
                                                     const char *name,



More information about the Bf-blender-cvs mailing list