Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_layout.c
| Show First 20 Lines • Show All 1,208 Lines • ▼ Show 20 Lines | static uiBut *uiItemFullO_ptr_ex(uiLayout *layout, | ||||
| if (flag & UI_ITEM_R_NO_BG) { | if (flag & UI_ITEM_R_NO_BG) { | ||||
| layout->emboss = prev_emboss; | layout->emboss = prev_emboss; | ||||
| } | } | ||||
| if (flag & UI_ITEM_O_DEPRESS) { | if (flag & UI_ITEM_O_DEPRESS) { | ||||
| but->flag |= UI_SELECT_DRAW; | but->flag |= UI_SELECT_DRAW; | ||||
| } | } | ||||
| if (flag & UI_ITEM_R_ICON_ONLY) { | |||||
| UI_but_drawflag_disable(but, UI_BUT_ICON_LEFT); | |||||
| } | |||||
| if (layout->redalert) { | if (layout->redalert) { | ||||
| UI_but_flag_enable(but, UI_BUT_REDALERT); | UI_but_flag_enable(but, UI_BUT_REDALERT); | ||||
| } | } | ||||
| if (layout->active_default) { | if (layout->active_default) { | ||||
| UI_but_flag_enable(but, UI_BUT_ACTIVE_DEFAULT); | UI_but_flag_enable(but, UI_BUT_ACTIVE_DEFAULT); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 204 Lines • ▼ Show 20 Lines | void uiItemsFullEnumO_items(uiLayout *layout, | ||||
| uiLayout *target, *split = NULL; | uiLayout *target, *split = NULL; | ||||
| const EnumPropertyItem *item; | const EnumPropertyItem *item; | ||||
| uiBlock *block = layout->root->block; | uiBlock *block = layout->root->block; | ||||
| const bool radial = ui_layout_is_radial(layout); | const bool radial = ui_layout_is_radial(layout); | ||||
| if (radial) { | if (radial) { | ||||
| target = uiLayoutRadial(layout); | target = uiLayoutRadial(layout); | ||||
| } | } | ||||
| else if (layout->item.type == ITEM_LAYOUT_ROW && flag & UI_ITEM_R_ICON_ONLY) { | |||||
| target = layout; | |||||
| /* Add a blank button to the beginning of the row. */ | |||||
| uiDefIconBut( | |||||
| block, UI_BTYPE_LABEL, 0, ICON_BLANK1, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, NULL); | |||||
| } | |||||
| else { | else { | ||||
| split = uiLayoutSplit(layout, 0.0f, false); | split = uiLayoutSplit(layout, 0.0f, false); | ||||
| target = uiLayoutColumn(split, layout->align); | target = uiLayoutColumn(split, layout->align); | ||||
| } | } | ||||
| int i; | int i; | ||||
| bool last_iter = false; | bool last_iter = false; | ||||
| Show All 31 Lines | if (item->identifier[0]) { | ||||
| if (properties) { | if (properties) { | ||||
| if (tptr.data) { | if (tptr.data) { | ||||
| IDP_FreeProperty(tptr.data); | IDP_FreeProperty(tptr.data); | ||||
| } | } | ||||
| tptr.data = IDP_CopyProperty(properties); | tptr.data = IDP_CopyProperty(properties); | ||||
| } | } | ||||
| RNA_property_enum_set(&tptr, prop, item->value); | RNA_property_enum_set(&tptr, prop, item->value); | ||||
| uiItemFullO_ptr(target, ot, item->name, item->icon, tptr.data, context, flag, NULL); | uiItemFullO_ptr(target, | ||||
| ot, | |||||
| (flag & UI_ITEM_R_ICON_ONLY) ? NULL : item->name, | |||||
| item->icon, | |||||
| tptr.data, | |||||
| context, | |||||
| flag, | |||||
| NULL); | |||||
| ui_but_tip_from_enum_item(block->buttons.last, item); | ui_but_tip_from_enum_item(block->buttons.last, item); | ||||
| } | } | ||||
| else { | else { | ||||
| if (item->name) { | if (item->name) { | ||||
| uiBut *but; | uiBut *but; | ||||
| if (item != item_array && !radial) { | if (item != item_array && !radial && split != NULL) { | ||||
| target = uiLayoutColumn(split, layout->align); | target = uiLayoutColumn(split, layout->align); | ||||
Severin: `split` may be used uninitialized here. I think just `NULL`-checking is fine. | |||||
| /* inconsistent, but menus with labels do not look good flipped */ | /* inconsistent, but menus with labels do not look good flipped */ | ||||
| block->flag |= UI_BLOCK_NO_FLIP; | block->flag |= UI_BLOCK_NO_FLIP; | ||||
| } | } | ||||
| if (item->icon || radial) { | if (item->icon || radial) { | ||||
| uiItemL(target, item->name, item->icon); | uiItemL(target, item->name, item->icon); | ||||
| ▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | else if (prop && RNA_property_type(prop) != PROP_ENUM) { | ||||
| return; | return; | ||||
| } | } | ||||
| else { | else { | ||||
| RNA_warning("%s.%s not found", RNA_struct_identifier(ptr.type), propname); | RNA_warning("%s.%s not found", RNA_struct_identifier(ptr.type), propname); | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname) | void uiItemsEnumO(uiLayout *layout, const char *opname, const char *propname, int flag) | ||||
| { | { | ||||
| uiItemsFullEnumO(layout, opname, propname, NULL, layout->root->opcontext, 0); | uiItemsFullEnumO(layout, opname, propname, NULL, layout->root->opcontext, flag); | ||||
| } | } | ||||
| /* for use in cases where we have */ | /* for use in cases where we have */ | ||||
| void uiItemEnumO_value(uiLayout *layout, | void uiItemEnumO_value(uiLayout *layout, | ||||
| const char *name, | const char *name, | ||||
| int icon, | int icon, | ||||
| const char *opname, | const char *opname, | ||||
| const char *propname, | const char *propname, | ||||
| ▲ Show 20 Lines • Show All 1,755 Lines • ▼ Show 20 Lines | typedef struct MenuItemLevel { | ||||
| PointerRNA rnapoin; | PointerRNA rnapoin; | ||||
| } MenuItemLevel; | } MenuItemLevel; | ||||
| static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, void *arg) | static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, void *arg) | ||||
| { | { | ||||
| MenuItemLevel *lvl = (MenuItemLevel *)(((uiBut *)arg)->func_argN); | MenuItemLevel *lvl = (MenuItemLevel *)(((uiBut *)arg)->func_argN); | ||||
| uiLayoutSetOperatorContext(layout, lvl->opcontext); | uiLayoutSetOperatorContext(layout, lvl->opcontext); | ||||
| uiItemsEnumO(layout, lvl->opname, lvl->propname); | uiItemsEnumO(layout, lvl->opname, lvl->propname, false); | ||||
| layout->root->block->flag |= UI_BLOCK_IS_FLIP; | layout->root->block->flag |= UI_BLOCK_IS_FLIP; | ||||
| /* override default, needed since this was assumed pre 2.70 */ | /* override default, needed since this was assumed pre 2.70 */ | ||||
| UI_block_direction_set(layout->root->block, UI_DIR_DOWN); | UI_block_direction_set(layout->root->block, UI_DIR_DOWN); | ||||
| } | } | ||||
| void uiItemMenuEnumO_ptr(uiLayout *layout, | void uiItemMenuEnumO_ptr(uiLayout *layout, | ||||
| ▲ Show 20 Lines • Show All 2,381 Lines • Show Last 20 Lines | |||||
split may be used uninitialized here. I think just NULL-checking is fine.