Last active
December 16, 2015 11:29
-
-
Save darkvertex/5428207 to your computer and use it in GitHub Desktop.
gator for multiple objects
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
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