Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@ktmmilk

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

More than 1 year has passed since last update.

以前記事を書いた
選択オブジェクトの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
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?