Commit for the 4 aforementioned "features":
- "Global Pivot": Maintains a global Pivot and Align mode setting for
all 3d views when enabled, instead of seperate settings per 3d view
- "Auto Perspective": Switch to ortho mode automatically on 1/3/7, and
to Perspective when the view is rotated with the mouse
- "Align mode": As suggested on the list, when enabled, transformations
on several objects only transform their locations, not their sizes or
rotations.
- Grid dotted when not 1:1
***ATTENTION***! The User Interface parts of these features have not been
committed, as I work on my own modified UI here. The three features need
toggle buttons to turn them on and off.
I used the following 3 buttons (first two features are in userprefs,
third as a 3d view setting):
uiDefButBitS(block, TOG, USER_AUTOPERSP, B_DRAWINFO, "Auto Persp",
(xpos+edgespace+(3*medprefbut)+(3*midspace)+smallprefbut+2),y3+10,smallprefbut,buth,
&(U.uiflag), 0, 0, 0, 0,
"Automatically switch between orthographic and perspective");
uiDefButBitS(block, TOG, USER_LOCKAROUND, B_DRAWINFO, "Global Pivot",
(xpos+edgespace+(4*midspace)+(4*medprefbut)),y3+10,smallprefbut,buth,
&(U.uiflag), 0, 0, 0, 0,
"Use global pivot setting for all 3d views");
uiDefIconButS(block, TOG|BIT|10, B_AROUND, ICON_ALIGN,
xco+=XIC,0,XIC,YIC,
&G.vd->flag, 0, 0, 0, 0, "Translate only (align)");
Someone needs to add these to the interface in an appropriate manner!
Thanks.
This commit is contained in:
@@ -89,12 +89,13 @@ typedef enum {
|
||||
ICON_POSE_HLT,
|
||||
ICON_BORDERMOVE,
|
||||
ICON_MAYBE_ITS_A_LASSO,
|
||||
ICON_BLANK1,
|
||||
ICON_BLANK1, /* ATTENTION, someone decided to use this throughout blender
|
||||
and didn't care to neither rename it nor update the PNG */
|
||||
ICON_ROTATE,
|
||||
ICON_CURSOR,
|
||||
ICON_ROTATECOLLECTION,
|
||||
ICON_ROTATECENTER,
|
||||
ICON_BLANK7,
|
||||
ICON_ALIGN,
|
||||
ICON_BLANK8,
|
||||
ICON_BLANK9,
|
||||
ICON_BLANK10,
|
||||
|
||||
@@ -189,6 +189,9 @@ extern UserDef U; /* from usiblender.c !!!! */
|
||||
#define USER_ALLWINCODECS 256
|
||||
#define USER_MENUOPENAUTO 512
|
||||
#define USER_PANELPINNED 1024
|
||||
#define USER_AUTOPERSP 2048
|
||||
#define USER_LOCKAROUND 4096
|
||||
|
||||
|
||||
/* transopts */
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ typedef struct View3D {
|
||||
#define V3D_POSEMODE 128
|
||||
#define V3D_TEXTUREPAINT 256
|
||||
#define V3D_WEIGHTPAINT 512
|
||||
#define V3D_ALIGN 1024
|
||||
|
||||
/* View3D->around */
|
||||
#define V3D_CENTRE 0
|
||||
|
||||
@@ -535,6 +535,7 @@ static void drawgrid(void)
|
||||
/* check zoom out */
|
||||
BIF_ThemeColor(TH_GRID);
|
||||
persp(PERSP_WIN);
|
||||
setlinestyle(3);
|
||||
|
||||
if(dx<6.0) {
|
||||
dx*= 10.0;
|
||||
@@ -586,12 +587,15 @@ static void drawgrid(void)
|
||||
BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
|
||||
drawgrid_draw(wx, wy, x, y, dx);
|
||||
BIF_ThemeColor(TH_GRID);
|
||||
drawgrid_draw(wx, wy, x, y, dx*10);
|
||||
setlinestyle(0);
|
||||
drawgrid_draw(wx, wy, x, y, dx*10); /* 1:1 */
|
||||
}
|
||||
}
|
||||
else {
|
||||
BIF_ThemeColorBlend(TH_BACK, TH_GRID, dx/60.0);
|
||||
drawgrid_draw(wx, wy, x, y, dx);
|
||||
setlinestyle(0);
|
||||
drawgrid_draw(wx, wy, x, y, dx); /* 1:1 */
|
||||
setlinestyle(3);
|
||||
BIF_ThemeColor(TH_GRID);
|
||||
drawgrid_draw(wx, wy, x, y, dx*10);
|
||||
}
|
||||
|
||||
@@ -4969,6 +4969,8 @@ void transform(int mode)
|
||||
* 3. multiply with its own rotation, calculate euler.
|
||||
*/
|
||||
|
||||
if ((G.vd->flag & V3D_ALIGN)==0) {
|
||||
|
||||
/* Roll around local axis */
|
||||
if (mode=='r' || mode=='R'){
|
||||
|
||||
@@ -5076,6 +5078,7 @@ void transform(int mode)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(G.vd->around!=V3D_LOCAL && (!G.obpose)) {
|
||||
float vec[3]; // make local, the other vec stores rot axis
|
||||
@@ -5265,6 +5268,8 @@ void transform(int mode)
|
||||
/* size local with respect to parent AND own rotation */
|
||||
/* local wrt parent: */
|
||||
|
||||
if ((G.vd->flag & V3D_ALIGN)==0) {
|
||||
|
||||
Mat3MulSerie(smat, tob->parmat, mat, tob->parinv, 0, 0,0 ,0, 0);
|
||||
|
||||
/* local wrt own rotation: */
|
||||
@@ -5313,6 +5318,7 @@ void transform(int mode)
|
||||
tob->size[1]= (tob->oldsize[1]+tob->olddsize[1])*sizelo[1] -tob->olddsize[1];
|
||||
tob->size[2]= (tob->oldsize[2]+tob->olddsize[2])*sizelo[2] -tob->olddsize[2];
|
||||
}
|
||||
}
|
||||
|
||||
if(G.vd->around!=V3D_LOCAL && !G.obpose) {
|
||||
/* translation */
|
||||
|
||||
@@ -267,6 +267,43 @@ void copy_view3d_lock(short val)
|
||||
}
|
||||
}
|
||||
|
||||
void handle_view3d_around()
|
||||
{
|
||||
bScreen *sc;
|
||||
int bit;
|
||||
|
||||
if ((U.uiflag & USER_LOCKAROUND)==0) return;
|
||||
|
||||
/* copies from G.vd->around to other view3ds */
|
||||
|
||||
sc= G.main->screen.first;
|
||||
|
||||
while(sc) {
|
||||
if(sc->scene==G.scene) {
|
||||
ScrArea *sa= sc->areabase.first;
|
||||
while(sa) {
|
||||
SpaceLink *sl= sa->spacedata.first;
|
||||
while(sl) {
|
||||
if(sl->spacetype==SPACE_VIEW3D) {
|
||||
View3D *vd= (View3D*) sl;
|
||||
if (vd != G.vd) {
|
||||
vd->around= G.vd->around;
|
||||
if (G.vd->flag & V3D_ALIGN)
|
||||
vd->flag |= V3D_ALIGN;
|
||||
else
|
||||
vd->flag &= ~V3D_ALIGN;
|
||||
scrarea_queue_headredraw(sa);
|
||||
}
|
||||
}
|
||||
sl= sl->next;
|
||||
}
|
||||
sa= sa->next;
|
||||
}
|
||||
}
|
||||
sc= sc->id.next;
|
||||
}
|
||||
}
|
||||
|
||||
void handle_view3d_lock()
|
||||
{
|
||||
if (G.vd != NULL) {
|
||||
@@ -2141,6 +2178,15 @@ void drawinfospace(ScrArea *sa, void *spacedata)
|
||||
&(U.viewzoom), 40, USER_ZOOM_SCALE, 0, 0,
|
||||
"Zooms in and out like scaling the view, mouse movements relative to center.");
|
||||
|
||||
uiDefButBitS(block, TOG, USER_AUTOPERSP, B_DRAWINFO, "Auto Persp",
|
||||
(xpos+edgespace+(3*medprefbut)+(3*midspace)+smallprefbut+2),y3+10,smallprefbut,buth,
|
||||
&(U.uiflag), 0, 0, 0, 0,
|
||||
"Automatically switch between orthographic and perspective");
|
||||
|
||||
uiDefButBitS(block, TOG, USER_LOCKAROUND, B_DRAWINFO, "Global Pivot",
|
||||
(xpos+edgespace+(4*midspace)+(4*medprefbut)),y3+10,smallprefbut,buth,
|
||||
&(U.uiflag), 0, 0, 0, 0,
|
||||
"Use global pivot setting for all 3d views");
|
||||
|
||||
|
||||
uiDefBut(block, LABEL,0,"View rotation:",
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
#include "DNA_screen_types.h"
|
||||
#include "DNA_space_types.h"
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_userdef_types.h"
|
||||
|
||||
#include "BKE_utildefines.h"
|
||||
#include "BKE_global.h"
|
||||
@@ -273,7 +274,8 @@ void persptoetsen(unsigned short event)
|
||||
G.vd->viewquat[2]= 0.0;
|
||||
G.vd->viewquat[3]= 0.0;
|
||||
G.vd->view= 7;
|
||||
if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
|
||||
else if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
}
|
||||
else if(event==PAD1) {
|
||||
G.vd->viewquat[0]= 0.0;
|
||||
@@ -281,7 +283,8 @@ void persptoetsen(unsigned short event)
|
||||
G.vd->viewquat[2]= (float)-cos(M_PI/4.0);
|
||||
G.vd->viewquat[3]= (float)-cos(M_PI/4.0);
|
||||
G.vd->view=1;
|
||||
if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
|
||||
else if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
}
|
||||
else if(event==PAD3) {
|
||||
G.vd->viewquat[0]= 0.5;
|
||||
@@ -289,7 +292,8 @@ void persptoetsen(unsigned short event)
|
||||
G.vd->viewquat[2]= 0.5;
|
||||
G.vd->viewquat[3]= 0.5;
|
||||
G.vd->view=3;
|
||||
if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
|
||||
else if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
}
|
||||
else if(event==PADMINUS) {
|
||||
/* this min and max is also in viewmove() */
|
||||
@@ -327,7 +331,8 @@ void persptoetsen(unsigned short event)
|
||||
G.vd->viewquat[2]= 0.0;
|
||||
G.vd->viewquat[3]= 0.0;
|
||||
G.vd->view=7;
|
||||
if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
|
||||
else if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
}
|
||||
else if(event==PAD1) {
|
||||
G.vd->viewquat[0]= (float)cos(M_PI/4.0);
|
||||
@@ -335,7 +340,8 @@ void persptoetsen(unsigned short event)
|
||||
G.vd->viewquat[2]= 0.0;
|
||||
G.vd->viewquat[3]= 0.0;
|
||||
G.vd->view=1;
|
||||
if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
|
||||
else if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
}
|
||||
else if(event==PAD3) {
|
||||
G.vd->viewquat[0]= 0.5;
|
||||
@@ -343,7 +349,8 @@ void persptoetsen(unsigned short event)
|
||||
G.vd->viewquat[2]= -0.5;
|
||||
G.vd->viewquat[3]= -0.5;
|
||||
G.vd->view=3;
|
||||
if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 0;
|
||||
else if(G.vd->persp>=2) G.vd->persp= perspo;
|
||||
}
|
||||
else if(event==PADMINUS) {
|
||||
/* this min and max is also in viewmove() */
|
||||
|
||||
@@ -450,6 +450,8 @@ void viewmove(int mode)
|
||||
|
||||
if(mode==0) { /* view rotate */
|
||||
|
||||
if (U.uiflag & USER_AUTOPERSP) G.vd->persp= 1;
|
||||
|
||||
/* if turntable method, we don't change mvalball[0] */
|
||||
|
||||
if(U.flag & USER_TRACKBALL) mvalball[0]= mval[0];
|
||||
|
||||
Reference in New Issue
Block a user