CreateShadersFromMaterialPreset
 
 
 

CreateShadersFromMaterialPreset

Introduced

v8.0 (2010)

Description

Adds one or more Shader(s) to a render tree created from a material preset.

Scripting Syntax

oReturn = CreateShadersFromMaterialPreset( [PresetObj], [Container] );

Return Value

The first Shader that was connected to the material.

Parameters

Parameter Type Description
PresetObj String or a material preset object (see SIGetPreset)

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.

Examples

JScript Example

/*
        This example demonstrates how to use the CreateShadersFromMaterialPreset command.
        A Material Preset is loaded as a shader tree and connected to the material.
*/
NewScene( null, false );
CreatePrim( "Sphere", "MeshSurface" );
CreateProjection( "sphere", siTxtSpherical, null, null, "Texture_Projection" );
IncreaseSubdivision();
IncreaseSubdivision();
SelectObj( "sphere", null, true );
SetValue( "sphere.polymsh.geom.subdivu", 15 );
SetValue( "sphere.polymsh.geom.subdivv", 15 );
strPresetPath = XSIUtils.BuildPath( Application.InstallationPath(siFactoryPath), 
        "Data", "DSPresets", "Materials", "Art", "im_art5.Preset" );
oShader = CreateShadersFromMaterialPreset( strPresetPath, "Sources.Materials.DefaultLib.Scene_Material" );
Application.LogMessage( oShader.FullName );
SIConnectShaderToCnxPoint( oShader, "Sources.Materials.DefaultLib.Scene_Material.surface", false );

See Also

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