diff options
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 52d909a34c0..9759c22f30e 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -68,6 +68,8 @@ #define EM_SEPR_X 6 #define EM_SEPR_Y 6 +// #define USE_OP_RESET_BUT // we may want to make this optional, disable for now. + #define UI_OPERATOR_ERROR_RET(_ot, _opname, return_statement) \ if (ot == NULL) { \ ui_item_disabled(layout, _opname); \ @@ -428,7 +430,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in but->type = NUMSLI; } } - else if (subtype == PROP_DIRECTION) { + else if (subtype == PROP_DIRECTION && !expand) { uiDefButR_prop(block, BUT_NORMAL, 0, name, x, y, UI_UNIT_X * 3, UI_UNIT_Y * 3, ptr, prop, 0, 0, 0, -1, -1, NULL); } else { @@ -1382,6 +1384,12 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN but->rnasearchprop = searchprop; but->flag |= UI_ICON_LEFT | UI_TEXT_LEFT; + if (RNA_property_type(prop) == PROP_ENUM) { + /* XXX, this will have a menu string, + * but in this case we just want the text */ + but->str[0] = 0; + } + uiButSetSearchFunc(but, rna_search_cb, but, NULL, NULL); } } @@ -1399,13 +1407,14 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna prop = RNA_struct_find_property(ptr, propname); if (!prop) { - RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); + RNA_warning("property not found: %s.%s", + RNA_struct_identifier(ptr->type), propname); return; } type = RNA_property_type(prop); - if (!ELEM(type, PROP_POINTER, PROP_STRING)) { - RNA_warning("Property %s must be a pointer or string", propname); + if (!ELEM3(type, PROP_POINTER, PROP_STRING, PROP_ENUM)) { + RNA_warning("Property %s must be a pointer, string or enum", propname); return; } @@ -1413,11 +1422,13 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna if (!searchprop) { - RNA_warning("search collection property not found: %s.%s", RNA_struct_identifier(ptr->type), searchpropname); + RNA_warning("search collection property not found: %s.%s", + RNA_struct_identifier(searchptr->type), searchpropname); return; } else if (RNA_property_type(searchprop) != PROP_COLLECTION) { - RNA_warning("search collection property is not a collection type: %s.%s", RNA_struct_identifier(ptr->type), searchpropname); + RNA_warning("search collection property is not a collection type: %s.%s", + RNA_struct_identifier(searchptr->type), searchpropname); return; } @@ -2840,10 +2851,12 @@ const char *uiLayoutIntrospect(uiLayout *layout) return str; } +#ifdef USE_OP_RESET_BUT static void ui_layout_operator_buts__reset_cb(bContext *UNUSED(C), void *op_pt, void *UNUSED(arg_dummy2)) { WM_operator_properties_reset((wmOperator *)op_pt); } +#endif /* this function does not initialize the layout, functions can be called on the layout before and after */ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, @@ -2911,6 +2924,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, } } +#ifdef USE_OP_RESET_BUT /* its possible that reset can do nothing if all have PROP_SKIP_SAVE enabled * but this is not so important if this button is drawn in those cases * (which isn't all that likely anyway) - campbell */ @@ -2925,6 +2939,7 @@ void uiLayoutOperatorButs(const bContext *C, uiLayout *layout, wmOperator *op, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Reset operator defaults")); uiButSetFunc(but, ui_layout_operator_buts__reset_cb, op, NULL); } +#endif /* set various special settings for buttons */ { |