When using the same images in multiple different materials, I always end up with several versions of the same images. For example making multiple variations a brick texture. But then I end up with several duplicate images ie.- Brick_rough_.001, Brick_Rough.002 etc
I think it is from appending models?
I know I can remap the images in the Outliner - Blender File- images. But I only know how to manually remap each duplicate. It takes a long time and is tedious.
How can I get rid of all the duplicates?
Should I get rid of all the duplicates?
Why are there Duplicates?
Yes appending is one reason. Blender doesn’t check if this are the same contrary to just copied image from the “internal” scene (which you can make single user)… and remap: you can remap all duplicate to one (the others are ophaned images after this) and that of course for ever different object…
Basically, when you append models/materials/other data from one file into your current file and they have the same name, Blender doesn’t know whether they are the same material/node/image/whatever, or whether they just have the same name, and it doesn’t try to guess. It just appends a number to keep everything safe.
Unfortunately, this results in a lot of redundant junk data sometimes, and increases your file size. Manually unifying the materials can be time consuming. Luckily it can be fixed with Python! You don’t need to know python, just copy and paste this script in the script editor (see below).
Materials.Named.Like.This are safe Materials.Named.Like.This.001 or This.001 will be replaced.
This script only checks the materials, not the images. Haven’t figured out how to grab an image node with python yet. It’ll greatly cut down on the number of images.001 though since the textures probably aren’t often reusued in different materials.
#--- Eliminate Material Duplicates
print("\nEliminate Material Duplicates:")
#--- Search for mat. slots in all objects
mats = bpy.data.materials
for obj in bpy.data.objects:
for slot in obj.material_slots:
# Get the material name as 3-tuple (base, separator, extension)
(base, sep, ext) = slot.name.rpartition('.')
# Replace the numbered duplicate with the original if found
if base in mats:
print(" For object '%s' replace '%s' with '%s'" % (obj.name, slot.name, base))
slot.material = mats.get(base)
Open a script tab, paste this, and run it. Code sourced from here.
Be warned: if you have any materials that end in a number, and are supposed to be kept, they’ll be replaced if a nonnumeric material with the same base name exists.
Thank you for your response but as the title of this thread states, I am using the same images for multiple materials. I am getting multiple versions of the same images, not multiple versions of the same material.
I already was aware of the material cleaner.
I need a way to quickly remap image.001, image.002, image.003 to the original image.