Imports a material library in the form of a .xsi file. Only the
SI_MaterialLibrary part of the file is read. It becomes part of the
scene as if merged.
Note: If the Reference flag is set, original path is maintained and
the library itself is flagged locked. If the Reference flag is not
set, the original path is lost.
Note: This command uses output
arguments. C# and some scripting languages (such as JScript,
PerlScript and Python) don't support arguments passed by reference
so you need to use the best workaround for your situation:
For scripting languages this command returns an ISIVTCollection which you can
use to get the output arguments.
For C# you can use the XSIApplication.ExecuteCommand
method to call this command. ExecuteCommand packs the output
arguments into a C# System.Object containing an Array of the output arguments (see
Calling
Commands from C#).
SIImportMatLib( FileName, [ShareOptions], [Value] ); |
Parameter | Type | Description |
---|---|---|
FileName | String | Name of the model file to import.
Default Value: If this parameter is not specified, a browser pops up, prompting the user to pick an .xsi file |
ShareOptions | siImportShareOptions | Bit field values of type Integer that specify whether to import
the model as a reference model
Default Value: siImportShareOptionsNone |
Value | MaterialLibrary | Returns the library created |
' ' This example illustrates how to import a material library (first the ' library is created and then exported). ' First create some libraries and materials NewScene , false CreatePrim "Sphere", "MeshSurface" ApplyShader , , , , siLetLocalMaterialsOverlap CreateLibrary SelectObj "Sources.Materials.MaterialLibrary" SetValue "Sources.Materials.MaterialLibrary.Name", "MyLibrary" SetCurrentMaterialLibrary "Sources.Materials.MyLibrary" SelectObj "sphere", , true ApplyShader , , , , siLetLocalMaterialsOverlap ' Then export the scene in a .xsi file dotXSIFile = Application.InstallationPath( siUserPath ) & "\MyMatLib4Import.xsi" SIExportDotXSIFile ActiveSceneRoot, dotXSIFile ' Dump everything and import the material library NewScene , false SIImportMatLib dotXSIFile |