Skip to content

Instantly share code, notes, and snippets.

@glued
Last active August 29, 2015 14:25
Show Gist options
  • Save glued/497948ca4a07bce60a65 to your computer and use it in GitHub Desktop.
Save glued/497948ca4a07bce60a65 to your computer and use it in GitHub Desktop.
Maya exporter mel script modified because it doesnt save settings
// ThreeJsExportScript.mel
// Author: Sean Griffin
// Email: sean@thoughtbot.com
global proc int ThreeJsExportScript(string $parent, string $action, string $settings, string $callback)
{
if ($action == "post")
{
setParent $parent;
columnLayout -adj true;
frameLayout -cll true -cl false -bv true -bs "etchedIn" -l "General Export Options";
columnLayout -adj true;
checkBox -v true -l "Vertices" vertsCb;
checkBox -v true -l "Faces" facesCb;
checkBox -v true -l "Normals" normalsCb;
checkBox -v false -l "UVs" uvsCb;
checkBox -v false -l "Colors" colorsCb;
checkBox
-v false
-l "Bones"
-onc "textField -e -en true maxInfluencesText;"
-ofc "textField -e -en false maxInfluencesText;"
bonesCb;
textFieldGrp -tx 4 -label "Max Influences Per Vertex" maxInfluencesText;
setParent ..; // columnLayout
setParent ..; // frameLayout
frameLayout -cll true -cl false -bv true -bs "etchedIn" -l "Skinning Options";
columnLayout -adj true;
checkBox -v true -l "Material Indices" materialsCb;
checkBox -v false -l "Diffuse Maps" diffuseMapsCb;
checkBox -v false -l "Specular Maps" specularMapsCb;
checkBox -v false -l "Bump Maps" bumpMapsCb;
checkBox -v false -l "Copy Texture Files to Target Directory" copyTexturesCb;
setParent ..; // columnLayout
setParent ..; // frameLayout
frameLayout -cll true -cl false -bv true -bs "etchedIn" -l "Animation Options";
columnLayout -adj true;
checkBox -v true -l "Export Animations" animCb;
checkBox
-v true
-l "Bake Animation"
-onc "textField -e -en true startText; textField -e -en true endText; textField -e -en true stepText;"
-ofc "textField -e -en false startText; textField -e -en false endText; textField -e -en false stepText;"
bakeAnimCb;
textField -en true -tx `playbackOptions -minTime true -q` -ann "Start" startText;
textField -en true -tx `playbackOptions -maxTime true -q` -ann "End" endText;
textField -en true -tx 1 -ann "Step" stepText;
setParent ..; // columnLayout
setParent ..; // frameLayout
frameLayout -cll true -cl false -bv true -bs "etchedIn" -l "Debug Options";
columnLayout -adj true;
checkBox -v false -l "Pretty Output" prettyOutputCb;
setParent ..; // columnLayout
setParent ..; // frameLayout
}
else if ($action == "query")
{
string $option = "\"";
if (`checkBox -q -v vertsCb`)
$option += "vertices ";
if (`checkBox -q -v facesCb`)
$option += "faces ";
if (`checkBox -q -v normalsCb`)
$option += "normals ";
if (`checkBox -q -v uvsCb`)
$option += "uvs ";
if (`checkBox -q -v materialsCb`)
$option += "materials ";
if (`checkBox -q -v diffuseMapsCb`)
$option += "diffuseMaps ";
if (`checkBox -q -v specularMapsCb`)
$option += "specularMaps ";
if (`checkBox -q -v bumpMapsCb`)
$option += "bumpMaps ";
if (`checkBox -q -v copyTexturesCb`)
$option += "copyTexturesMaps ";
if (`checkBox -q -v colorsCb`)
$option += "colors ";
if (`checkBox -q -v bonesCb`)
{
$option += "bones ";
$option += `textFieldGrp -q -tx maxInfluencesText`;
$option += " ";
}
if (`checkBox -q -v animCb`)
$option += "skeletalAnim ";
if (`checkBox -q -v bakeAnimCb`)
{
$option += "bakeAnimations ";
$option += `textField -q -tx startText`;
$option += " ";
$option += `textField -q -tx endText`;
$option += " ";
$option += `textField -q -tx stepText`;
$option += " ";
}
if (`checkBox -q -v prettyOutputCb`)
$option += "prettyOutput ";
$option += "\"";
eval($callback + $option);
}
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment