## DisconnectAndDeleteShaders

### Introduced

v3.0

### Description

Deletes the specified list of shaders after disconnecting them. This is a safer approach than using the DeleteObj command on the same list because this command only deletes the specified shader node in the rendertree (rather than the entire subtree, which is what would happen with DeleteObj).
Removes the shader compound ports when an internal connection is broken. Prevents image clips and materials from being deleted from within the render tree.
Note: This command does not unnest image clips properly from the current container. You should use DisconnectAndDeleteOrUnnestShaders instead, or call DeleteUnusedImageClips after this call to clean up a container of unconnected image clips.

### Scripting Syntax

    DisconnectAndDeleteShaders( Shaders );

### Parameters

Parameter | Type | Description
--- | --- | ---
Shaders | String | List of shaders to delete. This ensures that all the shaders are disconnected before they are deleted, which is important in the rendertree, where if you delete a node you only want that node to be deleted, and not the entire subtree.

### Examples

#### JScript Example

    /*
            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." );
    }

### See Also

SIApplyShader DeleteObj DisconnectAndDeleteOrUnnestShaders DeleteUnusedImageClips Shader