I have hundreds of Blender files laying around with hundreds of materials. I want to make a collage of all of them.

I can append the materials to a new file but then its allot of work to assign different materials to each object, lets say the object is a sphere.

It would be cool if Blender could automatically generate an object for each material.

Is there a way to automate this?

Since I am not experienced with coding, if coding is required, please explain how it is done.


2 Answers 2


You will need Python to automate this. If you are likely to be automating many things, I suggest the tutorial series "Scripting for Artists" from the Blender Foundation. You can find it on the Blender Studio web site, or on YouTube.

Here is a very simple example of how to automate your request, using spheres.

import bpy

sphere_x = 0.0
sphere_y = 0.0
sphere_z = 0.0

for material in bpy.data.materials:
    bpy.ops.mesh.primitive_uv_sphere_add(location = (sphere_x, sphere_y, sphere_z))
    object = bpy.data.objects[-1]
    object.name = material.name
    sphere_x += 3.0
    sphere_z += 3.0

Blender keeps track of all the materials in your file in bpy.data.materials. This code loops through that list. For each material it finds, it calls a function to create a sphere at a certain location. (bpy.ops.mesh.primitive_uv_sphere_add(location = (sphere_x, sphere_y, sphere_z)))

Then it finds the object it created. Creating the object adds it to the end of a list. The python way to find the last thing in a list is to use -1 as an index. (object = bpy.data.objects[-1])

Next it changes the name of the object to the name of the material, so you can see what materials go where in the outliner. (object.name = material.name)

Then it assigns the material to the object. (`object.data.materials.append(material))

Finally it calculates a location to put the next sphere. This probably not the calculation you want, so you'll probably want to change it. This simply puts the spheres on a diagonal line starting at the origin:

Result of running the script with four materials available

You'll at least need to learn enough Python to figure out how to position the spheres in 3D space. You could also learn about mesh operators. There's an add operator for every existing mesh type, so you could use monkeys instead of spheres.

To run this script, open the Scripting workspace, click 'new' in the text editor, paste the script into the text window and type AltP to run the script.

  • $\begingroup$ I'll give it a shot. Thanks a lot, that looks great. Much appreciated. $\endgroup$ May 6, 2022 at 7:42
  • $\begingroup$ Man, it works beautifully! Thank you so much! $\endgroup$ May 7, 2022 at 11:45
  • $\begingroup$ @MishaKerch you're welcome. $\endgroup$ May 7, 2022 at 13:35
  • $\begingroup$ I have another question, if its ok. What do I need to add to the code if I want to run the script but make blender COPY specific object from a collction and apply the materials to it? $\endgroup$ May 7, 2022 at 14:15
  • $\begingroup$ It's OK, but that's enough different that StackExchange would want you to ask another question. You can point to this question in your new question so you don't have to repeat everything. Think about how you want to specify the object to copy when you write your question. $\endgroup$ May 7, 2022 at 14:45

You can mark materials as asset

enter image description here

And get thumbnails:

enter image description here

Also, you will get a material library for free if you will have everything properly set up.

More automated way requires Python I guess.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .