Last active
September 21, 2023 12:01
-
-
Save GainDeveloper/bf15fe1f75e0067bc0fc61e97f0f2a47 to your computer and use it in GitHub Desktop.
mlMeshCopyToMorph.py
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 | |
meshes = modo.Scene().selectedByType('mesh') | |
source = meshes[0] | |
target = meshes[1] | |
indexToPosition = {} | |
with source.geometry as geo: | |
for vertex in geo.vertices: | |
indexToPosition[vertex.Index()] = vertex.Pos() | |
morphMap = target.geometry.vmaps.morphMaps[0] | |
with target.geometry as geo: | |
for vertex in geo.vertices: | |
newPos = modo.Vector3(indexToPosition[vertex.Index()]) - vertex.Pos() | |
morphMap[vertex.Index()] = newPos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment