Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/image.c
| Show First 20 Lines • Show All 5,207 Lines • ▼ Show 20 Lines | else { | ||||
| return framenr; | return framenr; | ||||
| } | } | ||||
| } | } | ||||
| void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra) | void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra) | ||||
| { | { | ||||
| if (iuser) { | if (iuser) { | ||||
| if (ima && BKE_image_is_animated(ima)) { | |||||
| /* Compute current frame for animated image. */ | |||||
| bool is_in_range; | bool is_in_range; | ||||
| const int framenr = BKE_image_user_frame_get(iuser, cfra, &is_in_range); | const int framenr = BKE_image_user_frame_get(iuser, cfra, &is_in_range); | ||||
| if (is_in_range) { | if (is_in_range) { | ||||
| iuser->flag |= IMA_USER_FRAME_IN_RANGE; | iuser->flag |= IMA_USER_FRAME_IN_RANGE; | ||||
| } | } | ||||
| else { | else { | ||||
| iuser->flag &= ~IMA_USER_FRAME_IN_RANGE; | iuser->flag &= ~IMA_USER_FRAME_IN_RANGE; | ||||
| } | } | ||||
| iuser->framenr = framenr; | iuser->framenr = framenr; | ||||
| } | |||||
| else { | |||||
| /* Set fixed frame number for still image. */ | |||||
| iuser->framenr = 0; | |||||
| iuser->flag |= IMA_USER_FRAME_IN_RANGE; | |||||
| } | |||||
| if (ima && BKE_image_is_animated(ima) && ima->gpuframenr != framenr) { | if (ima->gpuframenr != iuser->framenr) { | ||||
| /* Note: a single texture and refresh doesn't really work when | /* Note: a single texture and refresh doesn't really work when | ||||
| * multiple image users may use different frames, this is to | * multiple image users may use different frames, this is to | ||||
| * be improved with perhaps a GPU texture cache. */ | * be improved with perhaps a GPU texture cache. */ | ||||
| ima->gpuflag |= IMA_GPU_REFRESH; | ima->gpuflag |= IMA_GPU_REFRESH; | ||||
| ima->gpuframenr = framenr; | ima->gpuframenr = iuser->framenr; | ||||
| } | } | ||||
| if (iuser->ok == 0) { | if (iuser->ok == 0) { | ||||
| iuser->ok = 1; | iuser->ok = 1; | ||||
| } | } | ||||
| if (ima) { | if (ima) { | ||||
| LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) { | LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) { | ||||
| ▲ Show 20 Lines • Show All 612 Lines • Show Last 20 Lines | |||||