// =========================================================================== // 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 studioTransOptions ( string $parent, string $action, string $initialOptions, string $resultCallback ) // // Description: // This script posts the Studio Packet 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; int $value; string $AxisOption = "Axis"; string $RayTraceOption = "Raytrace"; string $UseCamerasOption = "useCameras"; string $UseLightsOption = "useLights"; string $ShellToPolyOption = "shellToPoly"; if ($action == "post") { setUITemplate -pushTemplate DefaultTemplate; setParent $parent; radioButtonGrp -label (uiRes("m_studioTransOptions.kUpAxis")) -nrb 3 -labelArray3 (uiRes("m_studioTransOptions.kY")) (uiRes("m_studioTransOptions.kZ")) (uiRes("m_studioTransOptions.kFromFile")) -sl 1 spfAxisGrpBox; checkBoxGrp -label (uiRes("m_studioTransOptions.kRaytrace")) -ncb 1 spfRaytraceChkBox; checkBoxGrp -label (uiRes("m_studioTransOptions.kIncludeCameras")) -ncb 1 spfUseCamerasChkBox; checkBoxGrp -label (uiRes("m_studioTransOptions.kIncludeLights")) -ncb 1 spfUseLightsChkBox; // checkBoxGrp // -l "Convert Nurbs Shell To Polygons:" // -ncb 1 // spfShellToPolyChkBox; // Now set to current settings. // $currentOptions = $initialOptions; if (size($currentOptions) > 0) { tokenize($currentOptions, ";", $optionList); for ($index = 0; $index < size($optionList); $index++) { tokenize($optionList[$index], "=", $optionBreakDown); if ($optionBreakDown[0] == $AxisOption ) { $value = int( $optionBreakDown[1] ); if ($value == 0) { radioButtonGrp -e -sl 1 spfAxisGrpBox; } else if ($value == 1) { radioButtonGrp -e -sl 2 spfAxisGrpBox; } else { radioButtonGrp -e -sl 3 spfAxisGrpBox; } } else if ($optionBreakDown[0] == $RayTraceOption) { $value = int( $optionBreakDown[1] ); if ($value == 1) { checkBoxGrp -e -v1 1 spfRaytraceChkBox; } } else if ($optionBreakDown[0] == $UseCamerasOption) { $value = int( $optionBreakDown[1] ); if ($value == 1) { checkBoxGrp -e -v1 1 spfUseCamerasChkBox; } } else if ($optionBreakDown[0] == $UseLightsOption) { $value = int( $optionBreakDown[1] ); if ($value == 1) { checkBoxGrp -e -v1 1 spfUseLightsChkBox; } // } else if ($optionBreakDown[0] == $ShellToPolyOption) { // $value = int( $optionBreakDown[1] ); // if ($value == 1) { // checkBoxGrp -e -v1 1 spfShellToPolyChkBox; // } } } } setUITemplate -popTemplate; $result = 1; } else if ($action == "query") { $value = `radioButtonGrp -q -sl spfAxisGrpBox` - 1; $currentOptions = $currentOptions + $AxisOption + "=" + $value; $value = `checkBoxGrp -q -v1 spfRaytraceChkBox`; $currentOptions = $currentOptions + ";" + $RayTraceOption + "=" + $value; $value = `checkBoxGrp -q -v1 spfUseCamerasChkBox`; $currentOptions = $currentOptions + ";" + $UseCamerasOption + "=" + $value; $value = `checkBoxGrp -q -v1 spfUseLightsChkBox`; $currentOptions = $currentOptions + ";" + $UseLightsOption + "=" + $value; // $value = `checkBoxGrp -q -v1 spfShellToPolyChkBox`; // $currentOptions = $currentOptions + ";" + $ShellToPolyOption + "=" + $value; eval($resultCallback+" \""+$currentOptions+"\""); $result = 1; } else { $result = 0; } return $result; }