Page MenuHome
Paste P888

T57457 snippet
ActivePublic

Authored by Philipp Oeser (lichtwerk) on Jan 9 2019, 3:21 PM.
diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c
index 6584b6953d5..615adeb61f1 100644
--- a/source/blender/draw/intern/draw_manager_data.c
+++ b/source/blender/draw/intern/draw_manager_data.c
@@ -40,6 +40,8 @@
#include "BLI_link_utils.h"
#include "BLI_mempool.h"
+#include "DEG_depsgraph_query.h"
+
#include "intern/gpu_codegen.h"
struct GPUVertFormat *g_pos_format = NULL;
@@ -802,7 +804,7 @@ static DRWShadingGroup *drw_shgroup_material_inputs(DRWShadingGroup *grp, struct
GPUTexture *tex = NULL;
if (input->ima) {
- double time = 0.0; /* TODO make time variable */
+ double time = DEG_get_ctime(DST.draw_ctx.depsgraph);
tex = GPU_texture_from_blender(input->ima, input->iuser, GL_TEXTURE_2D, input->image_isdata, time);
}
else {
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 6f939261729..a6fd71585e6 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -285,7 +285,7 @@ GPUTexture *GPU_texture_from_blender(
ImageUser *iuser,
int textarget,
bool is_data,
- double UNUSED(time))
+ double time)
{
if (ima == NULL) {
return NULL;
@@ -293,9 +293,11 @@ GPUTexture *GPU_texture_from_blender(
/* Test if we already have a texture. */
GPUTexture **tex = gpu_get_image_gputexture(ima, textarget);
+ /*
if (*tex) {
return *tex;
}
+ */
/* Check if we have a valid image. If not, we return a dummy
* texture with zero bindcode so we don't keep trying. */
@@ -312,6 +314,7 @@ GPUTexture *GPU_texture_from_blender(
}
/* check if we have a valid image buffer */
+ BKE_image_user_frame_calc(iuser, (int)time);
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, NULL);
if (ibuf == NULL) {
*tex = GPU_texture_from_bindcode(textarget, bindcode);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.c b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
index 524f7a5c8e2..c13a1064794 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.c
@@ -75,8 +75,8 @@ static int node_shader_gpu_tex_image(GPUMaterial *mat, bNode *node, bNodeExecDat
};
Image *ima = (Image *)node->id;
- ImageUser *iuser = NULL;
NodeTexImage *tex = node->storage;
+ ImageUser *iuser = &tex->iuser;
const char *gpu_node_name = (tex->projection == SHD_PROJ_BOX)
? names_box[tex->interpolation]
: names[tex->interpolation];