Skip to content

Instantly share code, notes, and snippets.

@darkvertex darkvertex/gatormulti.py
Last active Dec 16, 2015

Embed
What would you like to do?
gator for multiple objects
xsi = Application
selected = xsi.Selection
sourceMesh = xsi.PickObject("Pick source (enveloped) mesh", "Pick source (enveloped) mesh")("PickedElement")
if sourceMesh:
freezeMe = []
for targetMesh in selected:
if targetMesh.Envelopes.Count > 0:
xsi.RemoveFlexEnv(targetMesh)
gatorOp = xsi.ApplyGenOp("Gator", "", targetMesh.FullName+";"+sourceMesh.FullName, 3, "siPersistentOperation", "siKeepGenOpInputs")(0)
srcEnv = sourceMesh.Envelopes(0)
srcEnvProp = (p.Target2 for p in srcEnv.InputPorts if p.Target2.Type == "envweights").next()
env = xsi.TransferClusterPropertiesAcrossGenOp(targetMesh.FullName+"."+targetMesh.Type+".TransferAttributes", targetMesh, srcEnvProp, "Envelope_Weights")
freezeMe.append(gatorOp)
xsi.FreezeObj(freezeMe)
xsi.LogMessage("Gatored %s's envelope to ---> %s" % (sourceMesh.FullName, selected.GetAsText()), 4)
# TODO:
# Middleclick for continuous picking, left click for single.
# Offer to purge unused deformers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.