This version (2012/09/18 01:41) is a Draft.
Save a Render Settings Preset
This example is dependent on functionality provided by DAZ Studio 4.5.x.
Summary
Below is an example demonstrating how you can use script accessible settings to control the saving of a Render Settings Preset..., without causing the output options or file save dialogs to be displayed.
API Areas of Interest
Example
Click the name of the example below to save it as a file.
- Save_Render_Settings_Preset.dsa
// Get the asset IO manager var oAssetIOMgr = App.getAssetIOMgr(); // Define the class name of the asset filter we want to use var sClassName = "DzRenderSettingsAssetFilter"; // Find the index of the asset filter with the class name we want var nAssetIOFilter = oAssetIOMgr.findFilter( sClassName ); // If we've found an asset filter with the class name we wanted if( nAssetIOFilter > -1 ){ // Get the asset filter at the prescribed index var oAssetIOFilter = oAssetIOMgr.getFilter( nAssetIOFilter ); // If we have a valid asset filter if( oAssetIOFilter ){ // Create a settings object var oSettings = new DzFileIOSettings(); // Get the default settings //oAssetIOFilter.getDefaultOptions( oSettings ); // Get the content manager var oContentMgr = App.getContentMgr(); // Get the base path - the first mapped content directory var sBasePath = oContentMgr.getContentDirectoryPath( 0 ); // Get the default/saved options for the asset filter, // without displaying the options dialog (if any) if( oAssetIOFilter.getOptions( oSettings, false, "" ) ){ // Don't compress the file oSettings.setBoolValue( "CompressOutput", false ); // Don't show the file save dialog oSettings.setBoolValue( "RunSilent", true ); // Inspect the settings that will be passed to the asset filter print( oSettings.toString() ); // Use the asset filter to save a test file, using the defined settings. //oAssetIOFilter.doSave( oSettings, String("%1/%2 Test").arg( sBasePath ).arg( sClassName ), sBasePath ); oAssetIOMgr.doSaveWithOptions( oAssetIOFilter, oSettings, false, String("%1/%2 Test").arg( sBasePath ).arg( sClassName ), sBasePath, "" ); } } // We didn't find an asset filter with the class name we wanted } else { // Inform the user MessageBox.critical( String("An asset filter with the class name \"%1\" " + "could not be found.").arg( sClassName ), "Not Found", "&OK" ); }
