[Bf-blender-cvs] [cb614107d3b] blender2.8: UI: fix own error switching fake space types
Campbell Barton
noreply at git.blender.org
Thu May 31 18:00:38 CEST 2018
Commit: cb614107d3b41c40ca27df0cd5b72dc9df049827
Author: Campbell Barton
Date: Thu May 31 17:59:35 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBcb614107d3b41c40ca27df0cd5b72dc9df049827
UI: fix own error switching fake space types
===================================================================
M source/blender/makesdna/DNA_screen_types.h
M source/blender/makesrna/intern/rna_screen.c
===================================================================
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])
More information about the Bf-blender-cvs
mailing list