Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 30-06-2023 , 06:14 AM
Registered User
Join Date: Jun 2023
Location: Slovakia
Posts: 2

copy/paste Transform attributes into the Offset Parent Matrix

Hey everyone, could you help me with a script that copy/paste Transform attributes into the Offset Parent Matrix on selected object, and finally sets the Transform Attributes to zero? Thanks a lot. I tryed this, but it add values from parent Transforms to child. Thank you.
'''import maya.cmds as cmds

def copy_transform_to_offset_parent():

selected_objects = cmds.ls(selection=True)


translate = cmds.getAttr(obj + ".translate")[0]
rotate = cmds.getAttr(obj + ".rotate")[0]
scale = cmds.getAttr(obj + ".scale")[0]


transform_matrix = cmds.xform(obj, query=True, matrix=True, worldSpace=True)

cmds.setAttr(obj + ".offsetParentMatrix", transform_matrix, type="matrix")

cmds.setAttr(obj + ".translate", 0, 0, 0)
cmds.setAttr(obj + ".rotate", 0, 0, 0)
cmds.setAttr(obj + ".scale", 1, 1, 1)'''

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads