Mirror UV Texture from bpy python

The Polygons of UV Textures that im trying to create is saved on mirrored way,
the right to show it on correct location is to mirroring it back, its a big problem while creating many
different Polygons UV Texture

I’ve tried reversing the texture array
I’ve tried np.flip functions on texture array
I’ve searched about how to mirror UV Texture polygons in bpy documentation
and none of those made sense,

how can i mirror the uv texture polygons from script?
Example Image (close adblock if you cant see):

UV Texture creator script:

    # Creating UV Layer
    UVMesh = Object.data
    UVLayer = UVMesh.uv_layers.new() # default name and do_init
    UVMesh.uv_layers.active = UVLayer

    # Filling vertex UV (Textures)
    for face in UVMesh.polygons:

        for vert_idx, loop_idx in zip(face.vertices, face.loop_indices):
            UVLayer.data[loop_idx].uv = vertexVT[vert_idx ] # ie UV coord for each face with vert  me.vertices[vert_idx]

Not at a computer so I can’t give a super in depth response but it’s just basic math- literally just addition and subtraction.

say you want to mirror across the Y axis, specifically a point at 0.5 in uv space. Okay now imagine a uv coordinate with a Y position of 0.4

To get the mirrored coordinate, you get the delta (.5 - .4), which is .1, and add it to the mirror point. This gives you a mirrored coordinate of .6. do that on all of the uv coordinates you want to mirror.

To mirror the opposite direction you just reverse all of the signs. Easy peasy.

2 Likes