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

Maya TransformAttributesの値だけをリセット(改良版)

Posted at

以前記事を書いた
選択オブジェクトのTranslate, Rotate, Scaleを一度に初期化するMELの改良版です。

主にこのあたりを変更しました。
・locked状態のものはスルーして処理を続ける
・選択項目がない場合のエラー文追加

string $objs[] = `ls -sl`;
if(`size $objs` == 0){
    print "何も選択されていません";
}else{
    for ($objSel in $objs)
    {
        select $objSel;

        if(`getAttr -lock .tx` == 0){
            setAttr .tx 0;
        }
        if(`getAttr -lock .ty` == 0){
            setAttr .ty 0;
        }
        if(`getAttr -lock .tz` == 0){
            setAttr .tz 0;
        }

        if(`getAttr -lock .rx` == 0){
            setAttr .rx 0;
        }
        if(`getAttr -lock .ry` == 0){
            setAttr .ry 0;
        }
        if(`getAttr -lock .rz` == 0){
            setAttr .rz 0;
        }

        if(`getAttr -lock .sx` == 0){
            setAttr .sx 1;
        }
        if(`getAttr -lock .sy` == 0){
            setAttr .sy 1;
        }
        if(`getAttr -lock .sz` == 0){
            setAttr .sz 1;
        }
    }
}

後日、こちらも修正かけるかもしれません
・特定ノードを指定する
・選択オブジェクトの子もすべて初期化
・Connectedがある場合
・Expressionがある場合

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?