[Bf-blender-cvs] [75100d0b943] blender-v2.82-release: Fix T72648: Texture Paint color sampling always samples only 1st tile when using UDIMS
Philipp Oeser
noreply at git.blender.org
Wed Jan 15 09:45:48 CET 2020
Commit: 75100d0b943b8718afa937de0f2b2ba169a7f9d3
Author: Philipp Oeser
Date: Mon Jan 13 15:09:21 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rB75100d0b943b8718afa937de0f2b2ba169a7f9d3
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
===================================================================
M source/blender/editors/sculpt_paint/paint_utils.c
===================================================================
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;
More information about the Bf-blender-cvs
mailing list