Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_screen.c
| Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | static const EnumPropertyItem *rna_Area_ui_type_itemf(bContext *C, | ||||
| RNA_enum_item_end(&item, &totitem); | RNA_enum_item_end(&item, &totitem); | ||||
| *r_free = true; | *r_free = true; | ||||
| return item; | return item; | ||||
| } | } | ||||
| static int rna_Area_ui_type_get(PointerRNA *ptr) | static int rna_Area_ui_type_get(PointerRNA *ptr) | ||||
| { | { | ||||
| int value = rna_Area_type_get(ptr) << 16; | |||||
| ScrArea *sa = ptr->data; | ScrArea *sa = ptr->data; | ||||
| const int area_type = rna_Area_type_get(ptr); | |||||
| const bool area_changing = sa->butspacetype != SPACE_EMPTY; | |||||
| int value = area_type << 16; | |||||
| /* sa->type can be NULL (when not yet initialized), try to do it now. */ | /* sa->type can be NULL (when not yet initialized), try to do it now. */ | ||||
| /* Copied from `ED_area_initialize()`.*/ | /* Copied from `ED_area_initialize()`.*/ | ||||
| if (sa->type == NULL) { | if (sa->type == NULL || area_changing) { | ||||
| sa->type = BKE_spacetype_from_id(sa->spacetype); | sa->type = BKE_spacetype_from_id(area_type); | ||||
| if (sa->type == NULL) { | if (sa->type == NULL) { | ||||
| sa->spacetype = SPACE_VIEW3D; | sa->spacetype = SPACE_VIEW3D; | ||||
| sa->type = BKE_spacetype_from_id(sa->spacetype); | sa->type = BKE_spacetype_from_id(sa->spacetype); | ||||
| } | } | ||||
| BLI_assert(sa->type != NULL); | BLI_assert(sa->type != NULL); | ||||
| } | } | ||||
| if (sa->type->space_subtype_item_extend != NULL) { | if (sa->type->space_subtype_item_extend != NULL) { | ||||
| value |= sa->type->space_subtype_get(sa); | value |= area_changing ? sa->butspacetype_subtype : sa->type->space_subtype_get(sa); | ||||
| } | } | ||||
| return value; | return value; | ||||
| } | } | ||||
| static void rna_Area_ui_type_set(PointerRNA *ptr, int value) | static void rna_Area_ui_type_set(PointerRNA *ptr, int value) | ||||
| { | { | ||||
| ScrArea *sa = ptr->data; | ScrArea *sa = ptr->data; | ||||
| const int space_type = value >> 16; | const int space_type = value >> 16; | ||||
| ▲ Show 20 Lines • Show All 377 Lines • Show Last 20 Lines | |||||