[Bf-blender-cvs] [121677d] strand_editmode: Nicer vector math for mouse coordinates.
Lukas Tönne
noreply at git.blender.org
Mon Apr 20 14:23:27 CEST 2015
Commit: 121677d7c89707019871ba6b1da81ecf4b84e0e0
Author: Lukas Tönne
Date: Tue Dec 2 13:24:04 2014 +0100
Branches: strand_editmode
https://developer.blender.org/rB121677d7c89707019871ba6b1da81ecf4b84e0e0
Nicer vector math for mouse coordinates.
===================================================================
M source/blender/editors/hair/hair_edit.c
===================================================================
diff --git a/source/blender/editors/hair/hair_edit.c b/source/blender/editors/hair/hair_edit.c
index f2e1b3d..d1ef5c5 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;
}
More information about the Bf-blender-cvs
mailing list