diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2019-07-10 02:07:08 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2019-07-10 15:04:24 +0300 |
commit | fde88ad9d2fc93caa6c3cc39d4c009a0c9bac7c5 (patch) | |
tree | b8552569579717722a762b3fc0e8e3a6b32330a4 /source/blender/editors | |
parent | 91b42627287e47abe3845b56edb5532f32dcdb31 (diff) |
Fix T66627: Multiobject Edit UV constraint to image bounds
This was broken since the original commit to handle multi-object
editing: rBbfc9d426bb95.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 76 |
1 files changed, 37 insertions, 39 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 1b5ac66644d..27a2ab85127 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -3710,50 +3710,48 @@ bool clipUVTransform(TransInfo *t, float vec[2], const bool resize) for (a = 0, td = tc->data; a < tc->data_len; a++, td++) { minmax_v2v2_v2(min, max, td->loc); } + } - if (resize) { - if (min[0] < 0.0f && t->center_global[0] > 0.0f && - t->center_global[0] < t->aspect[0] * 0.5f) { - vec[0] *= t->center_global[0] / (t->center_global[0] - min[0]); - } - else if (max[0] > t->aspect[0] && t->center_global[0] < t->aspect[0]) { - vec[0] *= (t->center_global[0] - t->aspect[0]) / (t->center_global[0] - max[0]); - } - else { - clipx = 0; - } + if (resize) { + if (min[0] < 0.0f && t->center_global[0] > 0.0f && t->center_global[0] < t->aspect[0] * 0.5f) { + vec[0] *= t->center_global[0] / (t->center_global[0] - min[0]); + } + else if (max[0] > t->aspect[0] && t->center_global[0] < t->aspect[0]) { + vec[0] *= (t->center_global[0] - t->aspect[0]) / (t->center_global[0] - max[0]); + } + else { + clipx = 0; + } - if (min[1] < 0.0f && t->center_global[1] > 0.0f && - t->center_global[1] < t->aspect[1] * 0.5f) { - vec[1] *= t->center_global[1] / (t->center_global[1] - min[1]); - } - else if (max[1] > t->aspect[1] && t->center_global[1] < t->aspect[1]) { - vec[1] *= (t->center_global[1] - t->aspect[1]) / (t->center_global[1] - max[1]); - } - else { - clipy = 0; - } + if (min[1] < 0.0f && t->center_global[1] > 0.0f && t->center_global[1] < t->aspect[1] * 0.5f) { + vec[1] *= t->center_global[1] / (t->center_global[1] - min[1]); + } + else if (max[1] > t->aspect[1] && t->center_global[1] < t->aspect[1]) { + vec[1] *= (t->center_global[1] - t->aspect[1]) / (t->center_global[1] - max[1]); } else { - if (min[0] < 0.0f) { - vec[0] -= min[0]; - } - else if (max[0] > t->aspect[0]) { - vec[0] -= max[0] - t->aspect[0]; - } - else { - clipx = 0; - } + clipy = 0; + } + } + else { + if (min[0] < 0.0f) { + vec[0] -= min[0]; + } + else if (max[0] > t->aspect[0]) { + vec[0] -= max[0] - t->aspect[0]; + } + else { + clipx = 0; + } - if (min[1] < 0.0f) { - vec[1] -= min[1]; - } - else if (max[1] > t->aspect[1]) { - vec[1] -= max[1] - t->aspect[1]; - } - else { - clipy = 0; - } + if (min[1] < 0.0f) { + vec[1] -= min[1]; + } + else if (max[1] > t->aspect[1]) { + vec[1] -= max[1] - t->aspect[1]; + } + else { + clipy = 0; } } |