Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Poirier <theeth@yahoo.com>2006-10-26 03:57:00 +0400
committerMartin Poirier <theeth@yahoo.com>2006-10-26 03:57:00 +0400
commitf0dcd2db75b488be000a8be310e1c8a65e85227e (patch)
tree3b6d968aff79699a54b189412fd96e4679a02785 /source/blender/src/transform_generics.c
parent2556254e925cb93a203a5801e36fd24d2e44c985 (diff)
== Transform ==
Embryon functionnality for snapping. - Only snaps to grid on translations (grab) - Transform constraints are supported but header display is wrong. - Can be turned on/off in the Object/Mesh header menu under Transform Properties (tentative spot, will have to integrate better and in other object type menus too) - Can be turned on/off during transform with ` (Back Quote, also tentative) This is, of course, very much Work in Progress. This implements part of the structural ideas for the transform cleanup I've been juggling around with.
Diffstat (limited to 'source/blender/src/transform_generics.c')
-rwxr-xr-xsource/blender/src/transform_generics.c60
1 files changed, 1 insertions, 59 deletions
diff --git a/source/blender/src/transform_generics.c b/source/blender/src/transform_generics.c
index 09ad6e7a788..0ed75810b42 100755
--- a/source/blender/src/transform_generics.c
+++ b/source/blender/src/transform_generics.c
@@ -480,6 +480,7 @@ void initTrans (TransInfo *t)
t->around = V3D_CENTRE;
setTransformViewMatrices(t);
+ resetSnapping(t);
}
/* Here I would suggest only TransInfo related issues, like free data & reset vars. Not redraws */
@@ -532,65 +533,6 @@ void postTrans (TransInfo *t)
}
}
-static void apply_grid3(TransInfo *t, float *val, int max_index, float fac1, float fac2, float fac3)
-{
- /* fac1 is for 'nothing', fac2 for CTRL, fac3 for SHIFT */
- int invert;
- int ctrl;
- int i;
- float asp= 1.0f;
-
- if(t->mode==TFM_ROTATION || t->mode==TFM_WARP || t->mode==TFM_TILT || t->mode==TFM_TRACKBALL)
- invert = U.flag & USER_AUTOROTGRID;
- else if(t->mode==TFM_RESIZE || t->mode==TFM_SHEAR || t->mode==TFM_BONESIZE || t->mode==TFM_SHRINKFATTEN || t->mode==TFM_CURVE_SHRINKFATTEN)
- invert = U.flag & USER_AUTOSIZEGRID;
- else
- invert = U.flag & USER_AUTOGRABGRID;
-
- for (i=0; i<=max_index; i++) {
-
- /* evil hack - snapping needs to be adapted for image aspect ratio */
- if((t->spacetype==SPACE_IMAGE) && (t->mode==TFM_TRANSLATION)) {
- float aspx, aspy;
- transform_aspect_ratio_tface_uv(&aspx, &aspy);
- if(i==0) asp= aspx;
- else asp= aspy;
- }
-
- if(invert) {
- if(G.qual & LR_CTRLKEY) ctrl= 0;
- else ctrl= 1;
- }
- else ctrl= (G.qual & LR_CTRLKEY);
-
- if(ctrl && (G.qual & LR_SHIFTKEY)) {
- if(fac3!= 0.0) {
- for (i=0; i<=max_index; i++) {
- val[i]= fac3*asp*(float)floor(val[i]/(fac3*asp) +.5);
- }
- }
- }
- else if(ctrl) {
- if(fac2!= 0.0) {
- for (i=0; i<=max_index; i++) {
- val[i]= fac2*asp*(float)floor(val[i]/(fac2*asp) +.5);
- }
- }
- }
- else {
- if(fac1!= 0.0) {
- for (i=0; i<=max_index; i++) {
- val[i]= fac1*asp*(float)floor(val[i]/(fac1*asp) +.5);
- }
- }
- }
- }
-}
-
-void snapGrid(TransInfo *t, float *val) {
- apply_grid3(t, val, t->idx_max, t->snap[0], t->snap[1], t->snap[2]);
-}
-
void applyTransObjects(TransInfo *t)
{
TransData *td;