Skip to content

Instantly share code, notes, and snippets.

@bohdon
Last active January 19, 2020 22:18
Show Gist options
  • Select an option

  • Save bohdon/9be89db103234bede5e9b5003c0b120b to your computer and use it in GitHub Desktop.

Select an option

Save bohdon/9be89db103234bede5e9b5003c0b120b to your computer and use it in GitHub Desktop.
Maya 2020 offsetParentMatrix shelf commands
# create opm connection (select leader then follower)
# > opm
import pulse.nodes
wm = pulse.nodes.getWorldMatrix(pm.selected()[1])
pm.selected()[0].wm >> pm.selected()[1].opm
pm.selected()[1].inheritsTransform.set(False)
pulse.nodes.setWorldMatrix(pm.selected()[1], wm)
# break opm connection
# x opm
import pulse.nodes
for s in pm.selected():
wm = pulse.nodes.getWorldMatrix(s)
s.opm.disconnect()
s.opm.set(pm.dt.Matrix())
s.inheritsTransform.set(True)
pulse.nodes.setWorldMatrix(s, wm)
# freeze anim control
for s in pm.selected():
localMtx = s.m.get()
offsetMtx = s.opm.get()
newOffsetMtx = localMtx * offsetMtx
s.opm.set(newOffsetMtx)
s.setMatrix(pm.dt.Matrix())
# unfreeze anim control
for s in pm.selected():
localMtx = s.m.get()
offsetMtx = s.opm.get()
newLocalMtx = localMtx * offsetMtx
s.setMatrix(newLocalMtx)
s.opm.set(pm.dt.Matrix())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment