Difference between revisions of "LlSetRenderMaterial"

From Second Life Wiki
Jump to navigation Jump to search
(Add caveat regarding the use of NULL_KEY to "unset" a glTF material.)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{hint
[[Category:glTF]]
|mode=warning
 
|title_desc=Future feature
|desc=This function will be supported in the upcoming GLTF Materials project.</b><br/>Currently it will only work in supported testing areas with a supported test viewer.
}}
{{LSL_Function
{{LSL_Function
|inject-2={{LSL_Function/face|face}}{{LSL_Function/inventory|material|uuid=true|type=material}}
|inject-2={{LSL_Function/face|face}}{{LSL_Function/inventory|material|uuid=true|type=material}}
Line 12: Line 9:
|p2_type=integer|p2_name=face
|p2_type=integer|p2_name=face
|func_footnote
|func_footnote
|func_desc=Sets the {{LSLP|material}} of this prim's {{LSLP|face}}.|return_text
|func_desc=Sets the {{LSLP|material}} of this prim's {{LSLP|face}}. This function will clear most [[LlSetPrimitiveParams#PRIM_GLTF_BASE_COLOR|PRIM_GLTF_*]] properties on the face, with the exceptions of repeats, offsets, and rotation_in_radians.|return_text.
|spec
|spec
|constants
|constants
|examples=<source lang="lsl2">
|examples=<syntaxhighlight lang="lsl2">
default
default
{
{
Line 27: Line 24:
     }
     }
}
}
</source>
</syntaxhighlight>
|helpers
|helpers
|also_functions={{LSL DefineRow||[[llSetLinkRenderMaterial]]|[[PRIM_RENDER_MATERIAL]]}}
|also_functions={{LSL DefineRow||[[llSetLinkRenderMaterial]]|[[PRIM_RENDER_MATERIAL]]}}
Line 36: Line 33:
|also_events
|also_events
|notes
|notes
|caveats=
* If {{LSLP|material}} is provided as [[NULL_KEY]], the [[PBR_Materials|glTF Material]] is removed from {{LSLP|face}}, reverting back to any underlying [[PBR_Materials#Nomenclature_changes|Blinn-Phong]] materials.
|permission
|permission
|negative_index
|negative_index

Latest revision as of 05:47, 17 February 2024


Summary

Function: llSetRenderMaterial( string material, integer face );

Sets the material of this prim's face. This function will clear most PRIM_GLTF_* properties on the face, with the exceptions of repeats, offsets, and rotation_in_radians.

• string material a material in the inventory of the prim this script is in or a UUID of a material
• integer face face number or ALL_SIDES

If face is ALL_SIDES then the function works on all sides.

Caveats

  • This function causes the script to sleep for 0.2 seconds.
  • The function silently fails if its face value indicates a face that does not exist.
  • If 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 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.
  • If material is provided as NULL_KEY, the glTF Material is removed from face, reverting back to any underlying Blinn-Phong materials.
All Issues ~ Search JIRA for related Bugs

Examples

default
{
    state_entry()
    {
        // the first material alphabetically inside the same prim's inventory
        string material = llGetInventoryName(INVENTORY_MATERIAL, 0);

        // set it on all sides of the prim containing the script
        llSetRenderMaterial(material, ALL_SIDES);
    }
}

Deep Notes

Search JIRA for related Issues

Signature

function void llSetRenderMaterial( string material, integer face );