[Bf-blender-cvs] [11f375a] soc-2016-multiview: revise versioning code for RegionSpaceClip

Tianwei Shen noreply at git.blender.org
Fri Aug 12 19:26:34 CEST 2016


Commit: 11f375a62b448d8b7fb666d0704d79b08c300cbc
Author: Tianwei Shen
Date:   Sat Aug 13 01:24:57 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rB11f375a62b448d8b7fb666d0704d79b08c300cbc

revise versioning code for RegionSpaceClip

Thank Julian Eisel for pointing out the error. Also remove the version
bump.

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

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

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

diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h
index 2247d32..483fefb 100644
--- a/source/blender/blenkernel/BKE_blender_version.h
+++ b/source/blender/blenkernel/BKE_blender_version.h
@@ -28,7 +28,7 @@
  * and keep comment above the defines.
  * Use STRINGIFY() rather than defining with quotes */
 #define BLENDER_VERSION         277
-#define BLENDER_SUBVERSION      4
+#define BLENDER_SUBVERSION      3
 /* Several breakages with 270, e.g. constraint deg vs rad */
 #define BLENDER_MINVERSION      270
 #define BLENDER_MINSUBVERSION   6
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index 56929aa..225dbef 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1321,24 +1321,21 @@ void blo_do_versions_270(FileData *fd, Library *UNUSED(lib), Main *main)
 			}
 		}
 		/* ------- end of grease pencil initialization --------------- */
-	}
 
-	if (!MAIN_VERSION_ATLEAST(main, 277, 4)) {
 		/* initialize regiondata for each SpaceClip, due to the newly brought RegionSpaceClip */
-		bScreen *screen;
-
-		for (screen = main->screen.first; screen; screen = screen->id.next) {
-			ScrArea *area;
-			for (area = screen->areabase.first; area; area = area->next) {
-				SpaceLink *space_link;
-				for (space_link = area->spacedata.first; space_link; space_link = space_link->next) {
-					if (space_link->spacetype == SPACE_CLIP) {
-						for (ARegion *ar = area->regionbase.first; ar != NULL; ar = ar->next) {
-							if (ar->regiontype == RGN_TYPE_WINDOW) {
-								RegionSpaceClip *rsc = MEM_callocN(sizeof(RegionSpaceClip), "region data for clip");
-								rsc->zoom = 1.0f;
-								rsc->flag = RSC_MAIN_CLIP;
-								ar->regiondata = rsc;
+		if (!DNA_struct_elem_find(fd->filesdna, "ARegion", "RegionSpaceClip", "regiondata")) {
+			for (bScreen *screen = main->screen.first; screen != NULL; screen = screen->id.next) {
+				for (ScrArea *sa = screen->areabase.first; sa != NULL; sa = sa->next) {
+					for (SpaceLink *sl = sa->spacedata.first; sl != NULL; sl = sl->next) {
+						ListBase *regionbase = (sl == sa->spacedata.first) ? &sa->regionbase : &sl->regionbase;
+						if (sl->spacetype == SPACE_CLIP) {
+							for (ARegion *ar = regionbase->first; ar != NULL; ar = ar->next) {
+								if (ar->regiontype == RGN_TYPE_WINDOW) {
+									RegionSpaceClip *rsc = MEM_callocN(sizeof(RegionSpaceClip), "region data for clip");
+									rsc->zoom = 1.0f;
+									rsc->flag = RSC_MAIN_CLIP;
+									ar->regiondata = rsc;
+								}
 							}
 						}
 					}




More information about the Bf-blender-cvs mailing list