LlGetObjectAnimationNames/ja

From Second Life Wiki
< LlGetObjectAnimationNames
Revision as of 13:13, 9 December 2018 by SakuraNoel Fayray (talk | contribs) (Create Japanese translation page.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

要約

関数: list llGetObjectAnimationNames( );

スクリプトが動いているオブジェクトで再生されているアニメーションの名前の一覧を list で返します。

サンプル

stop_all_animations()
{
    list curr_anims = llGetObjectAnimationNames();
    llSay(0,"全て停止。curr_anims は " + (string) curr_anims + " です。");
    integer length = llGetListLength(curr_anims);
    integer index = 0;
    while (index < length)
    {
        string anim = llList2String(curr_anims, index);
        llSay(0, "停止 " + anim);
        llStopObjectAnimation(anim);
        // このチェックは実際には必要ではなく、is_animation_running()を実演するためだけに含まれています
        if (is_animation_running(anim))
        {
            llSay(0, "エラー - " + anim + " を停止出来ませんでした!");
        }
        ++index;
    }
}

integer is_animation_running(string anim)
{
    list curr_anims = llGetObjectAnimationNames();
    return ~llListFindList(curr_anims, (list)anim);
}

default
{
    state_entry()
    {
        llSay(0, "Hello, Avatar!");
    }

    touch_start(integer total_number)
    {
        // スクリプトが動いているオブジェクトにこの名前のアニメーションがあることを想定しています
        string anim_name = "MyFancyWalk";
        llSay(0, "Touched.");
        llStartObjectAnimation(anim_name);
        if (is_animation_running(anim_name))
        {
            llSay(0,anim_name + " は再生中だよ。いいね");
        }
        llSleep(5.0);
        stop_all_animations();
        if (is_animation_running(anim_name))
        {
            llSay(0,anim_name + " は再生中だよ。これは間違ってるよ!");
        }
    }
}

注意点

この機能の一般的な使用方法は、現在再生中のアニメーションをすべて停止するか、特定のアニメーションが現在再生中かどうかを確認することです。

この機能を使用すると、このオブジェクトで現在再生中のアニメーションを全て見ることが出来ます。通常返される値は、オブジェクトのインベントリ内のアニメーションの名前になります。アニメーションが見つからないという稀なケースでは、アニメーションのキーが代わりに(文字列として)返されます。どちらの場合でも、結果はllStopObjectAnimationに送ることが出来ます。

アニメーションオブジェクトは、1つまたは複数のリグメッシュプリミティブを含むリンクセットにスケルトンを関連付けることによって機能します。リンクセット内のプリムのいずれかのスクリプトによってアニメーションが再生されると、スケルトンがアニメートされ、リンクセットのリグメッシュされたメッシュがそれに応じて移動します。リンクセットの任意のプリムで実行されるスクリプトは、新しいコマンドを使用してアニメーションを開始、停止、または問い合わせることができます。これらの関数の一般的な使い方は、リンクセットのルートプリムですべてのオブジェクトアニメーションスクリプトを実行することです。このシナリオでは、アニメーションとスクリプトはすべてこのプリムのインベントリの一部であり、オブジェクト全体のインベントリの一部になります。しかし、スクリプトとアニメーションがリンクセットの複数のプリムに存在する場合、アニメーションは各プリムで独立して開始、停止、追跡されることを理解することが重要です。

関連項目

関数

•  llStartObjectAnimation スクリプトが動いているオブジェクトのアニメーションを開始する
•  llStopObjectAnimation スクリプトが動いているオブジェクトのアニメーションを停止する

特記事項

Search JIRA for related Issues

Signature

function list llGetObjectAnimationNames();
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。