diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-08-08 14:29:24 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-08-08 14:51:19 +0300 |
commit | 4b3315fc98a9edb254bf99e2747fbccb7813a34b (patch) | |
tree | bd6d2d323aca199d664e93a74f46873b66bf7f3d /source/blender/blenkernel/intern/image.cc | |
parent | 1382514bf2f881bc2139ebfd477e54bba92e497a (diff) |
Fix T100281: image save after copy not using correct filepath
Always use the image datablock filepath for saving. The only apparent reason
use the image buffer file path is image sequences, for which the current frame
filepath is now computed.
Diffstat (limited to 'source/blender/blenkernel/intern/image.cc')
-rw-r--r-- | source/blender/blenkernel/intern/image.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc index fa3cc06b087..78eaba44a08 100644 --- a/source/blender/blenkernel/intern/image.cc +++ b/source/blender/blenkernel/intern/image.cc @@ -785,7 +785,7 @@ bool BKE_image_has_opengl_texture(Image *ima) return false; } -static int image_get_tile_number_from_iuser(Image *ima, const ImageUser *iuser) +static int image_get_tile_number_from_iuser(const Image *ima, const ImageUser *iuser) { BLI_assert(ima != nullptr && ima->tiles.first); ImageTile *tile = static_cast<ImageTile *>(ima->tiles.first); @@ -3562,7 +3562,7 @@ RenderPass *BKE_image_multilayer_index(RenderResult *rr, ImageUser *iuser) return rpass; } -void BKE_image_multiview_index(Image *ima, ImageUser *iuser) +void BKE_image_multiview_index(const Image *ima, ImageUser *iuser) { if (iuser) { bool is_stereo = BKE_image_is_stereo(ima) && (iuser->flag & IMA_SHOW_STEREO); @@ -3583,7 +3583,7 @@ void BKE_image_multiview_index(Image *ima, ImageUser *iuser) /* if layer or pass changes, we need an index for the imbufs list */ /* note it is called for rendered results, but it doesn't use the index! */ -bool BKE_image_is_multilayer(Image *ima) +bool BKE_image_is_multilayer(const Image *ima) { if (ELEM(ima->source, IMA_SRC_FILE, IMA_SRC_SEQUENCE, IMA_SRC_TILED)) { if (ima->type == IMA_TYPE_MULTILAYER) { @@ -3598,13 +3598,13 @@ bool BKE_image_is_multilayer(Image *ima) return false; } -bool BKE_image_is_multiview(Image *ima) +bool BKE_image_is_multiview(const Image *ima) { ImageView *view = static_cast<ImageView *>(ima->views.first); return (view && (view->next || view->name[0])); } -bool BKE_image_is_stereo(Image *ima) +bool BKE_image_is_stereo(const Image *ima) { return BKE_image_is_multiview(ima) && (BLI_findstring(&ima->views, STEREO_LEFT_NAME, offsetof(ImageView, name)) && @@ -5002,14 +5002,19 @@ void BKE_image_user_id_eval_animation(Depsgraph *depsgraph, ID *id) image_walk_id_all_users(id, skip_nested_nodes, depsgraph, image_user_id_eval_animation); } -void BKE_image_user_file_path(ImageUser *iuser, Image *ima, char *filepath) +void BKE_image_user_file_path(const ImageUser *iuser, const Image *ima, char *filepath) { - BKE_image_user_file_path_ex(iuser, ima, filepath, true); + BKE_image_user_file_path_ex(G_MAIN, iuser, ima, filepath, true, true); } -void BKE_image_user_file_path_ex(ImageUser *iuser, Image *ima, char *filepath, bool resolve_udim) +void BKE_image_user_file_path_ex(const Main *bmain, + const ImageUser *iuser, + const Image *ima, + char *filepath, + const bool resolve_udim, + const bool resolve_multiview) { - if (BKE_image_is_multiview(ima)) { + if (resolve_multiview && BKE_image_is_multiview(ima)) { ImageView *iv = static_cast<ImageView *>(BLI_findlink(&ima->views, iuser->view)); if (iv->filepath[0]) { BLI_strncpy(filepath, iv->filepath, FILE_MAX); @@ -5042,7 +5047,7 @@ void BKE_image_user_file_path_ex(ImageUser *iuser, Image *ima, char *filepath, b } } - BLI_path_abs(filepath, ID_BLEND_PATH_FROM_GLOBAL(&ima->id)); + BLI_path_abs(filepath, ID_BLEND_PATH(bmain, &ima->id)); } bool BKE_image_has_alpha(Image *image) |