v7.0
シェーダ出力パラメータに接続されているオブジェクトを含むParameterCollectionを戻します。これにより、Parameter.Source プロパティと逆方向に Render Tree が移動されます。
Shader1.Out <== Shader2.In ('Shader2.In.Source' は Shader1.Out を戻します)
Shader1.Out ==> Shader2.In ('Shader1.GetShaderParameterTargets(Shader1.Out)' は Shader2.In を戻します)
注: シェーダ コンパウンドでこのメソッドを使用すると、公開された入力ポートも取得できます。
ParameterCollection Shader.GetShaderParameterTargets( String in_ParameterName ); |
oReturn = Shader.GetShaderParameterTargets( ParameterScriptName ); |
パラメータ | タイプ | 説明 |
---|---|---|
ParameterScriptName | String |
パラメータのスクリプト名。 ヒント:単一出力シェーダで空のスクリプト名を使用して、出力に接続されているシェーダを取得することができます。 |
/* This example creates a sample shader tree and shows how to traverse a shader tree from left to right using the Source property and right to left using the GetShaderParameterTargets method. Both shader compound ports and non-compound ports are demonstrated. */ // Fill the Default Material with some shaders. NewScene(null,false); CreatePrim("Sphere", "MeshSurface", null, null); SelectObj("Sources.Materials.DefaultLib.Scene_Material", null, null); CreateShaderFromPreset("Shaders\\Texture\\Share\\Color_share.Preset", "Sources.Materials.DefaultLib.Scene_Material", null); SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.Color_share", "Sources.Materials.DefaultLib.Scene_Material.Phong.ambient", false); CreateShaderFromPreset("Shaders\\Texture\\Share\\Color_share.Preset", "Sources.Materials.DefaultLib.Scene_Material", null); SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.Color_share", "Sources.Materials.DefaultLib.Scene_Material.Color_share1.input", false); CreateShaderFromPreset("Shaders\\Texture\\Share\\Color_share.Preset", "Sources.Materials.DefaultLib.Scene_Material", null); SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.Color_share", "Sources.Materials.DefaultLib.Scene_Material.Color_share2.input", false); CreateShaderCompound("Sources.Materials.DefaultLib.Scene_Material.Color_share2", null); CreateShaderFromPreset("Shaders\\Texture\\Share\\Color_share.Preset", "Sources.Materials.DefaultLib.Scene_Material", null); SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.Color_share2", "Sources.Materials.DefaultLib.Scene_Material.Color_share.input", false); CreateShaderFromPreset("Shaders\\Texture\\Share\\Color_share.Preset", "Sources.Materials.DefaultLib.Scene_Material", null); SIConnectShaderToCnxPoint("Sources.Materials.DefaultLib.Scene_Material.Color_share3", "Sources.Materials.DefaultLib.Scene_Material.Color_share2.input", false); CreateShaderCompound("Sources.Materials.DefaultLib.Scene_Material.Color_share3", null); // Get the Shader Source (single output shader) connected to a shader input port using // the Parameter.Source property. Application.LogMessage( "Source (Right to Left Traversal) of single output shader" ); var oColorShareShader = GetValue("Sources.Materials.DefaultLib.Scene_Material.Color_share"); var oColorShareInputParam = oColorShareShader.Parameters.Item("input"); var oSource = oColorShareInputParam.Source; if( oSource != null ) { Application.LogMessage( " CnxSource: " + oSource.FullName + ", " + "CnxTarget: " + oColorShareInputParam.FullName +"." ); } // Get the Parameter Source (multi-output shader) connected to a shader input port using // the Parameter.Source property. Application.LogMessage( "Source (Right to Left Traversal) of multi-output shader" ); var oColorShareShader = GetValue("Sources.Materials.DefaultLib.Scene_Material.Color_share2"); var oColorShareInputParam = oColorShareShader.Parameters.Item("input"); var oSource = oColorShareInputParam.Source; if( oSource != null ) { Application.LogMessage( " CnxSource: " + oSource.FullName + ", " + "CnxTarget: " + oColorShareInputParam.FullName +"." ); } // Get each Parameter Target driven by this multi-output shader's output port using the // Shader.GetShaderParameterTargets method. Application.LogMessage( "Target (Left to Right Traversal) for multi-output shader" ); var oColorShareShader = GetValue("Sources.Materials.DefaultLib.Scene_Material.Color_share"); var oTargets = oColorShareShader.GetShaderParameterTargets(""); if( oTargets != null ) { for( var i=0; i<oTargets.Count; i++ ) { Application.LogMessage( " CnxSource: " + oColorShareShader.FullName + ", " + "CnxTarget: " + oTargets.Item(i).FullName +"." ); } } // Get the Parameter Source connected inside a shader compound output port using // the Parameter.Source property. Application.LogMessage( "Source (Right to Left Traversal) of shader compound" ); var oShaderCompound = GetValue("Sources.Materials.DefaultLib.Scene_Material.ShaderCompound1"); var oShaderCompoundOutputParam = oShaderCompound.Parameters.Item("input"); var oSource = oShaderCompoundOutputParam.Source; if( oSource != null ) { Application.LogMessage( " CnxSource: " + oSource.FullName + ", " + "CnxTarget: " + oShaderCompoundOutputParam.FullName +"." ); } // Get the Parameter Target driven by this shader's output port (connected inside a shader // compound) using the Shader.GetShaderParameterTargets method. Application.LogMessage( "Target (Left to Right Traversal) for compound shader" ); var oShaderCompound = GetValue("Sources.Materials.DefaultLib.Scene_Material.ShaderCompound"); var oShaderCompoundInputParam = oShaderCompound.Parameters.Item("input"); var oTargets = oShaderCompound.GetShaderParameterTargets( oShaderCompoundInputParam.Name ); if( oTargets != null ) { for( var i=0; i<oTargets.Count; i++ ) { Application.LogMessage( " CnxSource: " + oShaderCompoundInputParam.FullName + ", " + "CnxTarget: " + oTargets.Item(i).FullName +"." ); } } // Expected results: // INFO : Source (Right to Left Traversal) of single output shader // INFO : CnxSource: Sources.Materials.DefaultLib.Scene_Material.Color_share2, // CnxTarget: Sources.Materials.DefaultLib.Scene_Material.Color_share.input. // INFO : Source (Right to Left Traversal) of multi-output shader // INFO : CnxSource: Sources.Materials.DefaultLib.Scene_Material.ShaderCompound1.input, // CnxTarget: Sources.Materials.DefaultLib.Scene_Material.Color_share2.input. // INFO : Target (Left to Right Traversal) for multi-output shader // INFO : CnxSource: Sources.Materials.DefaultLib.Scene_Material.Color_share, // CnxTarget: Sources.Materials.DefaultLib.Scene_Material.Phong.ambient. // INFO : CnxSource: Sources.Materials.DefaultLib.Scene_Material.Color_share, // CnxTarget: Sources.Materials.DefaultLib.Scene_Material.Color_share1.input. // INFO : CnxSource: Sources.Materials.DefaultLib.Scene_Material.Color_share, // CnxTarget: Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.input. // INFO : Source (Right to Left Traversal) of shader compound // INFO : CnxSource: Sources.Materials.DefaultLib.Scene_Material.ShaderCompound1.Color_share3, // CnxTarget: Sources.Materials.DefaultLib.Scene_Material.ShaderCompound1.input. // INFO : Target (Left to Right Traversal) for compound shader // INFO : CnxSource: Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.input, // CnxTarget: Sources.Materials.DefaultLib.Scene_Material.ShaderCompound.Color_share2.input. |