[Bf-blender-cvs] [56e330a] soc-2016-multiview: do versioning of RegionSpaceClip

Tianwei Shen noreply at git.blender.org
Fri Aug 12 10:57:46 CEST 2016


Commit: 56e330a190d1c26294536f5ddc3082921444fe86
Author: Tianwei Shen
Date:   Fri Aug 12 16:55:53 2016 +0800
Branches: soc-2016-multiview
https://developer.blender.org/rB56e330a190d1c26294536f5ddc3082921444fe86

do versioning of RegionSpaceClip

This commit may be useless since there is no region data in a space_clip
at the beginning of Blender. So a valid ARegion cannot be found for
ar->regiondata to new.

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

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 483fefb..2247d32 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      3
+#define BLENDER_SUBVERSION      4
 /* 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 c0aa84f..1bccfb0 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -1323,4 +1323,28 @@ 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) {
+						SpaceClip *space_clip = (SpaceClip *) space_link;
+						for (ARegion *ar = space_clip->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