diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-30 15:49:35 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-30 15:49:35 +0400 |
commit | 658e72f47d6299b8009a04b8aa40ecf95f69bd96 (patch) | |
tree | d24b4c147ef62fa2a78b637f73f361657227d67a | |
parent | 5f694a5078eb776fd8fdc78e265a1b5a9a8472ca (diff) |
minor ui edits
- move addon refresh button into header
- uilist, use icon for sorting by name (gives more room for name, icon is used in fileselector for same purpose).
- rename orderby to sort in rna and flag names.
- simplify BKE_nurb_handle_calc_simple
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/curve.c | 21 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 12 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_screen_types.h | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ui.c | 11 |
6 files changed, 20 insertions, 36 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 0418434c92b..1e9c9e7ff7e 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -62,6 +62,7 @@ class USERPREF_HT_header(Header): layout.operator("wm.keyconfig_export") elif userpref.active_section == 'ADDONS': layout.operator("wm.addon_install", icon="FILESEL") + layout.operator("wm.addon_refresh", icon='FILE_REFRESH') layout.menu("USERPREF_MT_addons_dev_guides") elif userpref.active_section == 'THEMES': layout.operator("ui.reset_default_theme") @@ -1147,7 +1148,6 @@ class USERPREF_PT_addons(Panel): split = layout.split(percentage=0.2) col = split.column() col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM') - col.operator("wm.addon_refresh", icon='FILE_REFRESH') col.label(text="Supported Level") col.prop(context.window_manager, "addon_support", expand=True) diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 0255e986661..ab6cf5ac5d1 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -3088,25 +3088,8 @@ void BKE_nurb_handles_calc(Nurb *nu) /* first, if needed, set handle flags */ * figures out the previous and next for us */ void BKE_nurb_handle_calc_simple(Nurb *nu, BezTriple *bezt) { - int index = (int)(bezt - nu->bezt); - BezTriple *prev, *next; - - BLI_assert(ARRAY_HAS_ITEM(bezt, nu->bezt, nu->pntsu)); - - if (nu->pntsu > 1) { - if (index == 0) { - prev = (nu->flagu & CU_NURB_CYCLIC) ? &nu->bezt[nu->pntsu - 1] : NULL; - next = bezt + 1; - } - else if (index == nu->pntsu - 1) { - prev = bezt - 1; - next = (nu->flagu & CU_NURB_CYCLIC) ? &nu->bezt[0] : NULL; - } - } - else { - prev = next = NULL; - } - + BezTriple *prev = BKE_nurb_bezt_get_prev(nu, bezt); + BezTriple *next = BKE_nurb_bezt_get_next(nu, bezt); BKE_nurb_handle_calc(bezt, prev, next, 0); } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 90040e221b0..d3dd4347d9f 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -6589,7 +6589,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar) /* activate up/down the list */ value = value_orig; - if ((ui_list->filter_orderby_flag & UILST_FLT_ORDERBY_REVERSE) != 0) { + if ((ui_list->filter_sort_flag & UILST_FLT_SORT_REVERSE) != 0) { inc = ELEM(type, UPARROWKEY, WHEELUPMOUSE) ? 1 : -1; } else { diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index e315d0c82a2..4e79fd19f24 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2513,9 +2513,9 @@ static void uilist_draw_filter_default(struct uiList *ui_list, struct bContext * (ui_list->filter_flag & UILST_FLT_EXCLUDE) ? ICON_ZOOM_OUT : ICON_ZOOM_IN); subrow = uiLayoutRow(row, TRUE); - uiItemR(subrow, &listptr, "use_filter_orderby_name", UI_ITEM_R_TOGGLE, NULL, ICON_NONE); - uiItemR(subrow, &listptr, "use_filter_orderby_invert", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", - (ui_list->filter_orderby_flag & UILST_FLT_ORDERBY_REVERSE) ? ICON_TRIA_UP : ICON_TRIA_DOWN); + uiItemR(subrow, &listptr, "use_filter_sort_alpha", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE); + uiItemR(subrow, &listptr, "use_filter_sort_reverse", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", + (ui_list->filter_sort_flag & UILST_FLT_SORT_REVERSE) ? ICON_TRIA_UP : ICON_TRIA_DOWN); } typedef struct { @@ -2538,7 +2538,7 @@ static void uilist_filter_items_default(struct uiList *ui_list, struct bContext const char *filter_raw = ui_list->filter_byname; char *filter = (char *)filter_raw, filter_buff[32], *filter_dyn = NULL; bool filter_exclude = (ui_list->filter_flag & UILST_FLT_EXCLUDE) != 0; - bool order_by_name = (ui_list->filter_orderby_flag & UILST_FLT_ORDERBY_NAME) != 0; + bool order_by_name = (ui_list->filter_sort_flag & UILST_FLT_SORT_ALPHA) != 0; int len = RNA_property_collection_length(dataptr, prop); dyn_data->items_shown = dyn_data->items_len = len; @@ -2838,7 +2838,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co /* Filter list items! (not for compact layout, though) */ if (dataptr->data && prop) { int filter_exclude = ui_list->filter_flag & UILST_FLT_EXCLUDE; - bool order_reverse = (ui_list->filter_orderby_flag & UILST_FLT_ORDERBY_REVERSE) != 0; + bool order_reverse = (ui_list->filter_sort_flag & UILST_FLT_SORT_REVERSE) != 0; int items_shown, idx = 0; #if 0 int prev_ii = -1, prev_i; @@ -3092,7 +3092,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, const char *listtype_name, co uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */ uiBlockSetEmboss(subblock, UI_EMBOSS); - } + } } if (items_ptr) { diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 435f5c634a9..ec86a4739c5 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -147,7 +147,7 @@ typedef struct uiList { /* some list UI data need to be saved in file /* Filtering data. */ char filter_byname[64]; /* defined as UI_MAX_NAME_STR */ int filter_flag; - int filter_orderby_flag; + int filter_sort_flag; /* Custom sub-classes properties. */ IDProperty *properties; @@ -284,11 +284,11 @@ enum { /* uiList filter orderby type */ enum { - UILST_FLT_ORDERBY_NAME = 1 << 0, - UILST_FLT_ORDERBY_REVERSE = 1 << 31 /* Special value, bitflag used to reverse order! */ + UILST_FLT_SORT_ALPHA = 1 << 0, + UILST_FLT_SORT_REVERSE = 1 << 31 /* Special value, bitflag used to reverse order! */ }; -#define UILST_FLT_ORDERBY_MASK (((unsigned int)UILST_FLT_ORDERBY_REVERSE) - 1) +#define UILST_FLT_SORT_MASK (((unsigned int)UILST_FLT_SORT_REVERSE) - 1) /* regiontype, first two are the default set */ /* Do NOT change order, append on end. Types are hardcoded needed */ diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index dbddf54fe04..6d521c6364f 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -1048,12 +1048,13 @@ static void rna_def_uilist(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_EXCLUDE); RNA_def_property_ui_text(prop, "Invert", "Invert filtering (show hidden items, and vice-versa)"); - prop = RNA_def_property(srna, "use_filter_orderby_name", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "filter_orderby_flag", UILST_FLT_ORDERBY_NAME); - RNA_def_property_ui_text(prop, "Order by Name", "Order shown items by their names"); + prop = RNA_def_property(srna, "use_filter_sort_alpha", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_ALPHA); + RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0); + RNA_def_property_ui_text(prop, "Sort by Name", "Sort items by their name"); - prop = RNA_def_property(srna, "use_filter_orderby_invert", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "filter_orderby_flag", UILST_FLT_ORDERBY_REVERSE); + prop = RNA_def_property(srna, "use_filter_sort_reverse", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_REVERSE); RNA_def_property_ui_text(prop, "Invert", "Invert the order of shown items"); /* draw_item */ |