Getting the script accessible settings from an importer/exporter.
Author: Rob Whisenant, © 2008
Below are examples of how to retrieve the script accessible settings from all importers/exporters.
Importers
* The DAZ Studio API, prior to version 2.3.3.57, is lacking the DzImportMgr::getImporter() function, so the importer example below will fail.
const oIMPORT_MANAGER = App.getImportMgr(); const nIMPORTERS = oIMPORT_MANAGER.getNumImporters(); var oImporter, oSettings; var sImporterExtensions; var nExtensions; for( var i = 0; i < nIMPORTERS; i++ ){ oImporter = oIMPORT_MANAGER.getImporter( i ); oSettings = new DzFileIOSettings(); oImporter.getOptions( oSettings, false ); print( '-----------------------------' ); print( String( 'Class Name : %1' ).arg( oImporter.className() ) ); print( String( 'Description : %1' ).arg( oImporter.getDescription() ) ); sImporterExtensions = ''; nExtensions = oImporter.getNumExtensions(); for( var j = 0; j < nExtensions; j++ ){ if( j > 0 ){ sImporterExtensions += ', '; } sImporterExtensions += oImporter.getExtension( j ); } print( String( 'Extension : %1' ).arg( sImporterExtensions ) ); print( oSettings.toString() ); print( '\n' ); }
Exporters
const oEXPORT_MANAGER = App.getExportMgr(); const nEXPORTERS = oEXPORT_MANAGER.getNumExporters(); var oExporter, oSettings; for( var i = 0; i < nEXPORTERS; i++ ){ oExporter = oEXPORT_MANAGER.getExporter( i ); oSettings = new DzFileIOSettings(); oExporter.getOptions( oSettings, false ); print( '-----------------------------' ); print( String( 'Class Name : %1' ).arg( oExporter.className() ) ); print( String( 'Description : %1' ).arg( oExporter.getDescription() ) ); print( String( 'Extension : %1' ).arg( oExporter.getExtension() ) ); print( oSettings.toString() ); print( '\n' ); }
You are here: start » Wiki » User Pages » Rob Whisenant » TechNotes » DAZ Script Related » Getting the script accessible settings from an importer/exporter.
