Page MenuHome

rotating_view_icon_v2.patch

File Metadata

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

rotating_view_icon_v2.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 16 Mar 2006 23:42:46 -0000
@@ -165,7 +165,7 @@
int textimeout, texcollectrate;
int memcachelimit;
short frameserverport;
- short pad;
+ short rvisize; /* rotating view icon size */
short obcenter_dia, pad1, pad2, pad3;
} UserDef;
@@ -215,6 +215,7 @@
#define USER_ORBIT_SELECTION 16384
#define USER_KEYINSERTAVAI 32768
#define USER_HIDE_DOT 65536
+#define USER_SHOW_ROTVIEWICON 131072
/* transopts */
Index: source/blender/src/drawview.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawview.c,v
retrieving revision 1.193
diff -u -r1.193 drawview.c
--- source/blender/src/drawview.c 11 Mar 2006 12:34:50 -0000 1.193
+++ source/blender/src/drawview.c 16 Mar 2006 23:42:49 -0000
@@ -1237,11 +1237,80 @@
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(U.rvisize * 2 + 22, 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 tag = (k + 6.0) / k; // placement of axis tag along axis
+ const float toll = 0.5; // used to see when view is quasi-orthogonal
+ const float start = 12.0 + k; // axis center in screen coordinates, x=y
+
+ unsigned char col[3];
+ float vec[4];
+ float dx, dy;
+
+ /* X */
+ vec[0] = vec[3] = 1;
+ vec[1] = vec[2] = 0;
+ QuatMulVecf(G.vd->viewquat, vec);
+
+ // Not using make_axis_color but the original icon's fixed colors
+ col[0] = 99;
+ col[1] = col[2] = 20;
+ glColor3ubv(col);
+
+ dx = vec[0] * k;
+ dy = vec[1] * k;
+ fdrawline(start, start, start + dx, start + dy);
+ if (fabs(dx) > toll || fabs(dy) > toll) {
+ glRasterPos2i(start + dx * tag - 2, start + dy * tag - 2);
+ BMF_DrawString(G.fonts, "x");
+ }
+
+ /* Y */
+ vec[1] = vec[3] = 1;
+ vec[0] = vec[2] = 0;
+ QuatMulVecf(G.vd->viewquat, vec);
+
+ col[1] = 99;
+ col[0] = col[2] = 20;
+ glColor3ubv(col);
+
+ dx = vec[0] * k;
+ dy = vec[1] * k;
+ fdrawline(start, start, start + dx, start + dy);
+ if (fabs(dx) > toll || fabs(dy) > toll) {
+ glRasterPos2i(start + dx * tag - 2, start + dy * tag - 2);
+ BMF_DrawString(G.fonts, "y");
+ }
+
+ /* Z */
+ vec[2] = vec[3] = 1;
+ vec[1] = vec[0] = 0;
+ QuatMulVecf(G.vd->viewquat, vec);
+
+ col[2] = 99;
+ col[0] = col[1] = 20;
+ glColor3ubv(col);
+
+ dx = vec[0] * k;
+ dy = vec[1] * k;
+ fdrawline(start, start, start + dx, start + dy);
+ if (fabs(dx) > toll || fabs(dy) > toll) {
+ glRasterPos2i(start + dx * tag - 2, start + dy * tag - 2);
+ BMF_DrawString(G.fonts, "z");
+ }
+}
+
+
static void draw_view_icon(void)
{
BIFIconID icon;
@@ -2511,7 +2580,10 @@
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();
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.340
diff -u -r1.340 space.c
--- source/blender/src/space.c 8 Mar 2006 17:45:32 -0000 1.340
+++ source/blender/src/space.c 16 Mar 2006 23:42:53 -0000
@@ -2674,6 +2674,21 @@
&(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/2),buth,
+ &(U.uiflag), 0, 0, 0, 0,
+ "Enable rotating view icon");
+ uiDefButS(block, NUM, B_DRAWINFO, "Axis size:",
+ (xpos+edgsp+(3*mpref)+(4*midsp)+(mpref/2)),y1,(mpref/2),buth,
+ &U.rvisize, 4.0, 32.0, 0, 0,
+ "Rotating view icon size");
+ uiBlockEndAlign(block);
uiDefBut(block, LABEL,0,"Middle Mouse Button:",
(xpos+(2*edgsp)+(4*mpref)+(4*midsp)),y6label,mpref,buth,
Index: source/blender/src/usiblender.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/usiblender.c,v
retrieving revision 1.101
diff -u -r1.101 usiblender.c
--- source/blender/src/usiblender.c 11 Mar 2006 18:51:41 -0000 1.101
+++ source/blender/src/usiblender.c 16 Mar 2006 23:42:55 -0000
@@ -306,6 +306,9 @@
if (U.frameserverport == 0) {
U.frameserverport = 8080;
}
+ if (U.rvisize == 0) {
+ U.rvisize = 12;
+ }
MEM_CacheLimiter_set_maximum(U.memcachelimit * 1024 * 1024);

Event Timeline