Is it possible to add a texture or material to more than one object at a time?
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
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"]
# 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
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.