LoginSignup
1

More than 3 years have passed since last update.

Maya AnimCurve のデータを Pythonで取得するメモ

Last updated at Posted at 2019-10-30

animcurve.PNG

背景

AnimCurve node の値を取得して, JSON なりでエクスポートしたい.

PyMel

(最近 Autodesk の PyMel ヘルプサイトが壊れているようでつらい)

numKeys() or numKeyframes() でキーの数を取得.

Angle 型の AnimCurve の場合は, radian の値が返ってくるので注意ください.
たとえば UI 上で 62.78493 の値は, getValue() すると 1.0958037491341635 がかえってきます.

Time について.

どうも? getTime(int) で取得する time 値はバグるときがあるようです.

MEL での,

getAttr "animCurveUA.ktv[1]";

と同等の python を使って値(time, value)取得がよいです.

その他参考情報

keyframe 関数
http://download.autodesk.com/global/docs/maya2012/ja_jp/PyMel/generated/functions/pymel.core.animation/pymel.core.animation.keyframe.html

Scripting for Animation in Maya
https://hub.packtpub.com/scripting-animation-maya/

TODO

  • cmds.keyframe で値を取得しようとすると, 構成によっては None or 空配列が返ってくるケースがある原因を突き止める.
  • 補間した値を取得する方法を調べる

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
1