ImportShaderCompound

導入

v7.0

詳細

シェーダ コンパウンドを読み込みます。

スクリプト構文

oReturn = ImportShaderCompound( [Container], Path );

戻り値

シェーダまたはテクスチャ オブジェクト。

パラメータ

パラメータ タイプ 説明
Container 文字列 読み込まれたシェーダ コンパウンドを保持するためのコンテナ。

デフォルト値: 現在選択されている値

Path 文字列 シェーダ コンパウンドのディスク上の場所。

Python の例

#

# This example demonstrates how to set up shader compound, export it to disk, and

# then import and connect it in a fresh scene.

#

app = Application

from win32com.client import constants as xsi

# For readability, we are always saving to the user's RTCompounds directory

path = XSIUtils.BuildPath(

	app.InstallationPath(xsi.siUserPath),

	"Data", "RTCompounds"

)

XSIUtils.EnsureFolderExists(path, 0)

# Convenience function to create and export a shader compound (innerSC.xsirtcompound)

# that we will reference/nest in another shader compound.

def CreateInnerCompound() :

	app.NewScene( None, 0 )

	app.CreatePrim( "Torus", "MeshSurface" )

	app.CreateShaderFromPreset( "Shaders\\Texture\\Gradient.Preset", 

		"Sources.Materials.DefaultLib.Scene_Material" )

	app.CreateShaderFromPreset( "Shaders\\Texture\\Grid.Preset", 

		"Sources.Materials.DefaultLib.Scene_Material" )

	app.SIConnectShaderToCnxPoint( "Sources.Materials.DefaultLib.Scene_Material.Grid", 

		"Sources.Materials.DefaultLib.Scene_Material.Phong.ambient", 0 )

	app.SIConnectShaderToCnxPoint( "Sources.Materials.DefaultLib.Scene_Material.Gradient", 

		"Sources.Materials.DefaultLib.Scene_Material.Grid.line_color", 0 )

	app.CreateShaderCompound( "Sources.Materials.DefaultLib.Scene_Material.Gradient,"

		+ "Sources.Materials.DefaultLib.Scene_Material.Grid" )

	app.ExportShaderCompound( "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound", 

		path+"\\innerSC.xsirtcompound" )

# Create the shader compound to be nested and save it to disk

CreateInnerCompound()

# Set up a new scene with a torus again

app.NewScene( None, 0 )

app.CreatePrim( "Torus", "MeshSurface" )

# Import the shader compound previously exported in the CreateInnerCompound() function

app.ImportShaderCompound( "Sources.Materials.DefaultLib.Scene_Material", 

	path+"\\innerSC.xsirtcompound" )

# Now connect the newly imported shader compound 

app.SIConnectShaderToCnxPoint( "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.ambient", 

	"Sources.Materials.DefaultLib.Scene_Material.Phong.ambient", 0 )

# Add some more shader connections

app.CreateShaderFromPreset( "Shaders\\Texture\\Fractal.Preset", 

	"Sources.Materials.DefaultLib.Scene_Material" )

app.SIConnectShaderToCnxPoint( "Sources.Materials.DefaultLib.Scene_Material.Fractal", 

	"Sources.Materials.DefaultLib.Scene_Material.Phong.specular", 0 )

app.CreateShaderFromPreset( "Shaders\\Texture\\Ripple.Preset", 

	"Sources.Materials.DefaultLib.Scene_Material" )

app.SIConnectShaderToCnxPoint( "Sources.Materials.DefaultLib.Scene_Material.Ripple", 

	"Sources.Materials.DefaultLib.Scene_Material.Phong.diffuse", 0 )

# Create a new shader compound which will have shaders and the newly imported shader compound

app.CreateShaderCompound( "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound,"

	+ "Sources.Materials.DefaultLib.Scene_Material.Fractal,"

	+ "Sources.Materials.DefaultLib.Scene_Material.Ripple" )

関連項目

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