Zero out translate/rotate channels by adding an intermediate parent group to hold those values. This can be preferable to offsetParentMatrix since that's only supported by Maya 2020+.
Usage
Select one or more nodes with non-zero translate/rotate channels, and run this.
import cmdx
with cmdx.DagModifier() as mod:
for src in cmdx.selection():
group = mod.create_node("transform",
name=src.name() + "_parent",
parent=src.parent())
mod.set_attr(group["translate"], src["translate"])
mod.set_attr(group["rotate"], src["rotate"])
mod.set_attr(src["translate"], (0, 0, 0))
mod.set_attr(src["rotate"], (0, 0, 0))
mod.parent(src, group)
Zero out translate/rotate channels by adding an intermediate parent group to hold those values. This can be preferable to
offsetParentMatrix
since that's only supported by Maya 2020+.Usage
Select one or more nodes with non-zero translate/rotate channels, and run this.
https://user-images.githubusercontent.com/2152766/137684150-407693ce-76dc-49f6-bbc2-8a84d024fd50.mp4