Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_translate.c
| Show First 20 Lines • Show All 431 Lines • ▼ Show 20 Lines | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| } | } | ||||
| } | } | ||||
| custom_data->prev.rotate_mode = rotate_mode; | custom_data->prev.rotate_mode = rotate_mode; | ||||
| } | } | ||||
| static bool clip_uv_transform_translation(TransInfo *t, float vec[2]) | static bool clip_uv_transform_translation(TransInfo *t, float vec[2]) | ||||
| { | { | ||||
| /* Check if the current image in UV editor is a tiled image or not. */ | |||||
| const SpaceImage *sima = t->area->spacedata.first; | |||||
| const Image *image = sima->image; | |||||
| const bool is_tiled_image = image && (image->source == IMA_SRC_TILED); | |||||
| /* Stores the coordinates of the closest UDIM tile. | /* Stores the coordinates of the closest UDIM tile. | ||||
| * Also acts as an offset to the tile from the origin of UV space. */ | * Also acts as an offset to the tile from the origin of UV space. */ | ||||
| float base_offset[2] = {0.0f, 0.0f}; | float base_offset[2] = {0.0f, 0.0f}; | ||||
| /* If tiled image then constrain to correct/closest UDIM tile, else 0-1 UV space. */ | /* If tiled image then constrain to correct/closest UDIM tile, else 0-1 UV space. */ | ||||
| if (is_tiled_image) { | const SpaceImage *sima = t->area->spacedata.first; | ||||
| BKE_image_find_nearest_tile_with_offset(image, t->center_global, base_offset); | BKE_image_find_nearest_tile_with_offset(sima->image, t->center_global, base_offset); | ||||
| } | |||||
| float min[2], max[2]; | float min[2], max[2]; | ||||
| min[0] = min[1] = FLT_MAX; | min[0] = min[1] = FLT_MAX; | ||||
| max[0] = max[1] = -FLT_MAX; | max[0] = max[1] = -FLT_MAX; | ||||
| FOREACH_TRANS_DATA_CONTAINER (t, tc) { | FOREACH_TRANS_DATA_CONTAINER (t, tc) { | ||||
| for (TransData *td = tc->data; td < tc->data + tc->data_len; td++) { | for (TransData *td = tc->data; td < tc->data + tc->data_len; td++) { | ||||
| minmax_v2v2_v2(min, max, td->loc); | minmax_v2v2_v2(min, max, td->loc); | ||||
| ▲ Show 20 Lines • Show All 165 Lines • Show Last 20 Lines | |||||