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:
authorCampbell Barton <campbell@blender.org>2022-07-22 06:05:26 +0300
committerCampbell Barton <campbell@blender.org>2022-07-22 06:07:24 +0300
commit08c5d99e88ee3e9f807dfe69c188660eae347f31 (patch)
tree7e4298800487b17a43c289462420507c35e4bb2b /source/blender/editors/transform
parent72e249974aa7f6a3bd6d5c35c5d5e59cd1c3bded (diff)
Cleanup: add BKE_image_find_nearest_tile_with_offset
Every caller BKE_image_find_nearest_tile was calculating the tile offset so add a version of this function that returns the offset too.
Diffstat (limited to 'source/blender/editors/transform')
-rw-r--r--source/blender/editors/transform/transform_mode_resize.c8
-rw-r--r--source/blender/editors/transform/transform_mode_translate.c8
2 files changed, 2 insertions, 14 deletions
diff --git a/source/blender/editors/transform/transform_mode_resize.c b/source/blender/editors/transform/transform_mode_resize.c
index bbe1cfdf521..1ccda96fecb 100644
--- a/source/blender/editors/transform/transform_mode_resize.c
+++ b/source/blender/editors/transform/transform_mode_resize.c
@@ -137,13 +137,7 @@ static bool clip_uv_transform_resize(TransInfo *t, float vec[2])
/* If tiled image then constrain to correct/closest UDIM tile, else 0-1 UV space. */
if (is_tiled_image) {
- int nearest_tile_index = BKE_image_find_nearest_tile(image, t->center_global);
- if (nearest_tile_index != -1) {
- nearest_tile_index -= 1001;
- /* Getting coordinates of nearest tile from the tile index. */
- base_offset[0] = nearest_tile_index % 10;
- base_offset[1] = nearest_tile_index / 10;
- }
+ BKE_image_find_nearest_tile_with_offset(image, t->center_global, base_offset);
}
/* Assume no change is required. */
diff --git a/source/blender/editors/transform/transform_mode_translate.c b/source/blender/editors/transform/transform_mode_translate.c
index 67bdeb3fed0..04a41814b53 100644
--- a/source/blender/editors/transform/transform_mode_translate.c
+++ b/source/blender/editors/transform/transform_mode_translate.c
@@ -448,13 +448,7 @@ static bool clip_uv_transform_translation(TransInfo *t, float vec[2])
/* If tiled image then constrain to correct/closest UDIM tile, else 0-1 UV space. */
if (is_tiled_image) {
- int nearest_tile_index = BKE_image_find_nearest_tile(image, t->center_global);
- if (nearest_tile_index != -1) {
- nearest_tile_index -= 1001;
- /* Getting coordinates of nearest tile from the tile index. */
- base_offset[0] = nearest_tile_index % 10;
- base_offset[1] = nearest_tile_index / 10;
- }
+ BKE_image_find_nearest_tile_with_offset(image, t->center_global, base_offset);
}
float min[2], max[2];