Difference between revisions of "Snippet:TD-SDK Shift UVs"

From The Foundry MODO SDK wiki
Jump to: navigation, search
Line 3: Line 3:
 
|code=<syntaxhighlight lang="python">
 
|code=<syntaxhighlight lang="python">
 
scene = modo.scene.current()
 
scene = modo.scene.current()
geo = modo.Mesh().geometry # gets currently selected mesh
+
geo   = modo.Mesh().geometry # gets currently selected mesh
 
uvmap = geo.vmaps.uvMaps[0]
 
uvmap = geo.vmaps.uvMaps[0]
  

Revision as of 09:05, 16 May 2016

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, uvmap=UVMapName)
		polygon.setUV ( (u+0.1, v), vertex, uvmap=UVMapName)
 
vertex = geo.vertices[0]
shiftUVs (vertex)
geo.setMeshEdits()