CrosswalkImportMatLib

Introduced

v7.0

Description

Imports the materials, shaders, texture layers and image clips including the associated user keywords from a Crosswalk file (.xsi v6.0 or .xsiml) into a specifed material library.

Scripting Syntax

CrosswalkImportMatLib( Filename, [MatLib] );

Parameters

Parameter Type Description
Filename String The path and filename of the file to import.
MatLib String The script name of the destination material library to import into. If not specified, a new material library will be created. Note that the name of this library will be changed to the name of the library in the imported file.

Examples

Python Example

#
# This example shows how to export/import a material library using Crosswalk
#
app = Application
# ---------------
# Export:
app.NewScene("", False)
# Add a new material library called "MyMatLib" and make it current
app.CreateLibrary("MyMatLib")
app.SetCurrentMaterialLibrary("Sources.Materials.MyMatLib")
# Add a material to the MyMatLib library
app.SICreateMaterial("Phong", "Phong", None, None, False)
# Export the MyMatLib library
app.CrosswalkExportMatLib("C:\\temp\\MyMatLib.xsiml", "MyMatLib", False, True)
# ---------------
# Import:
app.NewScene("", False)
# Import the material library
app.CrosswalkImportMatLib("C:\\temp\\MyMatLib.xsiml")
# Expected results:
# INFO : 15 mSec - cumulative: 15 mSec
# INFO : Set version
# INFO : 2 mSec - cumulative: 36 mSec
# INFO : Converting scene info
# INFO : 7 mSec - cumulative: 51 mSec
# INFO : Converting environment
# INFO : 12 mSec - cumulative: 72 mSec
# INFO : Converting image clips
# INFO : 1 mSec - cumulative: 82 mSec
# INFO : Converting image clip animations
# INFO : 0 mSec - cumulative: 93 mSec
# INFO : Converting materials
# INFO : 35 mSec - cumulative: 139 mSec
# INFO : Converting material animations
# INFO : 12 mSec - cumulative: 160 mSec
# INFO : Writing file
# INFO : Parser recognizes a dotXSI file
# INFO : 7 mSec - cumulative: 177 mSec
# INFO : Export completed
# INFO : Parser recognizes a dotXSI file

See Also

CrosswalkExportMatLib