0
$\begingroup$

I was looking through the blender 2.8 bees but I can't find anything, I've seen on some forums using the bmesh module, but I'm not sure it's the right way.

I could use the operator but I already know that on large scenes inserting the ops in a "for" loop would become very slow.

bpy.ops.mesh.uv_texture_add()

$\endgroup$
  • $\begingroup$ You just want to add a UV map, not generating it in a particular way? $\endgroup$ – lemon Aug 28 at 6:18
  • $\begingroup$ This is a good question, I noticed that by default it spreads the map on every single polygon, I would like to understand how to do this, it would also be good to understand how to simulate a "Smart uv" I didn't find much about it $\endgroup$ – Pastrokkio Aug 28 at 11:50
  • 1
    $\begingroup$ I don't think smart uv corresponds to API which is not bpy.ops (to verify). But just for texture_add, you can obj.data.uv_layers.new(name="UvMap") $\endgroup$ – lemon Aug 28 at 11:57
  • $\begingroup$ @lemon This is exactly what I was looking for, you should enter it as an answer, thank you very much $\endgroup$ – Pastrokkio Aug 28 at 13:21
1
$\begingroup$

An alternative to 'bpy.ops.mesh.uv_texture_add()' can be using 'obj.data.uv_layers.new(name="UvMap")' so that you don't need to be in an operator context.

Though, it will not allow complex unwrapping such as smart uv project.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.