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:28:32 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-04-20 13:22:10 +0300
commit0e06a6016870d8909e0bba9c5a5e6366840a7825 (patch)
treea0057f8c98de9b8e76b9a8846868be3e6479aa5c /source/blender/editors/hair
parent121677d7c89707019871ba6b1da81ecf4b84e0e0 (diff)
Make sure tool input data is in object space.
Diffstat (limited to 'source/blender/editors/hair')
-rw-r--r--source/blender/editors/hair/hair_edit.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/editors/hair/hair_edit.c b/source/blender/editors/hair/hair_edit.c
index d1ef5c586cd..e2b097c469c 100644
--- a/source/blender/editors/hair/hair_edit.c
+++ b/source/blender/editors/hair/hair_edit.c
@@ -214,9 +214,6 @@ typedef struct HairStroke {
bool first;
float lastmouse[2];
float zfac;
-
- /* optional cached view settings to avoid setting on every mousemove */
-// PEData data;
} HairStroke;
static int hair_stroke_init(bContext *C, wmOperator *op)
@@ -262,6 +259,7 @@ static bool hair_stroke_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
HairEditSettings *settings = &scene->toolsettings->hair_edit;
ARegion *ar = CTX_wm_region(C);
+ float imat[4][4];
float mouse[2], mdelta[2], zvec[3], delta_max;
int totsteps, step;
HairToolData tool_data;
@@ -269,6 +267,8 @@ static bool hair_stroke_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
RNA_float_get_array(itemptr, "mouse", mouse);
+ invert_m4_m4(imat, ob->obmat);
+
if (stroke->first) {
copy_v2_v2(stroke->lastmouse, mouse);
stroke->first = false;
@@ -295,6 +295,9 @@ static bool hair_stroke_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
zvec[0] = 0.0f; zvec[1] = 0.0f; zvec[2] = stroke->zfac;
ED_view3d_win_to_3d(ar, zvec, mouse, tool_data.loc);
ED_view3d_win_to_delta(ar, mdelta, tool_data.delta, stroke->zfac);
+ /* tools work in object space */
+ mul_m4_v3(imat, tool_data.loc);
+ mul_mat3_m4_v3(imat, tool_data.delta);
for (step = 0; step < totsteps; ++step) {
updated |= hair_brush_step(&tool_data);
@@ -346,7 +349,8 @@ static void hair_stroke_apply_event(bContext *C, wmOperator *op, const wmEvent *
float mouse[2];
bool updated = false;
- copy_v2_v2(mouse, event->mval);
+ mouse[0] = event->mval[0];
+ mouse[1] = event->mval[1];
/* fill in stroke */
RNA_collection_add(op->ptr, "stroke", &itemptr);