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>2010-03-09 04:19:32 +0300
committerMartin Poirier <theeth@yahoo.com>2010-03-09 04:19:32 +0300
commit70efb8d322bc3965a3e68ec2034af28cd8a0aa8b (patch)
tree1e7cf6dd3a5cd0674f8dfd4c02ba4f8640abc0b5 /source/blender/editors/transform/transform_input.c
parentf03a17d0f935a0f33114dea24ede731b721c307e (diff)
[#21433] Angular rotation snap issue, final value set is not snapped - SVN 27250 and 2.50A1
Proper fix for this. Moving special mouse input stuff to custom callbacks (this also makes the per transform main functions a bit cleaner). It also fixes the operator property (value) for shear and warp.
Diffstat (limited to 'source/blender/editors/transform/transform_input.c')
-rw-r--r--source/blender/editors/transform/transform_input.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c
index 0e4521052ad..d4110eedee0 100644
--- a/source/blender/editors/transform/transform_input.c
+++ b/source/blender/editors/transform/transform_input.c
@@ -225,6 +225,8 @@ void InputAngle(TransInfo *t, MouseInput *mi, short mval[2], float output[3])
double dx3 = mval[0] - mi->imval[0];
double dy3 = mval[1] - mi->imval[1];
+ double *angle = mi->data;
+
/* use doubles here, to make sure a "1.0" (no rotation) doesnt become 9.999999e-01, which gives 0.02 for acos */
double deler = ((dx1*dx1+dy1*dy1)+(dx2*dx2+dy2*dy2)-(dx3*dx3+dy3*dy3))
/ (2.0 * (A*B?A*B:1.0));
@@ -266,7 +268,11 @@ void InputAngle(TransInfo *t, MouseInput *mi, short mval[2], float output[3])
mi->imval[1] = mval[1];
}
- output[0] += dphi;
+ *angle += dphi;
+
+ printf("angle %.3f\n", *angle);
+
+ output[0] = *angle;
}
void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], short mval[2])
@@ -279,6 +285,8 @@ void initMouseInput(TransInfo *t, MouseInput *mi, int center[2], short mval[2])
mi->imval[0] = mval[0];
mi->imval[1] = mval[1];
+
+ mi->post = NULL;
}
static void calcSpringFactor(MouseInput *mi)
@@ -314,6 +322,7 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
t->helpline = HLP_SPRING;
break;
case INPUT_ANGLE:
+ mi->data = MEM_callocN(sizeof(double), "angle accumulator");
mi->apply = InputAngle;
t->helpline = HLP_ANGLE;
break;
@@ -354,12 +363,22 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
applyMouseInput(t, mi, mi->imval, t->values);
}
+void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *, float [3]))
+{
+ mi->post = post;
+}
+
void applyMouseInput(TransInfo *t, MouseInput *mi, short mval[2], float output[3])
{
if (mi->apply != NULL)
{
mi->apply(t, mi, mval, output);
}
+
+ if (mi->post)
+ {
+ mi->post(t, output);
+ }
}
int handleMouseInput(TransInfo *t, MouseInput *mi, wmEvent *event)