Below is an example demonstrating how you can configure whether or not specific plugins load when the application starts. As written, this script disables all plugins that are not authored by “Daz 3D” with the specific exception of the “aniMate 2” plugin - a plugin authored by a 3rd party, but included in the standard distribution of Daz Studio.
// Define an anonymous function; // serves as our main loop, // limits the scope of variables (function(){ /*********************************************************************/ // Use the new API if it exists; 4.11.0.35 var g_bNewAPI = (App.version64 >= 0x0004000b00000023); // Get the plugin manager var g_oPluginMgr = App.getPluginMgr(); /*********************************************************************/ // String : A function for retrieving a translation if one exists function text( sText ) { // If the version of the application supports qsTr() if( typeof( qsTr ) != "undefined" ){ // Return the translated (if any) text return qsTr( sText ); } // Return the original text return sText; }; /*********************************************************************/ // void : A function for adding plugin loading states to to the DOM doc function addPluginSettingsToDocument( oDomDoc, oParentElem, aPlugins, bState ) { // Declare working variables var oPlugin, oSettingElem, oSettingNode, oFileInfo; // Iterate over the list of plugins for( var i = 0, nPlugins = aPlugins.length; i < nPlugins; i += 1 ){ // Create a 'Setting' element oSettingElem = oDomDoc.createElement( "Setting" ); // Set the 'Type' attribute oSettingElem.setAttribute( "Type", "Bool" ); // Get the 'current' plugin oPlugin = aPlugins[ i ]; // Create a file info object; for easy path operations oFileInfo = new DzFileInfo( oPlugin.getFilename() ); // Set the 'Key' attribute oSettingElem.setAttribute( "Key", String("%1.%2") .arg( oFileInfo.baseName() ) .arg( oFileInfo.extension() ) ); // Create a text node to hold the state oSettingNode = oDomDoc.createTextNode( bState ? "yes" : "no" ); // Add the text node as a child to the 'Setting' element oSettingElem.appendChild( oSettingNode ); // Add the Setting' element as a child to the parent element oParentElem.appendChild( oSettingElem ); // Clean up; do not leak memory oFileInfo.deleteLater(); } }; /*********************************************************************/ // Boolean : A function for saving plugin loading configuration function savePluginLoadConfiguration( aPluginsOn, aPluginsOff ) { // Construct the path to the configuration file var sFilePath = String("%1/dzloadplugins.dsx").arg( App.getAppDataPath() ); // Create an XML document var oDomDoc = new DzDomDocument(); // Create the root 'dazpresets' element var oRootElem = oDomDoc.createElement( "dazpresets" ); // Set the 'version' attribute oRootElem.setAttribute( "version", "1.0" ); // Add the element as a child to the document oDomDoc.appendChild( oRootElem ); // Create the 'presets' element var oPresetsElem = oDomDoc.createElement( "presets" ); // Add the element as a child to the 'dazpresets' element oRootElem.appendChild( oPresetsElem ); // Create a 'preset' element var oPresetElem = oDomDoc.createElement( "preset" ); // Set the 'name' attribute oPresetElem.setAttribute( "name", "Current" ); // Add the element as a child to the 'presets' element oPresetsElem.appendChild( oPresetElem ); // Create a 'settings' element var oSettingsElem = oDomDoc.createElement( "settings" ); // Add the element as a child to the 'preset' element oPresetElem.appendChild( oSettingsElem ); // Add the 'off' plugins to the document addPluginSettingsToDocument( oDomDoc, oSettingsElem, aPluginsOff, false ); // Add the 'on' plugins to the document addPluginSettingsToDocument( oDomDoc, oSettingsElem, aPluginsOn, true ); // Save the file return oDomDoc.saveContent( sFilePath ); }; /*********************************************************************/ // Array<DzPlugin> : A function for resolving plugin loading states function resolvePluginStates( oPlugins, bState ) { // Get a list of the 'on' plugin names var aPlugins = Object.keys( oPlugins ); // Iterate over the plugin names for( var i = 0, nPlugins = aPlugins.length; i < nPlugins; i += 1 ){ // Get the 'current' plugin oPlugin = oPlugins[ aPlugins[ i ] ]; // If we are using the newer API if( g_bNewAPI ){ // Set the startup loading state g_oPluginMgr.setPluginLoadOnStartup( oPlugin, bState ); // If we are using the older API } else { // Capture the plugin aPlugins[ i ] = oPlugin; } } // If we are using the newer API if( g_bNewAPI ){ // Return an empty list return []; // If we are using the older API } else { // Return a list of the plugins return aPlugins; } }; /*********************************************************************/ // Initialize var oPluginsOn = {}; var oPluginsOff = {}; // Define a list of plugin authors to allow var aAuthors = [ "Daz 3D" ]; // Define a list of plugin names to allow var aNames = [ "aniMate 2" ]; // Declare working variables var oPlugin; var sName, sAuthor; // Iterate over the plugins for( var i = 0, nPlugins = g_oPluginMgr.getNumPlugins(); i < nPlugins; i += 1 ){ // Get the 'current' plugin oPlugin = g_oPluginMgr.getPlugin( i ); // Get the name of the plugin sName = oPlugin.getName(); // If the name is in the list of explicitly allowed if( aNames.indexOf( sName ) > -1 ){ // Capture the plugin in the 'on' map oPluginsOn[ sName ] = oPlugin; // If the name is not in the list of explicitly allowed } else { // Iterate over the list of authors for( var j = 0, nAuthors = aAuthors.length; j < nAuthors; j += 1 ){ // Get the 'current' author name; // convert to lowercase for case insensitive compare sAuthor = aAuthors[ j ].toLowerCase(); // If the plugin author starts with the 'current' author name if( oPlugin.getAuthor().toLowerCase().startsWith( sAuthor ) ){ // Capture the plugin in the 'on' map oPluginsOn[ sName ] = oPlugin; // Otherwise } else { // Capture the plugin in the 'off' map oPluginsOff[ sName ] = oPlugin; } } } } // Get a list of the 'on' plugins var aPluginsOn = resolvePluginStates( oPluginsOn, true ); // Get a list of the 'off' plugins var aPluginsOff = resolvePluginStates( oPluginsOff, false ); // Initialize var bResult = false; // If we are using the newer API if( g_bNewAPI ){ // Save the configuration file bResult = g_oPluginMgr.saveConfiguration(); // If we are using the older API } else { // Manually save the configuration file bResult = savePluginLoadConfiguration( aPluginsOn, aPluginsOff ); } // Define common variables var sTitle = App.appName; var sMessage = text( "Restarting %1 is required for plugin loading changes to take effect." ).arg( App.appName ); var sButton = text( "&OK" ); // If the configuration was saved if( bResult ){ // Alert the user MessageBox.information( sMessage, sTitle, sButton ); // If the configuration was not saved } else { // Adjust the message sMessage = text( "An error occured while attempting to save the plugin loading configuration." ); // Alert the user MessageBox.warning( sMessage, sTitle, sButton, "" ); } // Finalize the function and invoke })();