Skip to content

Instantly share code, notes, and snippets.

@GainDeveloper
Created January 3, 2021 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GainDeveloper/e56c665a8f7de037605ce0c8d9358e93 to your computer and use it in GitHub Desktop.
Save GainDeveloper/e56c665a8f7de037605ce0c8d9358e93 to your computer and use it in GitHub Desktop.
Collapses selected in vertices in Y axis and stores the offset in the V component of the second uv channel.
import modo
from mlFoundation import mlMath
mesh = modo.Mesh()
uvmap = mesh.geometry.vmaps.uvMaps[1]
bb = mlMath.BoundingBox3D()
for vertex in mesh.geometry.vertices.selected:
bb.EncapsulatePoint(vertex.position)
with mesh.geometry as geo:
for vertex in geo.vertices.selected:
pos = vertex.position
yPos = pos[1] - bb.center[1]
pos = (pos[0], bb.center[1], pos[2])
vertex.position = pos
vertex.setUVs((0, 1-yPos), uvmap=uvmap)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment