I want to be able to use Smart UV project on thousands of separate objects in a scene at once. I'm wanting the result to be as if I'd applied the Smart UV project to each individual object one at a time. Using A to select all and SPACE then Smart UV Project just seems to create a problem in sense that when I import even a single object into Unreal Engine it behaves like it has an enormous footprint bigger than my terrain map, even though the object itself does not and is small. Any advice or suggestions would be most welcome.
Scripting with Python
As you mentioned, Smart Unwrap in object mode takes all the objects as a whole. It's more useful to create a texture atlas, rather than individual UV maps.
Like in most scenarios where a tedius task must be done several times, you can try to automate the process with python code. You can write a script that iterates through all the selected object of the scene, enter edit mode for each object, select all the elements of the object an run the smart_project() function.
Here's what a possible script could look like:
import bpy if bpy.context.selected_objects != : for obj in bpy.context.selected_objects: #loop through all the selected objects if obj.type == 'MESH': bpy.context.scene.objects.active = obj bpy.ops.object.editmode_toggle() #entering edit mode bpy.ops.mesh.select_all(action='SELECT') #select all objects elements bpy.ops.uv.smart_project() #the actual unwrapping operation bpy.ops.object.editmode_toggle() #exiting edit mode
I took the origin code by Carlo and have created an small AddOn that can be installed in Blender.
This is my very first Blender Add-On and I'm not a good coder... So it’s nothing special, but helped me a lot.
What it does:
- It executes the Smart UV project function to all selected mesh objects in the scene.
- Correct Aspect ratio is always ON, Stretch to UV Bounds is always OFF.
- After the regular installation in the preferences you can activate the Add-On by pressing the spacebar and type „Smart“ in. Then „Smart UV project selected objects“ appear and you can execute it.
The quick script helped me a lot here. I hope it's something for you too.
Here is the link for the download: