v7.0
Rendering
Adds a Shader to a render tree based on the specified Shader.ProgID.
oReturn = CreateShaderFromProgID( ProgID, [Container], Name ); |
The new Shader object.
Parameter | Type | Description |
---|---|---|
ProgID | String | Identify the shader to add by its Shader.ProgID. You can also create shader compounds if you supply a valid shader compound ProgID. |
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 |
// // This example demonstrates how to use the CreateShaderFromProgID command // NewScene(null, false); CreatePrim("Sphere", "MeshSurface"); // Create an Image Shader using its ProgID and nest it under the material CreateShaderFromProgID( "Softimage.txt2d-image-explicit.1", "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 ProgID and nest it under the shader compound. CreateShaderFromProgID( "Softimage.txt3d-fractal_v3.1", "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound", "Fractal"); SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.Fractal", "Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.Phong.specular", false); // Application.LogMessage GetProgID on the shader compound before exporting it // You should get "XSIRTCOMPOUND" as the progid. It means the compound have not been exported // and the compound properties does not match the ones of an existing compound. var shaderCompound = GetValue("Sources.Materials.DefaultLib.Scene_Material.ShaderCompound"); Application.LogMessage( shaderCompound.ProgID ); //Export the shader compound var exportPath = XSIUtils.BuildPath( Application.InstallationPath(siUserPath), "Data", "RTCompounds", "XSIDOC_PhongSpecFractal.xsirtcompound" ); //Ensure the path exists XSIUtils.EnsureFolderExists( exportPath, true ); SetShaderCompoundPropertiesEx("Sources.Materials.DefaultLib.Scene_Material.ShaderCompound", 239, "XSIDOC_PhongSpecFractal", "Test Shaders", "Test for creation of compounds from progid", "SDK Doc", null, "", 1); ExportShaderCompound("Sources.Materials.DefaultLib.Scene_Material.ShaderCompound",exportPath); // Application.LogMessage GetProgID on the shader compound, you should get a valid ProgID. var shaderCompound = GetValue("Sources.Materials.DefaultLib.Scene_Material.ShaderCompound"); Application.LogMessage( shaderCompound.ProgID ); // Create a shader compound by ProgID and nest it under the material. CreateShaderFromProgID( "XSIRTCOMPOUND.XSIDOC_PhongSpecFractal.1.0", "Sources.Materials.DefaultLib.Scene_Material", "ReferencedShaderCompound"); // Expected results: // INFO : XSIRTCOMPOUND // INFO : XSIRTCOMPOUND.XSIDOC_PhongSpecFractal.1.0 |
CreateShaderFromPreset CreateShadersFromMaterialPreset CreateShaderFromCLSID CreateShaderCompound NestShaders UnnestShaders AddShaderCompoundPort RemoveShaderCompoundPort MoveShaderCompoundPort RenameShaderCompoundPort ExportShaderCompound ImportShaderCompound ExplodeShaderCompound SetShaderCompoundPropertiesEx GetShaderCompoundProperties EditShaderCompoundPPGLogic