diff options
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 7 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 15 | ||||
-rw-r--r-- | source/blender/src/drawview.c | 117 | ||||
-rw-r--r-- | source/blender/src/interface_panel.c | 7 | ||||
-rw-r--r-- | source/blender/src/space.c | 51 | ||||
-rw-r--r-- | source/blender/src/toets.c | 6 | ||||
-rw-r--r-- | source/blender/src/usiblender.c | 9 |
7 files changed, 184 insertions, 28 deletions
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 7ec86c9c080..9c112b7ca58 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -166,7 +166,10 @@ typedef struct UserDef { int memcachelimit; short frameserverport; short pad; - short obcenter_dia, pad1, pad2, pad3; + short obcenter_dia; + short rvisize; /* rotating view icon size */ + short rvibright; /* rotating view icon brightness */ + short pad1; } UserDef; extern UserDef U; /* from usiblender.c !!!! */ @@ -215,6 +218,8 @@ extern UserDef U; /* from usiblender.c !!!! */ #define USER_ORBIT_SELECTION 16384 #define USER_KEYINSERTAVAI 32768 #define USER_HIDE_DOT 65536 +#define USER_SHOW_ROTVIEWICON 131072 +#define USER_SHOW_VIEWPORTNAME 262144 /* transopts */ diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index e793ce2495e..d095e846927 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -102,7 +102,9 @@ typedef struct View3D { short drawtype; short localview; int lay, layact; - short scenelock, around, camzoom, flag; + short scenelock, around, camzoom; + + short pad1; float lens, grid, gridview, pixsize, near, far; float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */ @@ -118,12 +120,18 @@ typedef struct View3D { /* user defined clipping planes */ float clip[4][4]; + struct BoundBox *clipbb; /* afterdraw, for xray & transparent */ struct ListBase afterdraw; /* drawflags, denoting state */ - short zbuf, transp, xray, pad2; + short zbuf, transp, xray; + + short flag, flag2; + + short pad2[3]; + } View3D; /* View3D->flag (short) */ @@ -145,6 +153,9 @@ typedef struct View3D { #define V3D_CLIPPING 16384 #define V3D_DRAW_CENTERS 32768 +/* View3d->flag2 (short) */ +#define V3D_OPP_DIRECTION_NAME 1 + /* View3D->around */ #define V3D_CENTRE 0 #define V3D_CENTROID 3 diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c index b983fa828b9..daf78661b35 100644 --- a/source/blender/src/drawview.c +++ b/source/blender/src/drawview.c @@ -1217,6 +1217,7 @@ void drawname(Object *ob) static void draw_selected_name(Object *ob) { char info[128]; + short offset=30; if(ob->type==OB_ARMATURE) { bArmature *arm= ob->data; @@ -1248,11 +1249,93 @@ static void draw_selected_name(Object *ob) else sprintf(info, "(%d) %s", CFRA, ob->id.name+2); BIF_ThemeColor(TH_TEXT_HI); - glRasterPos2i(30, 10); + if (U.uiflag & USER_SHOW_ROTVIEWICON) + offset = 14 + (U.rvisize * 2); + + glRasterPos2i(offset, 10); BMF_DrawString(G.fonts, info); } +/* Draw a live substitute of the view icon, which is always shown */ +static void draw_view_axis(void) +{ + const float k = U.rvisize; /* axis size */ + const float toll = 0.5; /* used to see when view is quasi-orthogonal */ + const float start = k + 1.0; /* axis center in screen coordinates, x=y */ + float ydisp = 0.0; /* vertical displacement to allow obj info text */ + + /* rvibright ranges approx. from original axis icon color to gizmo color */ + const unsigned char bright = U.rvibright * 5; + + unsigned char col[3]; + unsigned char gridcol[3]; + + float vec[4]; + float dx, dy; + float h, s, v; + + BIF_GetThemeColor3ubv(TH_GRID, gridcol); + + /* X */ + vec[0] = vec[3] = 1; + vec[1] = vec[2] = 0; + QuatMulVecf(G.vd->viewquat, vec); + + make_axis_color(gridcol, col, 'x'); + col[0] = col[0]>255-(4*bright)?255:col[0]+4*bright; + col[1] = col[1]>255-(bright)?255:col[1]+bright; + col[2] = col[2]>255-(bright)?255:col[2]+bright; + glColor3ubv(col); + + dx = vec[0] * k; + dy = vec[1] * k; + fdrawline(start, start + ydisp, start + dx, start + dy + ydisp); + if (fabs(dx) > toll || fabs(dy) > toll) { + glRasterPos2i(start + dx + 2, start + dy + ydisp + 2); + BMF_DrawString(G.fonts, "x"); + } + + /* Y */ + vec[1] = vec[3] = 1; + vec[0] = vec[2] = 0; + QuatMulVecf(G.vd->viewquat, vec); + + make_axis_color(gridcol, col, 'y'); + col[0] = col[0]>255-(bright)?255:col[0]+bright; + col[1] = col[1]>255-(4*bright)?255:col[1]+4*bright; + col[2] = col[2]>255-(bright)?255:col[2]+bright; + glColor3ubv(col); + + dx = vec[0] * k; + dy = vec[1] * k; + fdrawline(start, start + ydisp, start + dx, start + dy + ydisp); + if (fabs(dx) > toll || fabs(dy) > toll) { + glRasterPos2i(start + dx + 2, start + dy + ydisp + 2); + BMF_DrawString(G.fonts, "y"); + } + + /* Z */ + vec[2] = vec[3] = 1; + vec[1] = vec[0] = 0; + QuatMulVecf(G.vd->viewquat, vec); + + make_axis_color(gridcol, col, 'z'); + col[0] = col[0]>255-(bright)?255:col[0]+bright; + col[1] = col[1]>255-(bright)?255:col[1]+bright; + col[2] = col[2]>255-(4*bright)?255:col[2]+4*bright; + glColor3ubv(col); + + dx = vec[0] * k; + dy = vec[1] * k; + fdrawline(start, start + ydisp, start + dx, start + dy + ydisp); + if (fabs(dx) > toll || fabs(dy) > toll) { + glRasterPos2i(start + dx + 2, start + dy + ydisp + 2); + BMF_DrawString(G.fonts, "z"); + } +} + + static void draw_view_icon(void) { BIFIconID icon; @@ -1271,6 +1354,31 @@ static void draw_view_icon(void) glDisable(GL_BLEND); } +static void draw_viewport_name(ScrArea *sa) +{ + char *name = NULL; + + switch(G.vd->view) { + case 1: + name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Back" : "Front"; + break; + case 3: + name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Left" : "Right"; + break; + case 7: + name = (G.vd->flag2 & V3D_OPP_DIRECTION_NAME) ? "Bottom" : "Top"; + break; + default: + name = G.vd->persp==V3D_PERSP_USE_THE_CAMERA ? "Camera" : "User"; + } + + if (name) { + BIF_ThemeColor(TH_TEXT_HI); + glRasterPos2i(10, sa->winy-20); + BMF_DrawString(G.fonts, name); + } +} + /* ******************* view3d space & buttons ************** */ static void view3d_change_bgpic_ima(View3D *v3d, Image *newima) { @@ -2522,7 +2630,12 @@ void drawview3dspace(ScrArea *sa, void *spacedata) if(v3d->persp>1) drawviewborder(); if(!(G.f & G_PLAYANIM)) drawcursor(v3d); - draw_view_icon(); + if(U.uiflag & USER_SHOW_ROTVIEWICON) + draw_view_axis(); + else + draw_view_icon(); + if(U.uiflag & USER_SHOW_VIEWPORTNAME) + draw_viewport_name(sa); ob= OBACT; if(ob && (U.uiflag & USER_DRAWVIEWINFO)) diff --git a/source/blender/src/interface_panel.c b/source/blender/src/interface_panel.c index 805b555f5a4..47961e22edc 100644 --- a/source/blender/src/interface_panel.c +++ b/source/blender/src/interface_panel.c @@ -544,7 +544,6 @@ int uiNewPanel(ScrArea *sa, uiBlock *block, char *panelname, char *tabname, int if(pnl_control & UI_PNL_UNSTOW) { if(pa->flag & PNL_CLOSEDY) { pa->flag &= ~PNL_CLOSED; - stow_unstow(block); // toggles! } } @@ -1735,6 +1734,7 @@ static void panel_clicked_tabs(uiBlock *block, int mousex) } +/* disabled /deprecated now, panels minimise in place */ static void stow_unstow(uiBlock *block) { SpaceLink *sl= curarea->spacedata.first; @@ -1832,11 +1832,6 @@ void ui_do_panel(uiBlock *block, uiEvent *uevent) else pa->flag &= ~PNL_CLOSED; } } - // extra, for non-butspace: open/collapse at window header - if(curarea->spacetype!=SPACE_BUTS) - stow_unstow(block); - - } if(align==0) addqueue(block->win, REDRAW, 1); else ui_animate_panels(curarea); diff --git a/source/blender/src/space.c b/source/blender/src/space.c index 0baa511417e..3e75320e6e7 100644 --- a/source/blender/src/space.c +++ b/source/blender/src/space.c @@ -2553,7 +2553,7 @@ void drawinfospace(ScrArea *sa, void *spacedata) xpos,y6label,spref,buth, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); - uiDefButBitI(block, TOG, USER_TOOLTIPS, 0, "ToolTips", + uiDefButBitI(block, TOG, USER_TOOLTIPS, 0, "Tool Tips", (xpos+edgsp),y5,spref,buth, &(U.flag), 0, 0, 0, 0, "Display tooltips (help tags) over buttons"); @@ -2573,10 +2573,10 @@ void drawinfospace(ScrArea *sa, void *spacedata) #else U.curssize=0; /*Small Cursor always for OS X for now */ #endif - uiDefButBitI(block, TOG, USER_PLAINMENUS, B_PLAINMENUS, "Plain menus", + uiDefButBitI(block, TOG, USER_SHOW_VIEWPORTNAME, B_DRAWINFO, "View Name", (xpos+edgsp),y1,spref,buth, &(U.uiflag), 0, 0, 0, 0, - "Use column layout for toolbox and do not flip contents in any menu"); + "Show the name of the view's direction in each 3D View"); uiBlockEndAlign(block); uiDefBut(block, LABEL,0,"Menus:", @@ -2615,11 +2615,11 @@ void drawinfospace(ScrArea *sa, void *spacedata) (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_LOCKAROUND, B_DRAWINFO, "Global Pivot", - (xpos+edgsp+spref+midsp+(mpref/2)),y1,(mpref/2),buth, + uiDefButBitI(block, TOG, USER_PLAINMENUS, B_PLAINMENUS, "Plain Menus", + (xpos+edgsp+(2*spref)+(2*midsp)),y1,spref,buth, &(U.uiflag), 0, 0, 0, 0, - "Lock the same rotation/scaling pivot in all 3D Views"); + "Use a column layout for toolbox and do not flip the contents of any menu"); + uiBlockEndAlign(block); uiDefBut(block, LABEL,0,"Snap to grid:", (xpos+(2*edgsp)+spref+midsp+mpref),y6label,mpref,buth, @@ -2639,6 +2639,11 @@ void drawinfospace(ScrArea *sa, void *spacedata) "Snap objects and sub-objects to grid units when scaling"); uiBlockEndAlign(block); + uiDefButBitI(block, TOG, USER_LOCKAROUND, B_DRAWINFO, "Global Pivot", + (xpos+edgsp+mpref+spref+(2*midsp)),y1,spref,buth, + &(U.uiflag), 0, 0, 0, 0, + "Lock the same rotation/scaling pivot in all 3D Views"); + uiDefBut(block, LABEL,0,"View zoom:", (xpos+(2*edgsp)+mpref+(2*spref)+(2*midsp)),y6label,mpref,buth, 0, 0, 0, 0, 0, ""); @@ -2682,6 +2687,23 @@ void drawinfospace(ScrArea *sa, void *spacedata) &(U.uiflag), 0, 0, 0, 0, "Keep the active object in place when orbiting the views (Object Mode)"); 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); + uiDefBut(block, LABEL,0,"Select with:", (xpos+(2*edgsp)+(3*mpref)+(3*midsp)),y6label,mpref,buth, @@ -2762,15 +2784,10 @@ void drawinfospace(ScrArea *sa, void *spacedata) &(U.tw_hotspot), 4, 40, 0, 0, "Hotspot in pixels for clicking widget handles"); uiBlockEndAlign(block); - - uiDefBut(block, LABEL,0,"Object center diameter", - (xpos+(2*edgsp)+(5*mpref)+(5*midsp)),y3label,mpref,buth, - 0, 0, 0, 0, 0, ""); - uiBlockBeginAlign(block); - uiDefButS(block, NUM, B_REDRCURW3D, "Size", - (xpos+(2*edgsp)+(5*mpref)+(5*midsp)),y2,mpref,buth, + uiDefButS(block, NUM, B_REDRCURW3D, "Object Center Size: ", + (xpos+edgsp+(5*mpref)+(6*midsp)),y3,mpref,buth, &(U.obcenter_dia), 4, 10, 0, 0, - "Diameter in Pixels for Object/Lamp center drawing"); + "Diameter in Pixels for Object/Lamp center display"); } else if (U.userpref == 1) { /* edit methods */ @@ -2793,11 +2810,11 @@ void drawinfospace(ScrArea *sa, void *spacedata) (xpos+(2*edgsp)+mpref),y3label, mpref,buth, 0, 0, 0, 0, 0, ""); uiBlockBeginAlign(block); - uiDefButS(block, NUMSLI, B_DRAWINFO, "Steps:", + uiDefButS(block, NUMSLI, B_DRAWINFO, "Steps: ", (xpos+edgsp+mpref+midsp),y2,mpref,buth, &(U.undosteps), 0, 64, 0, 0, "Number of undo steps available (smaller values conserve memory)"); - uiDefButBitI(block, TOG, USER_GLOBALUNDO, B_DRAWINFO, "Global undo", + uiDefButBitI(block, TOG, USER_GLOBALUNDO, B_DRAWINFO, "Global Undo", (xpos+edgsp+mpref+midsp),y1,mpref,buth, &(U.uiflag), 2, 64, 0, 0, "Global undo works by keeping a full copy of the file itself in memory, so takes extra memory"); uiBlockEndAlign(block); diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c index f470e0a43e8..b043bc85370 100644 --- a/source/blender/src/toets.c +++ b/source/blender/src/toets.c @@ -138,6 +138,10 @@ void persptoetsen(unsigned short event) } } else if((G.qual & (LR_SHIFTKEY | LR_CTRLKEY)) && (event != PAD0)) { + + /* indicate that this view is inverted */ + G.vd->flag2 |= V3D_OPP_DIRECTION_NAME; + if(event==PAD0) { /* G.vd->persp= 3; */ } @@ -197,6 +201,8 @@ void persptoetsen(unsigned short event) } } else { + /* indicate that this view is not inverted */ + G.vd->flag2 &= ~V3D_OPP_DIRECTION_NAME; if(event==PAD7) { G.vd->viewquat[0]= 1.0; diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index 265919a4937..4c660a5c4a6 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -292,6 +292,15 @@ static void init_userdef_file(void) SETCOL(btheme->tv3d.group_active, 0x66, 0xFF, 0x66, 255); } } + + /* set defaults for 3D View rotating axis indicator */ + /* since size can't be set to 0, this indicates it's not saved in .B.blend */ + if (U.rvisize == 0) { + U.rvisize = 18; + U.rvibright = 2; + U.uiflag |= USER_SHOW_ROTVIEWICON; + } + } if (U.undosteps==0) U.undosteps=32; |