Page MenuHome

view-icon_viewport-name.patch

File Metadata

Author
Davide Vercelli (unclezeiv)
Created
Nov 13 2013, 1:07 PM

view-icon_viewport-name.patch

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.54
diff -u -r1.54 DNA_userdef_types.h
--- source/blender/makesdna/DNA_userdef_types.h 10 Mar 2006 18:51:10 -0000 1.54
+++ source/blender/makesdna/DNA_userdef_types.h 14 Apr 2006 16:59:30 -0000
@@ -166,7 +166,10 @@
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 @@
#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 */
Index: source/blender/makesdna/DNA_view3d_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_view3d_types.h,v
retrieving revision 1.30
diff -u -r1.30 DNA_view3d_types.h
--- source/blender/makesdna/DNA_view3d_types.h 10 Apr 2006 13:27:05 -0000 1.30
+++ source/blender/makesdna/DNA_view3d_types.h 14 Apr 2006 16:59:30 -0000
@@ -123,7 +123,10 @@
/* afterdraw, for xray & transparent */
struct ListBase afterdraw;
/* drawflags, denoting state */
- short zbuf, transp, xray, pad2;
+ short zbuf, transp, xray;
+ /* added a switch to know if current viewport direction is inverted */
+ short viewdir;
+
} View3D;
/* View3D->flag (short) */
Index: source/blender/src/drawview.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawview.c,v
retrieving revision 1.195
diff -u -r1.195 drawview.c
--- source/blender/src/drawview.c 10 Apr 2006 13:27:06 -0000 1.195
+++ source/blender/src/drawview.c 14 Apr 2006 16:59:33 -0000
@@ -1248,11 +1248,85 @@
else sprintf(info, "(%d) %s", CFRA, ob->id.name+2);
BIF_ThemeColor(TH_TEXT_HI);
- glRasterPos2i(30, 10);
+ if (U.uiflag & USER_SHOW_ROTVIEWICON)
+ glRasterPos2i(10, 10);
+ else
+ glRasterPos2i(30, 10);
BMF_DrawString(G.fonts, info);
}
+/* Draw a live substitute of the view icon, which is always shown */
+static void draw_view_axis()
+{
+ 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 = 20.0; /* vertical displacement to allow obj info text */
+
+ /* rvibright ranges approx. from original axis icon color to gizmo color */
+ const unsigned char colval = 55 + U.rvibright * 20;
+
+ unsigned char col[3];
+ float vec[4];
+ float dx, dy;
+
+ if (!(U.uiflag & USER_DRAWVIEWINFO))
+ ydisp = 0.0;
+
+ /* X */
+ vec[0] = vec[3] = 1;
+ vec[1] = vec[2] = 0;0;
+ QuatMulVecf(G.vd->viewquat, vec);
+
+ col[0] = colval;
+ col[1] = col[2] = 20;
+ 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);
+
+ col[1] = colval;
+ col[0] = col[2] = 20;
+ 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);
+
+ col[2] = colval;
+ col[0] = col[1] = 20;
+ 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 +1345,31 @@
glDisable(GL_BLEND);
}
+static void draw_viewport_name(ScrArea *sa)
+{
+ char *name = NULL;
+
+ switch(G.vd->view) {
+ case 1:
+ name = G.vd->viewdir>=0 ? "Front" : "Back";
+ break;
+ case 3:
+ name = G.vd->viewdir>=0 ? "Right" : "Left";
+ break;
+ case 7:
+ name = G.vd->viewdir>=0 ? "Top" : "Bottom";
+ 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 +2621,12 @@
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))
Index: source/blender/src/space.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/space.c,v
retrieving revision 1.347
diff -u -r1.347 space.c
--- source/blender/src/space.c 14 Apr 2006 15:29:52 -0000 1.347
+++ source/blender/src/space.c 14 Apr 2006 16:59:47 -0000
@@ -2717,6 +2717,25 @@
&(U.flag), 0, 0, 0, 0,
"Emulates Middle Mouse with Alt+LeftMouse (doesnt work with Left Mouse Select option)");
+
+ uiDefBut(block, LABEL,0,"Rotating view icon:",
+ (xpos+(2*edgsp)+(3*mpref)+(3*midsp)),y2label,mpref,buth,
+ 0, 0, 0, 0, 0, "");
+
+ uiBlockBeginAlign(block);
+ uiDefButBitI(block, TOG, USER_SHOW_ROTVIEWICON, B_DRAWINFO, "Enable",
+ (xpos+edgsp+(3*mpref)+(4*midsp)),y1,(mpref/3),buth,
+ &(U.uiflag), 0, 0, 0, 0,
+ "Enable rotating view icon");
+ uiDefButS(block, NUM, B_DRAWINFO, "Size:",
+ (xpos+edgsp+(3*mpref)+(4*midsp)+(mpref/3)),y1,(mpref/3),buth,
+ &U.rvisize, 10, 64, 0, 0,
+ "Axis size");
+ uiDefButS(block, NUM, B_DRAWINFO, "Brightness:",
+ (xpos+edgsp+(3*mpref)+(4*midsp)+2*(mpref/3)),y1,(mpref/3),buth,
+ &U.rvibright, 0, 10, 0, 0,
+ "Set axis brightness");
+ uiBlockEndAlign(block);
uiDefBut(block, LABEL,0,"Middle Mouse Button:",
(xpos+(2*edgsp)+(4*mpref)+(4*midsp)),y6label,mpref,buth,
@@ -2745,6 +2764,15 @@
&U.wheellinescroll, 0.0, 32.0, 0, 0,
"The number of lines scrolled at a time with the mouse wheel");
uiBlockEndAlign(block);
+
+ uiDefBut(block, LABEL,0,"Viewport name:",
+ (xpos+(2*edgsp)+(4*mpref)+(4*midsp)),y2label,mpref,buth,
+ 0, 0, 0, 0, 0, "");
+
+ uiDefButBitI(block, TOG, USER_SHOW_VIEWPORTNAME, B_DRAWINFO, "Enable",
+ (xpos+edgsp+(4*mpref)+(5*midsp)),y1,mpref,buth,
+ &(U.uiflag), 0, 0, 0, 0,
+ "Enable text showing viewport name");
uiDefBut(block, LABEL,0,"3D Transform Widget:",
Index: source/blender/src/toets.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/toets.c,v
retrieving revision 1.71
diff -u -r1.71 toets.c
--- source/blender/src/toets.c 10 Feb 2006 21:10:58 -0000 1.71
+++ source/blender/src/toets.c 14 Apr 2006 16:59:47 -0000
@@ -138,6 +138,10 @@
}
}
else if((G.qual & (LR_SHIFTKEY | LR_CTRLKEY)) && (event != PAD0)) {
+
+ /* indicate that this view is inverted */
+ G.vd->viewdir=-1;
+
if(event==PAD0) {
/* G.vd->persp= 3; */
}
@@ -197,6 +201,8 @@
}
}
else {
+ /* indicate that this view is not inverted */
+ G.vd->viewdir=1;
if(event==PAD7) {
G.vd->viewquat[0]= 1.0;
Index: source/blender/src/usiblender.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/usiblender.c,v
retrieving revision 1.103
diff -u -r1.103 usiblender.c
--- source/blender/src/usiblender.c 20 Mar 2006 17:25:42 -0000 1.103
+++ source/blender/src/usiblender.c 14 Apr 2006 16:59:50 -0000
@@ -307,6 +307,12 @@
if (U.frameserverport == 0) {
U.frameserverport = 8080;
}
+ if (U.rvisize == 0) {
+ U.rvisize = 18;
+ }
+ if (U.rvibright == 0) {
+ U.rvibright = 2;
+ }
MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024);

Event Timeline