# Switching beetween UV sets across multiple objects

I have multiple objects on scene with 2 UV sets, first default and second for one shared lightmap. Now if i select all the objects (they have the same names for UVs) and try to switch between UV sets only active one will change. This forces me to tidiously selecting models one by one and changing UV sets for further edition in multi edit mode. Is there any way to switch between all object's UVs at once?

Not sure if this helps...

If it's a case of switching maps, (as opposed to images) The UV Map shader input node looks up by name. The Cube and sphere in the illustrations share a map: 'Shared UV', and each has a map: 'UV Map' of its own.

They share the material, so the switch can be made in the UV Map node.

• Well this is kinda walkaround, it will give me the view but still have to switch to second channel for editing lightmaps in object editor, Thx anyway. – JZK Sep 9 '19 at 9:21
• @JZK OK, got you. You want to change the active UV on multiple objects simultaneously. – Robin Betts Sep 9 '19 at 9:46

You could make a "Mix Vector" node and drive the Fac by a common property...

Toggle UV script

Going by question remit, ie objects having two UV maps, here is a script to toggle between them on selected objects.

Note script for 2.8 see How to change UVMap index? for prior.

import bpy

context = bpy.context

for o in context.selected_objects:
if o.type != 'MESH':
continue # only meshes?
uv = o.data.uv_layers
ai = uv.active_index
uv.active_index = 0 if ai else 1
uv.active.active_render = True


or set absolutely, script below sets all active UV maps to that of index 0.

import bpy

context = bpy.context

for o in context.selected_objects:
if o.type != 'MESH':
continue # only meshes?
uv = o.data.uv_layers
ai = uv.active_index
uv.active_index = 0
uv.active.active_render = True