mottosso / cmdx

Fast and persistent subset of maya.cmds
https://mottosso.com/cmdx
BSD 2-Clause "Simplified" License
193 stars 36 forks source link

Matrix access API #10

Open mottosso opened 4 years ago

mottosso commented 4 years ago

Maya 2020 and beyond has a greatly improved UI for dealing with matrices. Let's facilitate that.

Sometimes, you just want to view or modify members of a matrix.

>>> import cmdx
>>> mat = cmdx.Matrix4()
>>> mat[1, 3]
5.5
>>> mat[0, 3] = 12  # I.e. translate X
>>> mat[0]  # Print row
(1, 0, 0, 12)
>>> mat[, 2]  # Print column
(1, 0, 0, 0)
>>> mat[0] = (1, 0, 0, 11)  # Write row
>>> someNode["myMatrix"] = cmdx.MatrixAttribute(default=mat)

Replicate NumPy's array interface for familiarity.