Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_mode_resize.c
| Show First 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | static void constrain_scale_to_boundary(const float numerator, | ||||
| /* Scale origin is inside boundary, the "regular" case, limit maximum scale. */ | /* Scale origin is inside boundary, the "regular" case, limit maximum scale. */ | ||||
| if (*scale > correction) { | if (*scale > correction) { | ||||
| *scale = correction; | *scale = correction; | ||||
| } | } | ||||
| } | } | ||||
| static bool clip_uv_transform_resize(TransInfo *t, float vec[2]) | static bool clip_uv_transform_resize(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); | ||||
| } | |||||
| /* Assume no change is required. */ | /* Assume no change is required. */ | ||||
| float scale = 1.0f; | float scale = 1.0f; | ||||
| /* Are we scaling U and V together, or just one axis? */ | /* Are we scaling U and V together, or just one axis? */ | ||||
| const bool adjust_u = !(t->con.mode & CON_AXIS1); | const bool adjust_u = !(t->con.mode & CON_AXIS1); | ||||
| const bool adjust_v = !(t->con.mode & CON_AXIS0); | const bool adjust_v = !(t->con.mode & CON_AXIS0); | ||||
| const bool use_local_center = transdata_check_local_center(t, t->around); | const bool use_local_center = transdata_check_local_center(t, t->around); | ||||
| ▲ Show 20 Lines • Show All 204 Lines • Show Last 20 Lines | |||||