diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-04-13 14:37:16 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-04-13 14:37:16 +0300 |
commit | ae027413f4b3b4aa9e606f03f1d301b3c7cdc035 (patch) | |
tree | a2e811a2fa8819647127c01fd3fb06ab561552fb /source/blender/editors/sculpt_paint/paint_canvas.cc | |
parent | 9b16782aefbe373c613fe36327890f029af707cf (diff) |
Rebuild pixels when image resolution/uvmap changes.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_canvas.cc')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_canvas.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_canvas.cc b/source/blender/editors/sculpt_paint/paint_canvas.cc index 9c0f16636d7..bb52b442ee2 100644 --- a/source/blender/editors/sculpt_paint/paint_canvas.cc +++ b/source/blender/editors/sculpt_paint/paint_canvas.cc @@ -9,10 +9,13 @@ #include "BKE_context.h" #include "BKE_customdata.h" +#include "BKE_image.h" #include "BKE_material.h" #include "BKE_paint.h" #include "BKE_pbvh.h" +#include "IMB_imbuf_types.h" + #include "DEG_depsgraph.h" #include "NOD_shader.h" @@ -215,4 +218,29 @@ int ED_paint_canvas_uvmap_layer_index_get(const struct PaintModeSettings *settin } return -1; } + +char *ED_paint_canvas_key_get(struct PaintModeSettings *settings, struct Object *ob) +{ + std::stringstream ss; + int active_uv_map_layer_index = ED_paint_canvas_uvmap_layer_index_get(settings, ob); + ss << "UV_MAP:" << active_uv_map_layer_index; + + Image *image; + ImageUser *image_user; + if (ED_paint_canvas_image_get(settings, ob, &image, &image_user)) { + ImageUser tile_user = *image_user; + LISTBASE_FOREACH (ImageTile *, image_tile, &image->tiles) { + tile_user.tile = image_tile->tile_number; + ImBuf *image_buffer = BKE_image_acquire_ibuf(image, &tile_user, nullptr); + if (!image_buffer) { + continue; + } + ss << ",TILE_" << image_tile->tile_number; + ss << "(" << image_buffer->x << "," << image_buffer->y << ")"; + BKE_image_release_ibuf(image, image_buffer, nullptr); + } + } + + return BLI_strdup(ss.str().c_str()); +} } |