// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== global proc int objExportOptions ( 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; string $on = (uiRes("m_objExportOptions.kOn")); string $off = (uiRes("m_objExportOptions.kOff")); radioButtonGrp -label (uiRes("m_objExportOptions.kGroups")) -nrb 2 -cw3 175 75 75 -labelArray2 $on $off objGroups; radioButtonGrp -label (uiRes("m_objExportOptions.kPointGroups")) -nrb 2 -cw3 175 75 75 -labelArray2 $on $off objPtGroups; radioButtonGrp -label (uiRes("m_objExportOptions.kMaterials")) -nrb 2 -cw3 175 75 75 -labelArray2 $on $off objMaterials; radioButtonGrp -label (uiRes("m_objExportOptions.kSmoothing")) -nrb 2 -cw3 175 75 75 -labelArray2 $on $off objSmoothing; radioButtonGrp -label (uiRes("m_objExportOptions.kNormals")) -nrb 2 -cw3 175 75 75 -labelArray2 $on $off objNormals; // Now set to current settings. $currentOptions = $initialSettings; if (size($currentOptions) > 0) { tokenize($currentOptions, ";", $optionList); for ($index = 0; $index < size($optionList); $index++) { tokenize($optionList[$index], "=", $optionBreakDown); if ($optionBreakDown[0] == "groups") { if ($optionBreakDown[1] == "0") { radioButtonGrp -e -sl 2 objGroups; } else { radioButtonGrp -e -sl 1 objGroups; } } else if ($optionBreakDown[0] == "ptgroups") { if ($optionBreakDown[1] == "0") { radioButtonGrp -e -sl 2 objPtGroups; } else { radioButtonGrp -e -sl 1 objPtGroups; } } else if ($optionBreakDown[0] == "materials") { if ($optionBreakDown[1] == "0") { radioButtonGrp -e -sl 2 objMaterials; } else { radioButtonGrp -e -sl 1 objMaterials; } } else if ($optionBreakDown[0] == "smoothing") { if ($optionBreakDown[1] == "0") { radioButtonGrp -e -sl 2 objSmoothing; } else { radioButtonGrp -e -sl 1 objSmoothing; } } else if ($optionBreakDown[0] == "normals") { if ($optionBreakDown[1] == "0") { radioButtonGrp -e -sl 2 objNormals; } else { radioButtonGrp -e -sl 1 objNormals; } } } } $result = 1; } else if ($action == "query") { if (`radioButtonGrp -q -sl objGroups` == 1) { $currentOptions = $currentOptions + "groups=1"; } else { $currentOptions = $currentOptions + "groups=0"; } if (`radioButtonGrp -q -sl objPtGroups` == 1) { $currentOptions = $currentOptions + ";ptgroups=1"; } else { $currentOptions = $currentOptions + ";ptgroups=0"; } if (`radioButtonGrp -q -sl objMaterials` == 1) { $currentOptions = $currentOptions + ";materials=1"; } else { $currentOptions = $currentOptions + ";materials=0"; } if (`radioButtonGrp -q -sl objSmoothing` == 1) { $currentOptions = $currentOptions + ";smoothing=1"; } else { $currentOptions = $currentOptions + ";smoothing=0"; } if (`radioButtonGrp -q -sl objNormals` == 1) { $currentOptions = $currentOptions + ";normals=1"; } else { $currentOptions = $currentOptions + ";normals=0"; } eval($resultCallback+" \""+$currentOptions+"\""); $result = 1; } else { $bResult = 0; } return $bResult; }