A 4x4 matrix encodes a 3x3 rotation matrix, a position, and an extra column of values that used to distinguish between the position and rotation parts (you can think of that fourth column as a binary “am I a translation row” value)
recap
(this is pretty much what you posted)
The rotation matrix part encodes the 3 base coordinate axes for the transform of the matrix: In an unrotated matrix they are not rotated and they line up with the world:
1 0 0 = x
0 1 0 = y
0 0 1 = z
At any given point these numbers change to be the local X, Y and Z vectors (technically, they also encode scale if they are not normalized… lets ignore that for now)
If you were rotating on only one axis, you’d only change he other two rows. Here for example is a 45 degree rotation in Z only:
0.707 0.707 0
-0.707 0.707 0
0 1 0
You can see that the X axis 1,0,0
is now rotated around to 0.707, 0.707, 0
and the Y axis is rotated similarly from 0,1,0
to -0.707 , 0.707 , 0
but the Z axis is not changed.
Euler rotations
You can represent any single-axis Euler rotation in the form above: a 3x3 matrix with the rotating axis left alone and the other two representing the ‘twist’ around that axis. Rotation order comes in because to represent a 3-d Euler rotation you have to multiply together 3 matrices, one for each of the axes – and in matrix math, multiplication is order dependent.
So if you had the 45-degrees-in-X matrix above and mutiplied it by a 30-degrees-in-Y matrrix
you’d get something like this (i’m using maya.api.OpenMaya MMatrices, you could do this in the listener)
# numbers are approximated!
from maya.api.OpenMaya import MMatrix
# 45 degrees in Z
z_rot = MMatrix ([
0.707, 0.707, 0, 0,
-0.707, 0.707, 0, 0 ,
0, 0, 1, 0,
0, 0, 0, 1
])
# 30 degrees in Y
y_rot = ([
0.866, 0, 0.5, 0
0 , 1, 0, 0,
-0.5, 0 , 0.866, 0,
0, 0, 0, 1
])
yz_matrix = y_rot * z_rot
zy_matrix = z_rot * y_rot
print (yz_matrix)
# MMatrix([0.612, 0.707, 0.354, 0, -0.612, 0.707, -0.354, -0.5, 0, 0.866, 0, 0,0, 0, 1])
print (zy_matrix)
# MMatrix([0.612, 0.707, 0.354, 0, -707, 0.707, 0, -0.354, -0.354, 0.866, 0, 0,0, 0, 1])
As you can see the pieces are the same but the rotation order changes their arrangement, which makes sense since the maya results also look different for the same rotations applied using different orders
So, under the hood maya multiples 3 euler rotation matrices representing the X, Y and Z rotations you specified. The order of the rotations is variable, and affects the final outcome. The final matrix that comes out of that becomes the 3x3 rotation matrix in the upper-left corner of the final Maya transform.
The details are all laid out here in the Maya docs along with the other matrices (for scale, sheer, pivot transform and so on) that all get multiplied together to make the final matrix you see when you ask Maya for the transform of an object