Hello. Would somebody mind if someone can write a small python script for me pls? =]

I am working on a game and have made many low poly trees. For texturing reasons, I need to slide the UV map some units here and there. Im using a color palette-like texture. Imagine the light green colored leaf needs to be dark green for variation in them etc…
I really need a quick way to do it because it takes me much time cuz there are many “UV slidings” I need to do, really many many, for every tree and every LOD of it… plus there are many more models coming on soon and hence >.<
What I want to have is an easy way to grab the whole UV of all the selected objects, and move them across specified units on a specified axis (for me X)
If somebody could help me that would be really awesome >.<
Indeed ““grab the whole UV of all the selected objects, and move them across specified units on a specified axis”” is a very simple task, but honestly, it becomes slow and cumbersome when having to deal with lots of models

:roll_eyes:so many words…
Just Show it! Share your precious :pretzel: … don’t wanna be forced to guess-imagine what you already did :upside_down_face:

@burnin what did u actually ask for? The solution?
If so, there is a post like “move uv with python” =] google it :wink: maybe it was on stackexchange i forgot :confused:

1 Like

no, a simple sketch & step-by-step process 1-2-3 :wink:
tho stack might already have a solution

Man its easy af

I am a noob and i did it xD

You da mastar :sunglasses: just post a solution for others who might stumble on same issue :wink:

No sorry it takes 20 dollars :wink:

Okay soo

  • Open the text editor
  • Paste the following code
  • Select your objects in Object Mode
  • Click Run Script

And the whole UV will be moves as what u enter in the code… ^^ (also no need to select any verts or faces of the model, everything will be selected automagically by the script and boom, done! ^^

import bpy

#+ grab the current area
original_area = bpy.context.area.type

scene = bpy.context.scene
for count, ob in enumerate(bpy.context.selected_objects):
if ob.type == ‘MESH’:
scene.objects.active = ob
#+ switch to the image editor to perform transforms etc
bpy.context.area.type = ‘IMAGE_EDITOR’
bpy.ops.object.mode_set(mode=‘EDIT’, toggle=False)

    #+ select the uvs

    bpy.ops.transform.translate(value=(6, 0, 0), constraint_axis=(True, False, False))

    #+ return to the original mode where the script was run
    bpy.context.area.type = original_area
    bpy.ops.object.mode_set(mode='OBJECT', toggle=False)

The line:
bpy.ops.transform.translate(value=(6, 0, 0), constraint_axis=(True, False, False))
is the main one to be edited. value = (x units, y units, z units), and constraint_axis=(Move along X true or not, Move along Y true or not, Move along Z true or not)

Kind regards!
Happy to have helped ya!
Have a great day fellow artist!