Message 1 of 6
Animate edit poly modifier verts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
How do animate verts in an editpoly modifier with maxscript? My current attempt doesn't set keys even if I set the modifier to animate mode and also wrap it all within an on animate context.
Here's my code so far, it matches the vert positions of one object to another but I'd like it to animate the verts:
sourceobj = selection[1]
modifyObject = selection[2]
storedVertPositions = #()
vertCount = polyop.getNumVerts sourceobj
print vertCount
-- Cache vertex positions in world space
for i = 1 to vertCount do (
pos = polyop.getVert sourceobj i
--append storedVertPositions #(i, pos)
append storedVertPositions pos
)
-- add epoly to modified mesh
ePolyMod = undefined --Edit_Poly ()
for modify in modifyObject.modifiers where modify.name == "Edit Poly" do ePolyMod = modify
select modifyObject
max modify mode
modPanel.setCurrentObject ePolyMod
ePolyMod.enabled = true
subobjectLevel = 1
ePolyMod.useSoftSel = off
ePolyMod.SetSelection #Vertex #{}
ePolyMod.animationMode = true
for i = 1 to vertCount do (
sourcePos = storedVertPositions[i]
currentPos = polyop.getVert modifyObject i
diffVector = sourcePos - currentPos
with animate on(
at time 100
(
modifyObject.modifiers[#Edit_Poly].Select #Vertex #{i}
modifyObject.modifiers[#Edit_Poly].MoveSelection diffVector
modifyObject.modifiers[#Edit_Poly].Commit()
modifyObject.modifiers[#Edit_Poly].SetSelection #Vertex #{}
)
)
) Thanks for reading 🙂
Cheers