ThreeJsExportScript.mel 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // ThreeJsExportScript.mel
  2. // Author: Sean Griffin
  3. // Email: [email protected]
  4. global proc int ThreeJsExportScript(string $parent, string $action, string $settings, string $callback)
  5. {
  6. if ($action == "post")
  7. {
  8. setParent $parent;
  9. columnLayout -adj true;
  10. frameLayout -cll true -cl false -bv true -l "General Export Options";
  11. columnLayout -adj true;
  12. checkBox -v true -l "Vertices" vertsCb;
  13. checkBox -v true -l "Faces" facesCb;
  14. checkBox -v true -l "Normals" normalsCb;
  15. checkBox -v true -l "UVs" uvsCb;
  16. checkBox -v false -l "Colors" colorsCb;
  17. setParent ..; // columnLayout
  18. setParent ..; // frameLayout
  19. frameLayout -cll true -cl false -bv true -l "Skinning Options";
  20. columnLayout -adj true;
  21. checkBox -v true -l "Material Indices" materialsCb;
  22. checkBox -v true -l "Color Maps" colorMapsCb;
  23. checkBox -v true -l "Specular Maps" specularMapsCb;
  24. checkBox -v true -l "Bump Maps" bumpMapsCb;
  25. checkBox -v true -l "Copy Texture Files to Target Directory" copyTexturesCb;
  26. setParent ..; // columnLayout
  27. setParent ..; // frameLayout
  28. frameLayout -cll true -cl false -bv true -l "Animation Options";
  29. columnLayout -adj true;
  30. checkBox
  31. -v true
  32. -l "Bones"
  33. -onc "textField -e -en true maxInfluencesText;"
  34. -ofc "textField -e -en false maxInfluencesText;"
  35. bonesCb;
  36. textFieldGrp -tx 4 -label "Max Influences Per Vertex" maxInfluencesText;
  37. checkBox -v true -l "Export Animations" animCb;
  38. checkBox
  39. -v false
  40. -l "Bake Animation"
  41. -onc "textField -e -en true startText; textField -e -en true endText; textField -e -en true stepText;"
  42. -ofc "textField -e -en false startText; textField -e -en false endText; textField -e -en false stepText;"
  43. bakeAnimCb;
  44. textField -en false -tx `playbackOptions -minTime true -q` -ann "Start" startText;
  45. textField -en false -tx `playbackOptions -maxTime true -q` -ann "End" endText;
  46. textField -en false -tx 1 -ann "Step" stepText;
  47. text -label "NOTE: Animation data is only included in Export All.";
  48. setParent ..; // columnLayout
  49. setParent ..; // frameLayout
  50. frameLayout -cll true -cl false -bv true -l "Debug Options";
  51. columnLayout -adj true;
  52. checkBox -v true -l "Pretty Output" prettyOutputCb;
  53. setParent ..; // columnLayout
  54. setParent ..; // frameLayout
  55. }
  56. else if ($action == "query")
  57. {
  58. string $option = "\"";
  59. if (`checkBox -q -v vertsCb`)
  60. $option += "vertices ";
  61. if (`checkBox -q -v facesCb`)
  62. $option += "faces ";
  63. if (`checkBox -q -v normalsCb`)
  64. $option += "normals ";
  65. if (`checkBox -q -v uvsCb`)
  66. $option += "uvs ";
  67. if (`checkBox -q -v materialsCb`)
  68. $option += "materials ";
  69. if (`checkBox -q -v colorMapsCb`)
  70. $option += "colorMaps ";
  71. if (`checkBox -q -v specularMapsCb`)
  72. $option += "specularMaps ";
  73. if (`checkBox -q -v bumpMapsCb`)
  74. $option += "bumpMaps ";
  75. if (`checkBox -q -v copyTexturesCb`)
  76. $option += "copyTexturesMaps ";
  77. if (`checkBox -q -v colorsCb`)
  78. $option += "colors ";
  79. if (`checkBox -q -v bonesCb`)
  80. {
  81. $option += "bones ";
  82. $option += `textFieldGrp -q -tx maxInfluencesText`;
  83. $option += " ";
  84. }
  85. if (`checkBox -q -v animCb`)
  86. $option += "skeletalAnim ";
  87. if (`checkBox -q -v bakeAnimCb`)
  88. {
  89. $option += "bakeAnimations ";
  90. $option += `textField -q -tx startText`;
  91. $option += " ";
  92. $option += `textField -q -tx endText`;
  93. $option += " ";
  94. $option += `textField -q -tx stepText`;
  95. $option += " ";
  96. }
  97. if (`checkBox -q -v prettyOutputCb`)
  98. $option += "prettyOutput ";
  99. $option += "\"";
  100. eval($callback + $option);
  101. }
  102. return 1;
  103. }