## SetInstanceDataValue

### Introduced

v1.0

### Description

Sets instance-specific data for a parameter. Some properties, such as materials, can be shared with several objects. In some situations, it is necessary to assign different parameter values to one of the object's properties.
Note that the value of the parameter is context-specific--its value depends on the object. Currently this command is only used for specifying which Texture Projection should be used for a shader. If the command is called with an empty list of objects, all objects are given this value, and all future objects created that use this parameter will have this value as well. If the command is called with the value set to an empty string then the instance data value is reset.

### Scripting Syntax

    SetInstanceDataValue( [InputObjs], InputObj, Value );

### Parameters

Parameter | Type | Description
--- | --- | ---
InputObjs | String | List of objects. Default Value: Empty, all the objects
InputObj | String | List of Parameters to set.
Value | String | New data

### Examples

#### VBScript Example

    '
    ' This example demonstrates setting a parameter on a shader so that it uses
    ' two different projections depending on which item it applies to. In this
    ' case, we will create one projection for the cube and another for the sphere
    ' and then tell the shader to use the CubeProjection on the cube and the
    ' SphereProjection on the sphere.
    '
    NewScene , false
    ' Get the default pass
    Set oDefPass = GetValue( "Passes.Default_Pass" )
    ' Create a cube and a sphere
    CreatePrim "Cube", "MeshSurface"
    CreatePrim "Sphere", "MeshSurface"
    Translate "sphere", 5.987, 0.039, -0.004, siRelative, siView, siObj, siXYZ
    ' Create an XZ texture projection on the object
    CreateProjection "cube,sphere", "siTxtPlanarXZ", _
            "siTxtDefaultPlanarXY", , "WrongProjection"
    ' Create XY texture projections on the objects, named "CubeProjection"
    ' and "SphereProjection"
    CreateProjection "cube", "siTxtPlanarXY", _
            "siTxtDefaultPlanarXY", , "CubeProjection"
    CreateProjection "sphere", "siTxtPlanarXY", _
            "siTxtDefaultPlanarXZ", , "SphereProjection"
    ' Put the cube and sphere in a group, put a material on it, with
    ' an image attached to diffuse.
    ToggleSelection "cube"
    CreateGroup
    ApplyShader
    SIApplyShaderToCnxPoint "Image", "sphere.Material.Phong.diffuse"
    ' Now render one frame of the scene to see the effect
    ' (the default image was plunked directly on the top of the
    ' cube and sphere)
    RenderPasses oDefPass, 1, 1
    ' At this point, the image shader will, by default, choose the
    ' texture projection named "WrongProjection".  We want to tell
    ' the image shader that on the cube, it should use "CubeProjection",
    ' and on the sphere, it should use "SphereProjection".  This
    ' means that the parameter is instance-specific, so we use
    ' the SetInstanceDataValue command
    ' This line sets the parameter "tspace_id" to be "SphereProjection"
    ' for the object "sphere"
    SetInstanceDataValue "sphere", _
            "Group.Material.Phong.Image.tspace_id", "SphereProjection"
    ' This line sets the parameter "tspace_id" to be "CubeProjection"
    ' for the object "cube"
    SetInstanceDataValue "cube", _
            "Group.Material.Phong.Image.tspace_id", "CubeProjection"
    ' Now render one frame of the scene to see the effect
    ' (the default image was applied to the visible area of the
    ' cube and sphere)
    RenderPasses oDefPass, 1, 1