v7.0
shader
Imports a shader compound.
oReturn = ImportShaderCompound( [Container], Path ); |
| Parameter | Type | Description |
|---|---|---|
| Container | String | Container to hold imported shader compound.
Default Value: Current selection |
| Path | String | Location of shader compound on disk. |
#
# 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