There's a function to update and get the image data, image_update_for_frame or um something like this. The backjground image code does this.
Joe On Wed, Feb 10, 2010 at 12:12 PM, Benoit Bolsee <benoit.bol...@online.be> wrote: > Hi, > > Recently, based on my status of the VideoTexture module mantainer, I've > been asked whether video textures could be displayed dynamically in the > 3D view (based on frame number). Unfortunately, the BGE and Blender use > a different realtime render engine, so the VideoTexture module is no use > in Blender. > > Nevertheless, I've studied the question and isolated the places in the > code that must be changed to allow dynamic textures in the 3D view. I > thought I would release this information as some Blender dev might want > to implement the changes. > > /benoit > >>>>>> Here is the study: > > I finally had the time to look into that. It is not a simple problem. I > have identified the 2 missing links to get animated texture in the 3D > view but I'm not confident to implement them. The affected code is part > of the Blender UI render engine that I'm not familiar with. > > I can give pointers to the code. Note that the following explanations > are applicable to Blender 2.5. > > The function that is not doing the right thing is GPU_verify_image() in > source/blender/gpu/gpu_draw.c This function is called whenever a > textured face must be rendered in the 3D view. It calls the > BKE_image_get_ibuf() function (line 447) to get the image buffer. Note > that it uses a Image object, which is the central place in Blender where > images are stored, including images from movies. It passes NULL as > second argument, which means that the last loaded image from the movie > will be returned. > > This is not a problem if the image corresponding to the current frame > was loaded before this function is called. Unfortunately, there is no > proper mechanism in Blender to ensure that. I found that displaying the > Texture in the Button panel partially works: the frame number is updated > whenever you modify something on that panel. This could be fixed by > proper notifier/event but has the inconvenient that you have to keep the > texture panel opened. A better way would be scan all Images (there is a > global link of such objects) and update those pointing to movies > whenever the frame number is changed. I don't think that is particularly > difficult to do. > > The second problem is at line 446: if the image was already bound to a > GPU texture, it simply rebinds and the image is not reloaded. The > proper load code is below at line 553. The idea would be to keep at > Image level the number of the frame that was last loaded on the GPU and > if it differs from the frame returned by BKE_image_get_ibuf, reload the > image. Again I don't think this is complicated to do. > > <<<<<< > > _______________________________________________ > Bf-committers mailing list > Bf-committers@blender.org > http://lists.blender.org/mailman/listinfo/bf-committers > _______________________________________________ Bf-committers mailing list Bf-committers@blender.org http://lists.blender.org/mailman/listinfo/bf-committers