Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Check this out.
from maya.api import OpenMaya as om
tm = cmdx.om.MTransformationMatrix()
tm = tm.setScale(cmdx.om.MVector(-1, -1, -1), cmdx.om.MSpace.kWorld)
print(tm.scale(cmdx.om.MSpace.kWorld))
tm = cmdx.om.MTransformationMatrix(tm.asMatrix())
print(tm.scale(cmdx.om.MSpace.kWorld))
# [-1.0, -1.0, -1.0]
# [1.0, 1.0, -1.0]
And if that doesn't have you stumped, then this might.
from maya import cmds
cube, _ = cmds.polyCube()
cmds.scale(-1, -1, -1, cube)
# Get worldmatrix from cube
sl = om.MSelectionList()
sl.add(cube)
mobj = sl.getDependNode(0)
fn = om.MFnDependencyNode(mobj)
plug = fn.findPlug("worldMatrix", True).elementByLogicalIndex(0)
obj = plug.asMObject()
mat = om.MFnMatrixData(obj).matrix()
tm = cmdx.om.MTransformationMatrix(mat)
print(tm.scale(cmdx.om.MSpace.kWorld))
# [1.0, 1.0, -1.0]
That's right! The MTransformationMatrix is unable to represent the negative scale the X and Y axes in the matrix passed into it. For whatever reason, it removes the sign on the X and Y axis. Consistently.
Tested on Maya 2018.7 and 2020.2, Windows.
Solved! Go to Solution.