v8.0 (2010)
Exports the scene contents to a custom file. The custom file type must be registered in
an export custom converter event (see PluginRegistrar.RegisterConverterEvent
for more information about how to specify the extension of the filename).
This command fires the following events: siOnBeginFileExport,
the custom exporter registered for the matching file extension, and
siOnEndFileExport, in that order.
The FileType context attribute of the
siOnBeginFileExport, siOnCustomFileExport
and siOnEndFileExport events will have the siFileTypeCustom
value when this command is called.
Warning: If there is no custom exporter event registered with the matching file extension,
the command will fail and an error will be logged.
ExportCustomFile( FileName, [Target], [Frame], [UserData] ); |
Parameter | Type | Description |
---|---|---|
FileName | String | The full path name of the custom exported file. |
Target | String |
The objects to be exported. Default Value: Selected object |
Frame | Integer |
Frame at which to export the specified objects. This information is only accessible from the
custom converter export event callback.
Default Value: Current frame. |
UserData | Parameter-dependent | Any data that needs to be accessible from the custom converter export event callback. |
# # First of all, an export converter event must be registered with the extension of the file to export. # from win32com.client import constants as c def XSILoadPlugin( in_reg ) : in_reg.Author = "ABC" in_reg.Name = "ABC Text Converter plugin" in_reg.Major = 1 in_reg.Minor = 0 in_reg.URL = "www.abc.com" # Let XSI know that this plug-in implements custom import/export events for ABC files in_reg.RegisterConverterEvent( "ABCTextImport", c.siOnCustomFileImport, "ABC" ) in_reg.RegisterConverterEvent( "ABCTextExport", c.siOnCustomFileExport, "ABC" ) return 1 def ABCTextImport_OnEvent( in_ctxt ) : app = Application app.LogMessage( "ABC Text Import Event called..." ) app.LogMessage( "FileName: " + in_ctxt.GetAttribute("FileName") ) app.LogMessage( "Target: " + str(in_ctxt.GetAttribute("Target")) ) app.LogMessage( "FileType: " + str(in_ctxt.GetAttribute("FileType")) ) app.LogMessage( "Frame: " + str(in_ctxt.GetAttribute("Frame")) ) app.LogMessage( "UserData: " + str(in_ctxt.GetAttribute("UserData")) ) def ABCTextExport_OnEvent( in_ctxt ) : app = Application app.LogMessage( "ABC Text Export Event called..."); app.LogMessage( "FileName: " + in_ctxt.GetAttribute("FileName") ); app.LogMessage( "Target: " + str(in_ctxt.GetAttribute("Target")) ); app.LogMessage( "FileType: " + str(in_ctxt.GetAttribute("FileType")) ) app.LogMessage( "Frame: " + str(in_ctxt.GetAttribute("Frame")) ) app.LogMessage( "UserData: " + str(in_ctxt.GetAttribute("UserData")) ); # # Then, the ExportCustomFile command may be called from any script. # Application.ExportCustomFile( "MyABCfile.abc", "Scene_Root", 50, "ABCExportOptions" ) #--------------------------------------------------------- # Output from this script: # INFO : ABC Text Export Event called... # INFO : FileName: MyABCfile.abc # INFO : Target: Scene_Root # INFO : FileType: 31 # INFO : Frame: 50.0 # INFO : UserData: ABCExportOptions #--------------------------------------------------------- |