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-01-13 17:09:21 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2020-01-15 11:40:48 +0300
commit75100d0b943b8718afa937de0f2b2ba169a7f9d3 (patch)
tree7db3371bec231eb3f5f74f895b61e418e9c7a5f2 /source/blender/editors/sculpt_paint
parent27c5fb6fc4b2b9a3c0f43811e7d65ac4e132804b (diff)
Fix T72648: Texture Paint color sampling always samples only 1st tile
when using UDIMS A more generic approach might be considered in the future (I assume there are other operators around that need an update in shifting their uvs) though. Maniphest Tasks: T72648 Differential Revision: https://developer.blender.org/D6570
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_utils.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c
index 4a1b329fce5..db22729e8b0 100644
--- a/source/blender/editors/sculpt_paint/paint_utils.c
+++ b/source/blender/editors/sculpt_paint/paint_utils.c
@@ -519,13 +519,20 @@ void paint_sample_color(
}
if (image) {
- ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
- if (ibuf && ibuf->rect) {
- float uv[2];
- float u, v;
- imapaint_pick_uv(me_eval, scene, ob_eval, faceindex, mval, uv);
- sample_success = true;
-
+ float uv[2];
+ float u, v;
+ ImageUser iuser;
+ BKE_imageuser_default(&iuser);
+
+ imapaint_pick_uv(me_eval, scene, ob_eval, faceindex, mval, uv);
+
+ if (image->source == IMA_SRC_TILED) {
+ float new_uv[2];
+ iuser.tile = BKE_image_get_tile_from_pos(image, uv, new_uv, NULL);
+ u = new_uv[0];
+ v = new_uv[1];
+ }
+ else {
u = fmodf(uv[0], 1.0f);
v = fmodf(uv[1], 1.0f);
@@ -535,6 +542,11 @@ void paint_sample_color(
if (v < 0.0f) {
v += 1.0f;
}
+ }
+
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, &iuser, NULL);
+ if (ibuf && ibuf->rect) {
+ sample_success = true;
u = u * ibuf->x;
v = v * ibuf->y;