Is it possible to add a texture or material to more than one object at a time?
-
$\begingroup$ Like all objects have the same material? The materials must be apply one time for each mesh. You cannot select multiple objects and apply one material to all of them like expected in other graphic software. $\endgroup$– andrepazlealJul 21, 2015 at 18:34
-
2$\begingroup$ Add a material to one object. Then select all of the object (making sure the one with the material is the "active" object), hit CTRL-L and select "link materials" $\endgroup$– ajwoodJul 21, 2015 at 18:38
-
$\begingroup$ @ajwood this could be an answer :-) $\endgroup$– BithurJul 21, 2015 at 20:33
-
$\begingroup$ similar question $\endgroup$– DavidJul 21, 2015 at 23:24
-
$\begingroup$ Could you provide some more info about your current setup? E.g. What render engine you are using? $\endgroup$– gandalf3 ♦Jul 22, 2015 at 6:49
4 Answers
It's possible link the materials on a selection of objects to a single "active" object.
Add an material to an object:
Select all of the objects you want the material on, then select the object from step 1 (it's important that you select that object last; it needs to be the active object). Hit CTRL+L and select
Materials
This is an easy way to copy a material to many objects.
First the object with the material should be the active object while all the other objects you want to copy the material to are selected. Then press the "Copy Material to Others" button in the material tab of the property window.
For 2.8+ you can go to the 3D View header menu Object > Make Links > Materials
You can also access it from the material slots dropdown Copy to Selected option
Materials are always copied from the active object to the others selected. Shift clicking on an already selected object makes it the active one.
Also you can select all those objects you want to assign material to and execute the code:
#assuming there's image loaded in Blender and called 'sky_1'. It's the one you'd like to assign
img = bpy.data.images['sky_1.jpg']
imageTexture = bpy.data.textures.new('Image_Texture', type = 'IMAGE')
imageTexture.image = img
#check presence of material with the same name
if bpy.data.materials.get("textureMaterial") is not None:
materialToApply = bpy.data.materials["textureMaterial"]
else:
# create material
materialToApply = bpy.data.materials.new('textureMaterial')
materialTexture = materialToApply.texture_slots.add()
materialTexture.texture = imageTexture
materialTexture.texture_coords = 'UV'
materialTexture.mapping = 'FLAT'
#loop through selected objects and assign the material
for x in bpy.context.selected_objects:
me = x.data
me.materials.append(materialToApply)
The small advantage of this (at least for me, I always check twice which one is active if transfering materials) is that it doesn't really matter the objects' selection order in this case.