Skip to content

Instantly share code, notes, and snippets.

@mrmurphy
Created December 22, 2012 05:34
Show Gist options
  • Save mrmurphy/4357628 to your computer and use it in GitHub Desktop.
Save mrmurphy/4357628 to your computer and use it in GitHub Desktop.
Interactive session describing unexpected behavior within pymel
>> import pymel.core as pm
Warning: file: /Applications/Autodesk/maya2013/Maya.app/Contents/bin/../scripts/startup/initialStartup.mel line 192: Y-axis is already the Up-axis
## The matrix initializes as expected.
>>> spam = pm.datatypes.Matrix(1,2,3)
>>> print spam.formated()
[[1.0, 2.0, 3.0, 0.0],
[1.0, 2.0, 3.0, 0.0],
[1.0, 2.0, 3.0, 0.0],
[1.0, 2.0, 3.0, 0.0]]
## Now building a transformation matrix.
>>> eggs = pm.datatypes.TransformationMatrix()
## I expect this to take all of the same values from spam's matrix.
>>> eggs.assign(spam)
## Sadly, it doesn't. The middle two rows are missing.
>>> print eggs.formated()
[[1.0, 2.0, 3.0, 0.0],
[0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0],
[1.0, 2.0, 3.0, 1.0]]
## Trying by another method:
>>> eggs.data = spam.data
## Still nope:
>>> print eggs.formated()
[[1.0, 2.0, 3.0, 0.0],
[0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0],
[1.0, 2.0, 3.0, 1.0]]
## And here's something that I wouldn't expect to happen at all:
>>> eggs = pm.datatypes.TransformationMatrix(1,2,3)
>>> print eggs.formated()
[[1.0, 2.0, 3.0, 0.0],
[1.71713525163e-15, -3.53979629992e-15, 1.78748578273e-15, 0.0],
[-2.94819389609e-15, -6.98692156873e-16, 1.44852606995e-15, 0.0],
[1.0, 2.0, 3.0, 1.0]]
## I would expect the output above to look just like Matrix(1,2,3) considering
## that in the source for pymel, TransformationMatrix is a child of Matrix, and
## doesn't override the constructor. What's making those middle two rows blow up?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment