Fix items in mode pie changing position by supporting more than 8 items in operator-enum pies

Now a 'More' item is added to the pie when there are too many items. It opens a sub-pie that contains the remaining items.
Note that this only touches operator-enum pies (like the object mode pie is), it is not a complete support for pies with more than 8 items. For this further design and code work would be needed, but this is too urgent to wait for that.

This is a better fix for T46973, should definitely be applied for 2.77 release.

Patch D1800 by myself with some edits by @campbellbarton, thanks!
This commit is contained in:
Julian Eisel
2016-02-16 14:50:26 +01:00
parent 8f944789cd
commit 21c88df7c7
4 changed files with 247 additions and 83 deletions

View File

@@ -182,6 +182,9 @@ enum {
#define PIE_CLICK_THRESHOLD_SQ 50.0f
/* max amount of items a radial menu (pie menu) can contain */
#define PIE_MAX_ITEMS 8
typedef struct uiLinkLine { /* only for draw/edit */
struct uiLinkLine *next, *prev;
struct uiBut *from, *to;
@@ -332,6 +335,10 @@ typedef struct ColorPickerData {
} ColorPickerData;
struct PieMenuData {
/* store title and icon to allow access when pie levels are created */
const char *title;
int icon;
float pie_dir[2];
float pie_center_init[2];
float pie_center_spawned[2];
@@ -603,6 +610,10 @@ uiPopupBlockHandle *ui_popup_menu_create(
struct bContext *C, struct ARegion *butregion, uiBut *but,
uiMenuCreateFunc create_func, void *arg);
void ui_pie_menu_level_create(
uiBlock *block, struct wmOperatorType *ot, const char *propname, IDProperty *properties,
const EnumPropertyItem *items, int totitem, int context, int flag);
void ui_popup_block_free(struct bContext *C, uiPopupBlockHandle *handle);
int ui_but_menu_step(uiBut *but, int step);