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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-06-15 05:50:08 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-06-15 05:52:59 +0300
commit2ba804d7b7dc9612540ff0d15a89cc1fc8c0bffa (patch)
tree6d2aaf2ec1d0fd43010ba7bead88914a8bd935ca
parent5dc0fd08a70b123e5d17057e1cbc1462bef0d8d8 (diff)
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.
-rw-r--r--source/blender/blenkernel/intern/screen.c22
-rw-r--r--source/blender/editors/space_action/space_action.c2
-rw-r--r--source/blender/editors/space_graph/space_graph.c2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c7
4 files changed, 21 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c
index d0d63192ebf..2d59e978a81 100644
--- a/source/blender/blenkernel/intern/screen.c
+++ b/source/blender/blenkernel/intern/screen.c
@@ -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(&region->runtime, 0x0, sizeof(region->runtime));
+
direct_link_panel_list(reader, &region->panels);
BLO_read_list(reader, &region->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;
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index f6af2f79890..26b087168f9 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -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;
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 9f01773eadf..0c6d904de01 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -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);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 001def7318e..36901141497 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -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;
}