/* Guess offset for the first frame in the sequence */
int BKE_image_sequence_guess_offset(struct Image *image);
+bool BKE_image_is_animated(struct Image *image);
bool BKE_image_is_dirty(struct Image *image);
void BKE_image_file_format_set(struct Image *image, int ftype);
bool BKE_image_has_loaded_ibuf(struct Image *image);
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);
}
{
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;
}
}
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;
ima->packedfile = newPackedFile(reports, ima->name, ID_BLEND_PATH(bmain, &ima->id));
tot ++;
}
- else if (ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
+ else if (BKE_image_is_animated(ima)) {
BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported",
ima->id.name + 2);
}
/* ------------------------------------------------------------------------- */
bool BKE_texture_dependsOnTime(const struct Tex *texture)
{
- if (texture->ima &&
- ELEM(texture->ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
- {
+ if (texture->ima && BKE_image_is_animated(texture->ima)) {
return 1;
}
else if (texture->adt) {
col = uiLayoutColumn(split, FALSE);
/* XXX Why only display fields_per_frame only for video image types?
* And why allow fields for non-video image types at all??? */
- if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ if (BKE_image_is_animated(ima)) {
uiLayout *subsplit = uiLayoutSplit(col, 0.0f, FALSE);
uiLayout *subcol = uiLayoutColumn(subsplit, FALSE);
uiItemR(subcol, &imaptr, "use_fields", 0, NULL, ICON_NONE);
}
}
- if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ if (BKE_image_is_animated(ima)) {
uiItemS(layout);
split = uiLayoutSplit(layout, 0.0f, FALSE);
if (G.main)
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))
GPU_free_image(ima);
}
if (!image->packedfile) {
BKE_report(reports, RPT_ERROR, "Image not packed");
}
- else if (image->source == IMA_SRC_SEQUENCE || image->source == IMA_SRC_MOVIE) {
+ else if (BKE_image_is_animated(image)) {
BKE_report(reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
return;
}
if (!tex)
return;
- if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE))
+ if (tex->ima && BKE_image_is_animated(tex->ima)) {
BKE_image_user_frame_calc(&tex->iuser, scene->r.cfra, 0);
+ }
}
void get_texture_coords(MappingInfoModifierData *dmd, Object *ob,
/* otherwise always tag these node types */
if (node->type == CMP_NODE_IMAGE) {
Image *ima = (Image *)node->id;
- if (ima && ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ if (ima && BKE_image_is_animated(ima)) {
nodeUpdate(ntree, node);
tagged = 1;
}
static void init_render_texture(Render *re, Tex *tex)
{
/* imap test */
- if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ if (tex->ima && BKE_image_is_animated(tex->ima)) {
BKE_image_user_frame_calc(&tex->iuser, re ? re->r.cfra : 0, re ? re->flag & R_SEC_FIELD:0);
}
}
/* update image sequences and movies */
- if (tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
+ if (tex->ima && BKE_image_is_animated(tex->ima)) {
BKE_image_user_check_frame_calc(&tex->iuser, (int)scene->r.cfra, 0);
}
}