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:
authorCampbell Barton <ideasman42@gmail.com>2018-05-21 18:27:38 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-05-21 18:27:38 +0300
commitf0fda91a5591ebb2161922f35777a32cc374964a (patch)
tree2965f760afe4fa0d0a29496dd56f89965378f824 /source/blender/editors/transform/transform_constraints.c
parent20bafbd5507f8163b9e142fde1db3560616031aa (diff)
parent605e1841676ce44de827d924a9e7f3e8d5f8b3dc (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'source/blender/editors/transform/transform_constraints.c')
-rw-r--r--source/blender/editors/transform/transform_constraints.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 02cfc9c5e35..a95d21b2f02 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -171,7 +171,7 @@ static void postConstraintChecks(TransInfo *t, float vec[3], float pvec[3])
mul_m3_v3(t->con.mtx, vec);
}
-static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3])
+static void viewAxisCorrectCenter(const TransInfo *t, float t_con_center[3])
{
if (t->spacetype == SPACE_VIEW3D) {
// View3D *v3d = t->sa->spacedata.first;
@@ -195,7 +195,10 @@ static void viewAxisCorrectCenter(TransInfo *t, float t_con_center[3])
}
}
-static void axisProjection(TransInfo *t, const float axis[3], const float in[3], float out[3])
+/**
+ * Axis calculation taking the view into account, correcting view-aligned axis.
+ */
+static void axisProjection(const TransInfo *t, const float axis[3], const float in[3], float out[3])
{
float norm[3], vec[3], factor, angle;
float t_con_center[3];
@@ -213,12 +216,11 @@ static void axisProjection(TransInfo *t, const float axis[3], const float in[3],
if (angle > (float)M_PI_2) {
angle = (float)M_PI - angle;
}
- angle = RAD2DEGF(angle);
/* For when view is parallel to constraint... will cause NaNs otherwise
* So we take vertical motion in 3D space and apply it to the
* constraint axis. Nice for camera grab + MMB */
- if (angle < 5.0f) {
+ if (angle < DEG2RADF(5.0f)) {
project_v3_v3v3(vec, in, t->viewinv[1]);
factor = dot_v3v3(t->viewinv[1], vec) * 2.0f;
/* since camera distance is quite relative, use quadratic relationship. holding shift can compensate */
@@ -277,7 +279,7 @@ static void axisProjection(TransInfo *t, const float axis[3], const float in[3],
* Return true if the 2x axis are both aligned when projected into the view.
* In this case, we can't usefully project the cursor onto the plane.
*/
-static bool isPlaneProjectionViewAligned(TransInfo *t)
+static bool isPlaneProjectionViewAligned(const TransInfo *t)
{
const float eps = 0.001f;
const float *constraint_vector[2];
@@ -303,7 +305,7 @@ static bool isPlaneProjectionViewAligned(TransInfo *t)
return fabsf(factor) < eps;
}
-static void planeProjection(TransInfo *t, const float in[3], float out[3])
+static void planeProjection(const TransInfo *t, const float in[3], float out[3])
{
float vec[3], factor, norm[3];