Commit: 22a33418c9148b9ad2777184a5c332a4f5c16622
Author: Lukas Tönne
Date:   Tue Dec 2 13:24:04 2014 +0100
Branches: hair_immediate_fixes
https://developer.blender.org/rB22a33418c9148b9ad2777184a5c332a4f5c16622

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;
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to