From 8dedbb17478316ff44e739b68ff5d03d36b7ab40 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 23 Apr 2020 18:25:29 +1000 Subject: Fix T75836: Light target misses updates while dragging --- source/blender/editors/object/object_transform.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/object/object_transform.c') diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index b3d76382d26..62a8b46e904 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1727,7 +1727,7 @@ static void object_apply_location(Object *ob, const float loc[3]) copy_v3_v3(ob->loc, mat[3]); } -static void object_orient_to_location(Object *ob, +static bool object_orient_to_location(Object *ob, const float rot_orig[3][3], const float axis[3], const float location[3]) @@ -1744,9 +1744,10 @@ static void object_orient_to_location(Object *ob, object_apply_rotation(ob, final_rot); - DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM); + return true; } } + return false; } static void object_transform_axis_target_cancel(bContext *C, wmOperator *op) @@ -1975,6 +1976,8 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const object_orient_to_location( item->ob, item->rot_mat, item->rot_mat[2], location_world); + + DEG_id_tag_update(&item->ob->id, ID_RECALC_TRANSFORM); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, item->ob); } if (normal_found) { @@ -1986,8 +1989,11 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const else { struct XFormAxisItem *item = xfd->object_data; for (int i = 0; i < xfd->object_data_len; i++, item++) { - object_orient_to_location(item->ob, item->rot_mat, item->rot_mat[2], location_world); - WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, item->ob); + if (object_orient_to_location( + item->ob, item->rot_mat, item->rot_mat[2], location_world)) { + DEG_id_tag_update(&item->ob->id, ID_RECALC_TRANSFORM); + WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, item->ob); + } } xfd->prev.is_normal_valid = false; } -- cgit v1.2.3