Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto offset group #69

Open
mottosso opened this issue Oct 18, 2021 · 0 comments
Open

Auto offset group #69

mottosso opened this issue Oct 18, 2021 · 0 comments

Comments

@mottosso
Copy link
Owner

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)
offsetgroup.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant