Hi everyone,
I’m a complete noob in coding so I’d need your help with a little script that I would like to write.
I recently modified a couple of codes made by @irSindaco [here the link: 2.8 Texture atlas (missing feature)], I basically change one or two lines so all the credits should go to him.
With these scrips, I will now be able to fill some missing features that I miss of an old add-on called Texture Atlas that was very useful in my workflow.
So these are the scripts:
RENAME A SPECIFIC UV LAYER
import bpy
for obj in bpy.context.selected_objects :
for uvmap in obj.data.uv_layers :
if uvmap.name == "Gianni":
uvmap.name = "Luigi"
SELECT UV BY SPECIFIC NAME
import bpy
scene = bpy.context.scene
object = bpy.context.active_object
selected_objects = bpy.context.selected_objects
uv_maps = object.data.uv_layers
for obj in selected_objects:
if obj.type == 'MESH':
uv_maps = obj.data.uv_layers
uv_maps["Gianni"].active = True
ADD UV MAP AND SET ACTIVE
import bpy
scene = bpy.context.scene
object = bpy.context.active_object
selected_objects = bpy.context.selected_objects
uv_map_name = 'Gianni'
meshes = {obj.data for obj in bpy.context.selected_objects if obj.type == 'MESH'}
for mesh in meshes:
mesh.uv_layers.new(name=uv_map_name)
uv_maps = object.data.uv_layers
for obj in selected_objects:
if obj.type == 'MESH':
uv_maps = obj.data.uv_layers
uv_maps["Gianni"].active = True
As I said I’m completely newbie, so please report any possible problem with these scrips, they seem to work but having changing it I do not exclude to have broken something.
Now, let’s come to the point.
I’d need to add one last script to these.
Basically I would like to write a code that selects all the Meshes that have in their UV layers a UV that shares the same name.
Can someone help me, or at least give me a little hint?
I found some threads that are about the Mesh selection using Python, but despite this, I can’t write anything functional from scratch, that works for me.
Thank you so much in advance,