Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HI,
Looks like MTransformationMatrix.scale(space) has a bug inside maya that it doesn't return the correct output when trying to get om2.MSpace.kWorld.
Testing in Maya 2022 (windows) and it works as expected but once running in maya 2023 it returns only the local values.
Here is some test code
import maya.api.OpenMaya as om2
import maya.cmds as cmds
# Node name
node = 'cube'
# Lets make a simple cube and put it into a gorup
maya.cmds.polyCube(name=node)
group = maya.cmds.group()
# Scale the group x2
maya.cmds.scale(2,2,2, group)
selection_list = om2.MSelectionList()
selection_list.add(node)
dag_path = selection_list.getDagPath(0)
# Create an MFnTransform object for the node
transform_fn = om2.MFnTransform(dag_path)
# Get the MTransformationMatrix for the node
transform_matrix = transform_fn.transformation()
# Get the scale values in world space
scale_vector = transform_matrix.scale(om2.MSpace.kWorld)
# Print out scale
print('Object Scale in world space:', scale_vector)
"""
Returns:
Object Scale in world space: [1.0, 1.0, 1.0]
Expected Return:
Object Scale in world space: [2.0, 2.0, 2.0]
"""
Not sure if I have totally glossed over something here but it is not working when it comes to getting local scale.
Solved! Go to Solution.