Skip to content

Instantly share code, notes, and snippets.

@CGLion

CGLion/maya_get_ws_mtx.py

Last active Oct 4, 2020
Embed
What would you like to do?
Python for Maya - Get object world space transform matrix
from maya.api.OpenMaya import MVector, MMatrix, MPoint
import maya.cmds as cmds
def get_world_transform (obj):
return MMatrix ( cmds.xform( obj, q=True, matrix=True, ws=True ) )
selected_object = (cmds.ls(sl=1,sn=True))[0]
print ( get_world_transform( selected_object ) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment