diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-04 14:41:18 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2012-06-04 14:41:18 +0400 |
commit | 617027fdf33f2406ef7ea32ee6121825e3e18a5d (patch) | |
tree | 1cfaf463669a6b21e5012b6a8e1b9031865cd94d /source/blender/editors/space_image | |
parent | 1511bd8eb47fdbd37af065ee4d06d499fa8a68b6 (diff) |
Fix #31352: Image sequence texture - can't load image after changing image source
Added new flag to Imageuser which indicates whether user frame calculation is needed.
This flag is getting set in BKE_image_signal and handled in actual image usage areas
where both image user and current frame is known.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r-- | source/blender/editors/space_image/image_buttons.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 57 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 3 |
3 files changed, 11 insertions, 51 deletions
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 6e52056ff2b..332a2ecada4 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -637,6 +637,8 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char ima = imaptr.data; iuser = userptr->data; + BKE_image_user_check_frame_calc(iuser, (int)scene->r.cfra, 0); + cb = MEM_callocN(sizeof(RNAUpdateCb), "RNAUpdateCb"); cb->ptr = *ptr; cb->prop = prop; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 2cb36841082..02b95f8e7c8 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2443,56 +2443,15 @@ void IMAGE_OT_cycle_render_slot(wmOperatorType *ot) /* goes over all ImageUsers, and sets frame numbers if auto-refresh is set */ +static void image_update_frame(struct Image *UNUSED(ima), struct ImageUser *iuser, void *customdata) +{ + int cfra = *(int*)customdata; + + BKE_image_user_check_frame_calc(iuser, cfra, 0); +} + void ED_image_update_frame(const Main *mainp, int cfra) { - wmWindowManager *wm; - wmWindow *win; - Tex *tex; - - /* texture users */ - for (tex = mainp->tex.first; tex; tex = tex->id.next) { - if (tex->type == TEX_IMAGE && tex->ima) { - if (ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) { - if (tex->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_frame_calc(&tex->iuser, cfra, 0); - } - } - } - - /* image window, compo node users */ - for (wm = mainp->wm.first; wm; wm = wm->id.next) { /* only 1 wm */ - for (win = wm->windows.first; win; win = win->next) { - ScrArea *sa; - for (sa = win->screen->areabase.first; sa; sa = sa->next) { - if (sa->spacetype == SPACE_VIEW3D) { - View3D *v3d = sa->spacedata.first; - BGpic *bgpic; - for (bgpic = v3d->bgpicbase.first; bgpic; bgpic = bgpic->next) - if (bgpic->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_frame_calc(&bgpic->iuser, cfra, 0); - } - else if (sa->spacetype == SPACE_IMAGE) { - SpaceImage *sima = sa->spacedata.first; - if (sima->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_frame_calc(&sima->iuser, cfra, 0); - } - else if (sa->spacetype == SPACE_NODE) { - SpaceNode *snode = sa->spacedata.first; - if ((snode->treetype == NTREE_COMPOSIT) && (snode->nodetree)) { - bNode *node; - for (node = snode->nodetree->nodes.first; node; node = node->next) { - if (node->id && node->type == CMP_NODE_IMAGE) { - Image *ima = (Image *)node->id; - ImageUser *iuser = node->storage; - if (ELEM(ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) - if (iuser->flag & IMA_ANIM_ALWAYS) - BKE_image_user_frame_calc(iuser, cfra, 0); - } - } - } - } - } - } - } + BKE_image_walk_all_users(mainp, &cfra, image_update_frame); } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index a8d83500cc1..a2a16fd84a8 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -590,8 +590,7 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa)) ima = ED_space_image(sima); - if (sima->iuser.flag & IMA_ANIM_ALWAYS) - BKE_image_user_frame_calc(&sima->iuser, scene->r.cfra, 0); + BKE_image_user_check_frame_calc(&sima->iuser, scene->r.cfra, 0); /* check if we have to set the image from the editmesh */ if (ima && (ima->source == IMA_SRC_VIEWER || sima->pin)) ; |