1
2

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 5 years have passed since last update.

Maya ascii(mel のサブセット?)の文法メモ

Last updated at Posted at 2019-12-10

Maya ASCII の文法メモです.

.ma をちょっと編集したいとか, .ma から設定を読込みたいとかようです.

たぶん昔から存在するので, きちんとした言語定義は無いと思われますが, わかってしまえばそんなに難しい文法になっているわけではないのがわかります.
(ただ, .ma の Semantic を解釈するというのは面倒 or 難しい. maya でデータを評価しないとわからない値やブラックボックスなものもあるため )

Maya 2018 を想定しています.

大まかな構成

cgkit の mayaascii を参考にしてみてください.
(ただ, cgkit 自体は開発止まっているのか古いので, 最近 Maya では適用できないものがあるかもです)

大まかには以下の 14 のコマンドで構成されます.

  • file 外部ファイル読み込み?
  • requires 必要なプラグインとか
  • fileInfo ファイルの情報
  • currentUnit シーンで使う単位
  • createNode ノードを作る
  • rename ノードに UUID を割り当てる
  • setAttr ノードのアトリビュートを設定する
  • addAddr アトリビュートを追加する
  • select ノードを選択する
  • connectAttr アトリビュートを繋ぐ
  • disconnectAttr
  • relationship ライトリンクなど?
  • parent
  • lockNode

コマンドは ; で終了します.

コメントはダブルスラッシュです.

// this is comment

Maya 自体が出力する .ma は, まあまあ行ごとにまとまって出ているので, 行ごとにパースというのはやりやすそうです.

文字列

ダブルクォーテーションで囲わなくてもいけるらしい

"muadh"
mudah

両方とも OK

select -ne :bora 

select では : の prefix があったりする. なにか理由があるのかしら?

また,

( "mudah" + "bora" + "dora" )

と, かっこを使って文字列を連結することができます.

boolean

yes no on off

フラッグ

setAttr などでは, フラグの順序は比較的自由にできます(unix 系プログラムのオプションの扱いと似た感じですね).

setAttr -k off ".v" no;
setAttr ".v" -k off no;

と, どちらの記法でも OK です.

配列データ

setAttr ".wl[0:8].w"
  2 1 0 ...
  3 0 ...
  3 0 ...
  3 0 ...
  3 0 ...
  3 0 ...
  3 0 ...
  3 0 ...
  ;

と言う感じで, attribute の文字列に配列の範囲や個数, のこり ; までが配列の値, というふうになります.

文字列配列?

{ "mudah", "borah", "dorah" }

とカンマ区切り + カッコがあります. attributeAlias 型など.

バイナリデータ

Maya XGen などは, BASE64 あたりでエンコードされています.
(したがって .ma で数値をいじるというのが無理. XGen 自体については, SDK は Maya 非依存で動かすのができるので, XGen 関連のデータをいじりたい場合は XGen SDK で処理させる手もあります)

TODO

  • .ma を Blender で読み込む plugin を作る
1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?