Commit: 56df673be271c10200d758e0b0e891750103f8d6 Author: Philipp Oeser Date: Thu Mar 25 15:32:25 2021 +0100 Branches: master https://developer.blender.org/rB56df673be271c10200d758e0b0e891750103f8d6
Fix T86796: moving the cursor in the UV Editor does not take aspect into account UV coords are scaled by aspects (see UVsToTransData). This also applies for the Cursor in the UV Editor which also means that for display and when the cursor coords are flushed (new 'recalcData_cursor_image' was added for this), these need to be converted each time. Maniphest Tasks: T86796 Differential Revision: https://developer.blender.org/D10817 =================================================================== M source/blender/editors/transform/transform_convert.c M source/blender/editors/transform/transform_convert_cursor.c =================================================================== diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index dd577db01a3..c021c084a23 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -1644,6 +1644,21 @@ void animrecord_check_state(TransInfo *t, struct Object *ob) } } +static void recalcData_cursor_image(TransInfo *t) +{ + TransDataContainer *tc = t->data_container; + TransData *td = tc->data; + float aspect_inv[2]; + + aspect_inv[0] = 1.0f / t->aspect[0]; + aspect_inv[1] = 1.0f / t->aspect[1]; + + td->loc[0] = td->loc[0] * aspect_inv[0]; + td->loc[1] = td->loc[1] * aspect_inv[1]; + + DEG_id_tag_update(&t->scene->id, ID_RECALC_COPY_ON_WRITE); +} + static void recalcData_cursor(TransInfo *t) { DEG_id_tag_update(&t->scene->id, ID_RECALC_COPY_ON_WRITE); @@ -1678,6 +1693,8 @@ void recalcData(TransInfo *t) recalcData_curve(t); break; case TC_CURSOR_IMAGE: + recalcData_cursor_image(t); + break; case TC_CURSOR_VIEW3D: recalcData_cursor(t); break; diff --git a/source/blender/editors/transform/transform_convert_cursor.c b/source/blender/editors/transform/transform_convert_cursor.c index e6a972bfc7c..67d85f9610b 100644 --- a/source/blender/editors/transform/transform_convert_cursor.c +++ b/source/blender/editors/transform/transform_convert_cursor.c @@ -56,6 +56,13 @@ void createTransCursor_image(TransInfo *t) } td->flag = TD_SELECTED; + + /* UV coords are scaled by aspects (see UVsToTransData). This also applies for the Cursor in the + * UV Editor which also means that for display and when the cursor coords are flushed + * (recalcData_cursor_image), these are converted each time. */ + cursor_location[0] = cursor_location[0] * t->aspect[0]; + cursor_location[1] = cursor_location[1] * t->aspect[1]; + copy_v3_v3(td->center, cursor_location); td->ob = NULL; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs