Screen: clear runtime structures on file-read & data-copy
Clear the runtime data structs instead of individual members, this simplifies adding new runtime members as there are at least two places they would need to be cleared. Resolves error in D8883.
This commit is contained in:
@@ -467,7 +467,7 @@ static void panel_list_copy(ListBase *newlb, const ListBase *lb)
|
||||
Panel *panel = lb->first;
|
||||
for (; new_panel; new_panel = new_panel->next, panel = panel->next) {
|
||||
new_panel->activedata = NULL;
|
||||
new_panel->runtime.custom_data_ptr = NULL;
|
||||
memset(&new_panel->runtime, 0x0, sizeof(new_panel->runtime));
|
||||
panel_list_copy(&new_panel->children, &panel->children);
|
||||
}
|
||||
}
|
||||
@@ -476,6 +476,8 @@ ARegion *BKE_area_region_copy(const SpaceType *st, const ARegion *region)
|
||||
{
|
||||
ARegion *newar = MEM_dupallocN(region);
|
||||
|
||||
memset(&newar->runtime, 0x0, sizeof(newar->runtime));
|
||||
|
||||
newar->prev = newar->next = NULL;
|
||||
BLI_listbase_clear(&newar->handlers);
|
||||
BLI_listbase_clear(&newar->uiblocks);
|
||||
@@ -1419,6 +1421,8 @@ static void direct_link_panel_list(BlendDataReader *reader, ListBase *lb)
|
||||
|
||||
static void direct_link_region(BlendDataReader *reader, ARegion *region, int spacetype)
|
||||
{
|
||||
memset(®ion->runtime, 0x0, sizeof(region->runtime));
|
||||
|
||||
direct_link_panel_list(reader, ®ion->panels);
|
||||
|
||||
BLO_read_list(reader, ®ion->panels_category_active);
|
||||
@@ -1560,16 +1564,15 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area)
|
||||
|
||||
if (sl->spacetype == SPACE_VIEW3D) {
|
||||
View3D *v3d = (View3D *)sl;
|
||||
|
||||
memset(&v3d->runtime, 0x0, sizeof(v3d->runtime));
|
||||
|
||||
if (v3d->gpd) {
|
||||
BLO_read_data_address(reader, &v3d->gpd);
|
||||
BKE_gpencil_blend_read_data(reader, v3d->gpd);
|
||||
}
|
||||
BLO_read_data_address(reader, &v3d->localvd);
|
||||
|
||||
/* Runtime data */
|
||||
v3d->runtime.properties_storage = NULL;
|
||||
v3d->runtime.flag = 0;
|
||||
|
||||
/* render can be quite heavy, set to solid on load */
|
||||
if (v3d->shading.type == OB_RENDER) {
|
||||
v3d->shading.type = OB_SOLID;
|
||||
@@ -1584,7 +1587,7 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area)
|
||||
SpaceGraph *sipo = (SpaceGraph *)sl;
|
||||
|
||||
BLO_read_data_address(reader, &sipo->ads);
|
||||
BLI_listbase_clear(&sipo->runtime.ghost_curves);
|
||||
memset(&sipo->runtime, 0x0, sizeof(sipo->runtime));
|
||||
}
|
||||
else if (sl->spacetype == SPACE_NLA) {
|
||||
SpaceNla *snla = (SpaceNla *)sl;
|
||||
@@ -1652,7 +1655,7 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area)
|
||||
}
|
||||
else if (sl->spacetype == SPACE_TEXT) {
|
||||
SpaceText *st = (SpaceText *)sl;
|
||||
memset(&st->runtime, 0, sizeof(st->runtime));
|
||||
memset(&st->runtime, 0x0, sizeof(st->runtime));
|
||||
}
|
||||
else if (sl->spacetype == SPACE_SEQ) {
|
||||
SpaceSeq *sseq = (SpaceSeq *)sl;
|
||||
@@ -1724,6 +1727,11 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area)
|
||||
BLO_read_data_address(reader, &sfile->params);
|
||||
BLO_read_data_address(reader, &sfile->asset_params);
|
||||
}
|
||||
else if (sl->spacetype == SPACE_ACTION) {
|
||||
SpaceAction *saction = (SpaceAction *)sl;
|
||||
|
||||
memset(&saction->runtime, 0x0, sizeof(saction->runtime));
|
||||
}
|
||||
else if (sl->spacetype == SPACE_CLIP) {
|
||||
SpaceClip *sclip = (SpaceClip *)sl;
|
||||
|
||||
|
@@ -153,6 +153,8 @@ static SpaceLink *action_duplicate(SpaceLink *sl)
|
||||
{
|
||||
SpaceAction *sactionn = MEM_dupallocN(sl);
|
||||
|
||||
memset(&sactionn->runtime, 0x0, sizeof(sactionn->runtime));
|
||||
|
||||
/* clear or remove stuff from old */
|
||||
|
||||
return (SpaceLink *)sactionn;
|
||||
|
@@ -172,6 +172,8 @@ static SpaceLink *graph_duplicate(SpaceLink *sl)
|
||||
{
|
||||
SpaceGraph *sipon = MEM_dupallocN(sl);
|
||||
|
||||
memset(&sipon->runtime, 0x0, sizeof(sipon->runtime));
|
||||
|
||||
/* clear or remove stuff from old */
|
||||
BLI_duplicatelist(&sipon->runtime.ghost_curves, &((SpaceGraph *)sl)->runtime.ghost_curves);
|
||||
sipon->ads = MEM_dupallocN(sipon->ads);
|
||||
|
@@ -351,14 +351,13 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
|
||||
View3D *v3do = (View3D *)sl;
|
||||
View3D *v3dn = MEM_dupallocN(sl);
|
||||
|
||||
memset(&v3dn->runtime, 0x0, sizeof(v3dn->runtime));
|
||||
|
||||
/* clear or remove stuff from old */
|
||||
|
||||
if (v3dn->localvd) {
|
||||
v3dn->localvd = NULL;
|
||||
v3dn->runtime.properties_storage = NULL;
|
||||
}
|
||||
/* Only one View3D is allowed to have this flag! */
|
||||
v3dn->runtime.flag &= ~V3D_RUNTIME_XR_SESSION_ROOT;
|
||||
|
||||
v3dn->local_collections_uuid = 0;
|
||||
v3dn->flag &= ~(V3D_LOCAL_COLLECTIONS | V3D_XR_SESSION_MIRROR);
|
||||
@@ -373,8 +372,6 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
|
||||
|
||||
/* copy or clear inside new stuff */
|
||||
|
||||
v3dn->runtime.properties_storage = NULL;
|
||||
|
||||
return (SpaceLink *)v3dn;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user