Results 1 to 2 of 2

Thread: Scaling UVmap

  1. #1

    Scaling UVmap

    Hi, all.

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

    Code:
    bpy.ops.uv.select_all(action='TOGGLE')
    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?

    Thanks,
    Denis.
    Last edited by denisv; 18-Mar-17 at 12:19.



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

    Code:
    def scaleUV(obj, pivot, scale):
    
    
        uvMap = obj.data.uv_layers[0]
        for d in uvMap.data:
            d.uv[0] = pivot[0] + scale[0]*(d.uv[0] - pivot[0])
            d.uv[1] = pivot[1] + scale[1]*(d.uv[1] - pivot[1])



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •