v3.0
シェーダの接続を解除した後に指定のシェーダ リストを削除します。 この方法は、同じリストにDeleteObjコマンドを使用するよりも安全です。このコマンドはRender Tree 内の指定のシェーダノードのみを削除するためです(DeleteObjではサブツリー全体が削除されます)。
内部接続が解除されると、シェーダ コンパウンド ポートが削除されます。 レンダ ツリー内部からイメージ クリップおよびマテリアルが削除されることはありません。
注: このコマンドでは、現在のコンテナのイメージクリップが適切にネスト解除されることはありません。 代わりにDisconnectAndDeleteOrUnnestShadersを使用するか、この呼び出しの後でDeleteUnusedImageClipsを呼び出して、接続されていないイメージクリップのコンテナをクリーンアップする必要があります。
DisconnectAndDeleteShaders( Shaders ); |
| パラメータ | タイプ | 説明 |
|---|---|---|
| Shaders | 文字列 | 削除するシェーダのリスト。 シェーダが削除される前にすべてのシェーダが確実に接続解除されます。レンダ ツリーのサブツリー全体を削除せずに目的のノードのみを削除する場合は重要です。 |
/*
This example demonstrates how to use the DisconnectAndDeleteShaders command by
creating two shaders in a simple render tree, and deleting the phong without
deleting the attached fractal.
*/
NewScene( null, false );
// Build our shaders (a Phong and a Fractal)
var oSph = CreatePrim( "Sphere", "MeshSurface" );
var oPhong = SIApplyShader( "Phong", oSph );
var oFractal = BlendInPresets( "Fractal", null, null, true, siReplaceNoBlend,
false, false, true );
// Now display the render tree. A message box appears so that you can see the
// contents of the render tree before deleting one of the shaders. When you are
// ready to proceed, click OK...
OpenView( "Render Tree" );
var lResponse = XSIUIToolkit.MsgBox( "When you are ready to proceed, click OK. "
+ "The message box will close and the DisconnectAndDeleteShaders command "
+ "will remove the shader node only.", siMsgOkCancel + siMsgInformation,
"DisconnectAndDeleteShaders Demo" );
if ( lResponse == siMsgOk ) {
DisconnectAndDeleteShaders( oPhong );
} else {
Application.LogMessage( "You opted not to complete the demonstration." );
} |