# https://blender.stackexchange.com/questions/68143/all-textures-upside-down
import bpy
import bmesh
def mission1(mesh):
bm = bmesh.new()
bm.from_mesh(mesh)
for uvt in mesh.uv_textures:
uv_layer = bm.loops.layers.uv[uvt.name]
for face in bm.faces:
for loop in face.loops:
loop[uv_layer].uv[1] = 1-loop[uv_layer].uv[1]
bm.to_mesh(mesh)
mesh.update()
if bpy.context.mode != 'OBJECT':
bpy.ops.object.mode_set(mode='OBJECT')
meshes = set()
for obj in bpy.context.scene.objects:
if obj.select:
meshes.add(obj.data)
for mesh in meshes:
mission1(mesh)
|
Blender python API quick-start
Syntax highlighting by Pygments.