CreateShaderFromCLSID

Introduced

v7.0

Categories

Rendering

Description

Adds a Shader to a render tree based on the specified CLSID.

Scripting Syntax

oReturn = CreateShaderFromCLSID( [Clsid], [Container], Name );

Return Value

The new Shader object.

Parameters

Parameter Type Description
Clsid Unknown

Default Value: The ArgumentHandler may be able to resolve this value.

Container Selection list The shader compound or material to which we're adding the node.

Default Value: If not specified, the user is prompted to select a shader container.

Name String Name for the new shader

Examples

JScript Example

/*
        This example demonstrates how to use the CreateShaderFromCLSID command.
*/
NewScene(null, false);
CreatePrim("Sphere", "MeshSurface", null, null);
// Create an Image Shader using its CLSID found in the SPDL an nest it under the material.
// From txt2d-image-explicit.spdl CLSID={1C500B61-023C-11D3-8C03-00A0243E3672}
CreateShaderFromCLSID( "{1C500B61-023C-11D3-8C03-00A0243E3672}", "Sources.Materials.DefaultLib.Scene_Material", "Image");
SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.Image", 
        "Sources.Materials.DefaultLib.Scene_Material.Phong.diffuse", false);
CreateShaderCompound("Sources.Materials.DefaultLib.Scene_Material.Phong", null);
// Create a Fractal Shader using its CLSID found in the SPDL an nest it under the shader compound.
// From txt3d-fractal_v3.spdl CLSID={A5B2C100-9288-11D4-933F-00E0293D48C6}
CreateShaderFromCLSID( "{A5B2C100-9288-11D4-933F-00E0293D48C6}", 
        "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound", "Fractal");
SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.Fractal", 
        "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.Phong.specular", false);

See Also

CreateShaderFromPreset CreateShadersFromMaterialPreset CreateShaderFromProgID CreateShaderCompound NestShaders UnnestShaders AddShaderCompoundPort RemoveShaderCompoundPort MoveShaderCompoundPort RenameShaderCompoundPort ExportShaderCompound ImportShaderCompound ExplodeShaderCompound SetShaderCompoundPropertiesEx GetShaderCompoundProperties EditShaderCompoundPPGLogic