Hi,
excuse me if there is still such a script here around, but I didn’t found one in a short. I had the problem that the path to my document folder changed when I migrated to a new operating system this year. I store all the textures for a project into this project folder, but when the path changed for the reason I mentioned above, I had to reload every image manually. But this could be really annoying if there are a lot of them. So I decided to write a script which is able to change parts of the path’s automatically for all images. So if you have the same problem, you can use the script by copy it to the text editor window, changing the two variables ‘oldpath’ and ‘newpath’ the way I explain it below and run the script.
import Blender
from Blender import Texture,Image,Material
# insert the path which should be replaced
oldpath = "C:/Dokumente und Einstellungen/31/Eigene Dateien"
# insert the new path which replaces the old one
newpath = "C:/Users/31/sub"
image_count = 0
for tex in Blender.Texture.Get():
image = tex.getImage()
#print image.name
filename = ""
if (tex.getType() == "Image"):
if (len(image.getFilename()) > 0):
i=0
while i < len(image.getFilename()) :
if image.getFilename()[i:i+1] == "\\" :
filename += "/"
else :
filename += image.getFilename()[i:i+1]
i+=1
if (oldpath == filename[0:len(oldpath)]):
temp = filename[len(oldpath):len(filename)]
temp = newpath + temp
image.filename = temp
image.reload()
image_count += 1
print "image path's changed:"
print image_count
So here it goes:
For example your old directory structure looked like this:
c:\folder
ame\blender\project1 extures\bump.png
But the new path your ‘bump.png’ and all other textures are inside is:
c:\users est\blender\project1 extures\bump.png
Then you should give the variables the following values:
# insert the path which should be replaced
oldpath = "c:/folder/name"
# insert the new path which replaces the old one
newpath = "c:/users/test"
Now click ‘Text’ in the menu and ‘Run Python Script’. Another thing is that you have to use ‘/’ instead of ‘’ to seperate directories.
Hope that could be helpful…
cheers