Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2013-08-29 16:55:31 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-08-29 16:55:31 +0400
commit113997a03c9b1ecc7ec6460f24781d54fd9efb57 (patch)
tree27febdc8ef32e37b0519d4a9bd8426c1ef73257d /source/blender/makesdna/DNA_screen_types.h
parent034d5a9578714db01cd05629804d1dbef48c1734 (diff)
Last uiList patch (for now!): filtering and reordering of shown elements.
Thanks to Brecht for the reviews. :) This commit adds a show/hide extension below each uiList, containing by default an option to filter and/or reorder items by name (and to reverse those filtering and reordering). Each derived uiList class in Python can define more specific filtering by implementing callbacks: the draw_filter() function to draw options in UI, and the filter_items() function to effectively filter/reorder items. Note: the advanced options for vgroups shown as "proof od concept" in patches do not go in trunk for now, we have to find a better way to get those vgroups info for UI code, we can't afford to loop over each vertex here! And doc (release notes and uiList example) is still to be updated, will do this in next days.
Diffstat (limited to 'source/blender/makesdna/DNA_screen_types.h')
-rw-r--r--source/blender/makesdna/DNA_screen_types.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h
index 8e18a84060a..435f5c634a9 100644
--- a/source/blender/makesdna/DNA_screen_types.h
+++ b/source/blender/makesdna/DNA_screen_types.h
@@ -123,6 +123,10 @@ typedef struct uiListDyn {
int items_len; /* Number of items in collection. */
int items_shown; /* Number of items actually visible after filtering. */
+
+ /* Filtering data. */
+ int *items_filter_flags; /* items_len length. */
+ int *items_filter_neworder; /* org_idx -> new_idx, items_len length. */
} uiListDyn;
typedef struct uiList { /* some list UI data need to be saved in file */
@@ -140,6 +144,14 @@ typedef struct uiList { /* some list UI data need to be saved in file
int list_last_len;
int padi1;
+ /* Filtering data. */
+ char filter_byname[64]; /* defined as UI_MAX_NAME_STR */
+ int filter_flag;
+ int filter_orderby_flag;
+
+ /* Custom sub-classes properties. */
+ IDProperty *properties;
+
/* Dynamic data (runtime). */
uiListDyn *dyn_data;
} uiList;
@@ -259,6 +271,25 @@ enum {
UILST_RESIZING = 1 << 1, /* We are currently resizing, deactivate autosize! */
};
+/* uiList filter flags (dyn_data) */
+enum {
+ UILST_FLT_ITEM = 1 << 31, /* This item has passed the filter process successfully. */
+};
+
+/* uiList filter options */
+enum {
+ UILST_FLT_SHOW = 1 << 0, /* Show filtering UI. */
+ UILST_FLT_EXCLUDE = UILST_FLT_ITEM, /* Exclude filtered items, *must* use this same value. */
+};
+
+/* uiList filter orderby type */
+enum {
+ UILST_FLT_ORDERBY_NAME = 1 << 0,
+ UILST_FLT_ORDERBY_REVERSE = 1 << 31 /* Special value, bitflag used to reverse order! */
+};
+
+#define UILST_FLT_ORDERBY_MASK (((unsigned int)UILST_FLT_ORDERBY_REVERSE) - 1)
+
/* regiontype, first two are the default set */
/* Do NOT change order, append on end. Types are hardcoded needed */
enum {