I am thinking of writing a script wich allows to one to let the UV/Image Editor reload an image automatically per 5 secs or something…
I have some expierience in programming with Python, but not really with writing scripts for Blender. So is it possible to write such a script?
If it is: what is the code for just reloading an Image in the UV/Image Editor, where can I find this?
I added the reload function a while back for this purpose
and used it to pipe screencaptures of the gimp into blender - got about 5/10 fps.
This should work!- make it a redraw scriptlink.,
Hint! For fast updating disable mipmaps in the preferences.
It means that for every reload, blender dosent have to re-generage a multi-resolution set of images.
import Blender
import os
img= Blender.Image.GetCurrent() # currently displayed picture.
path= Blender.sys.expandpath(img.filename)
if Blender.sys.exists(path):
t= os.path.getctime(path)
if t != Blender.my_image_time:
img.reload()
Blender.my_image_time= t # global, persists between running the scripts.
Guess its just my stupid fualt, but when I run this script an error occurs
Console:
This is what I did:
-I copied your script in the Text window;
-I loaded an image in the UV/Image Editor + I made a cube in the 3D window and textured the texture from the Image Editor on the cube;
-I made a scriptlink and turned it on Redraw;
-I pressed ALT+P in the text window.
Thanks for your reply again,
This is how my code looks like:
import Blender
try:
Blender.my_image_time
except:
Blender.my_image_time=0
import os
img= Blender.Image.GetCurrent() # currently displayed picture.
path= Blender.sys.expandpath(img.filename)
if Blender.sys.exists(path):
t= os.path.getctime(path)
if t != Blender.my_image_time:
img.reload()
Blender.my_image_time= t # global, persists between running the scripts.
But when I edit the texture in Gimp (after I pressed ALT+P ofcourse), and save it, blender doesn’t reload the texture I just edited (thats what I want to do with the reload script…).
but it still isnt workling for me , what am I doing wrongh?
I just copied the script in Blenders text editor
I loaded an image in the UV/Image Editor + I made a cube in the 3D window and textured the texture from the Image Editor on the cube;
I made a scriptlink and turned it on Redraw;
I pressed ALT+P in the text window. After that I made some changes to the image texture, I saved it…but no changes to the texture in Blender…