Guest User

Untitled

a guest
Jul 16th, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.60 KB | None | 0 0
  1. /**
  2. * Copyright L. Spiro 2009
  3. * All rights reserved.
  4. *
  5. * Written by: Shawn (L. Spiro) Wilcoxen
  6. *
  7. * This code may not be sold or traded for any personal gain without express written consent. You may use
  8. * this code in your own projects and modify it to suit your needs as long as this disclaimer remains intact.
  9. * You may not take credit for having written this code.
  10. * If you wish to use this code in a commercial product contact yogurtemperor@hotmail.com.
  11. *
  12. * Description: Add options to the exporter.
  13. */
  14.  
  15.  
  16. global proc int LSpiroModelsOptions( string $parent,
  17. string $action,
  18. string $initialSettings,
  19. string $resultCallback ) {
  20.  
  21. // Return value.
  22. int $bResult = 1;
  23.  
  24. // For parsing the options strings.
  25. string $currentOptions;
  26. string $optionList[];
  27. string $optionBreakDown[];
  28.  
  29. if ( $action == "post" ) {
  30. setParent $parent;
  31. columnLayout -adj true lsmTypeCol;
  32. string $modelOnly = (uiRes("m_LSpiroModelsOptions.kModelOnly"));
  33. string $modelAndAnims = (uiRes("m_LSpiroModelsOptions.kModelAndAnims"));
  34. string $animsOnly = (uiRes("m_LSpiroModelsOptions.kAnimOnly"));
  35.  
  36. radioButtonGrp
  37. -label (uiRes("m_LSpiroModelsOptions.kAnims"))
  38. -nrb 3 -cw4 175 95 95 95
  39. -labelArray3 $modelAndAnims $modelOnly $animsOnly lsmAnims;
  40.  
  41. // Current settings.
  42. $currentOptions = $initialSettings;
  43. if ( size( $currentOptions ) > 0 ) {
  44. tokenize( $currentOptions, ";", $optionList );
  45. for ( $index = 0; $index < size( $optionList ); $index++ ) {
  46. tokenize( $optionList[$index], "=", $optionBreakDown );
  47.  
  48. if ( $optionBreakDown[0] == "anims" ) {
  49. if ( $optionBreakDown[1] == "0" ) {
  50. radioButtonGrp -e -sl 1 lsmAnims;
  51. }
  52. if ( $optionBreakDown[1] == "1" ) {
  53. radioButtonGrp -e -sl 2 lsmAnims;
  54. }
  55. else {
  56. radioButtonGrp -e -sl 3 lsmAnims;
  57. }
  58. }
  59. }
  60. }
  61. $result = 1;
  62. }
  63. else if ( $action == "query" ) {
  64. if ( `radioButtonGrp -q -sl lsmAnims` == 1 ) {
  65. $currentOptions = $currentOptions + "anims=0";
  66. }
  67. else if ( `radioButtonGrp -q -sl lsmAnims` == 2 ) {
  68. $currentOptions = $currentOptions + "anims=1";
  69. }
  70. else {
  71. $currentOptions = $currentOptions + "anims=2";
  72. }
  73. eval( $resultCallback + " \"" + $currentOptions + "\"" );
  74. $result = 1;
  75. }
  76.  
  77. return $bResult;
  78. }
  79.  
  80.  
  81.  
  82.  
  83.  
  84. // REGISTERED WITH:
  85. // Register the translator with the system.
  86. mStatus = mpPlugin.registerFileTranslator( "L. Spiro Models",
  87. "",
  88. MPI_CharExport::creator,
  89. "LSpiroModelsOptions",
  90. "anims=1;" );
  91.  
  92.  
  93. // Radio boxes are always unchecked when the dialog first appears.
  94. // The default "anims=1" seems to do nothing.
Add Comment
Please, Sign In to add comment