[Bf-committers] My first 'little' patch

Martin Poirier bf-committers@blender.org
Sun, 10 Aug 2003 21:33:27 -0700 (PDT)


--- Matt Ebb <matt@mke3.net> wrote:
> I had a look at the transform() function in
> editobject.c, and noticed the
> comment:
> /* 'g' 'G' 'r' 'R' 's' 'S' 't' or 'w' 'N' */
> which shows all the args, but doesn't explain what
> they mean (grrr).

from a quick look through the function:

g,r,s -> grab, rotate, scale
G,R,C (not S) -> grab, rotate, scale with PET
t -> tilt
w -> warp
N -> don't know, it's not called with that argument
anywhere in this file.

> The 3D
> math stuff in that function is way over my head, so
> I couldn't figure out
> where to insert a bit of code that would
> automatically put it in
> 'transformation along the local X axis' mode (for
> example), depending on the
> arg.
> 
> Can anyone here help/share some insights?

the constraining to axis seems to happen in this bit
of code:

--------------------------
				if(midtog) {
					if(cameragrab) {
						dx1= 0.002*(mval[1]-yn)*G.vd->grid;
						dvec[0]-= dx1*G.vd->viewinv[2][0];
						dvec[1]-= dx1*G.vd->viewinv[2][1];
						dvec[2]-= dx1*G.vd->viewinv[2][2];
						firsttime= 1;	/* so it keeps going */
					}
					else {
						window_to_3d(dvec, mval[0]-xn, mval[1]-yn);
						if(proj==0) dvec[1]=dvec[2]= 0.0;
						if(proj==1) dvec[0]=dvec[2]= 0.0;
						if(proj==2) dvec[0]=dvec[1]= 0.0;
					}
				}
				else window_to_3d(dvec, mval[0]-xn, mval[1]-yn);
-----------------------------------
and there:
-----------------------------------
				case MIDDLEMOUSE:
					midtog= ~midtog;
					if(midtog) {
						proj= test_midtog_proj(xn, yn, mval);
						phi0= phi1= 0.0;
						if(cameragrab) {
							dvec[0]= dvec[1]= dvec[2]= 0.0;
						}
					}
					firsttime= 1;
					break;


------------------------

as for the math, except the really obvious parts, it
looks like a big bowl of spaghetti to me too, sorry.

Martin

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com