diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2018-04-22 20:58:27 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2018-04-23 00:23:20 +0300 |
commit | 9db492de6dd07dca93f0de7dbfa92f811fe50765 (patch) | |
tree | f7050e660a9d6deedfe6873875d042c90fa5cea2 /source/blender/editors/screen/area.c | |
parent | 9eaf00616ba60df92cfab2837dd175b8e7eb4c44 (diff) |
Cleanup: Get rid of ScrArea.butspacetype syncing with ScrArea.spacetype
The only real reason we need `butspacetype` is while switching areas, where we
need to delay the actual switch to the RNA _update callback since only there we
can access context.
So instead of trying to sync it with `spacetype`, only set while needed and
unset it afterwards (as in set to `SPACE_EMPTY`).
This should also allow us to re-use `butspacetype` in versioning code when
trying to read removed editors. It'll store the space type value of the removed
editor which we can then use on versioning.
For backwards compatibility, we store `butspacetype` with the value of
`spacetype`.
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r-- | source/blender/editors/screen/area.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 5d999677ba8..588a2abec53 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1481,10 +1481,10 @@ void ED_area_initialize(wmWindowManager *wm, wmWindow *win, ScrArea *sa) sa->type = BKE_spacetype_from_id(sa->spacetype); if (sa->type == NULL) { - sa->butspacetype = sa->spacetype = SPACE_VIEW3D; + sa->spacetype = SPACE_VIEW3D; sa->type = BKE_spacetype_from_id(sa->spacetype); } - + for (ar = sa->regionbase.first; ar; ar = ar->next) ar->type = BKE_regiontype_from_id(sa->type, ar->regiontype); @@ -1607,7 +1607,6 @@ void ED_area_data_copy(ScrArea *sa_dst, ScrArea *sa_src, const bool do_free) sa_dst->headertype = sa_src->headertype; sa_dst->spacetype = sa_src->spacetype; sa_dst->type = sa_src->type; - sa_dst->butspacetype = sa_src->butspacetype; sa_dst->flag = (sa_dst->flag & ~flag_copy) | (sa_src->flag & flag_copy); @@ -1638,7 +1637,6 @@ void ED_area_data_swap(ScrArea *sa_dst, ScrArea *sa_src) SWAP(short, sa_dst->headertype, sa_src->headertype); SWAP(char, sa_dst->spacetype, sa_src->spacetype); SWAP(SpaceType *, sa_dst->type, sa_src->type); - SWAP(char, sa_dst->butspacetype, sa_src->butspacetype); SWAP(ListBase, sa_dst->spacedata, sa_src->spacedata); @@ -1677,8 +1675,9 @@ void ED_area_swapspace(bContext *C, ScrArea *sa1, ScrArea *sa2) */ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exit) { + wmWindow *win = CTX_wm_window(C); + if (sa->spacetype != type) { - wmWindow *win = CTX_wm_window(C); SpaceType *st; SpaceLink *slold; SpaceLink *sl; @@ -1702,7 +1701,6 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type, const bool skip_ar_exi slold = sa->spacedata.first; sa->spacetype = type; - sa->butspacetype = type; sa->type = st; /* If st->new may be called, don't use context until then. The |