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:
-rw-r--r--source/blender/include/BSE_view.h1
-rwxr-xr-xsource/blender/include/transform.h2
-rwxr-xr-xsource/blender/src/transform_constraints.c8
-rwxr-xr-xsource/blender/src/transform_generics.c16
-rw-r--r--source/blender/src/view.c24
5 files changed, 38 insertions, 13 deletions
diff --git a/source/blender/include/BSE_view.h b/source/blender/include/BSE_view.h
index 49a41e26ab1..67aa7bfd6ad 100644
--- a/source/blender/include/BSE_view.h
+++ b/source/blender/include/BSE_view.h
@@ -50,6 +50,7 @@ void initgrabz(float x, float y, float z);
void window_to_3d(float *vec, short mx, short my);
void project_short(float *vec, short *adr);
void project_short_noclip(float *vec, short *adr);
+void project_int(float *vec, int *adr);
void project_float(float *vec, float *adr);
int boundbox_clip(float obmat[][4], struct BoundBox *bb);
void fdrawline(float x1, float y1, float x2, float y2);
diff --git a/source/blender/include/transform.h b/source/blender/include/transform.h
index 7777804dd76..c7c6ceb3cc3 100755
--- a/source/blender/include/transform.h
+++ b/source/blender/include/transform.h
@@ -135,7 +135,7 @@ typedef struct TransInfo {
float propsize; /* proportional circle radius */
char proptext[20]; /* proportional falloff text */
float center[3]; /* center of transformation */
- short center2d[2]; /* center in screen coordinates */
+ int center2d[2]; /* center in screen coordinates */
short imval[2]; /* initial mouse position */
short shiftmval[2]; /* mouse position when shift was pressed */
short idx_max;
diff --git a/source/blender/src/transform_constraints.c b/source/blender/src/transform_constraints.c
index 9f45410ab7b..063f4ed6b57 100755
--- a/source/blender/src/transform_constraints.c
+++ b/source/blender/src/transform_constraints.c
@@ -842,8 +842,8 @@ void setNearestAxis(TransInfo *t)
float zfac;
float mvec[3], axis[3], proj[3];
float len[3];
+ int i, icoord[2];
short coord[2];
- int i;
t->con.mode &= ~CON_AXIS0;
t->con.mode &= ~CON_AXIS1;
@@ -871,10 +871,10 @@ void setNearestAxis(TransInfo *t)
VecMulf(axis, zfac);
/* now we can project to get window coordinate */
VecAddf(axis, axis, t->con.center);
- project_short_noclip(axis, coord);
+ project_int(axis, icoord);
- axis[0] = (float)(coord[0] - t->center2d[0]);
- axis[1] = (float)(coord[1] - t->center2d[1]);
+ axis[0] = (float)(icoord[0] - t->center2d[0]);
+ axis[1] = (float)(icoord[1] - t->center2d[1]);
axis[2] = 0.0f;
if (Normalise(axis) != 0.0f) {
diff --git a/source/blender/src/transform_generics.c b/source/blender/src/transform_generics.c
index 2171978e336..438f7864cf3 100755
--- a/source/blender/src/transform_generics.c
+++ b/source/blender/src/transform_generics.c
@@ -608,10 +608,10 @@ void calculateCenterCursor(TransInfo *t)
VECCOPY(vec, t->center);
Mat4MulVecfl(ob->obmat, vec);
- project_short_noclip(vec, t->center2d);
+ project_int(vec, t->center2d);
}
else {
- project_short_noclip(t->center, t->center2d);
+ project_int(t->center, t->center2d);
}
}
@@ -640,10 +640,10 @@ void calculateCenterMedian(TransInfo *t)
VECCOPY(vec, t->center);
Mat4MulVecfl(ob->obmat, vec);
- project_short_noclip(vec, t->center2d);
+ project_int(vec, t->center2d);
}
else {
- project_short_noclip(t->center, t->center2d);
+ project_int(t->center, t->center2d);
}
}
@@ -679,10 +679,10 @@ void calculateCenterBound(TransInfo *t)
VECCOPY(vec, t->center);
Mat4MulVecfl(ob->obmat, vec);
- project_short_noclip(vec, t->center2d);
+ project_int(vec, t->center2d);
}
else {
- project_short_noclip(t->center, t->center2d);
+ project_int(t->center, t->center2d);
}
}
@@ -709,7 +709,7 @@ void calculateCenter(TransInfo *t)
Object *ob= OBACT;
if(ob) {
VECCOPY(t->center, ob->obmat[3]);
- project_short_noclip(t->center, t->center2d);
+ project_int(t->center, t->center2d);
}
}
@@ -735,7 +735,7 @@ void calculateCenter(TransInfo *t)
axis[1]= t->center[1]- 6.0f*axis[1];
axis[2]= t->center[2]- 6.0f*axis[2];
- project_short_noclip(axis, t->center2d);
+ project_int(axis, t->center2d);
/* rotate only needs correct 2d center, grab needs initgrabz() value */
if(t->mode==TFM_TRANSLATION) VECCOPY(t->center, axis);
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index ce0803d24cc..9f30306d398 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -192,6 +192,30 @@ void project_short(float *vec, short *adr) /* clips */
}
}
+void project_int(float *vec, int *adr)
+{
+ float fx, fy, vec4[4];
+
+ adr[0]= 2140000000.0f;
+ VECCOPY(vec4, vec);
+ vec4[3]= 1.0;
+
+ Mat4MulVec4fl(G.vd->persmat, vec4);
+
+ if( vec4[3]>BL_NEAR_CLIP ) { /* 0.001 is the NEAR clipping cutoff for picking */
+ fx= (curarea->winx/2)*(1 + vec4[0]/vec4[3]);
+
+ if( fx>-2140000000.0f && fx<2140000000.0f) {
+ fy= (curarea->winy/2)*(1 + vec4[1]/vec4[3]);
+
+ if(fy>-2140000000.0f && fy<2140000000.0f) {
+ adr[0]= floor(fx);
+ adr[1]= floor(fy);
+ }
+ }
+ }
+}
+
void project_short_noclip(float *vec, short *adr)
{
float fx, fy, vec4[4];