From ab77f5b5fe59a8f0ff60b637883a53554b1de40c Mon Sep 17 00:00:00 2001 From: Habib Gahbiche Date: Fri, 9 Nov 2018 09:25:14 -0200 Subject: Improvements on CURVE_OT_select_similar: SIMCURHAND_DIRECTION Consider rotation and scale when calculating direction in world space. Reviewers: dfelinto Maniphest Tasks: T56948 Differential Revision: https://developer.blender.org/D3911 --- source/blender/editors/curve/editcurve_select.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/curve') diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c index 8495ef24536..8bd19d42193 100644 --- a/source/blender/editors/curve/editcurve_select.c +++ b/source/blender/editors/curve/editcurve_select.c @@ -1353,22 +1353,22 @@ static const EnumPropertyItem curve_prop_similar_types[] = { {0, NULL, 0, NULL, NULL} }; -/** Note: This function should actually take scaling into consideration. */ static void nurb_bezt_direction_worldspace_get(Object *ob, Nurb *nu, BezTriple *bezt, float r_dir[3]) { - float rmat[3][3]; + float rsmat[3][3]; BKE_nurb_bezt_calc_normal(nu, bezt, r_dir); - BKE_object_rot_to_mat3(ob, rmat, true); - mul_m3_v3(rmat, r_dir); + copy_m3_m4(rsmat, ob->obmat); + mul_m3_v3(rsmat, r_dir); + normalize_v3(r_dir); } -/** Note: This function should actually take scaling into consideration. */ static void nurb_bpoint_direction_worldspace_get(Object *ob, Nurb *nu, BPoint *bp, float r_dir[3]) { - float rmat[3][3]; + float rsmat[3][3]; BKE_nurb_bpoint_calc_normal(nu, bp, r_dir); - BKE_object_rot_to_mat3(ob, rmat, true); - mul_m3_v3(rmat, r_dir); + copy_m3_m4(rsmat, ob->obmat); + mul_m3_v3(rsmat, r_dir); + normalize_v3(r_dir); } static void curve_nurb_selected_type_get(Object *ob, Nurb *nu, const int type, KDTree *r_tree) -- cgit v1.2.3