Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_screen.c
| Show First 20 Lines • Show All 223 Lines • ▼ Show 20 Lines | static const EnumPropertyItem *rna_Area_ui_type_itemf( | ||||
| int totitem = 0; | int totitem = 0; | ||||
| /* +1 to skip SPACE_EMPTY */ | /* +1 to skip SPACE_EMPTY */ | ||||
| for (const EnumPropertyItem *item_from = rna_enum_space_type_items + 1; item_from->identifier; item_from++) { | for (const EnumPropertyItem *item_from = rna_enum_space_type_items + 1; item_from->identifier; item_from++) { | ||||
| if (ELEM(item_from->value, SPACE_TOPBAR, SPACE_STATUSBAR, SPACE_USERPREF)) { | if (ELEM(item_from->value, SPACE_TOPBAR, SPACE_STATUSBAR, SPACE_USERPREF)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| int space_type = item_from->value; | |||||
| SpaceType *st = item_from->identifier[0] ? BKE_spacetype_from_id(item_from->value) : NULL; | SpaceType *st = item_from->identifier[0] ? BKE_spacetype_from_id(item_from->value) : NULL; | ||||
| int totitem_prev = totitem; | int totitem_prev = totitem; | ||||
| if (st && st->space_subtype_item_extend != NULL) { | if (st && st->space_subtype_item_extend != NULL) { | ||||
| st->space_subtype_item_extend(C, &item, &totitem); | st->space_subtype_item_extend(C, &item, &totitem); | ||||
| while (totitem_prev < totitem) { | while (totitem_prev < totitem) { | ||||
| item[totitem_prev++].value |= item_from->value << 16; | item[totitem_prev++].value |= space_type << 16; | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| RNA_enum_item_add(&item, &totitem, item_from); | RNA_enum_item_add(&item, &totitem, item_from); | ||||
| item[totitem_prev++].value = item_from->value << 16; | item[totitem_prev++].value = space_type << 16; | ||||
| } | } | ||||
| BKE_screen_dynspace_enum_item_extend(space_type, &item, &totitem); | |||||
| } | } | ||||
| 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; | int value = rna_Area_type_get(ptr) << 16; | ||||
| ScrArea *sa = ptr->data; | ScrArea *sa = ptr->data; | ||||
| if (sa->type->space_subtype_item_extend != NULL) { | if (sa->type->space_subtype_item_extend != NULL) { | ||||
| value |= sa->type->space_subtype_get(sa); | value |= sa->type->space_subtype_get(sa); | ||||
| } | } | ||||
| SpaceLink *sl = sa->spacedata.first; | |||||
| if (sl->link_flag & SPACE_LINK_FLAG_IS_DYNAMIC) { | |||||
| value |= SPACE_DYN_FLAG; | |||||
| } | |||||
| 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; | ||||
| SpaceType *st = BKE_spacetype_from_id(space_type); | SpaceType *st = BKE_spacetype_from_id(space_type); | ||||
| rna_Area_type_set(ptr, space_type); | rna_Area_type_set(ptr, space_type); | ||||
| if (st && st->space_subtype_item_extend != NULL) { | if ((value & SPACE_DYN_FLAG) || | ||||
| (st && st->space_subtype_item_extend != NULL)) | |||||
| { | |||||
| sa->butspacetype_subtype = value & 0xffff; | sa->butspacetype_subtype = value & 0xffff; | ||||
| } | } | ||||
| } | } | ||||
| static void rna_Area_ui_type_update(bContext *C, PointerRNA *ptr) | static void rna_Area_ui_type_update(bContext *C, PointerRNA *ptr) | ||||
| { | { | ||||
| ScrArea *sa = ptr->data; | ScrArea *sa = ptr->data; | ||||
| SpaceType *st = BKE_spacetype_from_id(sa->butspacetype); | SpaceType *st = BKE_spacetype_from_id(sa->butspacetype); | ||||
| rna_Area_type_update(C, ptr); | rna_Area_type_update(C, ptr); | ||||
| if ((sa->type == st) && (st->space_subtype_item_extend != NULL)) { | SpaceLink *sl = sa->spacedata.first; | ||||
| sl->link_flag &= ~SPACE_LINK_FLAG_IS_DYNAMIC; | |||||
| if (sa->type == st) { | |||||
| if (sa->butspacetype_subtype & SPACE_DYN_FLAG) { | |||||
| sl->space_subtype = sa->butspacetype_subtype & ~SPACE_DYN_FLAG; | |||||
| sl->link_flag |= SPACE_LINK_FLAG_IS_DYNAMIC; | |||||
| } | |||||
| else if (st->space_subtype_item_extend != NULL) { | |||||
| st->space_subtype_set(sa, sa->butspacetype_subtype); | st->space_subtype_set(sa, sa->butspacetype_subtype); | ||||
| } | } | ||||
| } | |||||
| sa->butspacetype_subtype = 0; | sa->butspacetype_subtype = 0; | ||||
| } | } | ||||
| static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float result[2]) | static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float result[2]) | ||||
| { | { | ||||
| UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]); | UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 298 Lines • Show Last 20 Lines | |||||