eggImportOptions.mel 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. global proc int eggImportOptions ( string $parent,
  2. string $action,
  3. string $initialSettings,
  4. string $resultCallback )
  5. //
  6. // Description:
  7. // This script posts the OBJ file translator options.
  8. // The optionsString is of the form:
  9. // varName1=value1;varName2=value2;...
  10. //
  11. // Parameters:
  12. // $parent - the elf parent layout for this options layout. It is
  13. // always a scrollLayout.
  14. // $action - the action that is to be performed with this invokation
  15. // of this proc. Valid options are:
  16. // "query" - construct the options string and pass it
  17. // to the resultCallback.
  18. // "post" - post all the elf controls.
  19. // $initialSettings - the current options string in effect at the
  20. // time this script is invoked.
  21. // $resultCallback -
  22. // This is the proc to be called with the result string.
  23. // resultCallback ( string $optionsString )
  24. //
  25. // Returns:
  26. // 1 if successfull.
  27. // 0 otherwise.
  28. //
  29. {
  30. int $bResult;
  31. string $currentOptions;
  32. string $optionList[];
  33. string $optionBreakDown[];
  34. int $index;
  35. if ($action == "post") {
  36. setParent $parent;
  37. columnLayout -adj true objTypeCol;
  38. radioButtonGrp
  39. -l "Merge with Current Scene"
  40. -nrb 2 -cw3 175 75 75
  41. -la2 "On" "Off" objMerge;
  42. radioButtonGrp
  43. -l "Import Model"
  44. -nrb 2 -cw3 175 75 75
  45. -la2 "On" "Off" objModel;
  46. radioButtonGrp
  47. -l "Import Animation"
  48. -nrb 2 -cw3 175 75 75
  49. -la2 "On" "Off" objAnim;
  50. $currentOptions = $initialSettings;
  51. if (size($currentOptions) > 0) {
  52. tokenize($currentOptions, ";", $optionList);
  53. for ($index = 0; $index < size($optionList); $index++) {
  54. tokenize($optionList[$index], "=", $optionBreakDown);
  55. if ($optionBreakDown[0] == "merge") {
  56. if ($optionBreakDown[1] == "0") {
  57. radioButtonGrp -e -sl 2 objMerge;
  58. } else {
  59. radioButtonGrp -e -sl 1 objMerge;
  60. }
  61. } else if ($optionBreakDown[0] == "model") {
  62. if ($optionBreakDown[1] == "0") {
  63. radioButtonGrp -e -sl 2 objModel;
  64. } else {
  65. radioButtonGrp -e -sl 1 objModel;
  66. }
  67. } else if ($optionBreakDown[0] == "anim") {
  68. if ($optionBreakDown[1] == "0") {
  69. radioButtonGrp -e -sl 2 objAnim;
  70. } else {
  71. radioButtonGrp -e -sl 1 objAnim;
  72. }
  73. }
  74. }
  75. }
  76. $result = 1;
  77. } else if ($action == "query") {
  78. if (`radioButtonGrp -q -sl objMerge` == 1) {
  79. $currentOptions = $currentOptions + "merge=1";
  80. } else {
  81. $currentOptions = $currentOptions + "merge=0";
  82. }
  83. if (`radioButtonGrp -q -sl objModel` == 1) {
  84. $currentOptions = $currentOptions + ";model=1";
  85. } else {
  86. $currentOptions = $currentOptions + ";model=0";
  87. }
  88. if (`radioButtonGrp -q -sl objAnim` == 1) {
  89. $currentOptions = $currentOptions + ";anim=1";
  90. } else {
  91. $currentOptions = $currentOptions + ";anim=0";
  92. }
  93. eval($resultCallback+" \""+$currentOptions+"\"");
  94. $result = 1;
  95. } else {
  96. $bResult = 0;
  97. }
  98. return $bResult;
  99. }