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:
authorLukas Tönne <lukas.toenne@gmail.com>2014-12-02 15:24:04 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-04-20 13:22:10 +0300
commit121677d7c89707019871ba6b1da81ecf4b84e0e0 (patch)
tree92be42d1399d542064d42b4f9ca08871b9c44b76 /source/blender/editors/hair
parent1615da133f34d4abce3e75afacec10e2cad79d30 (diff)
Nicer vector math for mouse coordinates.
Diffstat (limited to 'source/blender/editors/hair')
-rw-r--r--source/blender/editors/hair/hair_edit.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/source/blender/editors/hair/hair_edit.c b/source/blender/editors/hair/hair_edit.c
index f2e1b3df118..d1ef5c586cd 100644
--- a/source/blender/editors/hair/hair_edit.c
+++ b/source/blender/editors/hair/hair_edit.c
@@ -212,7 +212,7 @@ typedef struct HairStroke {
BMEditStrands *edit;
bool first;
- int lastmouse[2];
+ float lastmouse[2];
float zfac;
/* optional cached view settings to avoid setting on every mousemove */
@@ -270,15 +270,14 @@ static bool hair_stroke_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
RNA_float_get_array(itemptr, "mouse", mouse);
if (stroke->first) {
- stroke->lastmouse[0] = mouse[0];
- stroke->lastmouse[1] = mouse[1];
+ copy_v2_v2(stroke->lastmouse, mouse);
+ stroke->first = false;
}
if (!settings->brush)
return false;
- mdelta[0] = mouse[0] - stroke->lastmouse[0];
- mdelta[1] = mouse[1] - stroke->lastmouse[1];
+ sub_v2_v2v2(mdelta, mouse, stroke->lastmouse);
delta_max = max_ff(fabsf(mdelta[0]), fabsf(mdelta[1]));
// totsteps = delta_max / (0.2f * pe_brush_size_get(scene, brush)) + 1;
@@ -301,9 +300,7 @@ static bool hair_stroke_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
updated |= hair_brush_step(&tool_data);
}
- stroke->lastmouse[0] = mouse[0];
- stroke->lastmouse[1] = mouse[1];
- stroke->first = false;
+ copy_v2_v2(stroke->lastmouse, mouse);
return updated;
}