Page MenuHome

radialmenus01.txt

Authored By
Matt Ebb (broken)
Nov 13 2013, 1:07 PM
Size
31 KB
Subscribers
None

radialmenus01.txt

Index: source/blender/include/BIF_interface.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/BIF_interface.h,v
retrieving revision 1.39
diff -u -r1.39 BIF_interface.h
--- source/blender/include/BIF_interface.h 28 Jan 2006 18:33:13 -0000 1.39
+++ source/blender/include/BIF_interface.h 16 Oct 2006 12:54:52 -0000
@@ -43,6 +43,7 @@
#define UI_EMBOSSM 2 /* Minimal builtin emboss, also for logic buttons */
#define UI_EMBOSSP 3 /* Pulldown */
#define UI_EMBOSSR 4 /* Rounded */
+#define UI_EMBOSSRAD 5 /* For radial (pie) menus */
#define UI_EMBOSSX 0 /* for a python file, which i can't change.... duh! */
@@ -78,6 +79,8 @@
#define UI_BLOCK_NOSHADOW 64
#define UI_BLOCK_FRONTBUFFER 128
#define UI_BLOCK_NO_HILITE 256
+#define UI_BLOCK_RADIAL 512
+#define UI_BLOCK_TRANSPARENT 1024
/* block->flag bits 12-15 are identical to but->flag bits */
@@ -176,6 +179,7 @@
void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad);
void uiSetRoundBox(int type);
void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad);
+void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad, float asp);
void uiDrawMenuBox(float minx, float miny, float maxx, float maxy, short flag);
void uiTextBoundsBlock(uiBlock *block, int addval);
@@ -295,6 +299,8 @@
extern void pupmenu_set_active(int val);
extern short pupmenu(char *instr);
extern short pupmenu_col(char *instr, int maxrow);
+extern short listpupmenu(char *instr);
+extern short radialpupmenu(char *instr);
extern void uiFreePanels(struct ListBase *lb);
extern void uiNewPanelTabbed(char *, char *);
Index: source/blender/include/BIF_mywindow.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/BIF_mywindow.h,v
retrieving revision 1.9
diff -u -r1.9 BIF_mywindow.h
--- source/blender/include/BIF_mywindow.h 3 Aug 2006 12:25:32 -0000 1.9
+++ source/blender/include/BIF_mywindow.h 16 Oct 2006 12:54:52 -0000
@@ -120,6 +120,8 @@
#define R_MOUSE 4
short get_mbut(void);
short get_qual(void);
+short get_key(void);
+short check_key(int key);
void getmouse(short *mval);
const struct GHOST_TabletData* get_tablet_data();
Index: source/blender/include/BIF_resources.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/BIF_resources.h,v
retrieving revision 1.58
diff -u -r1.58 BIF_resources.h
--- source/blender/include/BIF_resources.h 25 Sep 2006 11:33:53 -0000 1.58
+++ source/blender/include/BIF_resources.h 16 Oct 2006 12:54:52 -0000
@@ -405,6 +405,10 @@
TH_MENU_HILITE,
TH_MENU_TEXT,
TH_MENU_TEXT_HI,
+ TH_RADMENU_ITEM,
+ TH_RADMENU_HILITE,
+ TH_RADMENU_TEXT,
+ TH_RADMENU_TEXT_HI,
TH_BUT_DRAWTYPE,
Index: source/blender/include/interface.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/interface.h,v
retrieving revision 1.28
diff -u -r1.28 interface.h
--- source/blender/include/interface.h 28 Jan 2006 18:33:13 -0000 1.28
+++ source/blender/include/interface.h 16 Oct 2006 12:54:52 -0000
@@ -190,8 +190,11 @@
int afterval, flag;
void *curfont;
+ short menuqual; // for radial menus to disappear when the modifier key that opened it is lifted
+ short menukey; // same but no modifier key
+
short autofill, win, winq, direction, dt;
- short needflush, auto_open, in_use, pad; //flush see below
+ short needflush, auto_open, in_use; //flush see below
void *overdraw;
struct uiBlock *parent; // nested pulldowns
Index: source/blender/makesdna/DNA_userdef_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_userdef_types.h,v
retrieving revision 1.57
diff -u -r1.57 DNA_userdef_types.h
--- source/blender/makesdna/DNA_userdef_types.h 12 Oct 2006 11:53:50 -0000 1.57
+++ source/blender/makesdna/DNA_userdef_types.h 16 Oct 2006 12:54:53 -0000
@@ -57,6 +57,10 @@
char menu_hilite[4];
char menu_text[4];
char menu_text_hi[4];
+ char radmenu_item[4];
+ char radmenu_hilite[4];
+ char radmenu_text[4];
+ char radmenu_text_hi[4];
char but_drawtype;
char pad1[3];
@@ -181,22 +185,22 @@
/* ***************** USERDEF ****************** */
/* flag */
-#define USER_AUTOSAVE 1
-#define USER_AUTOGRABGRID 2
-#define USER_AUTOROTGRID 4
-#define USER_AUTOSIZEGRID 8
-#define USER_SCENEGLOBAL 16
-#define USER_TRACKBALL 32
-#define USER_DUPLILINK 64
-#define USER_FSCOLLUM 128
-#define USER_MAT_ON_OB 256
-#define USER_NO_CAPSLOCK 512
-#define USER_VIEWMOVE 1024
-#define USER_TOOLTIPS 2048
-#define USER_TWOBUTTONMOUSE 4096
-#define USER_NONUMPAD 8192
-#define USER_LMOUSESELECT 16384
-#define USER_FILECOMPRESS 32768
+#define USER_AUTOSAVE (1 << 0)
+#define USER_AUTOGRABGRID (1 << 1)
+#define USER_AUTOROTGRID (1 << 2)
+#define USER_AUTOSIZEGRID (1 << 3)
+#define USER_SCENEGLOBAL (1 << 4)
+#define USER_TRACKBALL (1 << 5)
+#define USER_DUPLILINK (1 << 6)
+#define USER_FSCOLLUM (1 << 7)
+#define USER_MAT_ON_OB (1 << 8)
+#define USER_NO_CAPSLOCK (1 << 9)
+#define USER_VIEWMOVE (1 << 10)
+#define USER_TOOLTIPS (1 << 11)
+#define USER_TWOBUTTONMOUSE (1 << 12)
+#define USER_NONUMPAD (1 << 13)
+#define USER_LMOUSESELECT (1 << 14)
+#define USER_FILECOMPRESS (1 << 15)
/* viewzom */
#define USER_ZOOM_CONT 0
@@ -205,25 +209,26 @@
/* uiflag */
-#define USER_KEYINSERTACT 1
-#define USER_KEYINSERTOBJ 2
-#define USER_WHEELZOOMDIR 4
-#define USER_FILTERFILEEXTS 8
-#define USER_DRAWVIEWINFO 16
-#define USER_PLAINMENUS 32 // old EVTTOCONSOLE print ghost events, here for tuhopuu compat. --phase
+#define USER_KEYINSERTACT (1 << 0)
+#define USER_KEYINSERTOBJ (1 << 1)
+#define USER_WHEELZOOMDIR (1 << 2)
+#define USER_FILTERFILEEXTS (1 << 3)
+#define USER_DRAWVIEWINFO (1 << 4)
+#define USER_PLAINMENUS (1 << 5) // old EVTTOCONSOLE print ghost events, here for tuhopuu compat. --phase
// old flag for hide pulldown was here
-#define USER_FLIPFULLSCREEN 128
-#define USER_ALLWINCODECS 256
-#define USER_MENUOPENAUTO 512
-#define USER_PANELPINNED 1024
-#define USER_AUTOPERSP 2048
-#define USER_LOCKAROUND 4096
-#define USER_GLOBALUNDO 8192
-#define USER_ORBIT_SELECTION 16384
-#define USER_KEYINSERTAVAI 32768
-#define USER_HIDE_DOT 65536
-#define USER_SHOW_ROTVIEWICON 131072
-#define USER_SHOW_VIEWPORTNAME 262144
+#define USER_FLIPFULLSCREEN (1 << 7)
+#define USER_ALLWINCODECS (1 << 8)
+#define USER_MENUOPENAUTO (1 << 9)
+#define USER_PANELPINNED (1 << 10)
+#define USER_AUTOPERSP (1 << 11)
+#define USER_LOCKAROUND (1 << 12)
+#define USER_GLOBALUNDO (1 << 13)
+#define USER_ORBIT_SELECTION (1 << 14)
+#define USER_KEYINSERTAVAI (1 << 15)
+#define USER_HIDE_DOT (1 << 16)
+#define USER_SHOW_ROTVIEWICON (1 << 17)
+#define USER_SHOW_VIEWPORTNAME (1 << 18)
+#define USER_LISTMENUS (1 << 19)
/* transopts */
Index: source/blender/src/editscreen.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/editscreen.c,v
retrieving revision 1.139
diff -u -r1.139 editscreen.c
--- source/blender/src/editscreen.c 20 Aug 2006 15:22:55 -0000 1.139
+++ source/blender/src/editscreen.c 16 Oct 2006 12:54:56 -0000
@@ -2085,6 +2085,16 @@
winlay_process_events(0);
return window_get_qual(mainwin);
}
+short check_key(int key)
+{
+ winlay_process_events(0);
+ return window_check_key(mainwin, key);
+}
+short get_key(void)
+{
+ winlay_process_events(0);
+ return window_get_key(mainwin);
+}
short get_mbut(void)
{
winlay_process_events(0);
Index: source/blender/src/ghostwinlay.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/ghostwinlay.c,v
retrieving revision 1.45
diff -u -r1.45 ghostwinlay.c
--- source/blender/src/ghostwinlay.c 3 Aug 2006 12:25:32 -0000 1.45
+++ source/blender/src/ghostwinlay.c 16 Oct 2006 12:54:58 -0000
@@ -87,6 +87,10 @@
int lmouse[2];
int lqual; /* (LR_SHFTKEY, LR_CTRLKEY, LR_ALTKEY, LR_COMMANDKEY) */
int lmbut; /* (L_MOUSE, M_MOUSE, R_MOUSE) */
+
+ /* this is kind of evil, but hopefully useful to test my radial menus.
+ * I hope lukep will come with a better solution! */
+ int lkeys[256];
/* Tracks the faked mouse button, if non-zero it is
* the event number of the last faked button.
@@ -567,6 +571,7 @@
GHOST_TEventKeyData *kd= data;
int val= (type==GHOST_kEventKeyDown);
int bkey= convert_key(kd->key);
+ int handle=1;
if (bkey) {
if (bkey==LEFTSHIFTKEY || bkey==RIGHTSHIFTKEY) {
@@ -578,8 +583,29 @@
} else if (bkey==COMMANDKEY) {
win->lqual= change_bit(win->lqual, LR_COMMANDKEY, val);
}
-
- window_handle_ext(win, bkey, val, kd->ascii);
+
+ /* dodgy storage for key held down */
+ if (bkey < 256) {
+
+ /* also dodgy stuff to discard multiple consecutive keydown events but ONLY
+ * on keys that will probably have menus */
+
+ if (win->lkeys[bkey] && type==GHOST_kEventKeyDown)
+ handle = 0;
+
+ /* allow overflowing for arrow, numpad, etc keys and other special ones */
+ if ((bkey >= LEFTARROWKEY) && (bkey <= LEFTSHIFTKEY))
+ handle = 1;
+
+ if(handle) {
+ if (type==GHOST_kEventKeyDown) win->lkeys[bkey] = 1;
+ else if (type==GHOST_kEventKeyUp) win->lkeys[bkey] = 0;
+
+ window_handle_ext(win, bkey, val, kd->ascii);
+ }
+ }
+ else
+ window_handle_ext(win, bkey, val, kd->ascii);
}
break;
@@ -698,6 +724,21 @@
if( query_qual('c')) qual |= LR_CTRLKEY;
return qual;
// return win->lqual;
+}
+
+short window_get_key(Window *win) {
+ int i;
+
+ /* this isn't the most solid way of doing things,
+ * I'm assuming that there will only be one key held at a time */
+ for (i=0; i < 256; i++) {
+ if (win->lkeys[i])
+ return i;
+ }
+ return 0;
+}
+short window_check_key(Window *win, int key) {
+ return win->lkeys[key];
}
short window_get_mbut(Window *win) {
Index: source/blender/src/interface.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/interface.c,v
retrieving revision 1.243
diff -u -r1.243 interface.c
--- source/blender/src/interface.c 31 Jul 2006 19:23:42 -0000 1.243
+++ source/blender/src/interface.c 16 Oct 2006 12:55:03 -0000
@@ -133,6 +133,8 @@
static void ui_set_but_val(uiBut *but, double value);
static void ui_do_but_tip(uiBut *buttip);
+static void ui_get_radialbut_angle3f(float *vec, short number, short total);
+
/* ****************************** */
static int uibut_contains_pt(uiBut *but, short *pt)
@@ -4227,7 +4229,7 @@
{
uiBut *but, *bt;
int butevent, event, retval=UI_NOTHING, count, act=0;
- int inside= 0, active=0;
+ int inside= 0, active=0, butcount=1;
if(block->win != mywinget()) return UI_NOTHING;
@@ -4556,17 +4558,63 @@
default:
for(but= block->buttons.first; but; but= but->next) {
-
// active flag clear, it can have been set with number keys or arrows, prevents next loop from wrong selection on click
if(uevent->event==LEFTMOUSE) but->flag &= ~UI_ACTIVE;
but->flag &= ~UI_MOUSE_OVER;
- /* check boundbox */
- if (uibut_contains_pt(but, uevent->mval)) {
- but->flag |= UI_MOUSE_OVER;
- UIbuttip= but;
+ /* check for mouse over */
+ if (block->flag & UI_BLOCK_RADIAL) {
+ float cenvec[3], mousevec[3], butvec[3];
+ float distthresh=20.0, anglethresh=0.0;
+ short totbuts;
+
+ totbuts = BLI_countlist(&block->buttons);
+
+ /* calculate allowed angle based on the total number of buttons */
+
+ if (totbuts > 8) anglethresh = 40.0 / (int)(totbuts/4);
+ else if (totbuts > 4) anglethresh = 22.5;
+ else if (totbuts > 2) anglethresh = 45.0;
+ else anglethresh = 90.0;
+
+ if (totbuts == 3) cenvec[1] += (block->maxy - block->miny)/2;
+
+ /* calculate block center point */
+ cenvec[0] = block->maxx - (block->maxx - block->minx)/2;
+ cenvec[1] = block->maxy - (block->maxy - block->miny)/2;
+ cenvec[2] = 0;
+
+ /* with three buttons, the block boundary is not symmetrical so we raise the center point */
+ if (totbuts == 3) cenvec[1] += 30;
+
+ /* calculate center->mouse vector */
+ mousevec[0]= uevent->mval[0] - cenvec[0];
+ mousevec[1]= uevent->mval[1] - cenvec[1];
+ mousevec[2] = 0;
+
+ /* if distance from center <-> mouse pointer is greater than a threshold,
+ * then calculate what is selected, by angle */
+ if ( VecLength(mousevec) > distthresh) {
+
+ ui_get_radialbut_angle3f(butvec, butcount, totbuts);
+
+ /* if the center->mouse pointer angle is within the correct threshold, the button is active! */
+ if ( VecAngle2(butvec, mousevec) < anglethresh ) {
+ but->flag |= UI_MOUSE_OVER;
+ UIbuttip= but;
+ }
+ }
+ } else {
+ /* check boundbox */
+ if (uibut_contains_pt(but, uevent->mval)) {
+ but->flag |= UI_MOUSE_OVER;
+ UIbuttip= but;
+ }
}
+
+ butcount++;
+
/* hilite case 1 */
if(but->flag & UI_MOUSE_OVER) {
if( (but->flag & UI_ACTIVE)==0) {
@@ -4615,6 +4663,19 @@
/* middlemouse exception, not for regular blocks */
if( (block->flag & UI_BLOCK_LOOP) && uevent->event==MIDDLEMOUSE) uevent->event= LEFTMOUSE;
+ /* check to see if the block can be confirmed with release of a modifier key */
+ /* or normal key */
+ if (block->menukey && check_key(block->menukey)) {
+ PIL_sleep_ms(60);
+ if ( check_key(block->menukey)==0 ) uevent->event = RETKEY;
+ else uevent->val = uevent->event = 0;
+ }
+ else if (block->menuqual && G.qual) {
+ PIL_sleep_ms(60);
+ if ( get_qual()==0 ) uevent->event = RETKEY;
+ else uevent->val = uevent->event = 0;
+ }
+
/* the final dobutton */
for(but= block->buttons.first; but; but= but->next) {
if(but->flag & UI_ACTIVE) {
@@ -5190,6 +5251,7 @@
static void ui_free_but(uiBut *but)
{
if(but->str && but->str != but->strdata) MEM_freeN(but->str);
+ if(but->tip) MEM_freeN(but->tip);
ui_free_link(but->link);
MEM_freeN(but);
@@ -5736,7 +5798,9 @@
but->max= max;
but->a1= a1;
but->a2= a2;
- but->tip= tip;
+
+ but->tip= MEM_callocN( strlen(tip)+2, "uiDefBut tip");
+ strcpy(but->tip, tip);
but->font= block->curfont;
@@ -5779,8 +5843,10 @@
rgb_to_hsv(rgb[0], rgb[1], rgb[2], but->hsv, but->hsv+1, but->hsv+2);
}
- if ELEM8(but->type, HSVSLI , NUMSLI, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM) {
- but->flag |= UI_TEXT_LEFT;
+ if ELEM8(but->type, HSVSLI, NUMSLI, MENU, TEX, LABEL, IDPOIN, BLOCK, BUTM) {
+ /* radial menus use center aligned text */
+ if (!(block->flag & UI_BLOCK_RADIAL))
+ but->flag |= UI_TEXT_LEFT;
}
if(but->type==ROUNDBOX)
@@ -6266,9 +6332,19 @@
return 0;
}
-#define PUP_LABELH 6
short pupmenu(char *instr)
{
+ short retval;
+
+ if (U.uiflag & USER_LISTMENUS) retval = listpupmenu(instr);
+ else retval = radialpupmenu(instr);
+
+ return retval;
+}
+
+#define PUP_LABELH 6
+short listpupmenu(char *instr)
+{
uiBlock *block;
ListBase listb= {NULL, NULL};
int event;
@@ -6552,5 +6628,204 @@
if((event & UI_RETURN_OUT)==0) ui_warp_pointer(mousemove[0], mousemove[1]);
return val;
+}
+
+/* calculates the angle of a specified button in a radial menu,
+ * stores a float vector in unit circle */
+static void ui_get_radialbut_angle3f(float *vec, short butnumber, short totbuts)
+{
+ float angle=0;
+ /* this goes in a seemingly weird pattern:
+
+ 3
+ 4 5
+ 0 1
+ 6 7
+ 2
+
+ but it's actually quite logical. It's designed to be 'upwards compatible'
+ for muscle memory so that the menu item locations are fixed and don't move
+ as new items are added to the menu later on. It also optimises efficiency -
+ a radial menu is best kept symmetrical, with as large an angle between
+ items as possible, so that the gestural mouse movements can be fast and inexact.
+
+ It starts off with two opposite sides for the first two items
+ then joined by the one below for the third (this way, even with three items,
+ the menu seems to still be 'in order' reading left to right). Then the fourth is
+ added to complete the compass directions. From here, it's just a matter of
+ subdividing the rest of the angles for the last 4 items.
+
+ --Matt 07/2006
+ */
+
+ if (butnumber <= 4) {
+ switch(butnumber) {
+ case 1:
+ angle = 270;
+ break;
+ case 2:
+ angle = 90;
+ break;
+ case 3:
+ angle = 180;
+ break;
+ case 4:
+ angle = 0;
+ break;
+ }
+ } else if (totbuts <= 8) {
+ switch(butnumber) {
+ case 5:
+ angle = 45;
+ break;
+ case 6:
+ angle = 135;
+ break;
+ case 7:
+ angle = 225;
+ break;
+ case 8:
+ angle = 315;
+ break;
+ }
+ } else { /* subdivide quadrants progressively, depending on number of items */
+ int anglepad, curquad, numinquad, aligncorrect=0;
+ int quaditems, overflow;
+
+ overflow = totbuts % 4; /* how many items are in the last incomplete loop */
+ curquad = butnumber % 4; /* the quadrant that the current button is in */
+
+ quaditems = (int)((totbuts-4) / 4); /* how many items in this quadrant between compass points */
+ if ((overflow) && (curquad <= overflow)) quaditems++;
+ numinquad = (int)((butnumber - 1) / 4); /* the ordered position of the current button in its quadrant */
+
+
+ /* divide up the required angle for this quadrant, and find the angle to offset this item */
+ anglepad = 90 / (quaditems+1);
+ switch(curquad) {
+ case 1:
+ angle = 0;
+ break;
+ case 2:
+ angle = 90;
+ break;
+ case 3:
+ angle = 180;
+ break;
+ case 0:
+ angle = 270;
+ break;
+ }
+ angle += anglepad * numinquad;
+
+
+ /* if the angle is near the horizontal, squish it a bit closer.
+ * This visually spaces the horizontal menu items better, since even though the
+ * item centers may be evenly distributed, it doesn't look that way. */
+ if (angle < 90)
+ aligncorrect = angle;
+ else if (angle < 270)
+ aligncorrect = angle - 180;
+ else if (angle <= 360)
+ aligncorrect = angle - 360;
+
+ angle += aligncorrect/17; /* 17 == magic number, works nicely */
+ }
+
+ angle = angle/180.0 * M_PI;
+
+ vec[0] = sin(angle);
+ vec[1] = cos(angle);
+}
+
+short radialpupmenu(char *instr)
+{
+ uiBlock *block;
+ ListBase listb= {NULL, NULL};
+ int event;
+ short width, tempwidth, mousexmove = 0, mouseymove=0, xmax, ymax, mval[2], val= -1;
+ short a, x1, y1;
+ short buth=30;
+ float offset=60;
+ int key;
+
+ float angle; /* in radians */
+ MenuData *md;
+
+ /* block stuff first, need to know the font */
+ block= uiNewBlock(&listb, "menu", UI_EMBOSSRAD, UI_HELV, G.curscreen->mainwin);
+ uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_REDRAW|UI_BLOCK_RET_1|UI_BLOCK_NUMSELECT|UI_BLOCK_TRANSPARENT|UI_BLOCK_RADIAL);
+ block->themecol= TH_MENU_ITEM;
+
+
+ /* store the currently held key or modifier key in the uiBlock,
+ * to check against later when we process events in ui_do_block() */
+ key = get_key();
+
+ if (key) block->menukey = key;
+ else block->menukey = 0;
+
+ if (G.qual) block->menuqual = G.qual;
+ else block->menuqual = 0;
+
+
+ md= decompose_menu_string(instr);
+
+ xmax = G.curscreen->sizex;
+ ymax = G.curscreen->sizey;
+
+ getmouseco_sc(mval);
+
+ /* here we go! */
+ if(md->title) {
+ /*
+
+ */
+ }
+
+ angle = 0;
+ width = 0;
+
+ for(a=0; a<md->nitems; a++) {
+ tempwidth = 20 + BIF_GetStringWidth(uiBlockGetCurFont(block), md->items[a].str, (U.transopts && USER_TR_BUTTONS));
+ if (tempwidth > width) width = tempwidth;
+ }
+
+ if (md->nitems > 8) offset = 60+((int)(md->nitems / 4) * 45);
+ else if (md->nitems > 4) offset = 100;
+ else if (md->nitems > 2) offset = 80;
+ else offset = 60;
+
+ offset += width/10;
+
+ for(a=0; a<md->nitems; a++) {
+ float vec[3];
+
+ char *name= md->items[a].str;
+
+ ui_get_radialbut_angle3f(vec, a+1, md->nitems); /* a+1 because a starts at 0 */
+
+ x1 = mval[0] + (vec[0] * offset); // - width/2;
+ y1 = mval[1] + (vec[1] * offset); // - 15;
+
+ if (vec[0] > 2) x1 += width/2;
+ else if (vec[0] < 2) x1 -= width/2;
+
+
+ /* more even visual spacing, though the 'official angle' remains the same */
+ if (ELEM(a, 4, 5)) y1 -= 7;
+ else if (ELEM(a, 6, 7)) y1 += 7;
+
+ uiDefButS(block, BUTM, B_NOP, name, x1, y1, width, buth, &val, (float) md->items[a].retval, 0.0, 0, 0, "");
+ }
+
+ uiBoundsBlock(block, 180);
+
+ event= uiDoBlocks(&listb, 0);
+
+ menudata_free(md);
+
+ if(mouseymove && (event & UI_RETURN_OUT)==0) ui_warp_pointer(mousexmove, mouseymove);
+ return val;
}
Index: source/blender/src/interface_draw.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/interface_draw.c,v
retrieving revision 1.58
diff -u -r1.58 interface_draw.c
--- source/blender/src/interface_draw.c 29 Jun 2006 09:44:08 -0000 1.58
+++ source/blender/src/interface_draw.c 16 Oct 2006 12:55:07 -0000
@@ -1375,6 +1375,8 @@
char col[4];
BIF_GetThemeColor4ubv(TH_MENU_BACK, col);
+ if (flag & UI_BLOCK_TRANSPARENT) return;
+
if( (flag & UI_BLOCK_NOSHADOW)==0) {
/* accumulated outline boxes to make shade not linear, is more pleasant */
ui_shadowbox(minx, miny, maxx, maxy, 6.0, (30*col[3])>>8);
@@ -1416,6 +1418,54 @@
glDisable(GL_BLEND);
}
+/* radial menu item */
+static void ui_draw_radial_item(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
+{
+ float rad;
+
+ glEnable(GL_BLEND);
+
+ /* rounded corners */
+ rad= (y2-y1)/2.0;
+ if (rad>(x2-x1)/2) rad = (x2-x1)/2;
+
+ uiSetRoundBox(15);
+ /* end rounded corners */
+
+ //shadow
+ glColor4ub(0, 0, 0, 20);
+ gl_round_box(GL_POLYGON, x1-2, y1-2, x2+2, y2-1, rad);
+ glColor4ub(0, 0, 0, 20);
+ gl_round_box(GL_POLYGON, x1-3, y1-3, x2+3, y2, rad);
+
+ if((flag & UI_ACTIVE) && type!=LABEL) {
+ BIF_ThemeColor4(TH_RADMENU_HILITE);
+
+ /*the solid base */
+ gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad);
+
+ /* outline */
+ BIF_ThemeColorShadeAlpha(TH_RADMENU_TEXT_HI, 0, -30);
+
+ uiRoundRectFakeAA(x1, y1, x2, y2, rad, asp);
+ /* end outline */
+
+ } else {
+ BIF_ThemeColor4(TH_RADMENU_ITEM);
+
+ /*the solid base */
+ gl_round_box(GL_POLYGON, x1, y1, x2, y2, rad);
+
+ /* outline */
+ BIF_ThemeColorShadeAlpha(TH_RADMENU_TEXT, 0, -30);
+
+ uiRoundRectFakeAA(x1, y1, x2, y2, rad, asp);
+ /* end outline */
+ }
+
+ glDisable(GL_BLEND);
+}
+
/* pulldown menu calling button */
static void ui_draw_pulldown_round(int type, int colorid, float asp, float x1, float y1, float x2, float y2, int flag)
{
@@ -1553,6 +1603,13 @@
BIF_ThemeColor(TH_MENU_TEXT);
}
}
+ else if(but->dt==UI_EMBOSSRAD) {
+ if((but->flag & (UI_SELECT|UI_ACTIVE)) && but->type!=LABEL) { // LABEL = title in pulldowns
+ BIF_ThemeColor(TH_RADMENU_TEXT_HI);
+ } else {
+ BIF_ThemeColor(TH_RADMENU_TEXT);
+ }
+ }
else {
if(but->flag & UI_SELECT) {
BIF_ThemeColor(TH_BUT_TEXT_HI);
@@ -2245,6 +2302,8 @@
void ui_set_embossfunc(uiBut *but, int drawtype)
{
+ int theme= BIF_GetThemeValue(TH_BUT_DRAWTYPE);
+
// this aded for evaluating textcolor for example
but->dt= drawtype;
@@ -2258,9 +2317,8 @@
else if(drawtype==UI_EMBOSSN) but->embossfunc= ui_draw_nothing;
else if(drawtype==UI_EMBOSSP) but->embossfunc= ui_draw_pulldown_item;
else if(drawtype==UI_EMBOSSR) but->embossfunc= ui_draw_round;
+ else if(drawtype==UI_EMBOSSRAD) but->embossfunc= ui_draw_radial_item;
else {
- int theme= BIF_GetThemeValue(TH_BUT_DRAWTYPE);
-
// and the themes
if(theme==1) {
but->embossfunc= ui_draw_default;
Index: source/blender/src/interface_panel.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/interface_panel.c,v
retrieving revision 1.39
diff -u -r1.39 interface_panel.c
--- source/blender/src/interface_panel.c 29 Jun 2006 09:44:08 -0000 1.39
+++ source/blender/src/interface_panel.c 16 Oct 2006 12:55:10 -0000
@@ -397,7 +397,30 @@
glDisable( GL_LINE_SMOOTH );
}
-
+/* plain fake antialiased unfilled round rectangle */
+void uiRoundRectFakeAA(float minx, float miny, float maxx, float maxy, float rad, float asp)
+{
+ float color[4];
+ float raddiff;
+ int i, passes=4;
+
+ /* get the colour and divide up the alpha */
+ glGetFloatv(GL_CURRENT_COLOR, color);
+ color[3]= 1/(float)passes;
+ glColor4fv(color);
+
+ /* set the 'jitter amount' */
+ raddiff = (1/(float)passes) * asp;
+
+ glEnable( GL_BLEND );
+
+ /* draw lots of lines on top of each other */
+ for (i=passes; i>=(-passes); i--) {
+ gl_round_box(GL_LINE_LOOP, minx, miny, maxx, maxy, rad+(i*raddiff));
+ }
+
+ glDisable( GL_BLEND );
+}
/* plain antialiased filled box */
void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
Index: source/blender/src/resources.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/resources.c,v
retrieving revision 1.60
diff -u -r1.60 resources.c
--- source/blender/src/resources.c 3 Jul 2006 09:49:12 -0000 1.60
+++ source/blender/src/resources.c 16 Oct 2006 12:55:11 -0000
@@ -130,6 +130,14 @@
cp= btheme->tui.menu_text; break;
case TH_MENU_TEXT_HI:
cp= btheme->tui.menu_text_hi; break;
+ case TH_RADMENU_ITEM:
+ cp= btheme->tui.radmenu_item; break;
+ case TH_RADMENU_HILITE:
+ cp= btheme->tui.radmenu_hilite; break;
+ case TH_RADMENU_TEXT:
+ cp= btheme->tui.radmenu_text; break;
+ case TH_RADMENU_TEXT_HI:
+ cp= btheme->tui.radmenu_text_hi; break;
case TH_BUT_DRAWTYPE:
cp= &btheme->tui.but_drawtype; break;
@@ -358,6 +366,10 @@
SETCOL(btheme->tui.menu_hilite, 0x7F,0x7F,0x7F, 255);
SETCOL(btheme->tui.menu_text, 0, 0, 0, 255);
SETCOL(btheme->tui.menu_text_hi, 255, 255, 255, 255);
+ SETCOL(btheme->tui.radmenu_item, 45, 45, 45, 200);
+ SETCOL(btheme->tui.radmenu_hilite, 255, 255, 255, 130);
+ SETCOL(btheme->tui.radmenu_text, 178, 178, 178, 255);
+ SETCOL(btheme->tui.radmenu_text_hi, 255, 255, 255, 255);
btheme->tui.but_drawtype= 1;
/* space view3d */
@@ -545,6 +557,11 @@
str += sprintf(str, "Menu Item Highlight %%x%d|", TH_MENU_HILITE);
str += sprintf(str, "Menu Text %%x%d|", TH_MENU_TEXT);
str += sprintf(str, "Menu Text Highlight %%x%d|", TH_MENU_TEXT_HI);
+ str += sprintf(str, "%%l|");
+ str += sprintf(str, "Radial Menu Item %%x%d|", TH_RADMENU_ITEM);
+ str += sprintf(str, "Radial Menu Item Highlight %%x%d|", TH_RADMENU_HILITE);
+ str += sprintf(str, "Radial Menu Text %%x%d|", TH_RADMENU_TEXT);
+ str += sprintf(str, "Radial Menu Text Highlight %%x%d|", TH_RADMENU_TEXT_HI);
str += sprintf(str, "%%l|");
str += sprintf(str, "Drawtype %%x%d|", TH_BUT_DRAWTYPE);
}
Index: source/blender/src/space.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/space.c,v
retrieving revision 1.384
diff -u -r1.384 space.c
--- source/blender/src/space.c 12 Oct 2006 11:53:50 -0000 1.384
+++ source/blender/src/space.c 16 Oct 2006 12:55:23 -0000
@@ -2465,7 +2465,10 @@
}
else {
uiBlockBeginAlign(block);
- if ELEM8(th_curcol, TH_PANEL, TH_LAMP, TH_FACE, TH_FACE_SELECT, TH_MENU_BACK, TH_MENU_HILITE, TH_MENU_ITEM, TH_NODE) {
+
+ if ( ELEM7(th_curcol, TH_PANEL, TH_LAMP, TH_FACE, TH_FACE_SELECT, TH_MENU_BACK, TH_MENU_HILITE, TH_MENU_ITEM) ||
+ ELEM3(th_curcol, TH_RADMENU_ITEM, TH_RADMENU_HILITE, TH_NODE)) {
+
uiDefButC(block, NUMSLI, B_UPDATE_THEME,"A ", 465,y3+25,200,20, col+3, 0.0, 255.0, B_THEMECOL, 0, "");
}
uiDefButC(block, NUMSLI, B_UPDATE_THEME,"R ", 465,y3,200,20, col, 0.0, 255.0, B_THEMECOL, 0, "");
@@ -2647,23 +2650,43 @@
0, 0, 0, 0, 0, "");
uiBlockBeginAlign(block);
uiDefButS(block, NUM, 0, "LMB:",
- (xpos+edgsp+spref+midsp),y2,spref+edgsp,buth,
+ (xpos+edgsp+spref+midsp),y2,(mpref/3),buth,
&(U.tb_leftmouse), 2, 40, 0, 0,
"Time in 1/10 seconds to hold the Left Mouse Button before opening the toolbox");
uiDefButS(block, NUM, 0, "RMB:",
- (xpos+edgsp+(2*spref)+(2*midsp)-edgsp),y2,spref+edgsp,buth,
+ (xpos+edgsp+spref+midsp+(mpref/3)),y2,(mpref/3),buth,
&(U.tb_rightmouse), 2, 40, 0, 0,
"Time in 1/10 seconds to hold the Right Mouse Button before opening the toolbox");
+ uiDefButBitI(block, TOG, USER_PLAINMENUS, B_PLAINMENUS, "Plain",
+ (xpos+edgsp+spref+midsp+2*(mpref/3)),y2,(mpref/3),buth,
+ &(U.uiflag), 0, 0, 0, 0,
+ "Use a column layout for toolbox and do not flip the contents of any menu");
+ uiBlockEndAlign(block);
+
+
+ uiBlockBeginAlign(block);
+ uiDefButBitI(block, TOG, USER_SHOW_ROTVIEWICON, B_DRAWINFO, "Mini Axis",
+ (xpos+edgsp+(2*mpref)+(2*midsp)),y1,(mpref/3),buth,
+ &(U.uiflag), 0, 0, 0, 0,
+ "Show a small rotating 3D axis in the bottom left corner of the 3D View");
+ uiDefButS(block, NUM, B_DRAWINFO, "Size:",
+ (xpos+edgsp+(2*mpref)+(2*midsp)+(mpref/3)),y1,(mpref/3),buth,
+ &U.rvisize, 10, 64, 0, 0,
+ "The axis icon's size");
+ uiDefButS(block, NUM, B_DRAWINFO, "Bright:",
+ (xpos+edgsp+(2*mpref)+(2*midsp)+2*(mpref/3)),y1,(mpref/3),buth,
+ &U.rvibright, 0, 10, 0, 0,
+ "The brightness of the icon");
uiBlockEndAlign(block);
uiDefButBitI(block, TOG, USER_PANELPINNED, 0, "Pin Floating Panels",
(xpos+edgsp+spref+midsp),y1,(mpref/2),buth,
&(U.uiflag), 0, 0, 0, 0,
"Make floating panels invoked by a hotkey (eg. N Key) open at the previous location");
- uiDefButBitI(block, TOG, USER_PLAINMENUS, B_PLAINMENUS, "Plain Menus",
+ uiDefButBitI(block, TOGN, USER_LISTMENUS, 0, "Radial Menus",
(xpos+edgsp+(2*spref)+(2*midsp)),y1,spref,buth,
&(U.uiflag), 0, 0, 0, 0,
- "Use a column layout for toolbox and do not flip the contents of any menu");
+ "Arrange popup menu items in a radial layout, rather than a list");
uiBlockEndAlign(block);
uiDefBut(block, LABEL,0,"Snap to grid:",
Index: source/blender/src/toolbox.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/toolbox.c,v
retrieving revision 1.139
diff -u -r1.139 toolbox.c
--- source/blender/src/toolbox.c 9 Oct 2006 18:56:02 -0000 1.139
+++ source/blender/src/toolbox.c 16 Oct 2006 12:55:28 -0000
@@ -172,7 +172,7 @@
if (title) s+= sprintf(s, "%s%%t|", title);
vsprintf(s, itemfmt, ap);
- return (pupmenu(buf)>=0);
+ return (listpupmenu(buf)>=0);
}
static int confirm(char *title, char *itemfmt, ...)
Index: source/blender/src/usiblender.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/usiblender.c,v
retrieving revision 1.127
diff -u -r1.127 usiblender.c
--- source/blender/src/usiblender.c 12 Oct 2006 11:53:50 -0000 1.127
+++ source/blender/src/usiblender.c 16 Oct 2006 12:55:30 -0000
@@ -316,6 +316,12 @@
SETCOL(btheme->tseq.transition, 162, 95, 111, 255);
SETCOL(btheme->tseq.meta, 109, 145, 131, 255);
}
+ if(btheme->tui.radmenu_text[3]==0) {
+ SETCOL(btheme->tui.radmenu_item, 45, 45, 45, 200);
+ SETCOL(btheme->tui.radmenu_hilite, 255, 255, 255, 130);
+ SETCOL(btheme->tui.radmenu_text, 178, 178, 178, 255);
+ SETCOL(btheme->tui.radmenu_text_hi, 255, 255, 255, 255);
+ }
}
/* set defaults for 3D View rotating axis indicator */
Index: source/blender/src/winlay.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/winlay.h,v
retrieving revision 1.12
diff -u -r1.12 winlay.h
--- source/blender/src/winlay.h 3 Aug 2006 12:25:32 -0000 1.12
+++ source/blender/src/winlay.h 16 Oct 2006 12:55:30 -0000
@@ -55,6 +55,8 @@
void window_lower (Window *win);
short window_get_qual (Window *win);
+short window_get_key (Window *win);
+short window_check_key (Window *win, int key);
short window_get_mbut (Window *win);
void window_get_mouse (Window *win, short *mval);
const struct GHOST_TabletData* window_get_tablet_data(Window *win);

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
56/d9/81ba759ea6e86d4f0cdfe12a532e

Event Timeline