## CrosswalkExportMatLib

### Introduced

v7.0

### Description

Exports a given material library to a Crosswalk file (.xsi v6.0 or .xsiml). The file will contain a single material library, with all the related materials, shaders, texture layers and image clips including the associated user keywords.

### Scripting Syntax

    CrosswalkExportMatLib( Filename, MatLib, Binary, ExportUsedImageClipsOnly );

### Parameters

Parameter | Type | Description
--- | --- | ---
Filename | String | The path and filename of the file.
MatLib | String | The script name of the material library to export.
Binary | Boolean | True to export to a dotXSI file using the Binary format; false to use the ASCII format. Default Value: false
ExportUsedImageClipsOnly | Boolean | True to export only the image clips related to the material library; false to export all image clips. Default Value: true

### Examples

#### JScript Example

    /*
            This example shows how to export/import a material library using Crosswalk
    */
    // ---------------
    // Export:
    NewScene(null, false);
    // Add a new material library called "MyMatLib" and make it current
    CreateLibrary("MyMatLib");
    SetCurrentMaterialLibrary("Sources.Materials.MyMatLib");
    // Add a material to the MyMatLib library
    SICreateMaterial("Phong", "Phong", null, null, false);
    // Export the MyMatLib library
    CrosswalkExportMatLib("C:\\temp\\MyMatLib.xsiml", "MyMatLib", false, true);
    // ---------------
    // Import:
    NewScene(null, false);
    // Import the material library
    CrosswalkImportMatLib("C:\\temp\\MyMatLib.xsiml" );
    // ---------------
    // Expected results:
    // INFO : 70 mSec - cumulative: 70 mSec
    // INFO : Set version
    // INFO : 5 mSec - cumulative: 98 mSec
    // INFO : Converting scene info
    // INFO : 19 mSec - cumulative: 121 mSec
    // INFO : Converting environment
    // INFO : 26 mSec - cumulative: 150 mSec
    // INFO : Converting image clips
    // INFO : 3 mSec - cumulative: 163 mSec
    // INFO : Converting image clip animations
    // INFO : 2 mSec - cumulative: 170 mSec
    // INFO : Converting materials
    // INFO : 117 mSec - cumulative: 294 mSec
    // INFO : Converting material animations
    // INFO : 32 mSec - cumulative: 332 mSec
    // INFO : Writing file
    // INFO : Parser recognizes a dotXSI file
    // INFO : 11 mSec - cumulative: 349 mSec
    // INFO : Export completed
    // INFO : Parser recognizes a dotXSI file

### See Also

CrosswalkImportMatLib