Description : |
Below is the source for a DAZ Script that will allow you to "render" to a RIB file. |
Concepts Covered : |
|
Source : ./samples/ |
00001 /********************************************************************** 00002 File: renderToRIB.ds 00003 00004 Copyright © 2002-2006 DAZ Productions. All Rights Reserved. 00005 00006 This file is part of the DAZ Script Documentation. 00007 00008 This file may be used only in accordance with the DAZ Script 00009 license provided with the DAZ Script Documentation. 00010 00011 The contents of this file may not be disclosed to third parties, 00012 copied or duplicated in any form, in whole or in part, without the 00013 prior written permission of DAZ Productions, except as explicitly 00014 allowed in the DAZ Script license. 00015 00016 See http://www.daz3d.com to contact DAZ Productions or for more 00017 information about DAZ Script. 00018 **********************************************************************/ 00019 /***************************** 00020 Script Globals 00021 *****************************/ 00022 const g_sTOOL_NAME = "Render To RIB"; 00023 const g_sTOOL_KEY = "3Delight"; 00024 const g_oFILE = new DzFileInfo( getScriptFileName() ); 00025 const g_sSCRIPT_NAME = String( "%1.%2" ).arg( g_oFILE.baseName() ).arg( g_oFILE.extension() ); 00026 00027 const g_bSHIFT_PRESSED = shiftPressed(); 00028 const g_bCONTROL_PRESSED = ctrlPressed(); 00029 00030 const g_sRIB_PATH_KEY = 'ribPath'; 00031 const g_sKEEP_SHADOWS_KEY = 'keepShadows'; 00032 const g_sCOLLECT_ASSETS_KEY = 'collectAssets'; 00033 00034 var g_oTmpFile = new DzFileInfo( Scene.getFilename() ); 00035 const g_sDEFAULT_RIB_PATH = String( "%1/%2" ).arg( App.getTempPath() ) 00036 .arg( g_oTmpFile.exists() ? String( "%1.rib" ).arg( g_oTmpFile.baseName() ) : "dzTest.rib" ); 00037 00038 delete g_oTmpFile; 00039 g_oTmpFile = undefined; 00040 00041 var g_oSettings = new DsSettings; 00042 var g_oGui = new DsInterface; 00043 var g_oActions = new DsActions; 00044 00045 /*********************************************************************/ 00046 // DsSettings - A class for setting/getting stored values 00047 /*********************************************************************/ 00048 class DsSettings{ 00049 /***************************** 00050 Class Members 00051 *****************************/ 00052 var m_oMgr = App.getAppSettingsMgr(); 00053 00054 /*********************************************************************/ 00055 // void : Method for recording settings 00056 function set( sPath, sName, oValue ){ 00057 // Add a temporary 'sub-directory' onto the settings manager path 00058 m_oMgr.pushPath( sPath ); 00059 // Store the setting; dependant on type 00060 switch( typeof oValue ){ 00061 // If value is a string 00062 case "string": 00063 // Set as String 00064 m_oMgr.setStringValue( sName, oValue ); 00065 break; 00066 // If value is bool 00067 case "boolean": 00068 // Set as a Bool 00069 m_oMgr.setBoolValue( sName, oValue ); 00070 break; 00071 // If value is an int, float or double 00072 case "number": 00073 // Set as Float 00074 m_oMgr.setFloatValue( sName, oValue ); 00075 break; 00076 // If none of the above 00077 default: 00078 // Don't do anything 00079 break; 00080 } 00081 // Return the settings manager path to it's previous state. 00082 m_oMgr.popPath(); 00083 } 00084 00085 /*********************************************************************/ 00086 // QObject : Method for retrieving settings 00087 function get( sPath, sName, oValue ){ 00088 // Create a variable to store the value 00089 var v; 00090 // Add a temporary 'sub-directory' onto the settings manager path 00091 m_oMgr.pushPath( sPath ); 00092 // Retrieve the setting; dependant on type 00093 switch( typeof oValue ){ 00094 // If value is a string 00095 case "string": 00096 v = m_oMgr.getStringValue( sName, oValue ); 00097 break; 00098 // If value is a bool 00099 case "boolean": 00100 v = m_oMgr.getBoolValue( sName, oValue ); 00101 break; 00102 // If value is an int, float or double 00103 case "number": 00104 v = m_oMgr.getFloatValue( sName, oValue ); 00105 break; 00106 // If none of the above 00107 default: 00108 // Don't do anything 00109 break; 00110 } 00111 // Return the settings manager path to it's previous state. 00112 m_oMgr.popPath(); 00113 // Return the value 00114 return v; 00115 } 00116 } 00117 00118 /*********************************************************************/ 00119 // DsInterface - A class for interfacing with the user 00120 /*********************************************************************/ 00121 class DsInterface{ 00122 /***************************** 00123 Class Members 00124 *****************************/ 00125 const m_nMARGIN = 5; 00126 const m_nSPACING = 5; 00127 const m_nMIN_BTN_WIDTH = 80; 00128 const m_nMAX_BTN_HEIGHT = 20; 00129 const m_nNOTES_WIDTH = 290; 00130 00131 // List of Boolean options 00132 var m_aBoolNames = new Array; 00133 var m_aBoolObjs = new Array; 00134 // List of String options 00135 var m_aStrNames = new Array; 00136 var m_aStrObjs = new Array; 00137 // List of ComboBox options 00138 var m_aCmbNames = new Array; 00139 var m_aCmbObjs = new Array; 00140 // 00141 var m_wDlg, m_wTabStack; 00142 var m_wOptionPage, m_wPrefsPage; 00143 var m_wPathGB, m_wPrefsGB; 00144 var m_wRibPath; 00145 var m_wKeepShadows, m_wCollect; 00146 var m_wHelpBtn, m_wAcceptBtn, m_wCancelBtn; 00147 var m_wRcrdOnExec, m_wRcrdBtn, m_wRdBtn, m_wDfltBtn; 00148 00149 /*********************************************************************/ 00150 // void : Build the 'common' portion of the interface (used in hidden and unhidden modes) 00151 function doCommon(){ 00152 // --------------------- 00153 // --- Main dialog 00154 // --------------------- 00155 m_wDlg = new DzDialog; 00156 m_wTabStack = new DzTabWidget( m_wDlg ); 00157 // --------------------- 00158 // --- Options Page 00159 // --------------------- 00160 m_wOptionPage = new DzVGroupBox( m_wTabStack ); 00161 // --- Path 00162 m_wPathGB = new DzVGroupBox( m_wOptionPage ); 00163 m_wRibPath = new DzLineEdit( m_wPathGB ); 00164 m_aStrObjs.push( m_wRibPath ); 00165 m_aStrNames.push( g_sRIB_PATH_KEY ); 00166 // --- Shadow Maps 00167 m_wKeepShadows = new DzCheckBox( m_wOptionPage ); 00168 m_aBoolObjs.push( m_wKeepShadows ); 00169 m_aBoolNames.push( g_sKEEP_SHADOWS_KEY ); 00170 // --- Collect 00171 m_wCollect = new DzCheckBox( m_wOptionPage ); 00172 m_aBoolObjs.push( m_wCollect ); 00173 m_aBoolNames.push( g_sCOLLECT_ASSETS_KEY ); 00174 // --------------------- 00175 // --- Preferences Page 00176 // --------------------- 00177 m_wPrefsPage = new DzVGroupBox( m_wTabStack ); 00178 m_wPrefsGB = new DzVGroupBox( m_wPrefsPage ); 00179 // --- Record on Execution 00180 m_wRcrdOnExec = new DzCheckBox( m_wPrefsGB ); 00181 m_aBoolObjs.push( m_wRcrdOnExec ); 00182 m_aBoolNames.push( 'rcrdOnExec' ); 00183 // Set the initial options 00184 setDefaults(); 00185 } 00186 00187 /*********************************************************************/ 00188 // void : Method for running with the dialog unhidden 00189 function doDialog(){ 00190 // Build the common portion of the dialog 00191 doCommon(); 00192 // Get the Help Manager for "What's This?" and tool tips 00193 var oHelpMgr = App.getHelpMgr(); 00194 // find the "What's This?" action; for the help button 00195 var oActionMgr = MainWindow.getActionMgr(); 00196 var oAction = oActionMgr ? oActionMgr.findAction( "DzWhatsThisAction" ) : undefined; 00197 // --------------------- 00198 // --- Main dialog 00199 // --------------------- 00200 m_wDlg.caption = g_sTOOL_NAME; 00201 m_wDlg.whatsThis = 00202 String( "<b>File : </b> %1<br>" ).arg( g_sSCRIPT_NAME ) + 00203 String( "<b>Type : </b> %2<br>" ).arg( getScriptType() ) + 00204 String( "<b>Size : </b> %3<br>" ).arg( g_oFILE.sizeStr() ) + 00205 String( "<b>Version : </b> %4<br>" ).arg( getScriptVersionString() ) + 00206 String( "<b>Created : </b> %5<br>" ).arg( g_oFILE.created().toString( "dddd, MMMM d yyyy h:mm ap" ) ) + 00207 String( "<b>Modified : </b> %6" ).arg( g_oFILE.lastModified().toString( "dddd, MMMM d yyyy h:mm ap" ) ); 00208 // --- Main dialog layout 00209 var wDlgLayout = new DzGridLayout( m_wDlg ); 00210 wDlgLayout.margin = m_nMARGIN; 00211 wDlgLayout.spacing = m_nSPACING; 00212 wDlgLayout.addMultiCellWidget( m_wTabStack, 0, 0, 0, 2 ); 00213 // --- Dialog Buttons 00214 var wDlgBtnsGB = new DzGroupBox( m_wDlg ); 00215 wDlgBtnsGB.flat = true; 00216 var wDlgBtnsLyt = new DzGridLayout( wDlgBtnsGB ); 00217 wDlgBtnsLyt.margin = m_nMARGIN; 00218 wDlgBtnsLyt.spacing = m_nSPACING; 00219 // --- Help button 00220 m_wHelpBtn = new DzPushButton( wDlgBtnsGB ); 00221 m_wHelpBtn.pixmap = new Pixmap( String( "%1/images/icons/whatsthissmallicon.png" ).arg( App.getResourcesPath() ) ); 00222 m_wHelpBtn.maxHeight = m_nMAX_BTN_HEIGHT; 00223 if( oAction ) 00224 connect( m_wHelpBtn, "clicked()", oAction, "activate()" ); 00225 m_wHelpBtn.toolTip = oHelpMgr.getToolTip( "WhatsThis" ); 00226 m_wHelpBtn.whatsThis = oHelpMgr.getHelpString( "WhatsThis" ); 00227 wDlgBtnsLyt.addWidget( m_wHelpBtn, 0, 0 ); 00228 // --- Space 00229 wDlgBtnsLyt.setColStretch( 1, 1 ); 00230 // --- Accept button 00231 m_wAcceptBtn = new DzPushButton( wDlgBtnsGB ); 00232 m_wAcceptBtn.text = "&Render"; 00233 m_wAcceptBtn.minWidth = m_nMIN_BTN_WIDTH; 00234 m_wAcceptBtn.maxHeight = m_nMAX_BTN_HEIGHT; 00235 m_wDlg.setAcceptButton( m_wAcceptBtn ); 00236 m_wAcceptBtn.toolTip = oHelpMgr.getToolTip( "AcceptDialog" ); 00237 m_wAcceptBtn.whatsThis = "<b>Render:</b><br>" 00238 + "Click here to render the current scene to the RIB specified.<br><br>" 00239 + "Accepting this dialog will commit the affect of the settings in this dialog, and close it."; 00240 wDlgBtnsLyt.addWidget( m_wAcceptBtn, 0, 2 ); 00241 // --- Cancel button 00242 m_wCancelBtn = new DzPushButton( wDlgBtnsGB ); 00243 m_wCancelBtn.text = "&Cancel"; 00244 m_wCancelBtn.minWidth = m_nMIN_BTN_WIDTH; 00245 m_wCancelBtn.maxHeight = m_nMAX_BTN_HEIGHT; 00246 m_wDlg.setRejectButton( m_wCancelBtn ); 00247 m_wCancelBtn.toolTip = oHelpMgr.getToolTip( "CancelDialog" ); 00248 m_wCancelBtn.whatsThis = oHelpMgr.getHelpString( "CancelDialog" ); 00249 wDlgBtnsLyt.addWidget( m_wCancelBtn, 0, 3 ); 00250 00251 wDlgLayout.addMultiCellWidget( wDlgBtnsGB, 1, 1, 0, 2 ); 00252 // --------------------- 00253 // --- Options Page 00254 // --------------------- 00255 m_wOptionPage.whatsThis = oHelpMgr.getHelpString( "PresetOptionTab" ); 00256 m_wOptionPage.flat = true; 00257 m_wOptionPage.insideMargin = m_nMARGIN; 00258 m_wOptionPage.insideSpacing = m_nSPACING; 00259 // --- Path 00260 m_wPathGB.title = "Path:"; 00261 m_wPathGB.margin = m_nMARGIN; 00262 m_wPathGB.whatsThis = "<b>" + m_wPathGB.title + "</b><br>" 00263 + "This field allows you to specify the absolute path for the RIB file you would like to render to."; 00264 // --- Keep Shadows 00265 m_wKeepShadows.text = "Keep Shadows"; 00266 m_wKeepShadows.whatsThis = "<b>" + m_wKeepShadows.text + ":</b><br>" 00267 + "This option allows you to choose if you would like to keep the generated shadow map files."; 00268 // --- Collect 00269 m_wCollect.text = "Collect and Localize"; 00270 m_wCollect.whatsThis = "<b>" + m_wCollect.text + ":</b><br>" 00271 + "This option allows you to choose if you would like to collect all of the associated files and localize their paths in the RIB."; 00272 // Add the 'Options Page' widget to the tab stack 00273 m_wTabStack.addTab( m_wOptionPage, "Options" ); 00274 // --------------------- 00275 // --- Preferences Page 00276 // --------------------- 00277 m_wPrefsPage.whatsThis = oHelpMgr.getHelpString( "PresetPrefTab" ); 00278 m_wPrefsPage.flat = true; 00279 m_wPrefsPage.insideMargin = m_nMARGIN; 00280 m_wPrefsPage.insideSpacing = m_nSPACING; 00281 m_wPrefsGB.margin = m_nMARGIN; 00282 m_wPrefsGB.spacing = m_nSPACING; 00283 // --- Record on Execution CheckBox 00284 m_wRcrdOnExec.text = "Set Preferred Options on Accept"; 00285 m_wRcrdOnExec.whatsThis = oHelpMgr.getHelpString( "PresetPrefOnAccept" ); 00286 // --- Set Preferred Options Button 00287 m_wRcrdBtn = new DzPushButton( m_wPrefsGB ); 00288 m_wRcrdBtn.text = "&Set Preferred Options"; 00289 m_wRcrdBtn.whatsThis = oHelpMgr.getHelpString( "PresetSetPref" ); 00290 connect( m_wRcrdBtn, "pressed()", setOptions ); 00291 // --- Read Preferred Options Button 00292 m_wRdBtn = new DzPushButton( m_wPrefsGB ); 00293 m_wRdBtn.text = "&Read Preferred Options"; 00294 m_wRdBtn.whatsThis = oHelpMgr.getHelpString( "PresetReadPref" ); 00295 connect( m_wRdBtn, "pressed()", getOptions ); 00296 // --- Restore Default Options Button 00297 m_wDfltBtn = new DzPushButton( m_wPrefsGB ); 00298 m_wDfltBtn.text = "Restore &Default Options"; 00299 m_wDfltBtn.whatsThis = oHelpMgr.getHelpString( "PresetRestoreDef" ); 00300 connect( m_wDfltBtn, "pressed()", setDefaults ); 00301 // --- Notes 00302 var wNotesGB = new DzVGroupBox( m_wPrefsPage ); 00303 wNotesGB.title = "Notes :"; 00304 wNotesGB.margin = m_nMARGIN; 00305 wNotesGB.spacing = m_nSPACING; 00306 wNotesGB.minWidth = m_nNOTES_WIDTH; 00307 var wKeyLbl = new DzLabel( wNotesGB ); 00308 wKeyLbl.text = oHelpMgr.getHelpString( "PresetNotes" ); 00309 // Add the 'Preferences Page' widget to the tab stack 00310 m_wTabStack.addTab( m_wPrefsPage, "Preferences" ); 00311 // --------------------- 00312 // --- Polish 00313 // --------------------- 00314 m_wDlg.maxWidth = m_wDlg.minWidth; 00315 m_wDlg.maxHeight = m_wDlg.minHeight; 00316 // Get the users prefered options 00317 getOptions(); 00318 // If the dialog is not canceled 00319 if( m_wDlg.exec() ){ 00320 // If the 'Record on Execute' checkbox is checked, record the current options 00321 if( m_wRcrdOnExec.checked ){ setOptions(); } 00322 // Do... whatever it is that we do 00323 g_oActions.begin(); 00324 } 00325 } 00326 00327 /*********************************************************************/ 00328 // void : Method for running with the dialog hidden 00329 function doNoDialog(){ 00330 // Build the common portion of the dialog 00331 doCommon(); 00332 // If the user was holding the shift modifier, update the options from the ones recorded 00333 if( g_bSHIFT_PRESSED ){ getOptions(); } 00334 // Do... whatever it is that we do 00335 g_oActions.begin(); 00336 } 00337 00338 /*********************************************************************/ 00339 // void : Method for setting initial option values 00340 function setDefaults(){ 00341 // --- String Options 00342 m_wRibPath.text = g_sDEFAULT_RIB_PATH; 00343 // --- Boolean options 00344 m_wKeepShadows.checked = false; 00345 m_wCollect.checked = false; 00346 m_wRcrdOnExec.checked = false; 00347 } 00348 00349 /*********************************************************************/ 00350 // void : Method for retrieving options 00351 function getOptions(){ 00352 // Iterate over all boolean option objects 00353 for( var i = 0; i < m_aBoolObjs.length; i++ ){ 00354 // Set the 'current' boolean option to the recorded value 00355 m_aBoolObjs[ i ].checked = g_oSettings.get( g_sTOOL_KEY, m_aBoolNames[ i ], m_aBoolObjs[ i ].checked ); 00356 } 00357 // Iterate over all string option objects 00358 for( var i = 0; i < m_aStrObjs.length; i++ ){ 00359 // Set the 'current' string option to the recorded value 00360 m_aStrObjs[ i ].text = g_oSettings.get( g_sTOOL_KEY, m_aStrNames[ i ], m_aStrObjs[ i ].text ); 00361 } 00362 // Iterate over all combobox option objects 00363 for( var i = 0; i < m_aCmbObjs.length; i++ ){ 00364 // Get the recorded currentText value 00365 var tStr = g_oSettings.get( g_sTOOL_KEY, m_aCmbNames[ i ], m_aCmbObjs[ i ].currentText ); 00366 // Iterate over all combo box option objects 00367 for( var j = 0; j < m_aCmbObjs[ i ].count; j++ ){ 00368 // If the recorded value is valid 00369 if( m_aCmbObjs[ i ].text( j ) == tStr ){ 00370 // Set the currentItem string option to the recorded value 00371 m_aCmbObjs[ i ].currentItem = j; 00372 break; 00373 } 00374 } 00375 } 00376 } 00377 00378 /*********************************************************************/ 00379 // void : Method for recording options 00380 function setOptions(){ 00381 // Iterate over all boolean option objects 00382 for( var i = 0; i < m_aBoolObjs.length; i++ ){ 00383 // Record the current boolean option 00384 g_oSettings.set( g_sTOOL_KEY, m_aBoolNames[ i ], m_aBoolObjs[ i ].checked ); 00385 } 00386 // Iterate over all string option objects 00387 for( var i = 0; i < m_aStrObjs.length; i++ ){ 00388 // Record the current string option 00389 g_oSettings.set( g_sTOOL_KEY, m_aStrNames[ i ], m_aStrObjs[ i ].text ); 00390 } 00391 // Iterate over all combobox option objects 00392 for( var i = 0; i < m_aCmbObjs.length; i++ ){ 00393 // Record the currentText string option 00394 g_oSettings.set( g_sTOOL_KEY, m_aCmbNames[ i ], m_aCmbObjs[ i ].currentText ); 00395 } 00396 } 00397 00398 /*********************************************************************/ 00399 // String : Method for retrieving the path 00400 function getPath(){ return m_wRibPath.text; } 00401 00402 /*********************************************************************/ 00403 // Boolean : Method for retrieving the shadows option 00404 function getKeepShadows(){ return m_wKeepShadows.checked; } 00405 00406 /*********************************************************************/ 00407 // Boolean : Method for retrieving the collect option 00408 function getCollect(){ return m_wCollect.checked; } 00409 00410 /*********************************************************************/ 00411 // Boolean : Method for retrieving the record option 00412 function getRecord(){ return m_wRcrdOnExec.checked; } 00413 } 00414 00415 /*********************************************************************/ 00416 // DsActions - A class for performing various actions 00417 /*********************************************************************/ 00418 class DsActions{ 00419 /***************************** 00420 Class Members 00421 *****************************/ 00422 var m_sRibPath, m_sTmpRibPath; 00423 var m_bKeepShadows, m_bTmpShadows, m_bCollect, m_bTmpCollect, m_bRecord; 00424 var m_oProcess : DzProcess; 00425 00426 /*********************************************************************/ 00427 // void : Method to inform the user of errors 00428 function readFromStderr(){ 00429 MessageBox.critical( m_oProcess.readStderr(), "Process Error", "&OK" ); 00430 } 00431 00432 /*********************************************************************/ 00433 // void : Method to do whatever it is we do 00434 function begin(){ 00435 // Get the user options 00436 m_sRibPath = g_oGui.getPath(); 00437 m_bKeepShadows = g_oGui.getKeepShadows(); 00438 m_bCollect = g_oGui.getCollect(); 00439 m_bRecord = g_oGui.getRecord(); 00440 00441 // Create new file info for easy path operations 00442 var oFile = new DzFileInfo( m_sRibPath ); 00443 00444 // If the user didn't record preferred settings 00445 if( !m_bRecord ){ 00446 // Record any previous values 00447 m_sTmpRibPath = g_oSettings.get( g_sTOOL_KEY, g_sRIB_PATH_KEY, g_sDEFAULT_RIB_PATH ); 00448 m_bTmpShadows = g_oSettings.get( g_sTOOL_KEY, g_sKEEP_SHADOWS_KEY, false ); 00449 m_bTmpCollect = g_oSettings.get( g_sTOOL_KEY, g_sCOLLECT_ASSETS_KEY, false ); 00450 // Temporarily set the flags 00451 g_oSettings.set( g_sTOOL_KEY, g_sRIB_PATH_KEY, m_sRibPath ); 00452 g_oSettings.set( g_sTOOL_KEY, g_sKEEP_SHADOWS_KEY, m_bKeepShadows ); 00453 g_oSettings.set( g_sTOOL_KEY, g_sCOLLECT_ASSETS_KEY, m_bCollect ); 00454 } 00455 00456 // Set the flag used by DzDelightRenderer 00457 g_oSettings.set( g_sTOOL_KEY, "toRib", true ); 00458 // Do the "render" 00459 App.getRenderMgr().doRender(); 00460 // Set the flag used by DzDelightRenderer 00461 g_oSettings.set( g_sTOOL_KEY, "toRib", false ); 00462 00463 // If the user didn't record preferred settings 00464 if( !m_bRecord ){ 00465 // Restore to the previous values 00466 g_oSettings.set( g_sTOOL_KEY, g_sRIB_PATH_KEY, m_sTmpRibPath ); 00467 g_oSettings.set( g_sTOOL_KEY, g_sKEEP_SHADOWS_KEY, m_bTmpShadows ); 00468 g_oSettings.set( g_sTOOL_KEY, g_sCOLLECT_ASSETS_KEY, m_bTmpCollect ); 00469 } 00470 00471 // Let the user know we're busy 00472 setBusyCursor(); 00473 // If we're collecting assets and the path is valid 00474 if( m_bCollect && oFile.exists() ){ 00475 // Create a new dir 00476 var oDir = new DzDir( oFile.path() ); 00477 // Construct the name of a sub-directory to collect into 00478 var sCollectDir = String( "%1_collected" ).arg( oFile.baseName() ); 00479 // If the sub-directory is successfully created 00480 if( oDir.mkdir( sCollectDir ) ) 00481 // Change to the created directory 00482 oDir.cd( String( "%1/%2" ).arg( oDir.absPath() ).arg( sCollectDir ) ); 00483 00484 // Create a new process 00485 m_oProcess = new DzProcess; 00486 // Set the communication flags for the process 00487 m_oProcess.communication = m_oProcess.Stdin|m_oProcess.Stdout|m_oProcess.Stderr; 00488 // Set the working directory 00489 m_oProcess.workingDirectory = App.getUtilitiesPath(); 00490 // Connect to recieve error messages 00491 connect( m_oProcess, "readyReadStderr()", readFromStderr ); 00492 // Create an array to hold process args 00493 var aArgs = new Array; 00494 // Populate the args array 00495 aArgs.push( String( "%1/%2" ).arg( m_oProcess.workingDirectory ).arg( "ribdepends" ) ); 00496 aArgs.push( "-noinit" ); 00497 aArgs.push( "-package" ); 00498 aArgs.push( oDir.absPath() ); 00499 aArgs.push( oFile.absFileName() ); 00500 // Assign the args 00501 m_oProcess.arguments = aArgs; 00502 00503 // If starting the process fails 00504 if( !m_oProcess.start() ) 00505 // Inform the user 00506 MessageBox.critical( "Could not start the process.", "Fatal Error", "&OK" ); 00507 00508 // Wait for the process to exit; 00509 // Otherwise the script will complete and in so cleaning up, the process object 00510 // will be destroyed before said process can actually do anything 00511 while( m_oProcess.running ){} 00512 } 00513 // Let the user know we're done 00514 clearBusyCursor(); 00515 } 00516 } 00517 00518 /*********************************************************************/ 00519 // If the user was holding the CTRL modifier key launch the dialog, otherwise run without the dialog 00520 g_bCONTROL_PRESSED ? g_oGui.doDialog() : g_oGui.doNoDialog(); |