mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Merge branch 'blender-v4.5-release'
This commit is contained in:
commit
ff8658b457
5 changed files with 23 additions and 6 deletions
|
|
@ -109,6 +109,15 @@ bool BKE_image_save_options_init(ImageSaveOptions *opts,
|
|||
* by the image saving code itself. */
|
||||
BKE_image_user_file_path_ex(bmain, iuser, ima, opts->filepath, false, false);
|
||||
|
||||
/* For movies, replace extension and add the frame number to avoid writing over the movie file
|
||||
* itself and provide a good default file path. */
|
||||
if (ima->source == IMA_SRC_MOVIE) {
|
||||
BLI_path_extension_strip(opts->filepath);
|
||||
SNPRINTF(opts->filepath, "%s_%.*d", opts->filepath, 4, ibuf->fileframe);
|
||||
BKE_image_path_ext_from_imformat_ensure(
|
||||
opts->filepath, sizeof(opts->filepath), &opts->im_format);
|
||||
}
|
||||
|
||||
/* sanitize all settings */
|
||||
|
||||
/* unlikely but just in case */
|
||||
|
|
|
|||
|
|
@ -464,6 +464,7 @@ struct UndoImageBuf {
|
|||
UndoImageBuf *post;
|
||||
|
||||
char ibuf_filepath[IMB_FILEPATH_SIZE];
|
||||
int ibuf_fileframe;
|
||||
|
||||
UndoImageTile **tiles;
|
||||
|
||||
|
|
@ -495,6 +496,7 @@ static UndoImageBuf *ubuf_from_image_no_tiles(Image *image, const ImBuf *ibuf)
|
|||
MEM_callocN(sizeof(*ubuf->tiles) * ubuf->tiles_len, __func__));
|
||||
|
||||
STRNCPY(ubuf->ibuf_filepath, ibuf->filepath);
|
||||
ubuf->ibuf_fileframe = ibuf->fileframe;
|
||||
ubuf->image_state.source = image->source;
|
||||
ubuf->image_state.use_float = ibuf->float_buffer.data != nullptr;
|
||||
|
||||
|
|
@ -661,10 +663,11 @@ static void uhandle_free_list(ListBase *undo_handles)
|
|||
|
||||
static UndoImageBuf *uhandle_lookup_ubuf(UndoImageHandle *uh,
|
||||
const Image * /*image*/,
|
||||
const char *ibuf_filepath)
|
||||
const char *ibuf_filepath,
|
||||
const int ibuf_fileframe)
|
||||
{
|
||||
LISTBASE_FOREACH (UndoImageBuf *, ubuf, &uh->buffers) {
|
||||
if (STREQ(ubuf->ibuf_filepath, ibuf_filepath)) {
|
||||
if (STREQ(ubuf->ibuf_filepath, ibuf_filepath) && ubuf->ibuf_fileframe == ibuf_fileframe) {
|
||||
return ubuf;
|
||||
}
|
||||
}
|
||||
|
|
@ -673,7 +676,7 @@ static UndoImageBuf *uhandle_lookup_ubuf(UndoImageHandle *uh,
|
|||
|
||||
static UndoImageBuf *uhandle_add_ubuf(UndoImageHandle *uh, Image *image, ImBuf *ibuf)
|
||||
{
|
||||
BLI_assert(uhandle_lookup_ubuf(uh, image, ibuf->filepath) == nullptr);
|
||||
BLI_assert(uhandle_lookup_ubuf(uh, image, ibuf->filepath, ibuf->fileframe) == nullptr);
|
||||
UndoImageBuf *ubuf = ubuf_from_image_no_tiles(image, ibuf);
|
||||
BLI_addtail(&uh->buffers, ubuf);
|
||||
|
||||
|
|
@ -684,7 +687,7 @@ static UndoImageBuf *uhandle_add_ubuf(UndoImageHandle *uh, Image *image, ImBuf *
|
|||
|
||||
static UndoImageBuf *uhandle_ensure_ubuf(UndoImageHandle *uh, Image *image, ImBuf *ibuf)
|
||||
{
|
||||
UndoImageBuf *ubuf = uhandle_lookup_ubuf(uh, image, ibuf->filepath);
|
||||
UndoImageBuf *ubuf = uhandle_lookup_ubuf(uh, image, ibuf->filepath, ibuf->fileframe);
|
||||
if (ubuf == nullptr) {
|
||||
ubuf = uhandle_add_ubuf(uh, image, ibuf);
|
||||
}
|
||||
|
|
@ -767,7 +770,8 @@ static UndoImageBuf *ubuf_lookup_from_reference(ImageUndoStep *us_prev,
|
|||
/* Use name lookup because the pointer is cleared for previous steps. */
|
||||
UndoImageHandle *uh_prev = uhandle_lookup_by_name(&us_prev->handles, image, tile_number);
|
||||
if (uh_prev != nullptr) {
|
||||
UndoImageBuf *ubuf_reference = uhandle_lookup_ubuf(uh_prev, image, ubuf->ibuf_filepath);
|
||||
UndoImageBuf *ubuf_reference = uhandle_lookup_ubuf(
|
||||
uh_prev, image, ubuf->ibuf_filepath, ubuf->ibuf_fileframe);
|
||||
if (ubuf_reference) {
|
||||
ubuf_reference = ubuf_reference->post;
|
||||
if ((ubuf_reference->image_dims[0] == ubuf->image_dims[0]) &&
|
||||
|
|
|
|||
|
|
@ -236,6 +236,8 @@ struct ImBuf {
|
|||
ImbFormatOptions foptions;
|
||||
/** The absolute file path associated with this image. */
|
||||
char filepath[IMB_FILEPATH_SIZE];
|
||||
/* For movie files, the frame number loaded from the file. */
|
||||
int fileframe;
|
||||
|
||||
/** reference counter for multiple users */
|
||||
int32_t refcounter;
|
||||
|
|
|
|||
|
|
@ -1432,7 +1432,8 @@ ImBuf *MOV_decode_frame(MovieReader *anim,
|
|||
#endif
|
||||
|
||||
if (ibuf) {
|
||||
SNPRINTF(ibuf->filepath, "%s.%04d", anim->filepath, anim->cur_position + 1);
|
||||
STRNCPY(ibuf->filepath, anim->filepath);
|
||||
ibuf->fileframe = anim->cur_position + 1;
|
||||
}
|
||||
return ibuf;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2041,6 +2041,7 @@ static std::optional<int> wm_main_playanim_intern(int argc, const char **argv, P
|
|||
#endif /* USE_FRAME_CACHE_LIMIT */
|
||||
|
||||
STRNCPY(ibuf->filepath, ps.picture->filepath);
|
||||
ibuf->fileframe = ps.picture->frame;
|
||||
}
|
||||
|
||||
while (pupdate_time()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue