Hi, I found this script - it runs without errors (in script IDE) but it wont export anything. Can anybody help ?
Thank you
const oEXPORT_MANAGER = App.getExportMgr();
const oOBJECT_EXPORTER = oEXPORT_MANAGER.findExporterByClassName( 'DzObjExporter' );
const oEXPORTER_SETTINGS = new DzFileIOSettings();
oOBJECT_EXPORTER.getOptions( oEXPORTER_SETTINGS, true, null );
oEXPORTER_SETTINGS.setIntValue( 'RunSilent', 1 );
var oNode;
const oPRIMARY_NODE = Scene.getPrimarySelection();
if( oPRIMARY_NODE ){
const oSKELETON = oPRIMARY_NODE.getSkeleton();
if( oSKELETON ){ oNode = oSKELETON; }
else{ oNode = oPRIMARY_NODE; }
}
const sEXPORT_PATH = ( oNode ? String( '%1/%2.%3' )
.arg( oEXPORT_MANAGER.getExportPath() )
.arg( oNode.name )
.arg( oOBJECT_EXPORTER.getExtension() ) : oEXPORT_MANAGER.getExportPath() );
const sOBJECT_EXPORT_PATH = FileDialog.doFileDialog( false,
String( 'Custom Export : %1 : %2' )
.arg( oOBJECT_EXPORTER.getDescription() )
.arg( oEXPORTER_SETTINGS.getStringValue( 'Preset' ) ),
sEXPORT_PATH,
String( '%1 (*.%2)' )
.arg( oOBJECT_EXPORTER.getDescription() )
.arg( oOBJECT_EXPORTER.getExtension() ) );
if( sOBJECT_EXPORT_PATH ){
const fileinfo = DzFileInfo(sOBJECT_EXPORT_PATH);
var timestep = Scene.getTimeStep();
var start = Scene.getPlayRange().start / timestep;
var end = Scene.getPlayRange().end / timestep;
var old_frame = Scene.getFrame;
for (var i=start; i <= end; ++i) {
var filename = fileinfo.canonicalPath() + fileinfo.completeBaseName() + "_" + i + "." + fileinfo.suffix();
print("Exporting frame #" + i + " as " + filename)
Scene.setFrame(i);
oOBJECT_EXPORTER.writeFile( filename, oEXPORTER_SETTINGS );
}
Scene.setFrame(old_frame);
}