Scaling UVmap

(denisv) #1

Hi, all.

I’m trying to scale an existing UV map for currently selected object, the log window suggest the following:

bpy.ops.transform.resize(value=(20, 20, 20), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1)

However, this works when I hover over the UV map, when I run it as a script with blender running in background, it scales the object instead.

Can it be solved?


(denisv) #2

Figured it out.
For some reason, there is no built in blender function to scale UV, but this works…

def scaleUV(obj, pivot, scale):

    uvMap =[0]
    for d in
        d.uv[0] = pivot[0] + scale[0]*(d.uv[0] - pivot[0])
        d.uv[1] = pivot[1] + scale[1]*(d.uv[1] - pivot[1])