mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix T78537: too much memory usage rendering animation with persistent images
For still images, always return 0 for the current frame number. This ensures Cycles can detects that the image did not change. Based on patch by Vincent Blankfield. Differential Revision: https://developer.blender.org/D8242
This commit is contained in:
parent
f47f9a04b1
commit
a71490c4b2
1 changed files with 17 additions and 9 deletions
|
|
@ -5180,24 +5180,32 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, bool *r_is_in_ran
|
|||
void BKE_image_user_frame_calc(Image *ima, ImageUser *iuser, int cfra)
|
||||
{
|
||||
if (iuser) {
|
||||
bool is_in_range;
|
||||
const int framenr = BKE_image_user_frame_get(iuser, cfra, &is_in_range);
|
||||
if (ima && BKE_image_is_animated(ima)) {
|
||||
/* Compute current frame for animated image. */
|
||||
bool is_in_range;
|
||||
const int framenr = BKE_image_user_frame_get(iuser, cfra, &is_in_range);
|
||||
|
||||
if (is_in_range) {
|
||||
iuser->flag |= IMA_USER_FRAME_IN_RANGE;
|
||||
if (is_in_range) {
|
||||
iuser->flag |= IMA_USER_FRAME_IN_RANGE;
|
||||
}
|
||||
else {
|
||||
iuser->flag &= ~IMA_USER_FRAME_IN_RANGE;
|
||||
}
|
||||
|
||||
iuser->framenr = framenr;
|
||||
}
|
||||
else {
|
||||
iuser->flag &= ~IMA_USER_FRAME_IN_RANGE;
|
||||
/* Set fixed frame number for still image. */
|
||||
iuser->framenr = 0;
|
||||
iuser->flag |= IMA_USER_FRAME_IN_RANGE;
|
||||
}
|
||||
|
||||
iuser->framenr = framenr;
|
||||
|
||||
if (ima && BKE_image_is_animated(ima) && ima->gpuframenr != framenr) {
|
||||
if (ima && ima->gpuframenr != iuser->framenr) {
|
||||
/* Note: a single texture and refresh doesn't really work when
|
||||
* multiple image users may use different frames, this is to
|
||||
* be improved with perhaps a GPU texture cache. */
|
||||
ima->gpuflag |= IMA_GPU_REFRESH;
|
||||
ima->gpuframenr = framenr;
|
||||
ima->gpuframenr = iuser->framenr;
|
||||
}
|
||||
|
||||
if (iuser->ok == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue