0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

mayaでmatrixの値をそのままコピーする

Posted at

下のようにTrans, Rotate, Scaleを適当に入れたものを、もう一つのConeにそのままコピーしたい。
image.png

cmds.xformのmatrixを使うと、値を1つ1つセットせずに済む。

import re
import maya.cmds as cmds
sl = cmds.ls(sl=1)
for i in sl:
    localMat = cmds.getAttr(i+'.matrix')
    rightNode = re.sub('_l$', '_r', i)
    cmds.select(rightNode)
    cmds.xform(m=localMat)

値を全く同じにしているので重なっているが、同じトランスフォームになっている。
image.png

cmds.xformで、translationやrotateを行う例文は多いものの、
matrixをそのまま扱ってるモノが少ないのでメモ。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?