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
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-07-20 19:19:37 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-07-20 19:23:03 +0300
commit5d4574ea0e7a010c130f1728408f198886ea5c44 (patch)
treea463cf1ad5fc3ffd44cb66f800bfadb35345a83d /source
parentc4d8e28aa7043d7b7774d5b88ef454ba4d3e81ce (diff)
Fix T99340: Image.frame_duration returning wrong value when image not loaded
The logic here was broken in d5f1b9c, it should load the image first.
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesrna/intern/rna_image.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 39f5b6e0e9f..7f134c5055f 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -475,18 +475,19 @@ static int rna_Image_frame_duration_get(PointerRNA *ptr)
Image *ima = (Image *)ptr->owner_id;
int duration = 1;
+ if (!BKE_image_has_anim(ima)) {
+ /* Ensure image has been loaded into memory and frame duration is known. */
+ void *lock;
+ ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+ BKE_image_release_ibuf(ima, ibuf, lock);
+ }
+
if (BKE_image_has_anim(ima)) {
struct anim *anim = ((ImageAnim *)ima->anims.first)->anim;
if (anim) {
duration = IMB_anim_get_duration(anim, IMB_TC_RECORD_RUN);
}
}
- else {
- /* acquire ensures ima->anim is set, if possible! */
- void *lock;
- ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
- BKE_image_release_ibuf(ima, ibuf, lock);
- }
return duration;
}