v7.0
指定された Shader.ProgID に基づいて Shader を Render Tree に追加します。
oReturn = CreateShaderFromProgID( ProgID, [Container], Name ); |
新しい Shader オブジェクト。
パラメータ | タイプ | 説明 |
---|---|---|
ProgID | 文字列 | 追加するシェーダをそのShader.ProgIDによって識別します。 有効なシェーダ コンパウンド ProgID を指定すると、シェーダ コンパウンドを作成することもできます。 |
Container | 選択リスト |
ノードの追加先シェーダ コンパウンドまたはマテリアル。 デフォルト値:指定されていない場合は、シェーダ コンテナを選択するよう求められます。 |
Name | 文字列 | 新しいシェーダの名前 |
// // 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