Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-06-15 11:23:03 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-06-15 11:24:53 +0300
commitcbc7ee28d7fe145564ca6c398a99e0519d97010d (patch)
tree9d2b4fed13dab24be2b43bb55509d83df803769b /source
parent3ee606621cf53a2a4897e534e7e04d3632f419f8 (diff)
WM: 2.8 screen compatibility
Without these minor changes loading files from 2.8 will crash. Manually applied edits from 26786a2b87a08
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/screen.c21
-rw-r--r--source/blender/blenloader/intern/readfile.c15
-rw-r--r--source/blender/blenloader/intern/writefile.c4
-rw-r--r--source/blender/makesdna/DNA_screen_types.h14
4 files changed, 38 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index a719cc8c94a..995d22c9ba5 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -68,13 +68,17 @@ static void spacetype_free(SpaceType *st)
for (art = st->regiontypes.first; art; art = art->next) {
BLI_freelistN(&art->drawcalls);
- for (pt = art->paneltypes.first; pt; pt = pt->next)
- if (pt->ext.free)
+ for (pt = art->paneltypes.first; pt; pt = pt->next) {
+ if (pt->ext.free) {
pt->ext.free(pt->ext.data);
+ }
+ }
- for (ht = art->headertypes.first; ht; ht = ht->next)
- if (ht->ext.free)
+ for (ht = art->headertypes.first; ht; ht = ht->next) {
+ if (ht->ext.free) {
ht->ext.free(ht->ext.data);
+ }
+ }
BLI_freelistN(&art->paneltypes);
BLI_freelistN(&art->headertypes);
@@ -199,10 +203,15 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
if (ar->regiondata) {
ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype);
- if (art && art->duplicate)
+ if (art && art->duplicate) {
newar->regiondata = art->duplicate(ar->regiondata);
- else
+ }
+ else if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
+ newar->regiondata = NULL;
+ }
+ else {
newar->regiondata = MEM_dupallocN(ar->regiondata);
+ }
}
if (ar->v2d.tab_offset)
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 937853463a2..7d3d417bf33 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6817,11 +6817,12 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
/* free render engines for now */
for (ar = sa->regionbase.first; ar; ar = ar->next) {
- RegionView3D *rv3d= ar->regiondata;
-
- if (rv3d && rv3d->render_engine) {
- RE_engine_free(rv3d->render_engine);
- rv3d->render_engine = NULL;
+ if (ar->regiontype == RGN_TYPE_WINDOW) {
+ RegionView3D *rv3d = ar->regiondata;
+ if (rv3d && rv3d->render_engine) {
+ RE_engine_free(rv3d->render_engine);
+ rv3d->render_engine = NULL;
+ }
}
}
}
@@ -7051,6 +7052,10 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
/* unkown space type, don't leak regiondata */
ar->regiondata = NULL;
}
+ else if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
+ /* Runtime data, don't use. */
+ ar->regiondata = NULL;
+ }
else {
ar->regiondata = newdataadr(fd, ar->regiondata);
if (ar->regiondata) {
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 88e6cbc8d24..0e67bde6883 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -2825,6 +2825,10 @@ static void write_region(WriteData *wd, ARegion *ar, int spacetype)
writestruct(wd, DATA, ARegion, 1, ar);
if (ar->regiondata) {
+ if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
+ return;
+ }
+
switch (spacetype) {
case SPACE_VIEW3D:
if (ar->regiontype == RGN_TYPE_WINDOW) {
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index a7718883438..a9767f506dc 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -53,10 +53,10 @@ typedef struct bScreen {
ListBase edgebase;
ListBase areabase;
ListBase regionbase; /* screen level regions (menus), runtime only */
-
+
struct Scene *scene;
struct Scene *newscene; /* temporary when switching */
-
+
short winid; /* winid from WM, starts with 1 */
short redraws_flag; /* user-setting for which editors get redrawn during anim playback (used to be time->redraws) */
@@ -384,7 +384,7 @@ enum {
RGN_TYPE_UI = 4,
RGN_TYPE_TOOLS = 5,
RGN_TYPE_TOOL_PROPS = 6,
- RGN_TYPE_PREVIEW = 7
+ RGN_TYPE_PREVIEW = 7,
};
/* use for function args */
#define RGN_TYPE_ANY -1
@@ -403,8 +403,12 @@ enum {
#define RGN_SPLIT_PREV 32
/* region flag */
-#define RGN_FLAG_HIDDEN 1
-#define RGN_FLAG_TOO_SMALL 2
+enum {
+ RGN_FLAG_HIDDEN = (1 << 0),
+ RGN_FLAG_TOO_SMALL = (1 << 1),
+ /* Region data is NULL'd on read, never written. */
+ RGN_FLAG_TEMP_REGIONDATA = (1 << 3),
+};
/* region do_draw */
#define RGN_DRAW 1