Unable to Pack Textures

Grr… I typed a whole bunch of explanation of my problem here, only for it to wiped due to a “Your submission could not be processed because a security token was invalid” error. To cut a long story short;

I cannot pack textures, because Blender thinks they are in a mystery folder (below) that doesn’t exist. I have around 100 of these textures with this problem.

The directory doesn’t exist, yet it renders the project fine in preview, meaning it knows where the original source textuers are, and is using them, but won’t allow me to pack the files because of the "unable to pack source file, C:\Users\blahblahblah…\ does not exist. It is correct, it doesn’t not exist, so why is it looking there for textures to pack?

I hope this makes sense and apologise if I’m coming across sounding fairly frustrated. Any help gratefully appreciated!

Looking at the data-blocks, which are there textures with .001 etc… extensions, duplicated textures etc…?

Is this a clue to the mystery or am I looking in the wrong place? It tells me these textures are being using by objects…though, they can’t be, can they? P.s. I’m now no longer frustrated - merely interested :slight_smile:

I’m not being able to replicate the same problem here…

have you tried to change the filepath of the images?
if you have many maybe using the console?

Thanks for the reply! Could you walk me through how I would use the console?

I’m currently testing the objects/materials in a new file to get my head around it.

Also, when I’m appending an asset, for example, a tree from a file which has packed textures. Where does it reference the texture from the new file? In this example, it’s referencing the file path of the creator’s computer! Is this standard?

First try the path tools for external data. Maybe they can fix it. Go into ‘File >> External Data’, then try find missing, and after, make absolute.

Tried that, I’m afraid. Quick summary:

  • The file is looking to save/pack 253 textures. I only have half that AT MOST, the rest of the textures are duplicates, linked to objects, with a mystery image file path, which does not exist.

  • I can render my file (low resolution) and all textures are included, but I need it rendered at a render-farm. When trying to pack the files it gives the error that the extra 150 or so duplicate textures “cannot be found”.

  • When the render farm renders the file, textures are not pack that clearly DO have a valid image file path. It is very confusing.

See below (the images are there, the .blend can render them, however, they won’t pack due to the file looking in the mystery .....\ folder?

…\ its a back folder.
if my blend is in ‘x:\home\user\files\objects\file.blend’ and an image is in ‘x:\home\user\files\images\file.jpg’, the image is in ‘…\images\file.jpg’ as seen from the blend file.

have you moved the blend file from one folder to another??

No, I’ve not moved the file since I created it :slight_smile:

I think that you must do a complete cleanup of your blend, replacing all the textures, removing unused textures…
in the console you can speed up things a bit with Python…
for example you can:

for img in D.images:
        '''change path of all images from 'C:\\users\\blablabla\\image.jpg' to 'D:\\MyNewFolder\\blablabla\\image.jpg' and pack the image
        pathI = img.filepath
        img.filepath = pathI.replace('C:\\Users\\', 'D:\\MyNewFolder\\')

Thanks so much - I had the same idea (cleaning up the file). I’ll let you know if it works.

P.s. Will that script allow me to re-direct every image.file.path in bulk?

it does for all the images in the Data. D=bpy.data and it’s predefined in the console.

Sorry mate, can you explain it like I’m 5? If you could run me through the steps to get that script to work, it may help other noobs who struggle with the console side of things.

ok… first. as you saw in the Datablocks, all the images are in one Datablock called ‘images’.
The real path of this Datablock is ‘bpy.data.images’ , and in the console we can simply write ‘D.images’ and this will return a collection of BlendDataImages, which you can look and change.

For example the first image is ‘D.images[0]’, the second ‘D.images[1]’ , etc. Each image has lots of information inside (even all the pixels color are there and can be changed if you want!), but for now let’s just look at the filepath property.
(if you want to check what each element has inside, you can allways write ‘D.images[0].’ and press CTRL+Space to see the list)

Image[0] has its filepath stored in ‘D.images[0].filepath’ and we can change it if we want to anything else.

so the script is just, in english:
For each image, that we will call ‘img’, in the collection D.images: (for img in D.images:)
because it’s a loop, the >>> will change to … and you can now say what to do for each image.

store the filepath of this image in a string variable, named ‘PathI’ (PathI=img.filepath)

now there’s a function inside every string variable that let us replace text inside the string, it works as string.replace(‘text to look for’, ‘text to replace’)
so if the initial string is ‘c:\oldfolder\filename.jpg’ and we want to set the path to ‘c:
ewfolder\filename.jpg’ , then we must write string.replace(‘c:\oldfolder\’, ‘c:
and we set the image.filepath to the result of the replace function ( img.filepath=PathI.replace(‘oldpath’, ‘newpath’) )

Images have also the function ‘pack()’ that as the name says, it packs the image. ( img.pack() )

of course if some images are in different folders, the ‘oldfolder’ string will not be found by the replace function. but you can change them manually.

In the end press enter twice to exit the ‘For’ loop, and it will execute automatically.

any doubts, you can allways check in the blender web site for the python api, or the python web site for more python specific functions. And of course the Python support here in BA :slight_smile: