| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- global proc int eggImportOptions ( string $parent,
- string $action,
- string $initialSettings,
- string $resultCallback )
- //
- // Description:
- // This script posts the OBJ 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 options 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 successfull.
- // 0 otherwise.
- //
- {
- int $bResult;
- string $currentOptions;
- string $optionList[];
- string $optionBreakDown[];
- int $index;
- if ($action == "post") {
- setParent $parent;
- columnLayout -adj true objTypeCol;
- radioButtonGrp
- -l "Merge with Current Scene"
- -nrb 2 -cw3 175 75 75
- -la2 "On" "Off" objMerge;
- radioButtonGrp
- -l "Import Model"
- -nrb 2 -cw3 175 75 75
- -la2 "On" "Off" objModel;
- radioButtonGrp
- -l "Import Animation"
- -nrb 2 -cw3 175 75 75
- -la2 "On" "Off" objAnim;
-
- $currentOptions = $initialSettings;
- if (size($currentOptions) > 0) {
- tokenize($currentOptions, ";", $optionList);
- for ($index = 0; $index < size($optionList); $index++) {
- tokenize($optionList[$index], "=", $optionBreakDown);
- if ($optionBreakDown[0] == "merge") {
- if ($optionBreakDown[1] == "0") {
- radioButtonGrp -e -sl 2 objMerge;
- } else {
- radioButtonGrp -e -sl 1 objMerge;
- }
- } else if ($optionBreakDown[0] == "model") {
- if ($optionBreakDown[1] == "0") {
- radioButtonGrp -e -sl 2 objModel;
- } else {
- radioButtonGrp -e -sl 1 objModel;
- }
- } else if ($optionBreakDown[0] == "anim") {
- if ($optionBreakDown[1] == "0") {
- radioButtonGrp -e -sl 2 objAnim;
- } else {
- radioButtonGrp -e -sl 1 objAnim;
- }
- }
- }
- }
- $result = 1;
-
- } else if ($action == "query") {
- if (`radioButtonGrp -q -sl objMerge` == 1) {
- $currentOptions = $currentOptions + "merge=1";
- } else {
- $currentOptions = $currentOptions + "merge=0";
- }
- if (`radioButtonGrp -q -sl objModel` == 1) {
- $currentOptions = $currentOptions + ";model=1";
- } else {
- $currentOptions = $currentOptions + ";model=0";
- }
- if (`radioButtonGrp -q -sl objAnim` == 1) {
- $currentOptions = $currentOptions + ";anim=1";
- } else {
- $currentOptions = $currentOptions + ";anim=0";
- }
- eval($resultCallback+" \""+$currentOptions+"\"");
- $result = 1;
- } else {
- $bResult = 0;
- }
-
- return $bResult;
- }
|