Code Cleanup: replace checks for ima->source with BKE_image_is_animated
[blender.git] / source / blender / blenkernel / intern / image.c
index c0362e3aaf36b120eecebf4ebad0a7103666cdd3..3ccc95635a39f3f5a3f692b615837e8e806d0321 100644 (file)
@@ -1010,7 +1010,7 @@ void BKE_image_all_free_anim_ibufs(int cfra)
        Image *ima;
 
        for (ima = G.main->image.first; ima; ima = ima->id.next)
-               if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
+               if (BKE_image_is_animated(ima))
                        BKE_image_free_anim_ibufs(ima, cfra);
 }
 
@@ -2254,7 +2254,7 @@ static void image_tag_frame_recalc(Image *ima, ImageUser *iuser, void *customdat
 {
        Image *changed_image = customdata;
 
-       if (ima == changed_image && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+       if (ima == changed_image && BKE_image_is_animated(ima)) {
                iuser->flag |= IMA_NEED_FRAME_RECALC;
        }
 }
@@ -3552,6 +3552,16 @@ int BKE_image_sequence_guess_offset(Image *image)
        return atoi(num);
 }
 
+/**
+ * Checks the image buffer changes (not keyframed values)
+ *
+ * to see if we need to call #BKE_image_user_check_frame_calc
+ */
+bool BKE_image_is_animated(Image *image)
+{
+       return ELEM(image->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE);
+}
+
 bool BKE_image_is_dirty(Image *image)
 {
        bool is_dirty = false;