CreateShaderFromPreset

Introduced

v7.0

Categories

Rendering

Description

Adds a Shader to a render tree created from the specified preset.

Scripting Syntax

oReturn = CreateShaderFromPreset( [PresetObj], [Container], Name );

Return Value

The new Shader object.

Parameters

Parameter Type Description
PresetObj String or a preset object (see SIGetPreset) Shader preset to use

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

Container SelectionList or Selection

Default Value: If no argument is specified, the current selection is used.

Name String Name for the new shader

Examples

JScript Example

/*
        This example demonstrates how to use the CreateShaderFromPreset command.
*/
NewScene(null, false);
CreatePrim("Sphere", "MeshSurface", null, null);
// Create a new shader from a preset and nest it under the material
CreateShaderFromPreset("Shaders\\Texture\\Image.Preset", 
        "Sources.Materials.DefaultLib.Scene_Material", null);
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 new shader from a preset and nest it under the material
CreateShaderFromPreset("Shaders\\Texture\\Fractal.Preset", 
        "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound", null);
SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.Fractal", 
        "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.Phong.specular", false);

See Also

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