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:
authorPhilipp Oeser <info@graphics-engineer.com>2020-05-07 13:53:19 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-05-07 13:53:19 +0300
commit4f846d9d2a3792dd1cc4dbf1a39fe58aacd2609c (patch)
tree44a569496f972e23d5e260de30ef3eb1c7ef82a6 /source/blender/blenkernel
parent45a77ba09dbe8c51084c0aaa80f884a9954459cf (diff)
parent2a2aa6abd0ae45133b083368be4bee77a1a420c4 (diff)
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/mesh_mirror.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh_mirror.c b/source/blender/blenkernel/intern/mesh_mirror.c
index 49ffa9561ce..d9be9a99b2b 100644
--- a/source/blender/blenkernel/intern/mesh_mirror.c
+++ b/source/blender/blenkernel/intern/mesh_mirror.c
@@ -290,6 +290,8 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis(MirrorModifierData *mmd,
(is_zero_v2(mmd->uv_offset_copy) == false)) {
const bool do_mirr_u = (mmd->flag & MOD_MIR_MIRROR_U) != 0;
const bool do_mirr_v = (mmd->flag & MOD_MIR_MIRROR_V) != 0;
+ /* If set, flip around center of each tile. */
+ const bool do_mirr_udim = (mmd->flag & MOD_MIR_MIRROR_UDIM) != 0;
const int totuv = CustomData_number_of_layers(&result->ldata, CD_MLOOPUV);
@@ -299,10 +301,22 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis(MirrorModifierData *mmd,
dmloopuv += j; /* second set of loops only */
for (; j-- > 0; dmloopuv++) {
if (do_mirr_u) {
- dmloopuv->uv[0] = 1.0f - dmloopuv->uv[0] + mmd->uv_offset[0];
+ float u = dmloopuv->uv[0];
+ if (do_mirr_udim) {
+ dmloopuv->uv[0] = ceilf(u) - fmodf(u, 1.0f) + mmd->uv_offset[0];
+ }
+ else {
+ dmloopuv->uv[0] = 1.0f - u + mmd->uv_offset[0];
+ }
}
if (do_mirr_v) {
- dmloopuv->uv[1] = 1.0f - dmloopuv->uv[1] + mmd->uv_offset[1];
+ float v = dmloopuv->uv[1];
+ if (do_mirr_udim) {
+ dmloopuv->uv[1] = ceilf(v) - fmodf(v, 1.0f) + mmd->uv_offset[1];
+ }
+ else {
+ dmloopuv->uv[1] = 1.0f - v + mmd->uv_offset[1];
+ }
}
dmloopuv->uv[0] += mmd->uv_offset_copy[0];
dmloopuv->uv[1] += mmd->uv_offset_copy[1];