manuelito
Hi there!

I'm just trying to create a script setting up a delta mush configuration as shown in the example video. I'm a bit confused in the way how the Morph class is supposed to work. And since no Python script is available, it is impossible to actually get any more information about this.

So, I'm applying exactly the same deformers in the same order as in the movie, i.e. one simpleSmooth, one morph, again a simpleSmooth and finally another morph.

When I do this by script, the morph targets do not seem to be active. It is as if they would not have any effect. When I add those targets manually after the script is finished, the system works again.

Here is the line that I use to apply the morph and add a target:


morph_def = cmds.deformer(dupl_trs, type="morph", before=True)[0]
Morph().add(morph_def, dupl_trs, ref_trs)


I don't know what should I do to use the surface transformation space and how this should actually work through scripting. It looks as if there would be some refresh issue somewhere. I forced multiple refreshments without any success.

Anyone any idea?

Thanks,
Carlo
Reply 0 0
pshipkov
Seems to be working here.
This is the list of commands you need:


# apply smooth deformer
n = mc.deformer("pSphere1", typ="smooth")[0]
mc.setAttr(n+".iterations", 15)
# apply morph deformer
n = mc.deformer("pSphere1", typ="morph")[0]
Morph().add(n, "pSphere1", "tgt", neutral=False, surface=True)
mc.setAttr(n+".tgt", 1)

# apply smooth deformer, second pass
n = mc.deformer("pSphere1", typ="smooth")[0]
mc.setAttr(n+".iterations", 2)
# apply morph deformer, second pass
n = mc.deformer("pSphere1", typ="morph")[0]
Morph().add(n, "pSphere1", "tgt", neutral=False, surface=True)
mc.setAttr(n+".tgt", 1)

Depends of how your object is deformed you may not need second pass smooth+morph

Reply 0 0
manuelito
Hi!

Thanks for your quick reply! I was actually missing the "surface" and "neutral" flag in the add target call. This seems to produce the expected result.

Thanks a lot and also a big thank you for this awesome Maya plugin!

Greets,
Carlo
Reply 0 0
Reply