home *** CD-ROM | disk | FTP | other *** search
- // this script posts the lta world importer file translator options.
- // the optionsString is of the form:
- // varName1=value1;varName2=value2;...
- //
- // parameters:
- // $parent - the elf parent layout for this options layout.
- // it is always a scrollLayout.
- // $action - the action that is to be performed with this invokation
- // of this proc. valid actions are:
- // "query" - construct the options string and pass
- // it to the resultCallback.
- // "post" - post all the elf controls.
- // $initialSettings - the current options string in effect at the
- // time this script is invoked.
- // $resultCallback - this is the proc to be called with the result
- // string. resultCallback( string $optionsString )
- //
- // returns:
- // 1 if successful
- // 0 on failure
-
- global proc LithTechWorldImportGetPath( string $buttonPath, string $dirPath, string $notUsed )
- {
- textFieldButtonGrp -edit -fileName $dirPath $buttonPath;
- }
-
- global proc LithTechWorldImportUpdateControls()
- {
- int $useTexInfo = `checkBox -query -value useTexInfo`;
- textFieldButtonGrp -edit -enable $useTexInfo baseTexPath;
- radioButtonGrp -edit -enable $useTexInfo importTexTga;
-
- int $prefabs = `checkBox -query -value prefabs`;
- textFieldButtonGrp -edit -enable $prefabs projectPath;
- }
-
- global proc int LithTechWorldImportOptions ( string $parent, string $action, string $initialSettings, string $resultCallback )
- {
- int $result = 0;
-
- if( $action == "post" )
- {
- setParent $parent;
-
- columnLayout -adjustableColumn true mainLayout;
- floatFieldGrp -label "Scale:" -value1 1.0 -precision 3 scale;
- checkBox -label "Import Objects" -align "left" -value off objects;
- checkBox -label "Use LithTech Texture Information" -align "left" -value on -changeCommand "LithTechWorldImportUpdateControls" useTexInfo;
- radioButtonGrp -numberOfRadioButtons 2 -labelArray2 "DTX" "TGA" -select 2 importTexTga;
- string $texPathCtl = `textFieldButtonGrp -label "Base Texture Path:" -fileName "" -buttonLabel "..." baseTexPath`;
- string $texPathButtonCmd = ( "fileBrowserDialog -m 4 -an \"\" -fc \"LithTechWorldImportGetPath " + $texPathCtl + "\"" );
- textFieldButtonGrp -edit -buttonCommand $texPathButtonCmd baseTexPath;
- checkBox -label "Import Prefabs as References" -align "left" -value on -changeCommand "LithTechWorldImportUpdateControls" prefabs;
- string $projectPathCtl = `textFieldButtonGrp -label "Project Path:" -fileName "" -buttonLabel "..." projectPath`;
- string $projectPathButtonCmd = ( "fileBrowserDialog -m 4 -an \"\" -fc \"LithTechWorldImportGetPath " + $projectPathCtl + "\"" );
- textFieldButtonGrp -edit -buttonCommand $projectPathButtonCmd projectPath;
-
- // now set the current settings
- string $currentOptions = $initialSettings;
- string $optionList[];
- string $optionBreakDown[];
- int $index;
-
- if( size( $currentOptions ) > 0 )
- {
- tokenize( $currentOptions, ";", $optionList );
-
- for( $index = 0; $index < size($optionList); $index++ )
- {
- tokenize( $optionList[$index], "=", $optionBreakDown );
-
- if( $optionBreakDown[0] == "useTexInfo" )
- {
- int $optionIntValue = $optionBreakDown[1];
- checkBox -edit -value $optionIntValue useTexInfo;
- }
- else if( $optionBreakDown[0] == "objects" )
- {
- int $optionIntValue = $optionBreakDown[1];
- checkBox -edit -value $optionIntValue objects;
- }
- else if( $optionBreakDown[0] == "baseTexPath" )
- {
- textFieldButtonGrp -edit -fileName $optionBreakDown[1] baseTexPath;
- }
- else if( $optionBreakDown[0] == "scale" )
- {
- float $optionFloatValue = $optionBreakDown[1];
- floatFieldGrp -edit -value1 $optionFloatValue scale;
- }
- else if( $optionBreakDown[0] == "importTexDtx" )
- {
- int $optionIntValue = $optionBreakDown[1];
- radioButtonGrp -edit -select 1 importTexTga;
- }
- else if( $optionBreakDown[0] == "prefabs" )
- {
- int $optionIntValue = $optionBreakDown[1];
- checkBox -edit -value $optionIntValue prefabs;
- }
- else if( $optionBreakDown[0] == "projectPath" )
- {
- textFieldButtonGrp -edit -fileName $optionBreakDown[1] projectPath;
- }
- }
- }
-
- LithTechWorldImportUpdateControls;
-
- $result = 1;
- }
- else if( $action == "query" )
- {
- string $currentOptions;
-
- int $importTexDtxValue = `radioButtonGrp -query -select importTexTga`;
-
- $currentOptions += ( "objects=" + `checkBox -query -value objects` );
- $currentOptions += ( ";useTexInfo=" + `checkBox -query -value useTexInfo` );
- $currentOptions += ( ";baseTexPath=" + `textFieldButtonGrp -query -fileName baseTexPath` );
- $currentOptions += ( ";scale=" + `floatFieldGrp -query -value1 scale` );
- $currentOptions += ( ";importTexDtx=" + ($importTexDtxValue == 1) );
- $currentOptions += ( ";prefabs=" + `checkBox -query -value prefabs` );
- $currentOptions += ( ";projectPath=" + `textFieldButtonGrp -query -fileName projectPath` );
- eval( $resultCallback + " \"" + $currentOptions + "\"" );
-
- $result = 1;
- }
-
- return $result;
- }
-