PRIM RENDER MATERIAL/ja

From Second Life Wiki
Jump to navigation Jump to search
Emblem-important-red.png Warning! Future feature

This function will be supported in the upcoming GLTF Materials project.
Currently it will only work in supported testing areas with a supported test viewer.

Description

Constant: integer PRIM_RENDER_MATERIAL = 43;

The integer constant PRIM_RENDER_MATERIAL has the value 43

Used to get or set the material settings of a prim's face.

llSetPrimitiveParams

[ PRIM_RENDER_MATERIAL, integer face, string render_material ]
• integer face 番号もしくは ALL_SIDES
• string render_material a material in the inventory of the prim this script is in or a UUID of a material

Used with llSetPrimitiveParams & llSetLinkPrimitiveParams.

Caveats

  • If render_material is missing from the prim's inventory and it is not a UUID or it is not a material then an error is shouted on DEBUG_CHANNEL.
  • If render_material is a UUID then there are no new asset permissions consequences for the object.
    • The resulting object develops no new usage restrictions that might have occurred if the asset had been placed in the prims inventory.
All Issues ~ Search JIRA for related Bugs

Examples

llSetPrimitiveParams([ PRIM_RENDER_MATERIAL, ALL_SIDES, my_render_material ]);
llSetPrimitiveParams([ PRIM_RENDER_MATERIAL, ALL_SIDES, llGetInventoryName(INVENTORY_RENDER_MATERIAL, 0) ]);
llSetPrimitiveParams([ PRIM_RENDER_MATERIAL, 0, my_render_material ]);

llGetPrimitiveParams

llGetPrimitiveParams([ PRIM_RENDER_MATERIAL, integer face ]);

Returns the list [ string render_material ]

• integer face 番号もしくは ALL_SIDES

• string render_material a material in the inventory of the target prim or a UUID of a material

Caveats

All Issues ~ Search JIRA for related Bugs

Target

In the case of llGetPrimitiveParams is either the prim the script resides in, or the prim specified by the immediately prior PRIM_LINK_TARGET/ja call. However in the case of llGetLinkPrimitiveParams, it is either the value of the link parameter, or the prim specified by the immediately prior PRIM_LINK_TARGET/ja call.

Related Articles

Constants

•  CHANGED_RENDER_MATERIAL/ja

Functions

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

Events

•  changed/ja

Notes

リンク番号

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

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

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

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

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

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

Deep Notes

Search JIRA for related Issues

Signature

integer PRIM_RENDER_MATERIAL = 43;