When we want to convert one geometry into another we normally use Morpher, only if they have the same amount of vertices -and the same vertex order. Some time ago I found quite useful to have Edit Poly modifiers on top of that base geometry instead of using Morpher when modelling the different morph targets, mainly because it was easier to toggle them on/off to see the difference from the base object. I have been using this small script during these time, and I thought it could be useful for someone else.
So this is how it works: select one EDIT POLY object, then run the script (you can drag and drop it to a toolbar), then select the ‘target’ object. As I said, as if you were using Morpher :-)
fn geoToEPMod source target =
(
local theVertCountA
local posArrayA = #()
local theVertCountB
local posArrayB = #()
in coordsys local
(
if classOf source == Editable_Poly do
(
theVertCountA = polyOp.getNumVerts source -- gets how many vertices are
posArrayA = #()
for i = 1 to theVertCountA do
(
theVertPos = polyOp.getVert source i
append posArrayA theVertPos
)
)
)
in coordsys local
(
if classOf source == Editable_Poly do
(
theVertCountB = polyOp.getNumVerts target -- gets how many vertices are
posArrayB = #()
for i = 1 to theVertCountB do
(
theVertPos = polyOp.getVert target i
append posArrayB theVertPos
)
)
)
max modify mode
addModifier target (Edit_Poly())
toolMode.coordsys #local
for i = 1 to theVertCountA do
(
if (matchPattern (posArrayA[i] as string) pattern:(posArrayB[i] as string)) == false do
(
mod_verts = #{}
append mod_verts i
target.modifiers[#Edit_Poly].EditPolyMod.setVert mod_verts posArrayA[i]
)
)
)
-- execution
if selection[1] != undefined then
(
if selection.count == 1 then
(
if classOf selection[1] == Editable_Poly then
(
geoToEPMod (pickObject rubberBand:selection[1].pos rubberBandColor:white) selection[1]
)
else messageBox "Object must be an Editable Poly"
)
else
(
messageBox "Please select only one object"
)
)
else
(
messageBox "Please select the target object"
)