Skip to content

Auto offset group #69

Open
Open
@mottosso

Description

@mottosso

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions