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
This commit is contained in:
parent
5f694a5078
commit
658e72f47d
|
@ -62,6 +62,7 @@ class USERPREF_HT_header(Header):
|
||||||
layout.operator("wm.keyconfig_export")
|
layout.operator("wm.keyconfig_export")
|
||||||
elif userpref.active_section == 'ADDONS':
|
elif userpref.active_section == 'ADDONS':
|
||||||
layout.operator("wm.addon_install", icon="FILESEL")
|
layout.operator("wm.addon_install", icon="FILESEL")
|
||||||
|
layout.operator("wm.addon_refresh", icon='FILE_REFRESH')
|
||||||
layout.menu("USERPREF_MT_addons_dev_guides")
|
layout.menu("USERPREF_MT_addons_dev_guides")
|
||||||
elif userpref.active_section == 'THEMES':
|
elif userpref.active_section == 'THEMES':
|
||||||
layout.operator("ui.reset_default_theme")
|
layout.operator("ui.reset_default_theme")
|
||||||
|
@ -1147,7 +1148,6 @@ class USERPREF_PT_addons(Panel):
|
||||||
split = layout.split(percentage=0.2)
|
split = layout.split(percentage=0.2)
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
|
col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
|
||||||
col.operator("wm.addon_refresh", icon='FILE_REFRESH')
|
|
||||||
|
|
||||||
col.label(text="Supported Level")
|
col.label(text="Supported Level")
|
||||||
col.prop(context.window_manager, "addon_support", expand=True)
|
col.prop(context.window_manager, "addon_support", expand=True)
|
||||||
|
|
|
@ -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 */
|
* figures out the previous and next for us */
|
||||||
void BKE_nurb_handle_calc_simple(Nurb *nu, BezTriple *bezt)
|
void BKE_nurb_handle_calc_simple(Nurb *nu, BezTriple *bezt)
|
||||||
{
|
{
|
||||||
int index = (int)(bezt - nu->bezt);
|
BezTriple *prev = BKE_nurb_bezt_get_prev(nu, bezt);
|
||||||
BezTriple *prev, *next;
|
BezTriple *next = BKE_nurb_bezt_get_next(nu, bezt);
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
BKE_nurb_handle_calc(bezt, prev, next, 0);
|
BKE_nurb_handle_calc(bezt, prev, next, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6589,7 +6589,7 @@ static int ui_handle_list_event(bContext *C, const wmEvent *event, ARegion *ar)
|
||||||
|
|
||||||
/* activate up/down the list */
|
/* activate up/down the list */
|
||||||
value = value_orig;
|
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;
|
inc = ELEM(type, UPARROWKEY, WHEELUPMOUSE) ? 1 : -1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -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);
|
(ui_list->filter_flag & UILST_FLT_EXCLUDE) ? ICON_ZOOM_OUT : ICON_ZOOM_IN);
|
||||||
|
|
||||||
subrow = uiLayoutRow(row, TRUE);
|
subrow = uiLayoutRow(row, TRUE);
|
||||||
uiItemR(subrow, &listptr, "use_filter_orderby_name", UI_ITEM_R_TOGGLE, NULL, ICON_NONE);
|
uiItemR(subrow, &listptr, "use_filter_sort_alpha", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "", ICON_NONE);
|
||||||
uiItemR(subrow, &listptr, "use_filter_orderby_invert", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "",
|
uiItemR(subrow, &listptr, "use_filter_sort_reverse", UI_ITEM_R_TOGGLE | UI_ITEM_R_ICON_ONLY, "",
|
||||||
(ui_list->filter_orderby_flag & UILST_FLT_ORDERBY_REVERSE) ? ICON_TRIA_UP : ICON_TRIA_DOWN);
|
(ui_list->filter_sort_flag & UILST_FLT_SORT_REVERSE) ? ICON_TRIA_UP : ICON_TRIA_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
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;
|
const char *filter_raw = ui_list->filter_byname;
|
||||||
char *filter = (char *)filter_raw, filter_buff[32], *filter_dyn = NULL;
|
char *filter = (char *)filter_raw, filter_buff[32], *filter_dyn = NULL;
|
||||||
bool filter_exclude = (ui_list->filter_flag & UILST_FLT_EXCLUDE) != 0;
|
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);
|
int len = RNA_property_collection_length(dataptr, prop);
|
||||||
|
|
||||||
dyn_data->items_shown = dyn_data->items_len = len;
|
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) */
|
/* Filter list items! (not for compact layout, though) */
|
||||||
if (dataptr->data && prop) {
|
if (dataptr->data && prop) {
|
||||||
int filter_exclude = ui_list->filter_flag & UILST_FLT_EXCLUDE;
|
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;
|
int items_shown, idx = 0;
|
||||||
#if 0
|
#if 0
|
||||||
int prev_ii = -1, prev_i;
|
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 */
|
uiButClearFlag(but, UI_BUT_UNDO); /* skip undo on screen buttons */
|
||||||
|
|
||||||
uiBlockSetEmboss(subblock, UI_EMBOSS);
|
uiBlockSetEmboss(subblock, UI_EMBOSS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (items_ptr) {
|
if (items_ptr) {
|
||||||
|
|
|
@ -147,7 +147,7 @@ typedef struct uiList { /* some list UI data need to be saved in file
|
||||||
/* Filtering data. */
|
/* Filtering data. */
|
||||||
char filter_byname[64]; /* defined as UI_MAX_NAME_STR */
|
char filter_byname[64]; /* defined as UI_MAX_NAME_STR */
|
||||||
int filter_flag;
|
int filter_flag;
|
||||||
int filter_orderby_flag;
|
int filter_sort_flag;
|
||||||
|
|
||||||
/* Custom sub-classes properties. */
|
/* Custom sub-classes properties. */
|
||||||
IDProperty *properties;
|
IDProperty *properties;
|
||||||
|
@ -284,11 +284,11 @@ enum {
|
||||||
|
|
||||||
/* uiList filter orderby type */
|
/* uiList filter orderby type */
|
||||||
enum {
|
enum {
|
||||||
UILST_FLT_ORDERBY_NAME = 1 << 0,
|
UILST_FLT_SORT_ALPHA = 1 << 0,
|
||||||
UILST_FLT_ORDERBY_REVERSE = 1 << 31 /* Special value, bitflag used to reverse order! */
|
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 */
|
/* regiontype, first two are the default set */
|
||||||
/* Do NOT change order, append on end. Types are hardcoded needed */
|
/* Do NOT change order, append on end. Types are hardcoded needed */
|
||||||
|
|
|
@ -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_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_EXCLUDE);
|
||||||
RNA_def_property_ui_text(prop, "Invert", "Invert filtering (show hidden items, and vice-versa)");
|
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);
|
prop = RNA_def_property(srna, "use_filter_sort_alpha", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "filter_orderby_flag", UILST_FLT_ORDERBY_NAME);
|
RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_ALPHA);
|
||||||
RNA_def_property_ui_text(prop, "Order by Name", "Order shown items by their names");
|
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);
|
prop = RNA_def_property(srna, "use_filter_sort_reverse", PROP_BOOLEAN, PROP_NONE);
|
||||||
RNA_def_property_boolean_sdna(prop, NULL, "filter_orderby_flag", UILST_FLT_ORDERBY_REVERSE);
|
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");
|
RNA_def_property_ui_text(prop, "Invert", "Invert the order of shown items");
|
||||||
|
|
||||||
/* draw_item */
|
/* draw_item */
|
||||||
|
|
Loading…
Reference in New Issue