diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-05-31 18:59:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-05-31 19:00:17 +0300 |
commit | cb614107d3b41c40ca27df0cd5b72dc9df049827 (patch) | |
tree | 78655f0bea37957a303967d9f7d5c238593c794f /source/blender | |
parent | 5a82aee9e69ddcfbd4ca704f6566cf7eeec97dec (diff) |
UI: fix own error switching fake space types
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesdna/DNA_screen_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_screen.c | 22 |
2 files changed, 20 insertions, 7 deletions
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index ef0dbceef38..7849c05e48b 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -274,11 +274,12 @@ typedef struct ScrArea { * SPACE_EMPTY. Also, versioning uses it to nicely replace deprecated * editors. It's been there for ages, name doesn't fit any more... */ char butspacetype; /* eSpace_Type (SPACE_FOO) */ + short butspacetype_subtype; short winx, winy; /* size */ - short headertype DNA_DEPRECATED;/* OLD! 0=no header, 1= down, 2= up */ - short do_refresh; /* private, for spacetype refresh callback */ + char headertype DNA_DEPRECATED;/* OLD! 0=no header, 1= down, 2= up */ + char do_refresh; /* private, for spacetype refresh callback */ short flag; short region_active_win; /* index of last used region of 'RGN_TYPE_WINDOW' * runtime variable, updated by executing operators */ diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 7596ccb19fa..731333bd18a 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -251,7 +251,7 @@ static const EnumPropertyItem *rna_Area_ui_type_itemf( static int rna_Area_ui_type_get(PointerRNA *ptr) { int value = rna_Area_type_get(ptr) << 16; - ScrArea *sa = (ScrArea *)ptr->data; + ScrArea *sa = ptr->data; if (sa->type->space_subtype_item_extend != NULL) { value |= sa->type->space_subtype_get(sa); } @@ -260,16 +260,28 @@ static int rna_Area_ui_type_get(PointerRNA *ptr) static void rna_Area_ui_type_set(PointerRNA *ptr, int value) { - rna_Area_type_set(ptr, value >> 16); - ScrArea *sa = (ScrArea *)ptr->data; - if (sa->type->space_subtype_item_extend != NULL) { - sa->type->space_subtype_set(sa, value & 0xffff); + ScrArea *sa = ptr->data; + const int space_type = value >> 16; + SpaceType *st = BKE_spacetype_from_id(space_type); + + rna_Area_type_set(ptr, space_type); + + if (st && st->space_subtype_item_extend != NULL) { + sa->butspacetype_subtype = value & 0xffff; } } static void rna_Area_ui_type_update(bContext *C, PointerRNA *ptr) { + ScrArea *sa = ptr->data; + SpaceType *st = BKE_spacetype_from_id(sa->butspacetype); + rna_Area_type_update(C, ptr); + + if ((sa->type == st) && (st->space_subtype_item_extend != NULL)) { + st->space_subtype_set(sa, sa->butspacetype_subtype); + } + sa->butspacetype_subtype = 0; } static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float result[2]) |