Unpack resources overwrites identically named images

Hi guys,

I try to unpack my blend file with many assets. Some of the different textures have similar names, like ‘tex_u1_v1_diffuse.jpg.001’, ‘tex_u1_v1_diffuse.jpg.002’ etc… Now, unfortunately when I got to file → external data → unpack resources, it overwrites the textures with these identical names. Is there any way to easily overcome this problem? As I have many textures I would prefer not to manually rename all the textures. Hope to hear your advice!

Cheers, Jelle

Aren’t the ...jpg.001 and ...jpg.002 just the names of the images and the filenames should just end on .jpg ?? Or are those image names just all referening to the same image.jpg ??

Don’t use unpack override. Instead, use one of the options using the write type: Create when necessary.

image

Thanks! Thats a good idea, I picked the 2nd option. I will definitely try that!

I tried it, unfortunately it does the exact same thing.

I learned that there are two names. One that is only recognized by blender and then the ‘real name’ that is identical for all the different files and which is the reason they overwrite themselves. Changing this name fixes the problem. Stil super annoying to do this and think about, especially with many assets.

By look at data API you can see the two name slots:

Again: does the texture with name tex_u1_v1_normal.jpg.002 have the same filename tex_u1_v1_normal.jpg as the previous texture with name tex_u1_v1_normal.jpg.001 and with name tex_u1_v1_normal.jpg ?? Then they all reference the same image.The need to separate this images not only to different names but alos to different instances/user usually also leads to the need to change the filename…

Sorry, no they do not reference the same image. There are different objects with different materials and images assigned, which are all unique. It is just that all of them share the same name (under ‘file name’ in the API menu), causing them to overwrite.

?? if they are different images with different filenames how can they overwrite ???

Hopefully this clarifies…

That’s what i meant: if you have different image with differrent Names but they have all the same Filename then they of course write all to the same File… In your workflow you soemwhere copied the image nodes (?) and the names where automatically changed to blabla.jpg.001 etc. but somewhere down the road you alsomade them single user… but then you have to change the filename
The Computer is just doing what you asked hin for: saving different images under the same name.

yeah, you have to change the name of the bottom file name, I think we are on the same page here.

I found a way around this (for blend files with many objects). In another thread someone shared this little snippet of code, which automatically will replace the bottom ‘file name’ with the ‘name’, automating the process.

snippet:

for image in D.images:
fp = f"//textures\{image.name}"
image.filepath = fp
for pf in image.packed_files:
pf.filepath = fp