<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic BUG MTransformationMatrix.scale() in Maya Programming Forum</title>
    <link>https://forums.autodesk.com/t5/maya-programming-forum/bug-mtransformationmatrix-scale/m-p/11849379#M1183</link>
    <description>&lt;P&gt;HI,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like&amp;nbsp;&lt;SPAN&gt;MTransformationMatrix.scale(space) has a bug inside maya that it doesn't return the correct output when trying to get&amp;nbsp;om2.MSpace.kWorld.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Testing in Maya 2022 (windows) and it works as expected but once running in maya 2023 it returns only the local values.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is some test code&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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]
"""&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if I have totally glossed over something here but it is not working when it comes to getting local scale.&lt;/P&gt;</description>
    <pubDate>Mon, 27 Mar 2023 02:58:13 GMT</pubDate>
    <dc:creator>AdamBakerArt</dc:creator>
    <dc:date>2023-03-27T02:58:13Z</dc:date>
    <item>
      <title>BUG MTransformationMatrix.scale()</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/bug-mtransformationmatrix-scale/m-p/11849379#M1183</link>
      <description>&lt;P&gt;HI,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like&amp;nbsp;&lt;SPAN&gt;MTransformationMatrix.scale(space) has a bug inside maya that it doesn't return the correct output when trying to get&amp;nbsp;om2.MSpace.kWorld.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Testing in Maya 2022 (windows) and it works as expected but once running in maya 2023 it returns only the local values.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is some test code&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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]
"""&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure if I have totally glossed over something here but it is not working when it comes to getting local scale.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 02:58:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/bug-mtransformationmatrix-scale/m-p/11849379#M1183</guid>
      <dc:creator>AdamBakerArt</dc:creator>
      <dc:date>2023-03-27T02:58:13Z</dc:date>
    </item>
    <item>
      <title>Re: BUG MTransformationMatrix.scale()</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/bug-mtransformationmatrix-scale/m-p/11851109#M1184</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On &lt;STRONG&gt;line 22&lt;/STRONG&gt; you are getting the local transformation matrix of the cube, not the world matrix.&amp;nbsp;Try this instead:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;transform_matrix = om2.MTransformationMatrix(dag_path.inclusiveMatrix())&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;P.S. I also tested you script in Maya 2022 and got the same result. Were you testing on the latest update release or an earlier one because I don't think the behaviour of &lt;STRONG&gt;transform_fn.transformation()&amp;nbsp;&lt;/STRONG&gt;has changed.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 15:56:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/bug-mtransformationmatrix-scale/m-p/11851109#M1184</guid>
      <dc:creator>brentmc</dc:creator>
      <dc:date>2023-03-27T15:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: BUG MTransformationMatrix.scale()</title>
      <link>https://forums.autodesk.com/t5/maya-programming-forum/bug-mtransformationmatrix-scale/m-p/11851128#M1185</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;Brent,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You are correct, I was not getting world Matrix, check in with that is going on in Maya 2022 and get back with that information.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I am going to approve your reply and respond with more information.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2023 16:02:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/maya-programming-forum/bug-mtransformationmatrix-scale/m-p/11851128#M1185</guid>
      <dc:creator>AdamBakerArt</dc:creator>
      <dc:date>2023-03-27T16:02:42Z</dc:date>
    </item>
  </channel>
</rss>

