5
$\begingroup$

I'd like to set which UV map is selected in Properties > Object Data > UV Maps. By "selected", I'm referring to the one highlighted, not the one with the camera icon enabled.

I tried

bpy.context.object.data.uv_layers.active = bpy.context.object.data.uv_layers['AO']

But uv_layers.active remained at the previous value and there was no error message.

How can I set the active UV map from python?

$\endgroup$
1
  • $\begingroup$ This technique also comes in handy when you are trying to prepare a mesh for texture baking, since the active UV layer seems to be important to the baking process. $\endgroup$
    – Mutant Bob
    Aug 22, 2017 at 3:10

1 Answer 1

7
$\begingroup$

blender 2.93:

bpy.context.object.data.uv_layers['AO'].active = True 
$\endgroup$

You must log in to answer this question.

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