Created
January 3, 2021 15:26
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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