WM: add support for temporary region data
This commit is contained in:
@@ -233,10 +233,15 @@ ARegion *BKE_area_region_copy(SpaceType *st, ARegion *ar)
|
|||||||
if (ar->regiondata) {
|
if (ar->regiondata) {
|
||||||
ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype);
|
ARegionType *art = BKE_regiontype_from_id(st, ar->regiontype);
|
||||||
|
|
||||||
if (art && art->duplicate)
|
if (art && art->duplicate) {
|
||||||
newar->regiondata = art->duplicate(ar->regiondata);
|
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);
|
newar->regiondata = MEM_dupallocN(ar->regiondata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ar->v2d.tab_offset)
|
if (ar->v2d.tab_offset)
|
||||||
|
|||||||
@@ -6431,6 +6431,10 @@ static void direct_link_region(FileData *fd, ARegion *ar, int spacetype)
|
|||||||
/* unkown space type, don't leak regiondata */
|
/* unkown space type, don't leak regiondata */
|
||||||
ar->regiondata = NULL;
|
ar->regiondata = NULL;
|
||||||
}
|
}
|
||||||
|
else if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
|
||||||
|
/* Runtime data, don't use. */
|
||||||
|
ar->regiondata = NULL;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
ar->regiondata = newdataadr(fd, ar->regiondata);
|
ar->regiondata = newdataadr(fd, ar->regiondata);
|
||||||
if (ar->regiondata) {
|
if (ar->regiondata) {
|
||||||
@@ -7213,11 +7217,12 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, Main
|
|||||||
|
|
||||||
/* free render engines for now */
|
/* free render engines for now */
|
||||||
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
for (ar = sa->regionbase.first; ar; ar = ar->next) {
|
||||||
RegionView3D *rv3d= ar->regiondata;
|
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||||
|
RegionView3D *rv3d = ar->regiondata;
|
||||||
if (rv3d && rv3d->render_engine) {
|
if (rv3d && rv3d->render_engine) {
|
||||||
RE_engine_free(rv3d->render_engine);
|
RE_engine_free(rv3d->render_engine);
|
||||||
rv3d->render_engine = NULL;
|
rv3d->render_engine = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2687,6 +2687,10 @@ static void write_region(WriteData *wd, ARegion *ar, int spacetype)
|
|||||||
writestruct(wd, DATA, ARegion, 1, ar);
|
writestruct(wd, DATA, ARegion, 1, ar);
|
||||||
|
|
||||||
if (ar->regiondata) {
|
if (ar->regiondata) {
|
||||||
|
if (ar->flag & RGN_FLAG_TEMP_REGIONDATA) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (spacetype) {
|
switch (spacetype) {
|
||||||
case SPACE_VIEW3D:
|
case SPACE_VIEW3D:
|
||||||
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
if (ar->regiontype == RGN_TYPE_WINDOW) {
|
||||||
|
|||||||
@@ -489,7 +489,9 @@ enum {
|
|||||||
/* Force delayed reinit of region size data, so that region size is calculated
|
/* Force delayed reinit of region size data, so that region size is calculated
|
||||||
* just big enough to show all its content (if enough space is available).
|
* just big enough to show all its content (if enough space is available).
|
||||||
* Note that only ED_region_header supports this right now. */
|
* Note that only ED_region_header supports this right now. */
|
||||||
RGN_FLAG_DYNAMIC_SIZE = (1 << 2),
|
RGN_FLAG_DYNAMIC_SIZE = (1 << 2),
|
||||||
|
/* Region data is NULL'd on read, never written. */
|
||||||
|
RGN_FLAG_TEMP_REGIONDATA = (1 << 3),
|
||||||
};
|
};
|
||||||
|
|
||||||
/* region do_draw */
|
/* region do_draw */
|
||||||
|
|||||||
Reference in New Issue
Block a user