📄 ogreexporter.mel
字号:
else
checkBox -edit -v false meshDiffuseColor;
}
$value = `fileInfo -q "Ogre_UVS"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true meshTexCoords;
else
checkBox -edit -v false meshTexCoords;
}
$value = `fileInfo -q "Ogre_SubMesh"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true meshBinary;
else
checkBox -edit -v false meshBinary;
}
$value = `fileInfo -q "Ogre_MeshBin"`;
if($value[0] != "")
{
if($value[0] == 1)
checkBox -edit -v true meshSub;
else
checkBox -edit -v false meshSub;
}
UpdateGUI();
}
global proc Export()
{
// flags to pass
// -msh (whether to export mesh or not) - done
// -bin (whether to export mesh to binary or not) - done
// -bsk (whether to export skeletion to binary or not) - done
// -sn (whether to include submesh name or not) - done
// -mat (whether to export material or not) - done
// -skl (whether to export skeleton or not) - done
// -nrm (whether to export normals or not) - done
// -uv (whether to export uvs or not) - done
// -col (whether to export colors or not) - done
// -vba (whether to export vertex bone assignments) - done
// -fuv (whether to flip uvs or not) - done
// -n (name of exported file) - done
// -dir (directory to export to) - done
// -ani (animations to export, can be many of these) - done
// write out settings to scene file
WriteSettings();
// check to see if we need to triangulate
//string $triangulate = `checkBox -query -v advTriangulate`;
//if($triangulate == "1")
// polyTriangulate;
// start command
string $command = "OgreExport";
// get the output file directory
string $dir_text = `textField -query -text exportOutputTxt`;
if($dir_text != "")
{
$dir_text = fromNativePath($dir_text);
$command += " -dir \"" + $dir_text + "\"";
}
else
error -sl false "No Output Directory specified under Export Options";
// get the output file name
string $file_text = `textField -query -text exportXMLTxt`;
if($file_text != "")
$command += " -n \"" + $file_text + "\"";
else
error -sl false "No XML Filename specified under Export Options";
// see whether or not to export mesh out
string $mesh_bool = `checkBox -query -v meshExportXML`;
// see whether or not to export materials
string $mat_bool = `checkBox -query -v materialExport`;
if($mesh_bool == 1)
{
$command += " -msh " + $mesh_bool;
$command += " -mat " + $mat_bool;
// see whether or not to export skeleton
string $skel_bool = `checkBox -query -v animExport`;
$command += " -skl " + $skel_bool;
// see whether or not to export normals
string $norm_bool = `checkBox -query -v meshNormals`;
$command += " -nrm " + $norm_bool;
// see whether or not to export uvs
string $uv_bool = `checkBox -query -v meshTexCoords`;
$command += " -uvs " + $uv_bool;
// see whether or not to flip uvs
string $uv_flip_bool = `radioButton -query -sl normUVs`;
$command += " -fuv " + $uv_flip_bool;
// see whether or not to export color
string $diff_color_bool = `checkBox -query -v meshDiffuseColor`;
$command += " -col " + $diff_color_bool;
// see whether or not to export bone assignments
string $bone_bool = `checkBox -query -v meshBoneAssign`;
$command += " -vba " + $bone_bool;
// see whether or not to export submeshes
string $subMeshes = `checkBox -query -v meshSub`;
$command += " -sn " + $subMeshes;
}
// see whether to export animation stuff
string $anim_exp = `checkBox -q -v animExport`;
if($anim_exp == 1)
{
// see whether or not to include animations
string $anim_check = `checkBox -query -v animAnims`;
if($anim_check == 1)
{
// check for animations to export
string $valid = `textScrollList -query -en animDefLst`;
string $animations = "\"";
if($valid == "1")
{
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[];
int $numTokens = `tokenize $anims[0] "\"" $buffer`;
$animations += $buffer[0] + " ";
}
}
$animations += "\"";
$command += " -ani " + $animations;
}
}
// call and end command
evalEcho($command);
string $file_path = `file -q -loc OgreExporter.mel`;
string $buffer[];
int $numTokens = `tokenize $file_path "//" $buffer`;
int $i;
$file_path = "";
for($i = 0; $i < $numTokens-2; $i++)
{
$file_path += $buffer[$i] + "/";
}
$file_path = fromNativePath($file_path);
$file_path = $file_path + "temp/";
// see whether or not to export to binary
string $binary = `checkBox -query -v meshBinary`;
if($mesh_bool && $binary)
{
//$command += " -bin " + $binary;
system("start " + $file_path + "OgreXMLConverter.exe " + "\"" + $dir_text + $file_text + ".mesh.xml\"");
}
// see whether or not to export skeletion to binary
string $skl_binary = `checkBox -query -v animBinary`;
if($anim_exp && $skl_binary)
{
//$command += " -bsk " + $skl_binary;
system("start " + $file_path + "OgreXMLConverter.exe " + "\"" + $dir_text + $file_text + ".skeleton.xml\"");
}
// call the material upgrader
if($mat_bool == 1)
{
system("start " + $file_path + "OgreMaterialUpgrade.exe " + "\"" + $dir_text + $file_text + ".material\"");
}
//if($triangulate == "1")
//{
//undo;
//undo;
//}
textScrollList -edit -da animDefLst;
}
global proc Preview()
{
// write out settings to scene file
WriteSettings();
// check to see if we need to triangulate
//string $triangulate = `checkBox -query -v advTriangulate`;
//if($triangulate == "1")
// polyTriangulate;
// start command
string $command = "OgreExport";
// get the output file directory
string $file_path = `file -q -loc OgreExporter.mel`;
string $buffer[];
int $numTokens = `tokenize $file_path "//" $buffer`;
int $i;
$file_path = "";
for($i = 0; $i < $numTokens-2; $i++)
{
$file_path += $buffer[$i] + "/";
}
string $dir_text = $file_path;
if($dir_text != "")
{
$dir_text = fromNativePath($dir_text);
$dir_text = $dir_text + "temp/";
$command += " -dir \"" + $dir_text + "\"";
}
else
error -sl false "No Output Directory specified under Export Options";
// get the output file name
string $file_text = "default";
if($file_text != "")
$command += " -n \"" + $file_text + "\"";
else
error -sl false "No XML Filename specified under Export Options";
// see whether or not to export mesh out
string $mesh_bool = `checkBox -query -v meshExportXML`;
// see whether or not to export materials
string $mat_bool = `checkBox -query -v materialExport`;
if($mesh_bool == 1)
{
$command += " -msh " + $mesh_bool;
$command += " -mat " + $mat_bool;
// see whether or not to export skeleton
string $skel_bool = `checkBox -query -v animExport`;
$command += " -skl " + $skel_bool;
// see whether or not to export normals
string $norm_bool = `checkBox -query -v meshNormals`;
$command += " -nrm " + $norm_bool;
// see whether or not to export uvs
string $uv_bool = `checkBox -query -v meshTexCoords`;
$command += " -uvs " + $uv_bool;
// see whether or not to flip uvs
string $uv_flip_bool = `radioButton -query -sl normUVs`;
$command += " -fuv " + $uv_flip_bool;
// see whether or not to export color
string $diff_color_bool = `checkBox -query -v meshDiffuseColor`;
$command += " -col " + $diff_color_bool;
// see whether or not to export bone assignments
string $bone_bool = `checkBox -query -v meshBoneAssign`;
$command += " -vba " + $bone_bool;
// see whether or not to export submeshes
string $subMeshes = `checkBox -query -v meshSub`;
$command += " -sn " + $subMeshes;
}
// see whether to export animation stuff
string $anim_exp = `checkBox -q -v animExport`;
if($anim_exp == 1)
{
// see whether or not to include animations
string $anim_check = `checkBox -query -v animAnims`;
if($anim_check == 1)
{
// check for animations to export
string $valid = `textScrollList -query -en animDefLst`;
string $animations = "\"";
if($valid == "1")
{
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[];
int $numTokens = `tokenize $anims[0] "\"" $buffer`;
$animations += $buffer[0] + " ";
}
}
$animations += "\"";
$command += " -ani " + $animations;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -