PRIM LINK TARGET/ja

From Second Life Wiki
Jump to navigation Jump to search

Description

Constant: integer PRIM_LINK_TARGET = 34;

The integer constant PRIM_LINK_TARGET has the value 34

Used to get or set multiple links with a single PrimParameters call.

llSetPrimitiveParams

llSetPrimitiveParams([ PRIM_LINK_TARGET, integer link_target ]);
• integer link_target リンク 番号 (0: リンクなし, 1: ルートプリム, >1: 子プリム) または LINK_* フラグ

The same syntax applies to llSetLinkPrimitiveParams and llSetLinkPrimitiveParamsFast but with an additional prefixed link parameter in the function call.

llGetPrimitiveParams

llGetPrimitiveParams([ PRIM_LINK_TARGET, integer link_target ]);

Returns the list [  ]

• integer link_target リンク 番号 (0: リンクなし, 1: ルートプリム, >1: 子プリム) または LINK_* フラグ

The same syntax applies to llGetLinkPrimitiveParams, but with an additional prefixed link parameter in the function call.

Caveats

  • texture がプリムの中で見つからない場合、かつこれが UUID でない場合、またはこれがtextureでない場合、エラーが DEBUG_CHANNEL 上で叫ばれます。
  • textureUUID である場合、オブジェクト自体に新たな アセット権限 が発生するようなことはありません。
    • アセットをプリムのインベントリの中に置いた場合、これまで発生していた使用制限は新しいオブジェクトで新たに作成されません。
  • ストレージ媒体として フローティングテキスト の機能が使えると思わないでください。これは不完全ですし、安全なものでもありません。
    • フローティングテキストはサーバの更新時に変更になったことが過去にあり、その際に既に設定されている内容は消去されていました。将来も変更が発生する可能性があります。
    • 「不可視」[1] のフローティングテキストもクライアントに送信されます。
      • 不可視にしているテキストを表示することのできるクライアントを持っている人が見れてしまう可能性があります。
      • テキストが含まれている通信パケットが盗聴され、テキストが読まれる可能性があります。
  • top_size とクライアントの値は異なります。範囲は一致しておらず、変換が必要です。シンプルな計算式は、結果 = 1.0 - value です。詳細は top_size Explained をご覧ください。
  • map がプリムの中で見つからない場合、かつこれが UUID でない場合、またはこれがtextureでない場合、エラーが DEBUG_CHANNEL 上で叫ばれます。
  • mapUUID である場合、オブジェクト自体に新たな アセット権限 が発生するようなことはありません。
    • アセットをプリムのインベントリの中に置いた場合、これまで発生していた使用制限は新しいオブジェクトで新たに作成されません。
  • PRIM_OMEGA/ja on nonphysical objects, and child prims of physical objects, is only a client side effect; the object or prim will collide as non-moving geometry.
  • PRIM_OMEGA/ja cannot be used on avatars sitting on the object. It will emit the error message "PRIM_OMEGA disallowed on agent".
  • If PRIM_OMEGA/ja does not appear to be working, make sure that that Develop > Network > Velocity Interpolate Objects is enabled on the viewer.
  • In the parameters returned by llGetPrimitiveParams([PRIM_OMEGA/ja]), the vector is normalized, and the spinrate is multiplied by the magnitude of the original vector.
  • If PRIM_LINK_TARGET's link_target describes a seated avatar...
All Issues ~ Search JIRA for related Bugs

Related Articles

Constants

フラグ 説明
LINK_ROOT 1 リンクセットの中のルートプリムに送ります
フラグ 説明
LINK_THIS -4 スクリプトの入った自プリムに送ります

Functions

•  llSetLinkPrimitiveParams/ja
•  llSetLinkPrimitiveParamsFast/ja
•  llGetLinkPrimitiveParams/ja
•  llSetPrimitiveParams/ja
•  llGetPrimitiveParams/ja
•  llGetLinkNumber スクリプトが入っているプリムのリンク番号を取得します。

Articles

•  各種制限 SL の制限と制約
•  LSL での色
•  透明度

Examples

default
{
    touch_start(integer num_detected)
    {
    //  color the root prim red and the first linked-prim green
        llSetLinkPrimitiveParamsFast(LINK_ROOT,
                [PRIM_COLOR, ALL_SIDES, <1.0, 0.0, 0.0>, (float)TRUE,
            PRIM_LINK_TARGET, 2,
                PRIM_COLOR, ALL_SIDES, <0.0, 1.0, 0.0>, (float)TRUE]);

    //  instead of:
    //  llSetLinkPrimitiveParamsFast(LINK_ROOT,
    //          [PRIM_COLOR, ALL_SIDES, <1.0, 0.0, 0.0>, (float)TRUE]);
    //  llSetLinkPrimitiveParamsFast(2,
    //          [PRIM_COLOR, ALL_SIDES, <0.0, 1.0, 0.0>, (float)TRUE]);
    }
}
//  assume that you have a global list "gPanels" loaded with the link numbers of prims
//  named "panel" and that the global integer parameter "gON" has been defined ....

    touch_start(integer num)
    {
    //  basic on/off switch
        gON = !gON;

    //  conditions which will change on touch
    //  white panel
        list WhichWay = [PRIM_COLOR, ALL_SIDES, <1.0, 1.0, 1.0>, (float)TRUE];

        if (gON)//  red panel
            WhichWay = [PRIM_COLOR, ALL_SIDES, <1.0, 0.0, 0.0>, (float)TRUE];

    //  to accumulate the parameter list that will be affected by SLPPF in this event
        list params;
        integer numberOfPrims = llGetNumberOfPrims();

    //  Links in a linkset start numbering with 1
        integer index = 1;
        do
        {
        //  build the parameters list, in the format PRIM_LINK_TARGET, link number, parameters
            params += [PRIM_LINK_TARGET, llList2Integer(gPanels, index)] + WhichWay;
        }
        while (++index < numberOfPrims);

    //  apply the parameters to all "panel" prims
        llSetLinkPrimitiveParamsFast(LINK_SET, params);
    }

Notes

リンク番号

オブジェクトを構成するそれぞれのプリムにはアドレスがあります。それがリンク番号です。オブジェクトの特定のプリムにアクセスするには、そのプリムのリンク番号を知らなければなりません。リンク番号はプリムに振られますが、オブジェクトに座っているアバターにも振られます。

  • オブジェクトが単一のプリムで構成されていて、アバターが座っていないとき、(ルート)プリムのリンク番号は 0 です。
  • しかし、オブジェクトが複数のプリムで構成されていたり、オブジェクトに座っているアバターがいたりすると、ルートプリムのリンク番号は 1 となります。

アバターがオブジェクトに座ると、リンクセットの末尾に追加され、いちばん大きなリンク番号が振られることになります。さらに、アバターがオブジェクトに座っている場合、アバターを立たせないと、プリムのリンク・リンク解除ができません。

プリムやアバターの数え方

オブジェクトのプリムや、プリムに座っているアバターの数を調べるのに、2つの関数があります。

  • llGetNumberOfPrims() - プリムと座っているアバターの数を返します。
  • llGetObjectPrimCount(llGetKey()) - オブジェクトのプリムの数だけを返しますが、アタッチメントとなっている場合は 0 を返します。
integer GetPrimCount() { //常にプリムの数だけを返します。
    if(llGetAttached())//装着されているか?
        return llGetNumberOfPrims();//アバターとプリムの数を返しますが、アタッチメントの上には座れないのでこれでいいです。
    return llGetObjectPrimCount(llGetKey());//プリムの数だけを返しますが、アタッチメントの場合ここは通りません。
}

Deep Notes

PRIM_TYPE の top_size とクライアントのテーパー変換
範囲 尖る 尖らない 底が尖る
クライアント [-1, 1] 1.0 0.0 -1.0
PRIM_TYPE [0, 2] 0.0 1.0 2.0
LEGACY [0, 1] 0.0 1.0 なし
1.11 以前 [0, 1] 0.0 1.0 なし

top_size について解説

もともとの PRIM_TYPE のインターフェースが廃止されたとき (PRIM_TYPE_LEGACY, SL 1.5)、新しい PRIM_TYPE インターフェースはプリムの底を尖らせる機能がまだサポートされておらず、SL 1.11 (2年後) になってようやく導入されました。これが導入され新しい PRIM_TYPE が廃止されたときに、top_size の範囲が拡張されました。 それまでの間、クライアントの中で属性とその定義値が再定義されていました。この再定義と範囲の拡張により、異なる値で同じことをする2つのインターフェースが存在することになりました。それまでの間 PRIM_TYPE_LEGACY のインターフェースは更新されず、プリムの底を尖らせるのはサポートされないままでした。その結果、3つのインターフェースがそれぞれ異なる範囲をもつことになり、いじわるな警告をつけるはめになってしまいました。

All Issues

~ Search JIRA for related Issues
   CHANGED_TEXTURE is not triggered when texture is changed via script

Footnotes

  1. ^ フローティングテキストの alpha を 1.0 に設定すると「不可視」になります。
  2. ^ The ranges in this article are written in Interval Notation.

Signature

integer PRIM_LINK_TARGET = 34;