📄 ogreexporter.mel
字号:
global proc UpdateGUI()
{
// mesh controls
string $xml_val = `checkBox -query -v meshExportXML`;
if($xml_val == "1")
{
checkBox -edit -en true meshBoneAssign;
checkBox -edit -en true meshNormals;
checkBox -edit -en true meshDiffuseColor;
checkBox -edit -en true meshTexCoords;
checkBox -edit -en true meshSub;
checkBox -edit -en true meshBinary;
}
else
{
checkBox -edit -en false meshBoneAssign;
checkBox -edit -en false meshNormals;
checkBox -edit -en false meshDiffuseColor;
checkBox -edit -en false meshTexCoords;
checkBox -edit -en false meshSub;
checkBox -edit -en false meshBinary;
}
// material controls
//string $mat_val = `checkBox -query -v materialExport`;
//if($mat_val == "1")
//{
// text -edit -en true materialLbl;
// textField -edit -en true materialTxt;
//}
//else
//{
// text -edit -en false materialLbl;
// textField -edit -en false materialTxt;
//}
// animation controls
string $anim_val = `checkBox -query -v animExport`;
if($anim_val == "1")
{
checkBox -edit -en true animBinary;
checkBox -edit -en true animAnims;
}
else
{
checkBox -edit -en false animBinary;
checkBox -edit -en false animAnims;
}
string $anim_in_val = `checkBox -query -v animAnims`;
string $anim_val = `checkBox -query -en animAnims`;
if($anim_val == "1" && $anim_in_val == "1")
{
text -edit -en true animDefsLbl;
textScrollList -edit -en true animDefLst;
text -edit -en true animAddLbl;
text -edit -en true animNameLbl;
textField -edit -en true animNameTxt;
text -edit -en true animStart;
textField -edit -en true animStartTxt;
text -edit -en true animEnd;
textField -edit -en true animEndTxt;
text -edit -en true animSkip;
textField -edit -en true animSkipTxt;
button -edit -en true animBttn;
}
else
{
text -edit -en false animDefsLbl;
textScrollList -edit -en false animDefLst;
text -edit -en false animAddLbl;
text -edit -en false animNameLbl;
textField -edit -en false animNameTxt;
text -edit -en false animStart;
textField -edit -en false animStartTxt;
text -edit -en false animEnd;
textField -edit -en false animEndTxt;
text -edit -en false animSkip;
textField -edit -en false animSkipTxt;
button -edit -en false animBttn;
}
}
global proc AddAnim()
{
string $name = `textField -query -text animNameTxt`;
if($name != "")
{
int $num_items = `textScrollList -query -numberOfItems animDefLst`;
int $i;
for($i = 0; $i < $num_items; $i++)
{
int $s = $i + 1;
textScrollList -edit -sii $s animDefLst;
string $anims[] = `textScrollList -query -si animDefLst`;
string $buffer[];
tokenize $anims[$i] "\" " $buffer;
int $compare = `strcmp $name $buffer[0]`;
if($compare == 0)
{
textScrollList -edit -da animDefLst;
textScrollList -edit -da animDefLst;
error -sl false "Animation name has to be unique";
}
}
string $step_val = `textField -query -text animSkipTxt`;
string $start_val = `textField -query -text animStartTxt`;
string $end_val = `textField -query -text animEndTxt`;
if($step_val == "")
error -sl false "Step value cannot be Zero";
string $new_anim = "\"" + $name + " " + $start_val + " " + $end_val + " " + $step_val + "\"";
textScrollList -edit -append $new_anim -da animDefLst;
textField -edit -text "" animNameTxt;
textField -edit -text "1" animSkipTxt;
textField -edit -text "0" animStartTxt;
textField -edit -text "0" animEndTxt;
button -edit -en false animRBttn;
textScrollList -edit -da animDefLst;
}
else
error -sl false "No Name for the animation specified";
}
global proc PreRemoveAnim()
{
string $obj[] = `textScrollList -query -si animDefLst`;
if($obj[0] != "")
button -edit -en true animRBttn;
else
button -edit -en true animRBttn;
}
global proc RemoveAnim()
{
string $obj[] = `textScrollList -query -si animDefLst`;
textScrollList -edit -ri $obj[0] animDefLst;
button -edit -en false animRBttn;
textScrollList -edit -da animDefLst;
}
global proc GetOutputDir()
{
string $directory = `OgreGetFolder`;
$directory = fromNativePath($directory);
$directory += "/";
textField -edit -text $directory exportOutputTxt;
}
global proc WriteSettings()
{
// Export parameters
fileInfo "Ogre_OutputDir" `textField -query -fileName exportOutputTxt`;
fileInfo "Ogre_OutputFile" `textField -query -fileName exportXMLTxt`;
fileInfo "Ogre_ExportOption" `radioButton -query -sl exportEverything`;
// Advanced options
fileInfo "Ogre_TexCoords" `radioButton -query -sl normUVs`;
//fileInfo "Ogre_Triangulate" `checkBox -query -v advTriangulate`;
// Animation
fileInfo "Ogre_Skeleton" `checkBox -query -v animExport`;
fileInfo "Ogre_SkeletonBin" `checkBox -query -v animBinary`;
fileInfo "Ogre_IncludeAnims" `checkBox -query -v animAnims`;
int $num_items = `textScrollList -query -numberOfItems animDefLst`;
string $animations;
int $i;
for($i = 0; $i < $num_items; $i++)
{
int $s = $i + 1;
textScrollList -edit -sii $s animDefLst;
string $anims[] = `textScrollList -query -si animDefLst`;
string $buffer[];
int $numTokens = `tokenize $anims[0] "\"" $buffer`;
$animations += $buffer[0] + ".";
}
fileInfo "Ogre_Animations" $animations;
// Material
fileInfo "Ogre_Material" `checkBox -query -v materialExport`;
// Mesh
fileInfo "Ogre_Mesh" `checkBox -query -v meshExportXML`;
fileInfo "Ogre_Bone" `checkBox -query -v meshBoneAssign`;
fileInfo "Ogre_Normals" `checkBox -query -v meshNormals`;
fileInfo "Ogre_Colors" `checkBox -query -v meshDiffuseColor`;
fileInfo "Ogre_UVS" `checkBox -query -v meshTexCoords`;
fileInfo "Ogre_SubMesh" `checkBox -query -v meshBinary`;
fileInfo "Ogre_MeshBin" `checkBox -query -v meshSub`;
}
global proc ReadSettings()
{
// Export parameters
string $value[] = `fileInfo -q "Ogre_OutputDir"`;
if($value[0] != "")
textField -edit -text $value[0] exportOutputTxt;
$value = `fileInfo -q "Ogre_OutputFile"`;
if($value[0] != "")
textField -edit -text $value[0] exportXMLTxt;
$value = `fileInfo -q "Ogre_ExportOption"`;
if($value[0] != "")
{
if($value[0] == 1)
radioButton -edit -sl exportEverything;
else
radioButton -edit -sl exportSelected;
}
// Advanced options
$value = `fileInfo -q "Ogre_TexCoords"`;
if($value[0] != "")
{
if($value[0] == 1)
radioButton -edit -sl normUVs;
else
radioButton -edit -sl mayaUVs;
}
//$value = `fileInfo -q "Ogre_Triangulate"`;
//if($value[0] != "")
//{
// if($value[0] == 1)
// checkBox -edit -v true advTriangulate;
// else
// checkBox -edit -v false advTriangulate;
//}
// Animation
$value = `fileInfo -q "Ogre_Skeleton"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true animExport;
else
checkBox -edit -v false animExport;
}
$value = `fileInfo -q "Ogre_SkeletonBin"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true animBinary;
else
checkBox -edit -v false animBinary;
}
$value = `fileInfo -q "Ogre_IncludeAnims"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true animAnims;
else
checkBox -edit -v false animAnims;
}
$value = `fileInfo -q "Ogre_Animations"`;
if($value[0] != "")
{
string $buffer[];
int $numTokens = `tokenize $value[0] "." $buffer`;
int $i;
for($i = 0; $i < $numTokens; $i++)
{
string $entry = "\"" + $buffer[$i] + "\"";
textScrollList -edit -append $entry animDefLst;
}
}
// Material
$value = `fileInfo -q "Ogre_Material"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true materialExport;
else
checkBox -edit -v false materialExport;
}
// Mesh
$value = `fileInfo -q "Ogre_Mesh"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true meshExportXML;
else
checkBox -edit -v false meshExportXML;
}
$value = `fileInfo -q "Ogre_Bone"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true meshBoneAssign;
else
checkBox -edit -v false meshBoneAssign;
}
$value = `fileInfo -q "Ogre_Normals"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true meshNormals;
else
checkBox -edit -v false meshNormals;
}
$value = `fileInfo -q "Ogre_Colors"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true meshDiffuseColor;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -