diff options
author | Tomek Gubala <VGT> | 2022-07-19 20:24:20 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-07-19 20:29:03 +0300 |
commit | 3b7ac10d6252a2a9cecbb9be7850a1dea41e281d (patch) | |
tree | 728c1995da1faa96f59b441f91fef26bd001cd91 /source/blender/editors/uvedit | |
parent | 75e62df4297093b2a65e295a43b0ff0fbffe44b7 (diff) |
UV: add Snap Cursor to Origin
Similar to snapping to the world origin in the 3D viewport. This can be found
in the Shift+S pie menu and UV > Snap menu.
Differential Revision: https://developer.blender.org/D15055
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 4e99eb3fc0f..74a9989f550 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1036,6 +1036,12 @@ static bool uv_snap_cursor_to_selection(Scene *scene, return ED_uvedit_center_multi(scene, objects_edit, objects_len, sima->cursor, sima->around); } +static void uv_snap_cursor_to_origin(float uvco[2]) +{ + uvco[0] = 0; + uvco[1] = 0; +} + static int uv_snap_cursor_exec(bContext *C, wmOperator *op) { SpaceImage *sima = CTX_wm_space_image(C); @@ -1058,6 +1064,10 @@ static int uv_snap_cursor_exec(bContext *C, wmOperator *op) MEM_freeN(objects); break; } + case 2: + uv_snap_cursor_to_origin(sima->cursor); + changed = true; + break; } if (!changed) { @@ -1074,6 +1084,7 @@ static void UV_OT_snap_cursor(wmOperatorType *ot) static const EnumPropertyItem target_items[] = { {0, "PIXELS", 0, "Pixels", ""}, {1, "SELECTED", 0, "Selected", ""}, + {2, "ORIGIN", 0, "Origin", ""}, {0, NULL, 0, NULL, NULL}, }; |