TD-SDK Shift UVs

From The Foundry MODO SDK wiki
Revision as of 09:02, 16 May 2016 by Ivo.grigull (Talk | contribs) (Created page with "{{Snippet |summary=Example of using modo.Polygon.setUV /getUV from the TD-SDK |code=<syntaxhighlight lang="python">scene = modo.scene.current() geo = modo.Mesh().geometry # g...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Description:

Example of using modo.Polygon.setUV /getUV from the TD-SDK

Code:

scene = modo.scene.current()
geo = modo.Mesh().geometry # gets currently selected mesh
uvmap = geo.vmaps.uvMaps[0]
 
# Shift vertex UVs on all polygons
def shiftUVs (vertex, UVMapName='Texture'):
 
	for polygon in vertex.polygons:
		u,v = polygon.getUV(vertex)
		polygon.setUV ( (u+0.1, v), vertex, uvmap=UVMapName)
 
vertex = geo.vertices[0]
shiftUVs (vertex)
geo.setMeshEdits()