// =========================================================================== // 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 objFileOptions ( string $parent, string $action, string $initialSettings, string $resultCallback ) // // Description: // This script posts the obj file accessor options. // // 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. // $resultCallback - // This is the proc to be called with the result string. // resultCallback ( string $optionsString ) // // Returns: // 1 if successfull. // 0 otherwise. // { int $result; string $currentOptions; string $optionList[]; string $optionBreakDown[]; int $index; if ($action == "post") { setUITemplate -pushTemplate DefaultTemplate; setParent $parent; columnLayout -adjustableColumn true objMultiObjCol; radioButtonGrp -numberOfRadioButtons 2 -label "" -label1 (uiRes("m_objFileOptions.kSingleObject")) -label2 (uiRes("m_objFileOptions.kMultiObjects")) objMultiObjGrp ; checkBoxGrp -numberOfCheckBoxes 1 -label "" -label1 (uiRes("m_objFileOptions.kLegacyVertexOrder")) -annotation (uiRes("m_objFileOptions.kPsvVertexOrderAnnot")) objLegacyVtxOrderGrp; radioButtonGrp -edit -onCommand2 ("checkBoxGrp -edit -enable 1 objLegacyVtxOrderGrp") -offCommand2 ("checkBoxGrp -edit -enable 0 objLegacyVtxOrderGrp; checkBoxGrp -edit -value1 0 objLegacyVtxOrderGrp;") objMultiObjGrp; // 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] == "mo") { if ($optionBreakDown[1] =="0" ){ radioButtonGrp -edit -select 1 objMultiObjGrp; checkBoxGrp -edit -enable 0 objLegacyVtxOrderGrp; checkBoxGrp -edit -value1 0 objLegacyVtxOrderGrp; } else{ radioButtonGrp -edit -select 2 objMultiObjGrp; checkBoxGrp -edit -enable 1 objLegacyVtxOrderGrp; } continue ; } if ($optionBreakDown[0] == "lo") { if ($optionBreakDown[1] == "0") { checkBoxGrp -edit -value1 0 objLegacyVtxOrderGrp; } else { checkBoxGrp -edit -value1 1 objLegacyVtxOrderGrp; } } } // end for if ( !`checkBoxGrp -query -enable objLegacyVtxOrderGrp` ) { checkBoxGrp -edit -value1 0 objLegacyVtxOrderGrp; } } setUITemplate -popTemplate; $result = 1; } else if ($action == "query") { // Set MultiObj option if (`radioButtonGrp -query -select objMultiObjGrp` == 2) { $currentOptions = $currentOptions + "mo=1"; // Set KeepIndexOrder option if (`checkBoxGrp -query -value1 objLegacyVtxOrderGrp` == 1) { $currentOptions = $currentOptions + ";lo=1"; } else { $currentOptions = $currentOptions + ";lo=0"; } } else { $currentOptions = $currentOptions + "mo=0"; } eval($resultCallback+" \""+$currentOptions+"\""); $result = 1; } else { $result = 0; } return $result; }