/****************************************************************************** NintendoWare for CTR Maya Plugin File: NW4C_ExpDialog.mel Description: create export dialog Date: 2010/10/07 Author: Takashi Endo Copyright (C)2009-2010 Nintendo Co., Ltd. / HAL Laboratory, Inc. All rights reserved. ******************************************************************************/ // NW4C_ExpDirect // OpenOptionWindow CreateSettingMenu // SetOptionVariable SetOptionControl UpdateOptionVariableT ResetOptionVariable // ExportCB DoExportCmd CheckOptionValue // SetConsistentCallback // SaveSettingToScene LoadSettingFromScene DeleteUselessSettingNode // SaveSettingToFile LoadSettingFromFile GetOptionStringFromC3es // SearchAnim /****************************************************************************** variables ******************************************************************************/ global int $nw4cExpDialog_SettingLatestVer = 13; global string $nw4cExpDialog_c3esLatestVer = "1.3.0"; global int $nw4cExpDialog_LoadSettingJob = -1; /****************************************************************************** load plugin ******************************************************************************/ proc LoadPlugin() { if (!`pluginInfo -q -l "NW4C_Export.mll"`) { loadPlugin("NW4C_Export.mll"); } } /****************************************************************************** show error & stop ******************************************************************************/ proc ShowError(string $msg) { if (!`about -batch`) { trace ("Error: " + $msg + "\n"); } error $msg; } /****************************************************************************** use custom ui ******************************************************************************/ proc int UseCustomUI() { // カスタム UI の使用設定を環境変数 NW4C_MAYA_CUSTOM_UI から取得する。 // 環境変数の設定値が "0" の時はカスタム UI を使用せず、サフィックスが指定されている時は // カスタム UI を使用する。環境変数が定義されていない場合は "0" が設定されているとみなす。 string $val = `getenv "NW4C_MAYA_CUSTOM_UI"`; if ($val == "") { $val = "0"; } else { $val = "1"; } return int($val); } /****************************************************************************** use 3DEditor ******************************************************************************/ proc int Use3DEditor() { // 3DEditor が存在しているか確認する。 int $exist = 0; string $nw4cRoot = `getenv "NW4C_ROOT"`; if ($nw4cRoot != "") { string $editorPath = ($nw4cRoot + "/tools/3DEditor/3DEditor.exe"); if (`filetest -e $editorPath`) { $exist = 1; } } return $exist; } /****************************************************************************** find string in array ******************************************************************************/ proc int FindStringInArray(string $array[], string $value) { int $size = size($array); int $idx; for ($idx = 0; $idx < $size; ++$idx) { if ($array[$idx] == $value) { return $idx; } } return -1; } /****************************************************************************** does save load scene setting ******************************************************************************/ proc int DoesSaveLoadSceneSetting() { if (!`optionVar -ex nw4cExpDialog_SaveLoadSceneSetting`) { return 1; // default } //trace ("save load scene setting: " + `optionVar -q nw4cExpDialog_SaveLoadSceneSetting` + "\n"); return `optionVar -q nw4cExpDialog_SaveLoadSceneSetting`; } /****************************************************************************** load setting from option string ******************************************************************************/ proc LoadSettingFromOptionString(int $version, string $opts) { print ("load NW4C export settings from scene (ver " + ($version / 10) + "." + ($version % 10) + ")\n"); //----------------------------------------------------------------------------- // set option variable optionVar -sv nw4cExport_Options $opts; //----------------------------------------------------------------------------- // refresh option box if (`scrollLayout -ex nw4cExpDialog_ScrollLayout`) { if (`columnLayout -ex nw4cExpDialog_MainColumn`) { NW4C_ExpDialog; } } } /****************************************************************************** load setting from scene (called when scene is opened) ******************************************************************************/ global proc nw4cExpDialog_LoadSettingFromScene() { global int $nw4cExpDialog_SettingVer; global string $nw4cExpDialog_SettingExportOptions; //----------------------------------------------------------------------------- // check save / load scene setting is enabled if (!DoesSaveLoadSceneSetting()) { return; } //----------------------------------------------------------------------------- // evaluate setting node string $node = "nw4cExpDialog_Setting1"; if (!`objExists $node`) { return; } if (nodeType($node) != "script") { return; } string $cmd = `getAttr ($node + ".b")`; if (!size($cmd)) { return; } eval($cmd); int $version = $nw4cExpDialog_SettingVer; string $opts = $nw4cExpDialog_SettingExportOptions; //----------------------------------------------------------------------------- // load setting if (size($opts)) { LoadSettingFromOptionString($version, $opts); } } /****************************************************************************** setting node function (called from script node) (do nothing now) ******************************************************************************/ global proc nw4cExpDialog_SettingNodeFunc() { } /****************************************************************************** set consistent callback ******************************************************************************/ global proc nw4cExpDialog_SetConsistentCallback() { // set load setting job at scene opened global int $nw4cExpDialog_LoadSettingJob = -1; $nw4cExpDialog_LoadSettingJob = `scriptJob -e "SceneOpened" "if (`exists nw4cExpDialog_LoadSettingFromScene`) nw4cExpDialog_LoadSettingFromScene;"`; } /****************************************************************************** delete useless setting node ******************************************************************************/ proc DeleteUselessSettingNode() { string $nodes[] = `ls -typ script`; string $node; for ($node in $nodes) { if (gmatch($node, "*_nw4cExpDialog_Setting*") || gmatch($node, "*:nw4cExpDialog_Setting*")) { if (`referenceQuery -inr $node`) // if referenced { print ("disable settings: " + $node + "\n"); if (`getAttr -l ($node + ".st")`) { print "(locked)\n"; } else { catch(`setAttr ($node + ".st") 0`); // Demand } } else { print ("delete settings: " + $node + "\n"); catch(`delete $node`); } } } } /****************************************************************************** get setting node command ******************************************************************************/ proc string GetSettingNodeCommand() { string $cmd = ""; //----------------------------------------------------------------------------- // setting version global int $nw4cExpDialog_SettingLatestVer; $cmd += "global int $nw4cExpDialog_SettingVer = " + $nw4cExpDialog_SettingLatestVer + ";\n"; //----------------------------------------------------------------------------- // export options $cmd += "global string $nw4cExpDialog_SettingExportOptions = \"" + `optionVar -q nw4cExport_Options` + "\";\n"; //----------------------------------------------------------------------------- // setting node function $cmd += "if (`exists nw4cExpDialog_SettingNodeFunc`) " + "nw4cExpDialog_SettingNodeFunc();\n"; return $cmd; } /****************************************************************************** save setting to scene ******************************************************************************/ proc SaveSettingToScene(int $checkSceneSettingFlag) { //return; // never save (debug) //----------------------------------------------------------------------------- // check save / load flag if ($checkSceneSettingFlag && !DoesSaveLoadSceneSetting()) { return; } //----------------------------------------------------------------------------- // delete useless setting node DeleteUselessSettingNode(); //----------------------------------------------------------------------------- // create setting node string $node = "nw4cExpDialog_Setting1"; if (!`objExists $node`) { string $selBak[] = `ls -sl`; createNode script -n $node; select $selBak; } //----------------------------------------------------------------------------- // set setting node command & attr if (`getAttr -l ($node + ".b")`) { print "NW4C export settings node is locked\n"; return; } string $cmd = GetSettingNodeCommand(); catch(`setAttr ($node + ".b") -type "string" $cmd`); catch(`setAttr ($node + ".st") 1`); // Open/Close } /****************************************************************************** save setting file folder ******************************************************************************/ proc SaveSettingFileFolder(string $filePath) { string $settingFolder = substitute("[^/]*$", $filePath, ""); optionVar -sv nw4cExpDialog_SettingFileFolder $settingFolder; } /****************************************************************************** set setting file folder to currnet ******************************************************************************/ proc SetSettingFileFolderToCurrent() { string $settingFolder = ""; if (`optionVar -ex nw4cExpDialog_SettingFileFolder`) { $settingFolder = `optionVar -q nw4cExpDialog_SettingFileFolder`; } if (size($settingFolder) > 0 && `filetest -d $settingFolder`) { workspace -dir $settingFolder; } } /****************************************************************************** get float string for setting file ******************************************************************************/ proc string GetFloatStringForSettingFile(float $val) { string $str = $val; if (match("\\.", $str) == "") { $str += ".0"; } return $str; } /****************************************************************************** save setting to file (do) ******************************************************************************/ global proc nw4cExpDialog_SaveSettingToFileDo(string $filePath) { global string $nw4cExpDialog_c3esLatestVer; string $boolNames[2] = { "false", "true" }; //----------------------------------------------------------------------------- // add extension if (match("\\.c3es$", $filePath) == "") { $filePath += ".c3es"; } //----------------------------------------------------------------------------- // update option variable nw4cExpDialog_UpdateOptionVariable(0); // no save setting to scene //----------------------------------------------------------------------------- // get generator version string $generatorVersion = "?"; if (`pluginInfo -q -l "NW4C_Export.mll"`) { $generatorVersion = eval("NW4C_ExportInfoCmd -p"); } //----------------------------------------------------------------------------- // get date & time if (size(match("^//", `pwd`)) != 0) { // if the current folder is on network drive // change it on local drive for getting date & time properly string $localFolder = getenv("TEMP"); if (size($localFolder) > 0 && `filetest -d $localFolder`) { chdir($localFolder); //trace ("change cur folder to " + $localFolder); } } string $date = `system "echo %DATE%"`; $date = match("[0-9/]+", $date); $date = substituteAllString($date, "/", "-"); string $time = `system "echo %TIME%"`; $time = match("[0-9:]+", $time); //----------------------------------------------------------------------------- // parse export options //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // init string $processMode = "Single"; string $exportTarget = "All"; string $outputFileName = ""; string $outputMode = "File"; string $outputFolder = ""; int $mergeCmdl = 0; string $mergeCmdlPath = ""; int $copyRelatedFiles = 0; //int $mergeCmdlAuto = 1; float $magnify = 1.0; string $frameRange = "All"; int $startFrame = 1; int $endFrame = 100; //string $texMatrixMode = "Maya"; int $removeNamespace = 0; int $outputCmdl = 1; int $outputCtex = 1; int $outputCmdla = 0; int $outputCskla = 0; int $outputCmata = 0; int $outputCmcla = 0; int $outputCmtpa = 0; int $outputCmtsa = 0; int $outputCcam = 0; int $outputClgt = 0; int $outputCenv = 0; string $compressNode = "None"; //int $combinePolygon = 0; int $compressMaterial = 0; int $optimizePrimitive = 1; int $convertToModel = 0; //int $delUselessVtxData = 0; string $quantizePos = "Float"; string $quantizeNrm = "Float"; string $quantizeTex = "Float"; int $frameFormat = 0; int $scaleQuantizeQuality = 9; int $rotateQuantizeQuality = 9; int $translateQuantizeQuality = 9; string $adjustSkinning = "None"; string $meshVisibilityMode = "BindByIndex"; int $nonUniformScale = 0; int $maxReservedUniformRegisters = 0; int $bakeAllAnim = 1; float $framePrecision = 1.0; int $loopAnim = 0; float $toleranceScale = 0.1; float $toleranceRotate = 0.1; float $toleranceTranslate = 0.01; float $toleranceTexScale = 0.1; float $toleranceTexRotate = 0.1; float $toleranceTexTranslate = 0.01; float $toleranceColor = 0.001; //----------------------------------------------------------------------------- // get option var string $optStr = ""; if (`optionVar -ex nw4cExport_Options`) { $optStr = `optionVar -q nw4cExport_Options`; } //----------------------------------------------------------------------------- // parse option var string $opts[], $words[]; tokenize($optStr, ";", $opts); int $optSize = size($opts); int $iopt; for ($iopt = 0; $iopt < $optSize; ++$iopt) { tokenize($opts[$iopt], "=", $words); string $tag = $words[0]; string $val = $words[1]; int $boolVal = ($val == "true" || $val == "On" || $val == "1"); //----------------------------------------------------------------------------- // output if ($tag == "ProcessMode") { $processMode = $val; } else if ($tag == "ExportTarget") { $exportTarget = $val; } else if ($tag == "OutputFileName") { $outputFileName = $val; } else if ($tag == "OutputMode") { $outputMode = $val; } else if ($tag == "OutputFolder") { $outputFolder = $val; } else if ($tag == "MergeCmdl") { $mergeCmdl = $boolVal; } else if ($tag == "MergeCmdlPath") { $mergeCmdlPath = $val; } else if ($tag == "CopyRelatedFiles") { $copyRelatedFiles = $boolVal; } //else if ($tag == "MergeCmdlAuto") //{ // $mergeCmdlAuto = $boolVal; //} //----------------------------------------------------------------------------- // general else if ($tag == "Magnify") { $magnify = $val; } else if ($tag == "FrameRange") { $frameRange = $val; } else if ($tag == "StartFrame") { $startFrame = $val; } else if ($tag == "EndFrame") { $endFrame = $val; } //else if ($tag == "TexMatrixMode") //{ // $texMatrixMode = $val; //} else if ($tag == "RemoveNamespace") { $removeNamespace = $boolVal; } //----------------------------------------------------------------------------- // file selection else if ($tag == "OutputCmdl") { $outputCmdl = $boolVal; } else if ($tag == "OutputCtex") { $outputCtex = $boolVal; } else if ($tag == "OutputCmdla") { $outputCmdla = $boolVal; } else if ($tag == "OutputCskla") { $outputCskla = $boolVal; } else if ($tag == "OutputCmata") { $outputCmata = $boolVal; } else if ($tag == "OutputCmcla") { $outputCmcla = $boolVal; } else if ($tag == "OutputCmtpa") { $outputCmtpa = $boolVal; } else if ($tag == "OutputCmtsa") { $outputCmtsa = $boolVal; } else if ($tag == "OutputCcam") { $outputCcam = $boolVal; } else if ($tag == "OutputClgt") { $outputClgt = $boolVal; } else if ($tag == "OutputCenv") { $outputCenv = $boolVal; } //----------------------------------------------------------------------------- // optimization else if ($tag == "CompressNode") { $compressNode = $val; } //else if ($tag == "CombinePolygon") //{ // $combinePolygon = $boolVal; //} else if ($tag == "CompressMaterial") { $compressMaterial = $boolVal; } else if ($tag == "OptimizePrimitive") { $optimizePrimitive = $boolVal; } else if ($tag == "ConvertToModel") { $convertToModel = $boolVal; } //else if ($tag == "DelUselessVtxData") //{ // $delUselessVtxData = $boolVal; //} //----------------------------------------------------------------------------- // quantization else if ($tag == "QuantizePos") { $quantizePos = $val; } else if ($tag == "QuantizeNrm") { $quantizeNrm = $val; } else if ($tag == "QuantizeTex") { $quantizeTex = $val; } else if ($tag == "FrameFormat") { $frameFormat = $boolVal; } else if ($tag == "ScaleQuantizeQuality") { $scaleQuantizeQuality = $val; } else if ($tag == "RotateQuantizeQuality") { $rotateQuantizeQuality = $val; } else if ($tag == "TranslateQuantizeQuality") { $translateQuantizeQuality = $val; } //----------------------------------------------------------------------------- // model else if ($tag == "AdjustSkinning") { $adjustSkinning = $val; } else if ($tag == "MeshVisibilityMode") { $meshVisibilityMode = $val; } else if ($tag == "NonUniformScale") { $nonUniformScale = $boolVal; } else if ($tag == "MaxReservedUniformRegisters") { $maxReservedUniformRegisters = $val; } //----------------------------------------------------------------------------- // animation else if ($tag == "BakeAllAnim") { $bakeAllAnim = $boolVal; } else if ($tag == "FramePrecision") { if ($val == "2") { $framePrecision = 0.5; } else if ($val == "5") { $framePrecision = 0.2; } else if ($val == "10") { $framePrecision = 0.1; } } else if ($tag == "LoopAnim") { $loopAnim = $boolVal; } //----------------------------------------------------------------------------- // tolerance else if ($tag == "ToleranceScale") { $toleranceScale = $val; } else if ($tag == "ToleranceRotate") { $toleranceRotate = $val; } else if ($tag == "ToleranceTranslate") { $toleranceTranslate = $val; } else if ($tag == "ToleranceTexScale") { $toleranceTexScale = $val; } else if ($tag == "ToleranceTexRotate") { $toleranceTexRotate = $val; } else if ($tag == "ToleranceTexTranslate") { $toleranceTexTranslate = $val; } else if ($tag == "ToleranceColor") { $toleranceColor = $val; } } //----------------------------------------------------------------------------- // open file int $fid = fopen($filePath, "w"); if ($fid == 0) { ShowError("Can't open file: " + $filePath); } //----------------------------------------------------------------------------- // header fprint($fid, "# NW4C_Export settings\r\n"); fprint($fid, "SettingsVersion=\"" + $nw4cExpDialog_c3esLatestVer + "\"\r\n"); fprint($fid, "GeneratorName=\"Maya " + `about -v` + " NW4C_Export\"\r\n"); fprint($fid, "GeneratorVersion=\"" + $generatorVersion + "\"\r\n"); fprint($fid, "Date=\"" + $date + "T" + $time + "\"\r\n"); fprint($fid, "\r\n"); //----------------------------------------------------------------------------- // output options fprint($fid, "# Output Options\r\n"); fprint($fid, "ProcessMode=\"" + $processMode + "\"\r\n"); fprint($fid, "ExportTarget=\"" + $exportTarget + "\"\r\n"); fprint($fid, "OutputFileName=\"" + $outputFileName + "\"\r\n"); fprint($fid, "OutputMode=\"" + $outputMode + "\"\r\n"); fprint($fid, "OutputFolder=\"" + $outputFolder + "\"\r\n"); fprint($fid, "MergeCmdl=\"" + $boolNames[$mergeCmdl] + "\"\r\n"); fprint($fid, "MergeCmdlPath=\"" + $mergeCmdlPath + "\"\r\n"); fprint($fid, "CopyRelatedFiles=\"" + $boolNames[$copyRelatedFiles] + "\"\r\n"); //fprint($fid, "MergeCmdlAuto=\"" + $boolNames[$mergeCmdlAuto] + "\"\r\n"); fprint($fid, "\r\n"); //----------------------------------------------------------------------------- // general options fprint($fid, "# General Options\r\n"); fprint($fid, "Magnify=\"" + GetFloatStringForSettingFile($magnify) + "\"\r\n"); fprint($fid, "FrameRange=\"" + $frameRange + "\"\r\n"); fprint($fid, "StartFrame=\"" + $startFrame + "\"\r\n"); fprint($fid, "EndFrame=\"" + $endFrame + "\"\r\n"); //fprint($fid, "TexMatrixMode=\"" + $texMatrixMode + "\"\r\n"); fprint($fid, "RemoveNamespace=\"" + $boolNames[$removeNamespace] + "\"\r\n"); fprint($fid, "\r\n"); //----------------------------------------------------------------------------- // output file selection fprint($fid, "# Output File Selection\r\n"); fprint($fid, "OutputCmdl=\"" + $boolNames[$outputCmdl] + "\"\r\n"); fprint($fid, "OutputCtex=\"" + $boolNames[$outputCtex] + "\"\r\n"); fprint($fid, "OutputCmdla=\"" + $boolNames[$outputCmdla] + "\"\r\n"); fprint($fid, "OutputCskla=\"" + $boolNames[$outputCskla] + "\"\r\n"); fprint($fid, "OutputCmata=\"" + $boolNames[$outputCmata] + "\"\r\n"); fprint($fid, "OutputCmcla=\"" + $boolNames[$outputCmcla] + "\"\r\n"); fprint($fid, "OutputCmtpa=\"" + $boolNames[$outputCmtpa] + "\"\r\n"); fprint($fid, "OutputCmtsa=\"" + $boolNames[$outputCmtsa] + "\"\r\n"); fprint($fid, "OutputCcam=\"" + $boolNames[$outputCcam] + "\"\r\n"); fprint($fid, "OutputClgt=\"" + $boolNames[$outputClgt] + "\"\r\n"); fprint($fid, "OutputCenv=\"" + $boolNames[$outputCenv] + "\"\r\n"); fprint($fid, "\r\n"); //----------------------------------------------------------------------------- // optimization options fprint($fid, "# Optimization Options\r\n"); fprint($fid, "CompressNode=\"" + $compressNode + "\"\r\n"); //fprint($fid, "CombinePolygon=\"" + $boolNames[$combinePolygon] + "\"\r\n"); fprint($fid, "CompressMaterial=\"" + $boolNames[$compressMaterial] + "\"\r\n"); fprint($fid, "OptimizePrimitive=\"" + $boolNames[$optimizePrimitive] + "\"\r\n"); fprint($fid, "ConvertToModel=\"" + $boolNames[$convertToModel] + "\"\r\n"); //fprint($fid, "DelUselessVtxData=\"" + $boolNames[$delUselessVtxData] + "\"\r\n"); fprint($fid, "\r\n"); //----------------------------------------------------------------------------- // quantization options fprint($fid, "# Quantization Options\r\n"); fprint($fid, "QuantizePos=\"" + $quantizePos + "\"\r\n"); fprint($fid, "QuantizeNrm=\"" + $quantizeNrm + "\"\r\n"); fprint($fid, "QuantizeTex=\"" + $quantizeTex + "\"\r\n"); fprint($fid, "\r\n"); //----------------------------------------------------------------------------- // model options fprint($fid, "# Model Options\r\n"); fprint($fid, "AdjustSkinning=\"" + $adjustSkinning + "\"\r\n"); fprint($fid, "MeshVisibilityMode=\"" + $meshVisibilityMode + "\"\r\n"); fprint($fid, "NonUniformScale=\"" + $boolNames[$nonUniformScale] + "\"\r\n"); fprint($fid, "MaxReservedUniformRegisters=\"" + $maxReservedUniformRegisters + "\"\r\n"); fprint($fid, "\r\n"); //----------------------------------------------------------------------------- // animation options fprint($fid, "# Animation Options\r\n"); fprint($fid, "BakeAllAnim=\"" + $boolNames[$bakeAllAnim] + "\"\r\n"); fprint($fid, "FramePrecision=\"" + GetFloatStringForSettingFile($framePrecision) + "\"\r\n"); fprint($fid, "LoopAnim=\"" + $boolNames[$loopAnim] + "\"\r\n"); fprint($fid, "FrameFormat=\"" + $boolNames[$frameFormat] + "\"\r\n"); fprint($fid, "ScaleQuantizeQuality=\"" + $scaleQuantizeQuality + "\"\r\n"); fprint($fid, "RotateQuantizeQuality=\"" + $rotateQuantizeQuality + "\"\r\n"); fprint($fid, "TranslateQuantizeQuality=\"" + $translateQuantizeQuality + "\"\r\n"); fprint($fid, "\r\n"); //----------------------------------------------------------------------------- // tolerance options fprint($fid, "# Tolerance Options\r\n"); fprint($fid, "ToleranceScale=\"" + GetFloatStringForSettingFile($toleranceScale) + "\"\r\n"); fprint($fid, "ToleranceRotate=\"" + GetFloatStringForSettingFile($toleranceRotate) + "\"\r\n"); fprint($fid, "ToleranceTranslate=\"" + GetFloatStringForSettingFile($toleranceTranslate) + "\"\r\n"); fprint($fid, "ToleranceTexScale=\"" + GetFloatStringForSettingFile($toleranceTexScale) + "\"\r\n"); fprint($fid, "ToleranceTexRotate=\"" + GetFloatStringForSettingFile($toleranceTexRotate) + "\"\r\n"); fprint($fid, "ToleranceTexTranslate=\"" + GetFloatStringForSettingFile($toleranceTexTranslate) + "\"\r\n"); fprint($fid, "ToleranceColor=\"" + GetFloatStringForSettingFile($toleranceColor) + "\"\r\n"); fprint($fid, "\r\n"); //----------------------------------------------------------------------------- // close file fclose($fid); //----------------------------------------------------------------------------- // end print ("Saved to " + $filePath + "\n"); } /****************************************************************************** save setting to file (file command) ******************************************************************************/ global proc nw4cExpDialog_SaveSettingToFileFC(string $filePath, string $fileType) { //----------------------------------------------------------------------------- // save setting file folder SaveSettingFileFolder($filePath); //----------------------------------------------------------------------------- // do nw4cExpDialog_SaveSettingToFileDo($filePath); } /****************************************************************************** save setting to file (main) ******************************************************************************/ global proc nw4cExpDialog_SaveSettingToFile() { //----------------------------------------------------------------------------- // set setting file folder to currnet SetSettingFileFolderToCurrent(); //----------------------------------------------------------------------------- // open file dialog fileBrowserDialog -m 1 -an "Save" -in "c3es" -ft "Best Guess" -fc "nw4cExpDialog_SaveSettingToFileFC"; } /****************************************************************************** get option string from c3es ******************************************************************************/ global proc string nw4cExpDialog_GetOptionStringFromC3es(string $filePath) { global string $nw4cExpDialog_c3esLatestVer; string $boolNames[2] = { "false", "true" }; //----------------------------------------------------------------------------- // init string $settingsVersion = ""; string $processMode = "Single"; string $exportTarget = "All"; string $outputFileName = ""; string $outputMode = "File"; string $outputFolder = ""; int $mergeCmdl = 0; string $mergeCmdlPath = ""; int $copyRelatedFiles = 0; //int $mergeCmdlAuto = 1; float $magnify = 1.0; string $frameRange = "All"; int $startFrame = 1; int $endFrame = 100; //string $texMatrixMode = "Maya"; int $removeNamespace = 0; int $outputCmdl = 1; int $outputCtex = 1; int $outputCmdla = 0; int $outputCskla = 0; int $outputCmata = 0; int $outputCmcla = 0; int $outputCmtpa = 0; int $outputCmtsa = 0; int $outputCcam = 0; int $outputClgt = 0; int $outputCenv = 0; string $compressNode = "None"; //int $combinePolygon = 0; int $compressMaterial = 0; int $optimizePrimitive = 1; int $convertToModel = 0; //int $delUselessVtxData = 0; string $quantizePos = "Float"; string $quantizeNrm = "Float"; string $quantizeTex = "Float"; int $frameFormat = 0; int $scaleQuantizeQuality = 9; int $rotateQuantizeQuality = 9; int $translateQuantizeQuality = 9; string $adjustSkinning = "None"; string $meshVisibilityMode = "IndexMode"; int $nonUniformScale = 0; int $maxReservedUniformRegisters = 0; int $bakeAllAnim = 1; int $framePrecision = 1; int $loopAnim = 0; float $toleranceScale = 0.1; float $toleranceRotate = 0.1; float $toleranceTranslate = 0.01; float $toleranceTexScale = 0.1; float $toleranceTexRotate = 0.1; float $toleranceTexTranslate = 0.01; float $toleranceColor = 0.001; //----------------------------------------------------------------------------- // open file int $fid = fopen($filePath, "r"); if ($fid == 0) { ShowError("Can't open file: " + $filePath); } //----------------------------------------------------------------------------- // check header string $line = fgetline($fid); if (size(match("^# NW4C_Export settings", $line)) == 0) { fclose($fid); ShowError("c3es file is wrong: " + $filePath); } //----------------------------------------------------------------------------- // parse string $words[]; while (!feof($fid)) { string $line = fgetline($fid); $line = substitute("\r*\n$", $line, ""); // cut [CR+LF] or [LF] // skip empty line & comment line if (size($line) == 0 || substring($line, 1, 1) == "#") { continue; } tokenize($line, "=", $words); if (size($words) < 2) { continue; } string $tag = $words[0]; string $val = $words[1]; $val = substitute("^\"", $val, ""); // cut first double quote $val = substitute("\".*$", $val, ""); // cut last double quote int $boolVal = ($val == "true" || $val == "On" || $val == "1"); //print ($tag + ": " + $val + "\n"); //----------------------------------------------------------------------------- // header if ($tag == "SettingsVersion") { $settingsVersion = $val; //if ($settingsVersion != $nw4cExpDialog_c3esLatestVer) //{ // fclose($fid); // ShowError("c3es file version is wrong: " + $settingsVersion); //} } //----------------------------------------------------------------------------- // output else if ($tag == "ProcessMode") { $processMode = $val; } else if ($tag == "ExportTarget") { $exportTarget = $val; } else if ($tag == "OutputFileName") { $outputFileName = $val; } else if ($tag == "OutputMode") { $outputMode = $val; } else if ($tag == "OutputFolder") { $outputFolder = NW4C_GetUnixFilePath($val); } else if ($tag == "MergeCmdl") { $mergeCmdl = $boolVal; } else if ($tag == "MergeCmdlPath") { $mergeCmdlPath = NW4C_GetUnixFilePath($val); } else if ($tag == "CopyRelatedFiles") { $copyRelatedFiles = $boolVal; } //else if ($tag == "MergeCmdlAuto") //{ // $mergeCmdlAuto = $boolVal; //} //----------------------------------------------------------------------------- // general else if ($tag == "Magnify") { $magnify = $val; } else if ($tag == "FrameRange") { $frameRange = $val; } else if ($tag == "StartFrame") { $startFrame = $val; } else if ($tag == "EndFrame") { $endFrame = $val; } //else if ($tag == "TexMatrixMode") //{ // $texMatrixMode = $val; //} else if ($tag == "RemoveNamespace") { $removeNamespace = $boolVal; } //----------------------------------------------------------------------------- // file selection else if ($tag == "OutputCmdl") { $outputCmdl = $boolVal; } else if ($tag == "OutputCtex") { $outputCtex = $boolVal; } else if ($tag == "OutputCmdla") { $outputCmdla = $boolVal; } else if ($tag == "OutputCskla") { $outputCskla = $boolVal; } else if ($tag == "OutputCmata") { $outputCmata = $boolVal; } else if ($tag == "OutputCmcla") { $outputCmcla = $boolVal; } else if ($tag == "OutputCmtpa") { $outputCmtpa = $boolVal; } else if ($tag == "OutputCmtsa") { $outputCmtsa = $boolVal; } else if ($tag == "OutputCcam") { $outputCcam = $boolVal; } else if ($tag == "OutputClgt") { $outputClgt = $boolVal; } else if ($tag == "OutputCenv") { $outputCenv = $boolVal; } //----------------------------------------------------------------------------- // optimization else if ($tag == "CompressNode") { $compressNode = $val; } //else if ($tag == "CombinePolygon") //{ // $combinePolygon = $boolVal; //} else if ($tag == "CompressMaterial") { $compressMaterial = $boolVal; } else if ($tag == "OptimizePrimitive") { $optimizePrimitive = $boolVal; } else if ($tag == "ConvertToModel") { // ConvertToModel は下位互換がないため、1.3.0 よりも前に出力された c3es // からロードする時は無視する if (strcmp($settingsVersion, "1.3.0") >= 0) { $convertToModel = $boolVal; } } //else if ($tag == "DelUselessVtxData") //{ // $delUselessVtxData = $boolVal; //} //----------------------------------------------------------------------------- // quantization else if ($tag == "QuantizePos") { $quantizePos = $val; } else if ($tag == "QuantizeNrm") { $quantizeNrm = $val; } else if ($tag == "QuantizeTex") { $quantizeTex = $val; } else if ($tag == "FrameFormat") { $frameFormat = $boolVal; } else if ($tag == "ScaleQuantizeQuality") { $scaleQuantizeQuality = $val; } else if ($tag == "RotateQuantizeQuality") { $rotateQuantizeQuality = $val; } else if ($tag == "TranslateQuantizeQuality") { $translateQuantizeQuality = $val; } //----------------------------------------------------------------------------- // model else if ($tag == "AdjustSkinning") { $adjustSkinning = $val; } else if ($tag == "MeshVisibilityMode") { $meshVisibilityMode = $val; } else if ($tag == "NonUniformScale") { $nonUniformScale = $boolVal; } else if ($tag == "MaxReservedUniformRegisters") { $maxReservedUniformRegisters = $val; } //----------------------------------------------------------------------------- // anim else if ($tag == "BakeAllAnim") { $bakeAllAnim = $boolVal; } else if ($tag == "FramePrecision") { float $floatVal = $val; if ($floatVal == 0.5) { $framePrecision = 2; } else if ($floatVal == 0.2) { $framePrecision = 5; } else if ($floatVal == 0.1) { $framePrecision = 10; } } else if ($tag == "LoopAnim") { $loopAnim = $boolVal; } //----------------------------------------------------------------------------- // tolerance else if ($tag == "ToleranceScale") { $toleranceScale = $val; } else if ($tag == "ToleranceRotate") { $toleranceRotate = $val; } else if ($tag == "ToleranceTranslate") { $toleranceTranslate = $val; } else if ($tag == "ToleranceTexScale") { $toleranceTexScale = $val; } else if ($tag == "ToleranceTexRotate") { $toleranceTexRotate = $val; } else if ($tag == "ToleranceTexTranslate") { $toleranceTexTranslate = $val; } else if ($tag == "ToleranceColor") { $toleranceColor = $val; } } //----------------------------------------------------------------------------- // close file fclose($fid); //----------------------------------------------------------------------------- // set option var string $optStr = ""; $optStr += "ProcessMode=" + $processMode + ";"; $optStr += "ExportTarget=" + $exportTarget + ";"; $optStr += "OutputFileName=" + $outputFileName + ";"; $optStr += "OutputMode=" + $outputMode + ";"; $optStr += "OutputFolder=" + $outputFolder + ";"; $optStr += "MergeCmdl=" + $boolNames[$mergeCmdl] + ";"; $optStr += "MergeCmdlPath=" + $mergeCmdlPath + ";"; $optStr += "CopyRelatedFiles=" + $boolNames[$copyRelatedFiles] + ";"; //$optStr += "MergeCmdlAuto=" + $boolNames[$mergeCmdlAuto] + ";"; $optStr += "Magnify=" + $magnify + ";"; $optStr += "FrameRange=" + $frameRange + ";"; $optStr += "StartFrame=" + $startFrame + ";"; $optStr += "EndFrame=" + $endFrame + ";"; //$optStr += "TexMatrixMode=" + $texMatrixMode + ";"; $optStr += "RemoveNamespace=" + $boolNames[$removeNamespace] + ";"; $optStr += "OutputCmdl=" + $boolNames[$outputCmdl] + ";"; $optStr += "OutputCtex=" + $boolNames[$outputCtex] + ";"; $optStr += "OutputCmdla=" + $boolNames[$outputCmdla] + ";"; $optStr += "OutputCskla=" + $boolNames[$outputCskla] + ";"; $optStr += "OutputCmata=" + $boolNames[$outputCmata] + ";"; $optStr += "OutputCmcla=" + $boolNames[$outputCmcla] + ";"; $optStr += "OutputCmtpa=" + $boolNames[$outputCmtpa] + ";"; $optStr += "OutputCmtsa=" + $boolNames[$outputCmtsa] + ";"; $optStr += "OutputCcam=" + $boolNames[$outputCcam] + ";"; $optStr += "OutputClgt=" + $boolNames[$outputClgt] + ";"; $optStr += "OutputCenv=" + $boolNames[$outputCenv] + ";"; $optStr += "CompressNode=" + $compressNode + ";"; //$optStr += "CombinePolygon=" + $boolNames[$combinePolygon] + ";"; $optStr += "CompressMaterial=" + $boolNames[$compressMaterial] + ";"; $optStr += "OptimizePrimitive=" + $boolNames[$optimizePrimitive] + ";"; $optStr += "ConvertToModel=" + $boolNames[$convertToModel] + ";"; //$optStr += "DelUselessVtxData=" + $boolNames[$delUselessVtxData] + ";"; $optStr += "QuantizePos=" + $quantizePos + ";"; $optStr += "QuantizeNrm=" + $quantizeNrm + ";"; $optStr += "QuantizeTex=" + $quantizeTex + ";"; $optStr += "FrameFormat=" + $boolNames[$frameFormat] + ";"; $optStr += "ScaleQuantizeQuality=" + $scaleQuantizeQuality + ";"; $optStr += "RotateQuantizeQuality=" + $rotateQuantizeQuality + ";"; $optStr += "TranslateQuantizeQuality=" + $translateQuantizeQuality + ";"; $optStr += "AdjustSkinning=" + $adjustSkinning + ";"; $optStr += "MeshVisibilityMode=" + $meshVisibilityMode + ";"; $optStr += "NonUniformScale=" + $boolNames[$nonUniformScale] + ";"; $optStr += "MaxReservedUniformRegisters=" + $maxReservedUniformRegisters + ";"; $optStr += "BakeAllAnim=" + $boolNames[$bakeAllAnim] + ";"; $optStr += "FramePrecision=" + $framePrecision + ";"; $optStr += "LoopAnim=" + $boolNames[$loopAnim] + ";"; $optStr += "ToleranceScale=" + $toleranceScale + ";"; $optStr += "ToleranceRotate=" + $toleranceRotate + ";"; $optStr += "ToleranceTranslate=" + $toleranceTranslate + ";"; $optStr += "ToleranceTexScale=" + $toleranceTexScale + ";"; $optStr += "ToleranceTexRotate=" + $toleranceTexRotate + ";"; $optStr += "ToleranceTexTranslate=" + $toleranceTexTranslate + ";"; $optStr += "ToleranceColor=" + $toleranceColor + ";"; return $optStr; } /****************************************************************************** load setting from file (do) ******************************************************************************/ global proc nw4cExpDialog_LoadSettingFromFileDo(string $filePath) { //----------------------------------------------------------------------------- // get option string from c3es $optStr = nw4cExpDialog_GetOptionStringFromC3es($filePath); optionVar -sv nw4cExport_Options $optStr; //----------------------------------------------------------------------------- // update setting node SaveSettingToScene(1); //----------------------------------------------------------------------------- // refresh option box if (`scrollLayout -ex nw4cExpDialog_ScrollLayout`) { if (`columnLayout -ex nw4cExpDialog_MainColumn`) { NW4C_ExpDialog; } } //----------------------------------------------------------------------------- // end print ("Loaded from " + $filePath + "\n"); } /****************************************************************************** load setting from file (file command) ******************************************************************************/ global proc nw4cExpDialog_LoadSettingFromFileFC(string $filePath, string $fileType) { //----------------------------------------------------------------------------- // save setting file folder SaveSettingFileFolder($filePath); //----------------------------------------------------------------------------- // do nw4cExpDialog_LoadSettingFromFileDo($filePath); } /****************************************************************************** load setting from file (main) ******************************************************************************/ global proc nw4cExpDialog_LoadSettingFromFile() { //----------------------------------------------------------------------------- // set setting file folder to currnet //SetSettingFileFolderToCurrent(); //----------------------------------------------------------------------------- // open file dialog //fileBrowserDialog -m 0 -an "Load" -in "c3es" // -fc "nw4cExpDialog_LoadSettingFromFileFC"; string $dirMask = "*.c3es"; // fileDialog can use mask string $settingFolder = ""; if (`optionVar -ex nw4cExpDialog_SettingFileFolder`) { $settingFolder = `optionVar -q nw4cExpDialog_SettingFileFolder`; } if (size($settingFolder) > 0 && `filetest -d $settingFolder`) { $dirMask = $settingFolder + $dirMask; } //trace ("dirMask: " + $dirMask); string $filePath = `fileDialog -dm $dirMask`; if (size($filePath) > 0) { nw4cExpDialog_LoadSettingFromFileFC($filePath, ""); } } /****************************************************************************** process mode callback ******************************************************************************/ global proc nw4cExpDialog_ProcessModeCB() { if (!`control -q -vis nw4cExpDialog_ProcessMode`) { return; } int $animRangeFlag = (`radioButtonGrp -q -sl nw4cExpDialog_ProcessMode` == 2); int $useNWCS = (`radioButtonGrp -q -sl nw4cExpDialog_UseCreativeStudio` == 1); int $cmata = `checkBoxGrp -q -v1 nw4cExpDialog_CmataFileOut`; int $cmcla = 0; int $cmtpa = 0; int $cmtsa = 0; int $ccam = `checkBoxGrp -q -v1 nw4cExpDialog_CcamFileOut`; int $clgt = `checkBoxGrp -q -v1 nw4cExpDialog_ClgtFileOut`; int $cenv = `checkBoxGrp -q -v1 nw4cExpDialog_CenvFileOut`; int $fileNameFlag; if (`UseCustomUI` == 1) { $cmcla = `checkBoxGrp -q -v1 nw4cExpDialog_CmclaFileOut`; $cmtpa = `checkBoxGrp -q -v1 nw4cExpDialog_CmtpaFileOut`; $cmtsa = `checkBoxGrp -q -v1 nw4cExpDialog_CmtsaFileOut`; } $fileNameFlag = (!$animRangeFlag || $cmata || $cmcla || $cmtpa || $cmtsa || $ccam || $clgt || $cenv); control -e -en $fileNameFlag nw4cExpDialog_OutFileName; control -e -en $fileNameFlag nw4cExpDialog_SceneToOutFileName; control -e -en $fileNameFlag nw4cExpDialog_NodeToOutFileName; control -e -en ($animRangeFlag==0) nw4cExpDialog_UseCreativeStudio; if ($animRangeFlag && $useNWCS) { radioButtonGrp -e -sl 1 nw4cExpDialog_OutInterFile; radioButtonGrp -e -sl 0 nw4cExpDialog_UseCreativeStudio; nw4cExpDialog_OutInterFileCB(); } string $selectionStr = (!$animRangeFlag) ? "Selection ( Below )" : "Selection ( Tree )"; radioButtonGrp -e -l2 $selectionStr nw4cExpDialog_ExportTarget; } /****************************************************************************** out inter file callback ******************************************************************************/ global proc nw4cExpDialog_OutInterFileCB() { int $outInterFile = (`radioButtonGrp -q -sl nw4cExpDialog_OutInterFile` == 1); control -e -en $outInterFile nw4cExpDialog_OutFolder; control -e -en $outInterFile nw4cExpDialog_OutFolderBrowser; int $useCs = (`radioButtonGrp -q -sl nw4cExpDialog_UseCreativeStudio` == 1); int $cmdl = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlFileOut`; int $mergeCmdl = `checkBoxGrp -q -v1 nw4cExpDialog_MergeCmdlFlag`; int $cmdlPathEnable = $cmdl && $mergeCmdl; control -e -en $cmdl nw4cExpDialog_MergeCmdlFlag; control -e -en $cmdlPathEnable nw4cExpDialog_MergeCmdlPath; control -e -en $cmdlPathEnable nw4cExpDialog_MergeCmdlBrowser; control -e -en $cmdlPathEnable nw4cExpDialog_CopyRelatedFiles; //control -e -en ($cmdlPathEnable && $useCs) nw4cExpDialog_MergeCmdlAuto; } /****************************************************************************** set node name to file name ******************************************************************************/ global proc nw4cExpDialog_SetNodeNameToFileName() { // get selection // 後で階層の深さを調べるので -l が必要 string $xforms[] = `ls -l -sl -typ transform`; if (size($xforms) == 0) { $xforms = `ls -l -v -typ transform`; } if (size($xforms) == 0) { error "No transform node"; } // find top level node string $name, $buf[]; int $depthMin = 10000; for ($xform in $xforms) { int $depth = tokenize($xform, "|", $buf); if ($depth < $depthMin) { $name = $xform; $depthMin = $depth; } } // set name $name = substitute(".*|", $name, ""); // to short path textFieldGrp -e -tx $name nw4cExpDialog_OutFileName; } /****************************************************************************** out folder browser callback ******************************************************************************/ global proc nw4cExpDialog_OutFolderBrowserFC(string $filePath, string $fileType) { textFieldGrp -e -tx $filePath nw4cExpDialog_OutFolder; } global proc nw4cExpDialog_OutFolderBrowserCB() { NW4C_SetCurDirFromFile(`textFieldGrp -q -tx nw4cExpDialog_OutFolder`); eval("NW4C_FileDialog -m 4 -an \"Select\" -in \"Output Folder\" " + "-fc \"nw4cExpDialog_OutFolderBrowserFC\""); //fileBrowserDialog -m 4 -an "Select" -in "Output Folder" // -fc "nw4cExpDialog_OutFolderBrowserFC"; } /****************************************************************************** merge cmdl browser callback ******************************************************************************/ global proc nw4cExpDialog_MergeCmdlBrowserCB() { string $curPath = `textField -q -tx nw4cExpDialog_MergeCmdlPath`; if (size($curPath) > 0) { $curPath = dirname($curPath); $curPath = (`filetest -d $curPath`) ? ($curPath + "/") : ""; } string $newPath = `fileDialog -dm ($curPath + "*.cmdl")`; if (size($newPath) > 0) { textField -e -tx $newPath nw4cExpDialog_MergeCmdlPath; } } /****************************************************************************** magnify callback ******************************************************************************/ global proc nw4cExpDialog_MagnifyCB() { float $magnify = `floatFieldGrp -q -v1 nw4cExpDialog_Magnify`; if ($magnify < 0.001) { floatFieldGrp -e -v1 0.001 nw4cExpDialog_Magnify; } else if ($magnify > 1000.0) { floatFieldGrp -e -v1 1000.0 nw4cExpDialog_Magnify; } } /****************************************************************************** frame range callback ******************************************************************************/ global proc nw4cExpDialog_FrameRangeCB() { int $frameRange = `radioButtonGrp -q -sl nw4cExpDialog_FrameRange` - 1; int $enableFlag = ($frameRange == 2); control -e -en $enableFlag nw4cExpDialog_StartFrame; control -e -en $enableFlag nw4cExpDialog_EndFrame; } /****************************************************************************** frame start end callback ******************************************************************************/ global proc nw4cExpDialog_FrameStartEndCB() { int $start = `intField -q -v nw4cExpDialog_StartFrame`; int $end = `intField -q -v nw4cExpDialog_EndFrame`; if ($start > $end) { intField -e -v $end nw4cExpDialog_StartFrame; intField -e -v $start nw4cExpDialog_EndFrame; } } /****************************************************************************** convert to model callback ******************************************************************************/ global proc nw4cExpDialog_ConvertToModelCB() { int $convertToModel = `checkBoxGrp -q -v1 nw4cExpDialog_ConvertToModel`; control -e -en ($convertToModel == 0) nw4cExpDialog_CompressNode; } /****************************************************************************** max reserved uniform registers callback ******************************************************************************/ global proc nw4cExpDialog_MaxReservedUniformRegistersCB() { int $val = `intFieldGrp -q -v1 nw4cExpDialog_MaxReservedUniformRegisters`; if ($val < 0 || $val > 57) { if ($val < 0 ) $val = 0; if ($val > 57 ) $val = 57; intFieldGrp -e -v1 $val nw4cExpDialog_MaxReservedUniformRegisters; } } /****************************************************************************** model file callback ******************************************************************************/ global proc nw4cExpDialog_ModelCB() { int $cmdl = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlFileOut`; int $cmdla = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlaFileOut`; int $visAnim = ($cmdl || $cmdla); control -e -en $cmdl nw4cExpDialog_CompressMaterial; control -e -en $cmdl nw4cExpDialog_OptimizePrimitive; //control -e -en $cmdl nw4cExpDialog_DelUselessVtxData; control -e -en $cmdl nw4cExpDialog_QuantPos; control -e -en $cmdl nw4cExpDialog_QuantNrm; control -e -en $cmdl nw4cExpDialog_QuantTex; control -e -en $cmdl nw4cExpDialog_AdjustSkinning; control -e -en $visAnim nw4cExpDialog_MeshVisibilityMode; control -e -en $cmdl nw4cExpDialog_NonUniformScale; control -e -en $cmdl nw4cExpDialog_MaxReservedUniformRegisters; nw4cExpDialog_OutInterFileCB(); // update merge cmdl file } /****************************************************************************** anim file callback ******************************************************************************/ global proc nw4cExpDialog_AnimCB() { //----------------------------------------------------------------------------- // get out file int $cmdl = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlFileOut`; int $cmdla = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlaFileOut`; int $cskla = `checkBoxGrp -q -v1 nw4cExpDialog_CsklaFileOut`; int $ccam = `checkBoxGrp -q -v1 nw4cExpDialog_CcamFileOut`; int $clgt = `checkBoxGrp -q -v1 nw4cExpDialog_ClgtFileOut`; int $cmata = `checkBoxGrp -q -v1 nw4cExpDialog_CmataFileOut`; int $cmcla = 0; int $cmtpa = 0; int $cmtsa = 0; int $anyAnim; int $visAnim; if (`UseCustomUI` == 1) { $cmcla = `checkBoxGrp -q -v1 nw4cExpDialog_CmclaFileOut`; $cmtpa = `checkBoxGrp -q -v1 nw4cExpDialog_CmtpaFileOut`; $cmtsa = `checkBoxGrp -q -v1 nw4cExpDialog_CmtsaFileOut`; } $anyAnim = ($cmdla || $cskla || $cmata || $cmcla || $cmtpa || $cmtsa || $ccam || $clgt); $visAnim = ($cmdl || $cmdla); //----------------------------------------------------------------------------- // get frame format int $frameFmt = `checkBoxGrp -q -v1 nw4cExpDialog_FrameFormat`; //----------------------------------------------------------------------------- // process mode callback (enable/disable out file name) nw4cExpDialog_ProcessModeCB(); //----------------------------------------------------------------------------- // quantization options control -e -en $cskla nw4cExpDialog_FrameFormat; control -e -en ($cskla && !$frameFmt) nw4cExpDialog_ScaleQuantizeQuality; control -e -en ($cskla && !$frameFmt) nw4cExpDialog_RotateQuantizeQuality; control -e -en ($cskla && !$frameFmt) nw4cExpDialog_TranslateQuantizeQuality; //----------------------------------------------------------------------------- // model options control -e -en $visAnim nw4cExpDialog_MeshVisibilityMode; //----------------------------------------------------------------------------- // animation options control -e -en $anyAnim nw4cExpDialog_BakeAll; control -e -en $anyAnim nw4cExpDialog_FramePrecision; control -e -en $anyAnim nw4cExpDialog_LoopAnim; //----------------------------------------------------------------------------- // tolerance options int $nodeTolFlagRT = $cskla || $ccam || $clgt; int $nodeTolFlagS = $cskla; control -e -en $nodeTolFlagRT nw4cExpDialog_TolT; control -e -en $nodeTolFlagRT nw4cExpDialog_TolR; control -e -en $nodeTolFlagS nw4cExpDialog_TolS; int $texTolFlagSRT = $cmata || $cmtsa; control -e -en $texTolFlagSRT nw4cExpDialog_TolTexT; control -e -en $texTolFlagSRT nw4cExpDialog_TolTexR; control -e -en $texTolFlagSRT nw4cExpDialog_TolTexS; int $colorTolFlag = $cmata || $cmcla || $clgt; control -e -en $colorTolFlag nw4cExpDialog_TolC; } /****************************************************************************** tolerance srt callback ******************************************************************************/ global proc nw4cExpDialog_ToleranceSRTCB(string $field) { float $val = eval("floatFieldGrp -q -v1 " + $field); if ($val < 0.0) { eval("floatFieldGrp -e -v1 0.0 " + $field); } } /****************************************************************************** tolerance color callback ******************************************************************************/ global proc nw4cExpDialog_ToleranceColorCB(string $field) { float $val = eval("floatFieldGrp -q -v1 " + $field); if ($val < 0.0) { eval("floatFieldGrp -e -v1 0.0 " + $field); } } /****************************************************************************** update all control state ******************************************************************************/ proc nw4cExpDialog_UpdateAllControlState() { nw4cExpDialog_ProcessModeCB(); nw4cExpDialog_OutInterFileCB(); nw4cExpDialog_MagnifyCB(); nw4cExpDialog_FrameRangeCB(); nw4cExpDialog_FrameStartEndCB(); nw4cExpDialog_ConvertToModelCB(); nw4cExpDialog_ModelCB(); nw4cExpDialog_AnimCB(); nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolT"); nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolR"); nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolS"); nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolTexT"); nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolTexR"); nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolTexS"); nw4cExpDialog_ToleranceColorCB("nw4cExpDialog_TolC"); } /****************************************************************************** set option variable ******************************************************************************/ proc SetOptionVariable(int $resetFlag) { if ($resetFlag || !`optionVar -ex nw4cExport_Options`) { string $optStr = "ProcessMode=Single;" + "ExportTarget=All;" + "OutputFileName=" + `file -q -namespace` + ";" + "OutputMode=File;" + "OutputFolder=" + `workspace -q -rd` + ";" + "MergeCmdl=false;" + "MergeCmdlPath=" + "" + ";" + "CopyRelatedFiles=false;" + //"MergeCmdlAuto=true;" + "Magnify=1.0;" + "FrameRange=All;" + "StartFrame=1;" + "EndFrame=100;" + //"TexMatrixMode=Maya;" + "RemoveNamespace=false;" + "OutputCmdl=true;" + "OutputCtex=true;" + "OutputCmdla=false;" + "OutputCskla=false;" + "OutputCmata=false;" + "OutputCmcla=false;" + "OutputCmtpa=false;" + "OutputCmtsa=false;" + "OutputCcam=false;" + "OutputClgt=false;" + "OutputCenv=false;" + "CompressNode=None;" + //"CombinePolygon=true;" + "CompressMaterial=false;" + "OptimizePrimitive=true;" + "ConvertToModel=false;" + //"DelUselessVtxData=false;" + "QuantizePos=Float;" + "QuantizeNrm=Float;" + "QuantizeTex=Float;" + "FrameFormat=false;" + "ScaleQuantizeQuality=9;" + "RotateQuantizeQuality=9;" + "TranslateQuantizeQuality=9;" + "AdjustSkinning=None;" + "MeshVisibilityMode=BindByIndex;" + "NonUniformScale=false;" + "MaxReservedUniformRegisters=0;" + "BakeAllAnim=true;" + "FramePrecision=1;" + "LoopAnim=false;" + "ToleranceScale=0.1;" + "ToleranceRotate=0.1;" + "ToleranceTranslate=0.01;" + "ToleranceTexScale=0.1;" + "ToleranceTexRotate=0.1;" + "ToleranceTexTranslate=0.01;" + "ToleranceColor=0.001;" + ""; optionVar -sv nw4cExport_Options $optStr; } } /****************************************************************************** set option control ******************************************************************************/ proc SetOptionControl() { global int $nw4cExpDialog_SettingVer; global int $nw4cExpDialog_SettingLatestVer; int $useCustomUI = UseCustomUI(); int $use3DEditor = Use3DEditor(); if (`optionVar -ex nw4cExport_Options`) { string $optStr = `optionVar -q nw4cExport_Options`; if (size($optStr) > 0) { string $optList[]; tokenize($optStr, ";", $optList); int $iopt; for ($iopt = 0; $iopt < size($optList); ++$iopt) { string $words[]; tokenize($optList[$iopt], "=", $words); int $intVal; float $floatVal; int $boolVal = ($words[1] == "true" || $words[1] == "On" || $words[1] == "1"); //----------------------------------------------------------------------------- // output if ($words[0] == "ProcessMode") { $intVal = ($words[1] == "AnimationRange"); radioButtonGrp -e -sl ($intVal + 1) nw4cExpDialog_ProcessMode; } else if ($words[0] == "ExportTarget") { $intVal = ($words[1] == "Selection"); radioButtonGrp -e -sl ($intVal + 1) nw4cExpDialog_ExportTarget; } else if ($words[0] == "OutputFileName") { textFieldGrp -e -tx $words[1] nw4cExpDialog_OutFileName; } else if ($words[0] == "OutputMode") { if ($words[1] == "File") { radioButtonGrp -e -sl 1 nw4cExpDialog_OutInterFile; } else if ($words[1] == "CreativeStudio") { radioButtonGrp -e -sl 1 nw4cExpDialog_UseCreativeStudio; } else if ($use3DEditor) { radioButtonGrp -e -sl 1 nw4cExpDialog_Use3DEditor; } } else if ($words[0] == "OutputFolder") { textFieldGrp -e -tx $words[1] nw4cExpDialog_OutFolder; } else if ($words[0] == "MergeCmdl") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_MergeCmdlFlag; } else if ($words[0] == "MergeCmdlPath") { textField -e -tx $words[1] nw4cExpDialog_MergeCmdlPath; } else if ($words[0] == "CopyRelatedFiles") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CopyRelatedFiles; } //else if ($words[0] == "MergeCmdlAuto") //{ // checkBoxGrp -e -v1 $boolVal nw4cExpDialog_MergeCmdlAuto; //} //----------------------------------------------------------------------------- // general else if ($words[0] == "Magnify") { $floatVal = $words[1]; floatFieldGrp -e -v1 $floatVal nw4cExpDialog_Magnify; } else if ($words[0] == "FrameRange") { int $sel = 1; // All if ($words[1] == "Playback") { $sel = 2; } else if ($words[1] == "Range") { $sel = 3; } radioButtonGrp -e -sl $sel nw4cExpDialog_FrameRange; } else if ($words[0] == "StartFrame") { $intVal = $words[1]; intField -e -v $intVal nw4cExpDialog_StartFrame; } else if ($words[0] == "EndFrame") { $intVal = $words[1]; intField -e -v $intVal nw4cExpDialog_EndFrame; } //else if ($words[0] == "TexMatrixMode") //{ // int $sel = 1; // maya // if ($words[1] == "3dsmax") // { // $sel = 2; // } // optionMenuGrp -e -sl $sel nw4cExpDialog_TexMatrixMode; //} else if ($words[0] == "RemoveNamespace") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_RemoveNamespace; } //----------------------------------------------------------------------------- // file select else if ($words[0] == "OutputCmdl") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmdlFileOut; } else if ($words[0] == "OutputCtex") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CtexFileOut; } else if ($words[0] == "OutputCmdla") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmdlaFileOut; } else if ($words[0] == "OutputCskla") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CsklaFileOut; } else if ($words[0] == "OutputCmata") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmataFileOut; } else if ($words[0] == "OutputCmcla") { if ($useCustomUI == 1) { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmclaFileOut; } } else if ($words[0] == "OutputCmtpa") { if ($useCustomUI == 1) { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmtpaFileOut; } } else if ($words[0] == "OutputCmtsa") { if ($useCustomUI == 1) { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmtsaFileOut; } } else if ($words[0] == "OutputCcam") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CcamFileOut; } else if ($words[0] == "OutputClgt") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_ClgtFileOut; } else if ($words[0] == "OutputCenv") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CenvFileOut; } //----------------------------------------------------------------------------- // optimization else if ($words[0] == "CompressNode") { int $sel = 1; // None if ($words[1] == "Cull") { $sel = 2; } else if ($words[1] == "CullUninfluential") { $sel = 3; } else if ($words[1] == "UniteCompressible") { $sel = 4; } else if ($words[1] == "UniteAll") { $sel = 5; } optionMenuGrp -e -sl $sel nw4cExpDialog_CompressNode; } //else if ($words[0] == "CombinePolygon") //{ // checkBox -e -v $boolVal nw4cExpDialog_CombinePolygon; //} else if ($words[0] == "CompressMaterial") { optionMenuGrp -e -sl ($boolVal + 1) nw4cExpDialog_CompressMaterial; } else if ($words[0] == "OptimizePrimitive") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_OptimizePrimitive; } else if ($words[0] == "ConvertToModel") { // ConvertToModel は下位互換がないため、1.3.0 よりも前に設定された出力オプション // からロードする時は無視する if ($nw4cExpDialog_SettingVer >= 13) { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_ConvertToModel; } } //else if ($words[0] == "DelUselessVtxData") //{ // checkBoxGrp -e -v1 $boolVal nw4cExpDialog_DelUselessVtxData; //} //----------------------------------------------------------------------------- // quantization else if ($words[0] == "QuantizePos") { int $sel = 1; // Float if ($words[1] == "Float") { $sel = 1; } else if ($words[1] == "Short") { $sel = 2; } else if ($words[1] == "Byte") { $sel = 3; } optionMenuGrp -e -sl $sel nw4cExpDialog_QuantPos; } else if ($words[0] == "QuantizeNrm") { int $sel = 1; // Float if ($words[1] == "Float") { $sel = 1; } else if ($words[1] == "Short") { $sel = 2; } else if ($words[1] == "Byte") { $sel = 3; } optionMenuGrp -e -sl $sel nw4cExpDialog_QuantNrm; } else if ($words[0] == "QuantizeTex") { int $sel = 1; // Float if ($words[1] == "Float") { $sel = 1; } else if ($words[1] == "Short") { $sel = 2; } else if ($words[1] == "Byte") { $sel = 3; } optionMenuGrp -e -sl $sel nw4cExpDialog_QuantTex; } else if ($words[0] == "FrameFormat") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_FrameFormat; } else if ($words[0] == "ScaleQuantizeQuality") { $intVal = $words[1]; intSliderGrp -e -v $intVal nw4cExpDialog_ScaleQuantizeQuality; } else if ($words[0] == "RotateQuantizeQuality") { $intVal = $words[1]; intSliderGrp -e -v $intVal nw4cExpDialog_RotateQuantizeQuality; } else if ($words[0] == "TranslateQuantizeQuality") { $intVal = $words[1]; intSliderGrp -e -v $intVal nw4cExpDialog_TranslateQuantizeQuality; } //----------------------------------------------------------------------------- // model else if ($words[0] == "AdjustSkinning") { int $sel = 1; // None if ($words[1] == "None") { $sel = 1; } else if ($words[1] == "RigidSkinning") { $sel = 2; } optionMenuGrp -e -sl $sel nw4cExpDialog_AdjustSkinning; } else if ($words[0] == "MeshVisibilityMode") { int $sel = 1; // BindByIndex if ($words[1] == "BindByIndex") { $sel = 1; } else if ($words[1] == "BindByName") { $sel = 2; } optionMenuGrp -e -sl $sel nw4cExpDialog_MeshVisibilityMode; } else if ($words[0] == "NonUniformScale") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_NonUniformScale; } else if ($words[0] == "MaxReservedUniformRegisters") { $intVal = $words[1]; intFieldGrp -e -v1 $intVal nw4cExpDialog_MaxReservedUniformRegisters; } //----------------------------------------------------------------------------- // anim else if ($words[0] == "BakeAllAnim") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_BakeAll; } else if ($words[0] == "FramePrecision") { $intVal = $words[1]; int $sel = 1; // 1.0 if ($intVal == "2") // 0.5 { $sel = 2; } else if ($intVal == "5") // 0.2 { $sel = 3; } else if ($intVal == "10") // 0.1 { $sel = 4; } optionMenuGrp -e -sl $sel nw4cExpDialog_FramePrecision; } else if ($words[0] == "LoopAnim") { checkBoxGrp -e -v1 $boolVal nw4cExpDialog_LoopAnim; } //----------------------------------------------------------------------------- // tolerance else if ($words[0] == "ToleranceScale") { $floatVal = $words[1]; floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolS; } else if ($words[0] == "ToleranceRotate") { $floatVal = $words[1]; floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolR; } else if ($words[0] == "ToleranceTranslate") { $floatVal = $words[1]; floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolT; } else if ($words[0] == "ToleranceTexScale") { $floatVal = $words[1]; floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolTexS; } else if ($words[0] == "ToleranceTexRotate") { $floatVal = $words[1]; floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolTexR; } else if ($words[0] == "ToleranceTexTranslate") { $floatVal = $words[1]; floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolTexT; } else if ($words[0] == "ToleranceColor") { $floatVal = $words[1]; floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolC; } } } } //----------------------------------------------------------------------------- // update control state nw4cExpDialog_UpdateAllControlState(); //----------------------------------------------------------------------------- // ConvertToModel がバージョンによって動作が異なるための処理。 // 一度ロードしたら内部のバージョンを上げて、以降は ConvertToModel を読み込むようにする。 $nw4cExpDialog_SettingVer = $nw4cExpDialog_SettingLatestVer; } /****************************************************************************** check option value ******************************************************************************/ proc CheckOptionValue() { int $use3DEditor = Use3DEditor(); int $animRangeFlag = (`radioButtonGrp -q -sl nw4cExpDialog_ProcessMode` == 2); //int $cscaFlag = `checkBoxGrp -q -v1 nw4cExpDialog_CscaFileOut`; int $cscaFlag = 0; if (!$animRangeFlag || $cscaFlag) { string $outputFileName = `textFieldGrp -q -tx nw4cExpDialog_OutFileName`; if (size($outputFileName) == 0) { ShowError("Output File Name is wrong"); } if (size(match("[=;:/*?<>|\"]", $outputFileName)) > 0 || NW4C_GetUnixFilePath($outputFileName) != $outputFileName) // check "\" { ShowError("Output File Name is wrong (please don't use [=] [;] [:] [/] [\\] [*] [?] [<] [>] [|] [double quote])"); } } int $useCs = (`radioButtonGrp -q -sl nw4cExpDialog_UseCreativeStudio` == 1); int $use3DE = 0; if ($use3DEditor) { $use3DE = (`radioButtonGrp -q -sl nw4cExpDialog_Use3DEditor` == 1); } if (!$useCs && !$use3DE) { string $outputFolder = `textFieldGrp -q -tx nw4cExpDialog_OutFolder`; if (size($outputFolder) == 0) { ShowError("Output Folder is wrong"); } if (size(match("[=;*?<>|\"]", $outputFolder)) > 0) { ShowError("Output Folder is wrong (please don't use [=] [;] [*] [?] [<] [>] [|] [double quote])"); } } int $mergeCmdl = `checkBoxGrp -q -v1 nw4cExpDialog_MergeCmdlFlag`; if ($mergeCmdl) { string $mergeCmdlPath = `textField -q -tx nw4cExpDialog_MergeCmdlPath`; if (size($mergeCmdlPath) == 0) { ShowError("Path of cmdl file to merge is wrong"); } if (size(match("[=;*?<>|\"]", $mergeCmdlPath)) > 0) { ShowError("Path of cmdl file to merge is wrong (please don't use [=] [;] [*] [?] [<] [>] [|] [double quote])"); } } } /****************************************************************************** update option variable (UpdateOptionVariableT) ******************************************************************************/ global proc nw4cExpDialog_UpdateOptionVariable(int $saveSettingToScene) { int $use3DEditor = Use3DEditor(); int $intVal; float $floatVal; string $optStr = "", $path; string $boolNames[2] = { "false", "true" }; //----------------------------------------------------------------------------- // output $intVal = `radioButtonGrp -q -sl nw4cExpDialog_ProcessMode` - 1; string $processModeNames[] = { "Single", "AnimationRange" }; $optStr += "ProcessMode=" + $processModeNames[$intVal] + ";"; $intVal = `radioButtonGrp -q -sl nw4cExpDialog_ExportTarget` - 1; string $exportTargetNames[] = { "All", "Selection" }; $optStr += "ExportTarget=" + $exportTargetNames[$intVal] + ";"; $optStr += "OutputFileName=" + `textFieldGrp -q -tx nw4cExpDialog_OutFileName` + ";"; $intVal = (`radioButtonGrp -q -sl nw4cExpDialog_UseCreativeStudio` == 1); if ($use3DEditor) { if (`radioButtonGrp -q -sl nw4cExpDialog_Use3DEditor` == 1) $intVal = 2; } string $outputTargetNames[] = { "File", "CreativeStudio", "3DEditor" }; $optStr += "OutputMode=" + $outputTargetNames[$intVal] + ";"; $path = `textFieldGrp -q -tx nw4cExpDialog_OutFolder`; $optStr += "OutputFolder=" + NW4C_GetUnixFilePath($path) + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_MergeCmdlFlag`; $optStr += "MergeCmdl=" + $boolNames[$intVal] + ";"; $path = `textField -q -tx nw4cExpDialog_MergeCmdlPath`; $optStr += "MergeCmdlPath=" + NW4C_GetUnixFilePath($path) + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CopyRelatedFiles`; $optStr += "CopyRelatedFiles=" + $boolNames[$intVal] + ";"; // $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_MergeCmdlAuto`; // $optStr += "MergeCmdlAuto=" + $boolNames[$intVal] + ";"; //----------------------------------------------------------------------------- // general $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_Magnify`; $optStr += "Magnify=" + $floatVal + ";"; $intVal = `radioButtonGrp -q -sl nw4cExpDialog_FrameRange` - 1; string $frameRangeNames[] = { "All", "Playback", "Range" }; $optStr += "FrameRange=" + $frameRangeNames[$intVal] + ";"; $intVal = `intField -q -v nw4cExpDialog_StartFrame`; $optStr += "StartFrame=" + $intVal + ";"; $intVal = `intField -q -v nw4cExpDialog_EndFrame`; $optStr += "EndFrame=" + $intVal + ";"; // $intVal = `optionMenuGrp -q -sl nw4cExpDialog_TexMatrixMode` - 1; // string $texMatrixModeNames[] = { "Maya", "3dsMax" }; // $optStr += "TexMatrixMode=" + $texMatrixModeNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_RemoveNamespace`; $optStr += "RemoveNamespace=" + $boolNames[$intVal] + ";"; //----------------------------------------------------------------------------- // file selection $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlFileOut`; $optStr += "OutputCmdl=" + $boolNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CtexFileOut`; $optStr += "OutputCtex=" + $boolNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlaFileOut`; $optStr += "OutputCmdla=" + $boolNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CsklaFileOut`; $optStr += "OutputCskla=" + $boolNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmataFileOut`; $optStr += "OutputCmata=" + $boolNames[$intVal] + ";"; if (`UseCustomUI` == 1) { $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmclaFileOut`; $optStr += "OutputCmcla=" + $boolNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmtpaFileOut`; $optStr += "OutputCmtpa=" + $boolNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmtsaFileOut`; $optStr += "OutputCmtsa=" + $boolNames[$intVal] + ";"; } else { // CustomUI を使用しない時は cmcla, cmtpa, cmtsa を出力しないようにする。 $optStr += "OutputCmcla=" + $boolNames[0] + ";"; $optStr += "OutputCmtpa=" + $boolNames[0] + ";"; $optStr += "OutputCmtsa=" + $boolNames[0] + ";"; } $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CcamFileOut`; $optStr += "OutputCcam=" + $boolNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_ClgtFileOut`; $optStr += "OutputClgt=" + $boolNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CenvFileOut`; $optStr += "OutputCenv=" + $boolNames[$intVal] + ";"; //----------------------------------------------------------------------------- // optimization $intVal = `optionMenuGrp -q -sl nw4cExpDialog_CompressNode` - 1; string $compressNodeNames[] = { "None", "Cull", "CullUninfluential", "UniteCompressible", "UniteAll" }; $optStr += "CompressNode=" + $compressNodeNames[$intVal] + ";"; // $intVal = `checkBox -q -v nw4cExpDialog_CombinePolygon`; // $optStr += "CombinePolygon=" + $boolNames[$intVal] + ";"; $intVal = `optionMenuGrp -q -sl nw4cExpDialog_CompressMaterial` - 1; $optStr += "CompressMaterial=" + $boolNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_OptimizePrimitive`; $optStr += "OptimizePrimitive=" + $boolNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_ConvertToModel`; $optStr += "ConvertToModel=" + $boolNames[$intVal] + ";"; // $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_DelUselessVtxData`; // $optStr += "DelUselessVtxData=" + $boolNames[$intVal] + ";"; //----------------------------------------------------------------------------- // quantization $intVal = `optionMenuGrp -q -sl nw4cExpDialog_QuantPos` - 1; string $quantPosNames[] = { "Float", "Short", "Byte", "Auto" }; $optStr += "QuantizePos=" + $quantPosNames[$intVal] + ";"; $intVal = `optionMenuGrp -q -sl nw4cExpDialog_QuantNrm` - 1; string $quantNrmNames[] = { "Float", "Short", "Byte", "Auto" }; $optStr += "QuantizeNrm=" + $quantNrmNames[$intVal] + ";"; $intVal = `optionMenuGrp -q -sl nw4cExpDialog_QuantTex` - 1; string $quantTexNames[] = { "Float", "Short", "Byte", "Auto" }; $optStr += "QuantizeTex=" + $quantTexNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_FrameFormat`; $optStr += "FrameFormat=" + $boolNames[$intVal] + ";"; $intVal = `intSliderGrp -q -v nw4cExpDialog_ScaleQuantizeQuality`; $optStr += "ScaleQuantizeQuality=" + $intVal + ";"; $intVal = `intSliderGrp -q -v nw4cExpDialog_RotateQuantizeQuality`; $optStr += "RotateQuantizeQuality=" + $intVal + ";"; $intVal = `intSliderGrp -q -v nw4cExpDialog_TranslateQuantizeQuality`; $optStr += "TranslateQuantizeQuality=" + $intVal + ";"; //----------------------------------------------------------------------------- // model $intVal = `optionMenuGrp -q -sl nw4cExpDialog_AdjustSkinning` - 1; string $adjustSkinningNames[] = { "None", "RigidSkinning" }; $optStr += "AdjustSkinning=" + $adjustSkinningNames[$intVal] + ";"; $intVal = `optionMenuGrp -q -sl nw4cExpDialog_MeshVisibilityMode` - 1; string $meshVisibilityModeNames[] = { "BindByIndex", "BindByName" }; $optStr += "MeshVisibilityMode=" + $meshVisibilityModeNames[$intVal] + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_NonUniformScale`; $optStr += "NonUniformScale=" + $boolNames[$intVal] + ";"; $intVal = `intFieldGrp -q -v1 nw4cExpDialog_MaxReservedUniformRegisters`; $optStr += "MaxReservedUniformRegisters=" + $intVal + ";"; //----------------------------------------------------------------------------- // animation $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_BakeAll`; $optStr += "BakeAllAnim=" + $boolNames[$intVal] + ";"; $intVal = `optionMenuGrp -q -sl nw4cExpDialog_FramePrecision`; int $framePrecision = 1; if ($intVal == 2) // 0.5 { $framePrecision = 2; } else if ($intVal == 3) // 0.2 { $framePrecision = 5; } else if ($intVal == 4) // 0.1 { $framePrecision = 10; } $optStr += "FramePrecision=" + $framePrecision + ";"; $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_LoopAnim`; $optStr += "LoopAnim=" + $boolNames[$intVal] + ";"; //----------------------------------------------------------------------------- // tolerance $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolS`; $optStr += "ToleranceScale=" + $floatVal + ";"; $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolR`; $optStr += "ToleranceRotate=" + $floatVal + ";"; $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolT`; $optStr += "ToleranceTranslate=" + $floatVal + ";"; $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolTexT`; $optStr += "ToleranceTexTranslate=" + $floatVal + ";"; $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolTexR`; $optStr += "ToleranceTexRotate=" + $floatVal + ";"; $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolTexS`; $optStr += "ToleranceTexScale=" + $floatVal + ";"; $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolC`; $optStr += "ToleranceColor=" + $floatVal + ";"; //----------------------------------------------------------------------------- // set option var optionVar -sv nw4cExport_Options $optStr; //----------------------------------------------------------------------------- // save setting to scene if ($saveSettingToScene) { SaveSettingToScene(1); } } /****************************************************************************** reset option variable ******************************************************************************/ global proc nw4cExpDialog_ResetOptionVariable() { //----------------------------------------------------------------------------- // reset export dialog options SetOptionVariable(1); SetOptionControl(); //----------------------------------------------------------------------------- // save setting to scene SaveSettingToScene(1); } /****************************************************************************** do export command ******************************************************************************/ proc DoExportCmd(int $forceOverwrite) { //----------------------------------------------------------------------------- // load plugin LoadPlugin(); //----------------------------------------------------------------------------- // get options string $optStr = ""; if (`optionVar -ex nw4cExport_Options`) { $optStr = `optionVar -q nw4cExport_Options`; } //----------------------------------------------------------------------------- // export string $cmd = "NW4C_ExportCmd "; if ($forceOverwrite) { $cmd += "-f "; } $cmd += "-op \"" + $optStr + "\""; //trace ("cmd: " + $cmd); if (catch(eval($cmd))) { //error "NW4C_Export Failed"; } } /****************************************************************************** export callback ******************************************************************************/ global proc nw4cExpDialog_ExportCB() { CheckOptionValue(); nw4cExpDialog_UpdateOptionVariable(1); DoExportCmd(0); } /****************************************************************************** save settings callback ******************************************************************************/ global proc nw4cExpDialog_SaveSettingsCB() { CheckOptionValue(); nw4cExpDialog_UpdateOptionVariable(1); } /****************************************************************************** setting menu command (post menu command) ******************************************************************************/ global proc nw4cExpDialog_SettingMenuCmd() { int $sceneSettingFlag = DoesSaveLoadSceneSetting(); int $settingNodeFlag = `objExists nw4cExpDialog_Setting1`; menuItem -e -cb $sceneSettingFlag nw4cExpDialog_SaveLoadSceneSettingMenu; menuItem -e -en $settingNodeFlag nw4cExpDialog_DeleteSceneSettingMenu; } /****************************************************************************** save load scene setting menu command ******************************************************************************/ global proc nw4cExpDialog_SaveLoadSceneSettingMenuCmd() { int $sceneSettingFlag = DoesSaveLoadSceneSetting(); $sceneSettingFlag = !$sceneSettingFlag; optionVar -iv nw4cExpDialog_SaveLoadSceneSetting $sceneSettingFlag; menuItem -e -cb $sceneSettingFlag nw4cExpDialog_SaveLoadSceneSettingMenu; } /****************************************************************************** delete scene setting menu command ******************************************************************************/ global proc nw4cExpDialog_DeleteSceneSettingMenuCmd() { DeleteUselessSettingNode(); string $node = "nw4cExpDialog_Setting1"; if (`referenceQuery -inr $node`) { print "NW4C export settings node is referenced\n"; } else { catch(`delete $node`); } } /****************************************************************************** create setting menu ******************************************************************************/ proc CreateSettingMenu(string $parent) { //----------------------------------------------------------------------------- // get option box global string $gOptionBox; if (!`window -ex $gOptionBox`) { return; } //----------------------------------------------------------------------------- // delete previous menu if (`menu -q -ex nw4cExpDialog_SettingMenu`) { deleteUI nw4cExpDialog_SettingMenu; } //----------------------------------------------------------------------------- // create menu int $sceneSettingFlag = DoesSaveLoadSceneSetting(); menu -l "NW4C Settings" -p $gOptionBox -pmc "nw4cExpDialog_SettingMenuCmd" nw4cExpDialog_SettingMenu; menuItem -l "Save / Load Scene Settings" -cb $sceneSettingFlag -ann "Save settings to scene when exporting & Load settings from scene when opening scene" -c "nw4cExpDialog_SaveLoadSceneSettingMenuCmd" nw4cExpDialog_SaveLoadSceneSettingMenu; menuItem -l "Delete Scene Settings" -ann "Delete script node for settings" -c "nw4cExpDialog_DeleteSceneSettingMenuCmd" nw4cExpDialog_DeleteSceneSettingMenu; menuItem -d 1; menuItem -l "Load Settings from c3es File" -ann "Load settings from \".c3es\" file" -c "nw4cExpDialog_LoadSettingFromFile" nw4cExpDialog_LoadSettingFromFileMenu; menuItem -l "Save Settings to c3es File" -ann "Save settings to \".c3es\" file" -c "nw4cExpDialog_SaveSettingToFile" nw4cExpDialog_SaveSettingToMenu; //----------------------------------------------------------------------------- // set script job to delete menu scriptJob -p $gOptionBox -uid nw4cExpDialog_ScrollLayout "if (!`scrollLayout -ex nw4cExpDialog_ScrollLayout`) { deleteUI nw4cExpDialog_SettingMenu; }"; } /****************************************************************************** is no compress node ******************************************************************************/ proc int IsNoCompressNode(string $node) { return (`attributeQuery -n $node -ex "nw4cNoCompressNode"`) ? `getAttr ($node + ".nw4cNoCompressNode")` : 0; } /****************************************************************************** is scene anim object ******************************************************************************/ proc int IsSceneAnimObject(string $node) { string $type = nodeType($node); string $childs[] = `listRelatives -pa -s $node`; if (size(`ls -cameras -lights -typ environmentFog $childs`) > 0 || $type == "lookAt") { return true; } return false; } /****************************************************************************** is constraint node ******************************************************************************/ proc int IsConstraintNode(string $node) { return (size(`ls -typ constraint $node`) != 0); } /****************************************************************************** is needless locator or group ******************************************************************************/ proc int IsNeedlessLocatorOrGroup(string $node) { if (nodeType($node) == "transform") { string $childs[] = `listRelatives -pa -ni $node`; if (size($childs) == 0) // empty group { return true; } else if (size($childs) == 1) { string $childType = nodeType($childs[0]); if ($childType == "locator") // locator without child { return true; } } } return false; } /****************************************************************************** is blend shape target ******************************************************************************/ proc int IsBlendShapeTarget(string $node) { string $shapes[] = `listRelatives -pa -ni -s $node`; if (size($shapes) && nodeType($shapes[0]) == "mesh") { string $cons[] = `listConnections -s 0 -d 1 ($shapes[0] + ".worldMesh")`; if (size($cons) && nodeType($cons[0]) == "blendShape") { return true; } } return false; } /****************************************************************************** is animation range control node ******************************************************************************/ proc int IsAnimRangeControlNode(string $node) { return `attributeQuery -n $node -ex "nw4c_AnimRangeEnable"`; } /****************************************************************************** is effective node ******************************************************************************/ proc int IsEffectiveNode(string $node) { if (IsNoCompressNode($node)) { return true; } string $type = nodeType($node); if ($type == "ikHandle" || $type == "ikEffector" || IsConstraintNode($node) || IsNeedlessLocatorOrGroup($node) || IsBlendShapeTarget($node) || IsAnimRangeControlNode($node)) { return false; } if (`getAttr ($node + ".template")`) { return false; } if (`getAttr ($node + ".overrideEnabled")`) { if (!`getAttr ($node + ".overrideVisibility")` || !`getAttr ($node + ".overrideShading")` || `getAttr ($node + ".overrideDisplayType")` == 1) // Template { return false; } } return true; } /****************************************************************************** remove no output child (both argments must be long path) ******************************************************************************/ proc RemoveNoOutputChild(string $xforms[], string $noOutputs[]) { string $dsts[]; for ($xform in $xforms) { int $enable = true; for ($noOutput in $noOutputs) { if (gmatch($xform, $noOutput + "|*")) { $enable = false; //print ("remove by parent: " + $xform + " (" + $noOutput + ")\n"); } } if ($enable) { $dsts[size($dsts)] = $xform; } } $xforms = $dsts; } /****************************************************************************** get animation range target nodes ******************************************************************************/ proc GetAnimRangeTargetNodes(string $xforms[]) { string $roots[]; string $sels[] = `ls -l -sl -typ transform`; for ($sel in $sels) { string $root = match("|[^|]+", $sel); $roots[size($roots)] = $root; } $xforms = `ls -l -dag -typ transform $roots`; } /****************************************************************************** get node parent list ******************************************************************************/ proc GetNodeParentList(string $list[], string $node) { clear($list); while (1) { $list[size($list)] = $node; string $parents[] = `listRelatives -pa -p $node`; if (!size($parents)) { break; } $node = $parents[0]; } } /****************************************************************************** is attr animated ******************************************************************************/ proc int IsAttrAnimated(string $plug) { string $ins[] = `listConnections -s 1 -d 0 $plug`; if (size($ins)) { string $hists[] = `listHistory $ins[0]`; if (size(`ls -typ animCurve -typ expression $hists`)) { return true; } } return false; } /****************************************************************************** is xform node animated ******************************************************************************/ proc int IsXformNodeAnimated(string $xform, int $depth) { string $attrs[] = { "tx", "ty", "tz", "rx", "ry", "rz", "sx", "sy", "sz" }; string $compAttrs[] = { "t", "r", "s" }; //----------------------------------------------------------------------------- // check search depth //print ("ixna: " + $xform + ", " + $depth + "\n"); if ($depth >= 3) { return false; } //----------------------------------------------------------------------------- // child attr string $checkedCons[]; for ($attr in $attrs) { string $plug = $xform + "." + $attr; string $ins[] = `listConnections -s 1 -d 0 $plug`; if (size($ins)) { string $inNode = $ins[0]; string $inType = nodeType($inNode); string $hists[]; if (gmatch($inType, "animBlendNode*")) $hists = `listHistory $inNode`; else $hists = `listHistory $plug`; //----------------------------------------------------------------------------- // curve & expression & rigid body if (size(`ls -typ animCurve -typ expression -typ rigidBody $hists`)) { return true; } //----------------------------------------------------------------------------- // xform attr connection (node1.attr -> node2.attr) if ($inNode != $xform && size(`ls -et transform -et joint $inNode`)) { if (IsXformNodeAnimated($inNode, $depth + 1)) { return true; } } //----------------------------------------------------------------------------- // constraint string $cons[] = `ls -typ constraint $hists`; if (size($cons)) { //return true; string $con = $cons[0]; if (FindStringInArray($checkedCons, $con) == -1) { string $targets[] = `listConnections -s 1 -d 0 -type transform ($con + ".tg")`; $targets = stringArrayRemoveDuplicates($targets); //print "tar:\n"; print $targets; for ($target in $targets) { if ($target != $xform && $target != $con) { string $list[]; GetNodeParentList($list, $target); for ($n in $list) { if (IsXformNodeAnimated($n, $depth + 1)) { return true; } } } } $checkedCons[size($checkedCons)] = $con; } } } } //----------------------------------------------------------------------------- // compound attr for ($attr in $compAttrs) { string $plug = $xform + "." + $attr; string $ins[] = `listConnections -s 1 -d 0 $plug`; if (size($ins)) { string $inNode = $ins[0]; //----------------------------------------------------------------------------- // xform (curve -> node1.t -> node2.t) if (size(`ls -et transform -et joint $inNode`) && $inNode != $xform) { if (IsXformNodeAnimated($inNode, $depth + 1)) { return true; } } } } return false; } /****************************************************************************** is pole vector animated ******************************************************************************/ proc int IsPoleVectorAnimated(string $ik) { string $attrs[] = { "pvx", "pvy", "pvz" }; string $checkedCons[]; for ($attr in $attrs) { string $plug = $ik + "." + $attr; string $ins[] = `listConnections -s 1 -d 0 $plug`; if (size($ins)) { string $inNode = $ins[0]; //string $hists[] = `listHistory $inNode`; string $hists[] = `listHistory $plug`; if (size(`ls -typ animCurve -typ expression $hists`)) { return true; } if (nodeType($inNode) == "poleVectorConstraint") { string $con = $inNode; if (FindStringInArray($checkedCons, $con) == -1) { string $targets[] = `listConnections -s 1 -d 0 -type transform ($con + ".tg")`; $targets = stringArrayRemoveDuplicates($targets); //print "pole tar:\n"; print $targets; for ($target in $targets) { if ($target != $ik && $target != $con) { string $list[]; GetNodeParentList($list, $target); for ($n in $list) { if (IsXformNodeAnimated($n, 0)) { return true; } } } } $checkedCons[size($checkedCons)] = $con; } } } } return false; } /****************************************************************************** does ik controlled xform exist ******************************************************************************/ proc int DoesIkControlledXformExist(string $xforms[], string $ik) { string $sjs[] = `listConnections -s 1 -d 0 ($ik + ".startJoint")`; string $efs[] = `listConnections -s 1 -d 0 ($ik + ".endEffector")`; if (size($sjs) && size($efs)) { string $node = $efs[0]; while ($node != $sjs[0]) { string $parents[] = `listRelatives -pa -p $node`; if (!size($parents)) { break; } $node = $parents[0]; if (FindStringInArray($xforms, $node) != -1) { return true; } } } return false; } /****************************************************************************** does chara exist ******************************************************************************/ proc int DoesCharaAnimExist(string $xforms[]) { //----------------------------------------------------------------------------- // check size if (!size($xforms)) { return false; } //----------------------------------------------------------------------------- // check curve / expression / constraint / rigid body for ($xform in $xforms) { if (IsXformNodeAnimated($xform, 0)) { return true; } } //----------------------------------------------------------------------------- // check IK string $iks[] = `ls -typ ikHandle`; for ($ik in $iks) { if (DoesIkControlledXformExist($xforms, $ik)) { if (IsXformNodeAnimated($ik, 0) || IsPoleVectorAnimated($ik)) { return true; } } } return false; } /****************************************************************************** does vis anim exist ******************************************************************************/ proc int DoesVisAnimExist(string $xforms[], string $meshs[]) { for ($xform in $xforms) { if (IsAttrAnimated($xform + ".v")) { return true; } } for ($mesh in $meshs) { if (IsAttrAnimated($mesh + ".v")) { return true; } } return false; } /****************************************************************************** get first file node ******************************************************************************/ proc string GetFirstFileNode(string $plug) { string $ins[] = `listConnections -s 1 -d 0 $plug`; if (size($ins)) { string $file = $ins[0]; if (nodeType($file) == "layeredTexture") { $ins = `listConnections -s 1 -d 0 -type file ($file + ".cs")`; if (!size($ins)) { return ""; } $file = $ins[0]; } if (nodeType($file) == "file") { return $file; } } return ""; } /****************************************************************************** does color anim exist ******************************************************************************/ proc int DoesColorAnimExist(string $mats[]) { string $attrs[] = { "cr", "cg", "cb", "itr", "acr", "acg", "acb", "sr", "sg", "sb" }; string $colorGains[] = { "cgr", "cgg", "cgb" }; for ($mat in $mats) { //----------------------------------------------------------------------------- // direct anim for ($attr in $attrs) { if (!`attributeQuery -n $mat -ex $attr`) { break; } if (IsAttrAnimated($mat + "." + $attr)) { return true; } } //----------------------------------------------------------------------------- // color gain anim string $file = GetFirstFileNode($mat + ".c"); if (size($file)) { for ($attr in $colorGains) { if (IsAttrAnimated($file + "." + $attr)) { return true; } } } //----------------------------------------------------------------------------- // alpha gain anim string $file = GetFirstFileNode($mat + ".it"); if (size($file)) { if (IsAttrAnimated($file + ".ag")) { return true; } } } return false; } /****************************************************************************** does tex pat anim exist ******************************************************************************/ proc int DoesTexPatAnimExist(string $files[]) { for ($file in $files) { if (`getAttr ($file + ".ufe")`) { if (IsAttrAnimated($file + ".fe")) { return true; } //string $ins[] = `listConnections -s 1 -d 0 ($file + ".fe")`; //if (size($ins)) //{ // string $hists[] = `listHistory $ins[0]`; // if (size(`ls -typ animCurve $hists`)) // curve only // { // return true; // } //} } } return false; } /****************************************************************************** does tex srt anim exist ******************************************************************************/ proc int DoesTexSrtAnimExist(string $files[]) { string $attrs[] = { "tfu", "tfv", "rf", "reu", "rev" }; for ($file in $files) { string $ins[] = `listConnections -s 1 -d 0 -type place2dTexture ($file + ".uv")`; if (size($ins)) { string $place = $ins[0]; for ($attr in $attrs) { if (IsAttrAnimated($place + "." + $attr)) { return true; } } } } return false; } /****************************************************************************** does shape anim exist ******************************************************************************/ proc int DoesShapeAnimExist(string $meshs[]) { if (!size(`ls -typ blendShape`)) // check blend shape exists in scene first { return false; } for ($mesh in $meshs) { string $ins[] = `listConnections -s 1 -d 0 ($mesh + ".i")`; if (size($ins)) { string $hists[] = `listHistory $ins[0]`; string $bss[] = `ls -typ blendShape $hists`; for ($bs in $bss) { if (`getAttr ($bs + ".nds")` == 0) { return true; } } } } return false; } /****************************************************************************** get file node for attr ******************************************************************************/ proc GetFileNodeForAttr(string $files[], string $plug) { string $ins[] = `listConnections -s 1 -d 0 $plug`; if (size($ins)) { string $hists[] = `listHistory $ins[0]`; string $fins[] = `ls -typ file $hists`; for ($file in $fins) { if (FindStringInArray($files, $file) == -1) { $files[size($files)] = $file; // append } } } } /****************************************************************************** search anim ******************************************************************************/ global proc nw4cExpDialog_SearchAnim() { //----------------------------------------------------------------------------- // get mode int $animRangeFlag = (`radioButtonGrp -q -sl nw4cExpDialog_ProcessMode` == 2); int $selFlag = (`radioButtonGrp -q -sl nw4cExpDialog_ExportTarget` == 2); //----------------------------------------------------------------------------- // begin wait cursor //waitCursor -st 1; //----------------------------------------------------------------------------- // get target transform string $tarXforms[]; if (!$selFlag) // all { $tarXforms = `ls -l -typ transform`; } else if (!$animRangeFlag) // sel (below) { $tarXforms = `ls -l -sl -dag -typ transform`; } else // sel (tree) { GetAnimRangeTargetNodes($tarXforms); } //----------------------------------------------------------------------------- // get effective transform string $xforms[]; string $noOutputs[]; for ($xform in $tarXforms) { if (!IsSceneAnimObject($xform)) { if (IsEffectiveNode($xform)) { $xforms[size($xforms)] = $xform; } else { $noOutputs[size($noOutputs)] = $xform; } } } RemoveNoOutputChild($xforms, $noOutputs); //print "-- xforms --\n"; print $xforms; if (size($xforms) == 0) { if (!$selFlag) { warning "No effective node"; } else { warning "Effective node is not selected"; } } //----------------------------------------------------------------------------- // get mesh string $meshs[]; for ($xform in $xforms) { string $shapes[] = `listRelatives -pa -ni -s $xform`; if (size($shapes) && nodeType($shapes[0]) == "mesh" && !`getAttr ($shapes[0] + ".template")`) { $meshs[size($meshs)] = $shapes[0]; } } //----------------------------------------------------------------------------- // get material & file string $mats[]; string $files[]; for ($mesh in $meshs) { string $sgs[] = `listSets -t 1 -o $mesh`; for ($sg in $sgs) { string $ins[] = `listConnections -s 1 -d 0 -type lambert ($sg + ".ss")`; if (size($ins)) { string $mat = $ins[0]; if (FindStringInArray($mats, $mat) == -1) { $mats[size($mats)] = $mat; GetFileNodeForAttr($files, $mat + ".c"); GetFileNodeForAttr($files, $mat + ".n"); // for nrm map } } } } //----------------------------------------------------------------------------- // search & check //checkBoxGrp -e -v1 (DoesCharaAnimExist($xforms)) nw4cExpDialog_CsklaFileOut; //checkBoxGrp -e -v1 (DoesVisAnimExist($xforms, $meshs)) nw4cExpDialog_CviaFileOut; //checkBoxGrp -e -v1 (DoesColorAnimExist($mats)) nw4cExpDialog_CclaFileOut; //checkBoxGrp -e -v1 (DoesTexPatAnimExist($files)) nw4cExpDialog_CtpaFileOut; //checkBoxGrp -e -v1 (DoesTexSrtAnimExist($files)) nw4cExpDialog_CtsaFileOut; //checkBoxGrp -e -v1 (DoesShapeAnimExist($meshs)) nw4cExpDialog_CshaFileOut; //----------------------------------------------------------------------------- // update control nw4cExpDialog_AnimCB(); //----------------------------------------------------------------------------- // end wait cursor //waitCursor -st 0; } /****************************************************************************** open option window return 1 if success, 0 otherwise ******************************************************************************/ proc int OpenOptionWindow() { int $adjustSpace = 20; // Don't zero it ! int $useCustomUI = UseCustomUI(); int $use3DEditor = Use3DEditor(); int $afterMaya2011Adjust = 0; if (getApplicationVersionAsFloat() >= 2011) $afterMaya2011Adjust = 1; //----------------------------------------------------------------------------- // init option variable SetOptionVariable(0); //----------------------------------------------------------------------------- // get option box string $optionBox = getOptionBox(); if (size($optionBox) == 0) { return 0; } setParent $optionBox; setOptionBoxTitle("NW4C Export Options"); //----------------------------------------------------------------------------- // create control //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // begin setUITemplate -pst DefaultTemplate; waitCursor -st 1; //----------------------------------------------------------------------------- // create layout scrollLayout -childResizable 1 -minChildWidth 508 nw4cExpDialog_ScrollLayout; // horizontal scroll bar is appear if layout width < minChildWidth string $parent = `columnLayout -adj 1 -cat "both" 5 -co "both" 5 nw4cExpDialog_MainColumn`; $parent = substitute(".*|", $parent, ""); // to short name setParent $parent; //----------------------------------------------------------------------------- // output options frameLayout -l "Output Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; string $outForm = `formLayout -nd 100`; radioButtonGrp -l "Process Mode" -vis 1 -nrb 2 -cw 1 (103+$adjustSpace) -cw 2 95 -la2 "Single" "Animation Range" -sl 1 -cc "nw4cExpDialog_ProcessModeCB" nw4cExpDialog_ProcessMode; string $sep1 = `separator -vis 1 -st "in" -h 3`; radioButtonGrp -l "Export Target" -nrb 2 -cw 1 (103+$adjustSpace) -cw 2 95 -la2 "All" "Selection" -sl 1 nw4cExpDialog_ExportTarget; textFieldGrp -l "Output File Name" -cw2 (103+$adjustSpace) 160 nw4cExpDialog_OutFileName; button -l "Scene" -w 50 -c "textFieldGrp -e -tx `file -q -ns` nw4cExpDialog_OutFileName" nw4cExpDialog_SceneToOutFileName; button -l "Node" -w 50 -c "nw4cExpDialog_SetNodeNameToFileName" nw4cExpDialog_NodeToOutFileName; //----------------------------------------------------------------------------- // out intermediate file string $sep2 = `separator -st "in" -h 3`; radioButtonGrp -l "" -nrb 1 -cw 1 (0+$adjustSpace) -cw 2 200 -l1 "Output 3D Intermediate Files" -sl 1 -cc "nw4cExpDialog_OutInterFileCB" nw4cExpDialog_OutInterFile; textFieldGrp -l "Output Folder" -cw2 (104+$adjustSpace) 290 -adj 2 -rat 1 "both" 2 nw4cExpDialog_OutFolder; symbolButton -i "navButtonBrowse.xpm" -w 25 -h 22 -c "nw4cExpDialog_OutFolderBrowserCB" nw4cExpDialog_OutFolderBrowser; //----------------------------------------------------------------------------- // use CreativeStudio radioButtonGrp -l "" -nrb 1 -cw 1 (0+$adjustSpace) -cw 2 200 -l1 "Use CreativeStudio" -scl nw4cExpDialog_OutInterFile -cc "nw4cExpDialog_OutInterFileCB" nw4cExpDialog_UseCreativeStudio; //----------------------------------------------------------------------------- // use 3DEditor if ($use3DEditor == 1) { radioButtonGrp -l "" -nrb 1 -cw 1 (0+$adjustSpace) -cw 2 200 -l1 "Use 3DEditor" -scl nw4cExpDialog_OutInterFile -cc "nw4cExpDialog_OutInterFileCB" nw4cExpDialog_Use3DEditor; } //----------------------------------------------------------------------------- // merge cmdl file string $sep3 = `separator -st "in" -h 3`; checkBoxGrp -l "" -ncb 1 -cw 1 (0+$adjustSpace) -cw 2 103 -l1 "Merge cmdl File" -v1 0 -cc "nw4cExpDialog_OutInterFileCB" nw4cExpDialog_MergeCmdlFlag; textField -w 290 nw4cExpDialog_MergeCmdlPath; symbolButton -i "navButtonBrowse.xpm" -w 25 -h 22 -c "nw4cExpDialog_MergeCmdlBrowserCB" nw4cExpDialog_MergeCmdlBrowser; checkBoxGrp -l "" -ncb 1 -cw 1 (0+$adjustSpace) -cw 2 103 -l1 "Copy Related Files" -v1 0 nw4cExpDialog_CopyRelatedFiles; //checkBoxGrp -l "" -ncb 1 -cw 1 28 -cw 2 50 // -l1 "Auto" -v1 1 // nw4cExpDialog_MergeCmdlAuto; if ($use3DEditor == 1) { formLayout -e -af nw4cExpDialog_ProcessMode "left" 0 -af nw4cExpDialog_ProcessMode "top" 4 -an nw4cExpDialog_ProcessMode "right" -an nw4cExpDialog_ProcessMode "bottom" -af $sep1 "left" 0 -ac $sep1 "top" 4 nw4cExpDialog_ProcessMode -af $sep1 "right" 0 -an $sep1 "bottom" -af nw4cExpDialog_ExportTarget "left" 0 -ac nw4cExpDialog_ExportTarget "top" 4 $sep1 -an nw4cExpDialog_ExportTarget "right" -an nw4cExpDialog_ExportTarget "bottom" -af nw4cExpDialog_OutFileName "left" 0 -ac nw4cExpDialog_OutFileName "top" 4 nw4cExpDialog_ExportTarget -an nw4cExpDialog_OutFileName "right" -an nw4cExpDialog_OutFileName "bottom" -ac nw4cExpDialog_SceneToOutFileName "left" 5 nw4cExpDialog_OutFileName -ac nw4cExpDialog_SceneToOutFileName "top" 4 nw4cExpDialog_ExportTarget -an nw4cExpDialog_SceneToOutFileName "right" -an nw4cExpDialog_SceneToOutFileName "bottom" -ac nw4cExpDialog_NodeToOutFileName "left" 5 nw4cExpDialog_SceneToOutFileName -ac nw4cExpDialog_NodeToOutFileName "top" 4 nw4cExpDialog_ExportTarget -an nw4cExpDialog_NodeToOutFileName "right" -an nw4cExpDialog_NodeToOutFileName "bottom" -af $sep2 "left" 0 -ac $sep2 "top" 4 nw4cExpDialog_OutFileName -af $sep2 "right" 0 -an $sep2 "bottom" -af nw4cExpDialog_OutInterFile "left" 0 -ac nw4cExpDialog_OutInterFile "top" 4 $sep2 -an nw4cExpDialog_OutInterFile "right" -an nw4cExpDialog_OutInterFile "bottom" -af nw4cExpDialog_OutFolder "left" 0 -ac nw4cExpDialog_OutFolder "top" 4 nw4cExpDialog_OutInterFile -ac nw4cExpDialog_OutFolder "right" 5 nw4cExpDialog_OutFolderBrowser -an nw4cExpDialog_OutFolder "bottom" -an nw4cExpDialog_OutFolderBrowser "left" -ac nw4cExpDialog_OutFolderBrowser "top" 4 nw4cExpDialog_OutInterFile -af nw4cExpDialog_OutFolderBrowser "right" 46 -an nw4cExpDialog_OutFolderBrowser "bottom" -af nw4cExpDialog_UseCreativeStudio "left" 0 -ac nw4cExpDialog_UseCreativeStudio "top" 4 nw4cExpDialog_OutFolder -an nw4cExpDialog_UseCreativeStudio "right" -an nw4cExpDialog_UseCreativeStudio "bottom" -af nw4cExpDialog_Use3DEditor "left" 0 -ac nw4cExpDialog_Use3DEditor "top" 4 nw4cExpDialog_UseCreativeStudio -an nw4cExpDialog_Use3DEditor "right" -an nw4cExpDialog_Use3DEditor "bottom" -af $sep3 "left" 0 -ac $sep3 "top" 4 nw4cExpDialog_Use3DEditor -af $sep3 "right" 0 -an $sep3 "bottom" -af nw4cExpDialog_MergeCmdlFlag "left" 0 -ac nw4cExpDialog_MergeCmdlFlag "top" (4+3) $sep3 -an nw4cExpDialog_MergeCmdlFlag "right" -an nw4cExpDialog_MergeCmdlFlag "bottom" -ac nw4cExpDialog_MergeCmdlPath "left" 2 nw4cExpDialog_MergeCmdlFlag -ac nw4cExpDialog_MergeCmdlPath "top" 4 $sep3 -ac nw4cExpDialog_MergeCmdlPath "right" 5 nw4cExpDialog_MergeCmdlBrowser -an nw4cExpDialog_MergeCmdlPath "bottom" -an nw4cExpDialog_MergeCmdlBrowser "left" -ac nw4cExpDialog_MergeCmdlBrowser "top" 4 $sep3 -af nw4cExpDialog_MergeCmdlBrowser "right" 46 -an nw4cExpDialog_MergeCmdlBrowser "bottom" -af nw4cExpDialog_CopyRelatedFiles "left" 0 -ac nw4cExpDialog_CopyRelatedFiles "top" 4 nw4cExpDialog_MergeCmdlFlag -an nw4cExpDialog_CopyRelatedFiles "right" -an nw4cExpDialog_CopyRelatedFiles "bottom" //-af nw4cExpDialog_MergeCmdlAuto "left" 0 //-ac nw4cExpDialog_MergeCmdlAuto "top" 4 nw4cExpDialog_MergeCmdlPath //-an nw4cExpDialog_MergeCmdlAuto "right" //-af nw4cExpDialog_MergeCmdlAuto "bottom" 4 $outForm; } else { formLayout -e -af nw4cExpDialog_ProcessMode "left" 0 -af nw4cExpDialog_ProcessMode "top" 4 -an nw4cExpDialog_ProcessMode "right" -an nw4cExpDialog_ProcessMode "bottom" -af $sep1 "left" 0 -ac $sep1 "top" 4 nw4cExpDialog_ProcessMode -af $sep1 "right" 0 -an $sep1 "bottom" -af nw4cExpDialog_ExportTarget "left" 0 -ac nw4cExpDialog_ExportTarget "top" 4 $sep1 -an nw4cExpDialog_ExportTarget "right" -an nw4cExpDialog_ExportTarget "bottom" -af nw4cExpDialog_OutFileName "left" 0 -ac nw4cExpDialog_OutFileName "top" 4 nw4cExpDialog_ExportTarget -an nw4cExpDialog_OutFileName "right" -an nw4cExpDialog_OutFileName "bottom" -ac nw4cExpDialog_SceneToOutFileName "left" 5 nw4cExpDialog_OutFileName -ac nw4cExpDialog_SceneToOutFileName "top" 4 nw4cExpDialog_ExportTarget -an nw4cExpDialog_SceneToOutFileName "right" -an nw4cExpDialog_SceneToOutFileName "bottom" -ac nw4cExpDialog_NodeToOutFileName "left" 5 nw4cExpDialog_SceneToOutFileName -ac nw4cExpDialog_NodeToOutFileName "top" 4 nw4cExpDialog_ExportTarget -an nw4cExpDialog_NodeToOutFileName "right" -an nw4cExpDialog_NodeToOutFileName "bottom" -af $sep2 "left" 0 -ac $sep2 "top" 4 nw4cExpDialog_OutFileName -af $sep2 "right" 0 -an $sep2 "bottom" -af nw4cExpDialog_OutInterFile "left" 0 -ac nw4cExpDialog_OutInterFile "top" 4 $sep2 -an nw4cExpDialog_OutInterFile "right" -an nw4cExpDialog_OutInterFile "bottom" -af nw4cExpDialog_OutFolder "left" 0 -ac nw4cExpDialog_OutFolder "top" 4 nw4cExpDialog_OutInterFile -ac nw4cExpDialog_OutFolder "right" 5 nw4cExpDialog_OutFolderBrowser -an nw4cExpDialog_OutFolder "bottom" -an nw4cExpDialog_OutFolderBrowser "left" -ac nw4cExpDialog_OutFolderBrowser "top" 4 nw4cExpDialog_OutInterFile -af nw4cExpDialog_OutFolderBrowser "right" 46 -an nw4cExpDialog_OutFolderBrowser "bottom" -af nw4cExpDialog_UseCreativeStudio "left" 0 -ac nw4cExpDialog_UseCreativeStudio "top" 4 nw4cExpDialog_OutFolder -an nw4cExpDialog_UseCreativeStudio "right" -an nw4cExpDialog_UseCreativeStudio "bottom" -af $sep3 "left" 0 -ac $sep3 "top" 4 nw4cExpDialog_UseCreativeStudio -af $sep3 "right" 0 -an $sep3 "bottom" -af nw4cExpDialog_MergeCmdlFlag "left" 0 -ac nw4cExpDialog_MergeCmdlFlag "top" (4+3) $sep3 -an nw4cExpDialog_MergeCmdlFlag "right" -an nw4cExpDialog_MergeCmdlFlag "bottom" -ac nw4cExpDialog_MergeCmdlPath "left" 2 nw4cExpDialog_MergeCmdlFlag -ac nw4cExpDialog_MergeCmdlPath "top" 4 $sep3 -ac nw4cExpDialog_MergeCmdlPath "right" 5 nw4cExpDialog_MergeCmdlBrowser -an nw4cExpDialog_MergeCmdlPath "bottom" -an nw4cExpDialog_MergeCmdlBrowser "left" -ac nw4cExpDialog_MergeCmdlBrowser "top" 4 $sep3 -af nw4cExpDialog_MergeCmdlBrowser "right" 46 -an nw4cExpDialog_MergeCmdlBrowser "bottom" -af nw4cExpDialog_CopyRelatedFiles "left" 0 -ac nw4cExpDialog_CopyRelatedFiles "top" 4 nw4cExpDialog_MergeCmdlFlag -an nw4cExpDialog_CopyRelatedFiles "right" -an nw4cExpDialog_CopyRelatedFiles "bottom" //-af nw4cExpDialog_MergeCmdlAuto "left" 0 //-ac nw4cExpDialog_MergeCmdlAuto "top" 4 nw4cExpDialog_MergeCmdlPath //-an nw4cExpDialog_MergeCmdlAuto "right" //-af nw4cExpDialog_MergeCmdlAuto "bottom" 4 $outForm; } setParent ..; // formLayout setParent ..; // frameLayout //----------------------------------------------------------------------------- // general frameLayout -l "General Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; columnLayout -adj 1 -rs 4; rowColumnLayout -nc 2 -cw 1 (215 + $adjustSpace) -cw 2 190; floatFieldGrp -l "Magnify" -nf 1 -cw 1 (140 + $adjustSpace) -cw 2 60 -v1 1.0 -pre 4 -cc "nw4cExpDialog_MagnifyCB" nw4cExpDialog_Magnify; text -l ""; // dummy //optionMenuGrp -l "Texture Matrix" -cw 1 120 -rat 1 "both" 4 // nw4cExpDialog_TexMatrixMode; // menuItem -l "Maya"; // menuItem -l "3dsmax"; setParent ..; // rowColumnLayout rowColumnLayout -nc 4 -cw 1 (325 + $adjustSpace + $afterMaya2011Adjust * 25) -cw 2 50 -cw 3 5 -cw 4 50; radioButtonGrp -l "Start / End Frame" -nrb 3 -cw4 160 50 80 65 -rat 2 "both" 0 -rat 3 "both" 0 -rat 4 "both" 0 -la3 "All" "Playback" "Range" -sl 1 -cc "nw4cExpDialog_FrameRangeCB" nw4cExpDialog_FrameRange; intField -v 1 -cc "nw4cExpDialog_FrameStartEndCB" nw4cExpDialog_StartFrame; text -l ""; // dummy intField -v 100 -cc "nw4cExpDialog_FrameStartEndCB" nw4cExpDialog_EndFrame; setParent ..; // rowColumnLayout checkBoxGrp -l "" -ncb 1 -cw 1 (140+$adjustSpace) -cw 2 120 -l1 "Remove Namespace" -v1 0 nw4cExpDialog_RemoveNamespace; setParent ..; // columnLayout setParent ..; // frameLayout //----------------------------------------------------------------------------- // file selection frameLayout -l "Output File Selection" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; string $form = `formLayout`; checkBoxGrp -l "Model Data" -ncb 1 -l1 "[.cmdl]" -v1 1 -cw 1 140 -cw 2 60 -cc1 "nw4cExpDialog_ModelCB" nw4cExpDialog_CmdlFileOut; checkBoxGrp -l "Texture Data" -ncb 1 -l1 "[.ctex]" -v1 1 -cw 1 140 -cw 2 60 nw4cExpDialog_CtexFileOut; checkBoxGrp -l "Model Animation Data" -ncb 1 -l1 "[.cmdla]" -v1 0 -cw 1 140 -cw 2 60 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CmdlaFileOut; checkBoxGrp -l "Skeletal Animation Data" -ncb 1 -l1 "[.cskla]" -v1 0 -cw 1 140 -cw 2 60 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CsklaFileOut; checkBoxGrp -l "Material Animation Data" -ncb 1 -l1 "[.cmata]" -v1 0 -cw 1 (140) -cw 2 60 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CmataFileOut; if ($useCustomUI == 1) { // カスタム UI を使用する場合はマテリアルアニメーションを要素(カラー、 // テクスチャパターン、テクスチャSRT)毎に出力設定を行う。 checkBoxGrp -l "Material Color Animation Data" -ncb 1 -l1 "[.cmata]" -v1 0 -cw 1 (170 + $afterMaya2011Adjust * 20) -cw 2 60 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CmclaFileOut; checkBoxGrp -l "Texture Pattern Animation Data" -ncb 1 -l1 "[.cmata]" -v1 0 -cw 1 (170 + $afterMaya2011Adjust * 20) -cw 2 60 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CmtpaFileOut; checkBoxGrp -l "Texture SRT Animation Data" -ncb 1 -l1 "[.cmata]" -v1 0 -cw 1 (170 + $afterMaya2011Adjust * 20) -cw 2 60 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CmtsaFileOut; } checkBoxGrp -l "Camera Data" -ncb 1 -l1 "[.ccam]" -v1 0 -cw 1 140 -cw 2 60 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CcamFileOut; checkBoxGrp -l "Light Data" -ncb 1 -l1 "[.clgt]" -v1 0 -cw 1 140 -cw 2 60 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_ClgtFileOut; checkBoxGrp -l "Environment Data" -ncb 1 -l1 "[.cenv]" -v1 0 -cw 1 (140) -cw 2 60 -cc "nw4cExpDialog_ProcessModeCB" nw4cExpDialog_CenvFileOut; button -l "Search Animation" -w 104 -c "nw4cExpDialog_SearchAnim" nw4cExpDialog_SearchAnimBtn; setParent ..; // formLayout if ($useCustomUI == 1) { // マテリアルアニメーションを分割して出力するカスタム UI を使用する場合の // 出力ファイル設定の配置を行う。 formLayout -e -af nw4cExpDialog_CmdlFileOut "left" $adjustSpace -af nw4cExpDialog_CmdlFileOut "top" 4 -an nw4cExpDialog_CmdlFileOut "right" -an nw4cExpDialog_CmdlFileOut "bottom" -af nw4cExpDialog_CtexFileOut "left" $adjustSpace -ac nw4cExpDialog_CtexFileOut "top" 4 nw4cExpDialog_CmdlFileOut -an nw4cExpDialog_CtexFileOut "right" -an nw4cExpDialog_CtexFileOut "bottom" -af nw4cExpDialog_CmdlaFileOut "left" $adjustSpace -ac nw4cExpDialog_CmdlaFileOut "top" 4 nw4cExpDialog_CtexFileOut -an nw4cExpDialog_CmdlaFileOut "right" -an nw4cExpDialog_CmdlaFileOut "bottom" -af nw4cExpDialog_CsklaFileOut "left" $adjustSpace -ac nw4cExpDialog_CsklaFileOut "top" 4 nw4cExpDialog_CmdlaFileOut -an nw4cExpDialog_CsklaFileOut "right" -an nw4cExpDialog_CsklaFileOut "bottom" -af nw4cExpDialog_CcamFileOut "left" $adjustSpace -ac nw4cExpDialog_CcamFileOut "top" 4 nw4cExpDialog_CsklaFileOut -an nw4cExpDialog_CcamFileOut "right" -an nw4cExpDialog_CcamFileOut "bottom" -af nw4cExpDialog_ClgtFileOut "left" $adjustSpace -ac nw4cExpDialog_ClgtFileOut "top" 4 nw4cExpDialog_CcamFileOut -an nw4cExpDialog_ClgtFileOut "right" -an nw4cExpDialog_ClgtFileOut "bottom" -af nw4cExpDialog_CmataFileOut "left" (270 + $adjustSpace + $afterMaya2011Adjust * 20) -af nw4cExpDialog_CmataFileOut "top" 4 -an nw4cExpDialog_CmataFileOut "right" -an nw4cExpDialog_CmataFileOut "bottom" -af nw4cExpDialog_CmclaFileOut "left" (240 + $adjustSpace + $afterMaya2011Adjust * 0) -ac nw4cExpDialog_CmclaFileOut "top" 4 nw4cExpDialog_CmataFileOut -an nw4cExpDialog_CmclaFileOut "right" -an nw4cExpDialog_CmclaFileOut "bottom" -af nw4cExpDialog_CmtpaFileOut "left" (240 + $adjustSpace + $afterMaya2011Adjust * 0) -ac nw4cExpDialog_CmtpaFileOut "top" 4 nw4cExpDialog_CmclaFileOut -an nw4cExpDialog_CmtpaFileOut "right" -an nw4cExpDialog_CmtpaFileOut "bottom" -af nw4cExpDialog_CmtsaFileOut "left" (240 + $adjustSpace + $afterMaya2011Adjust * 0) -ac nw4cExpDialog_CmtsaFileOut "top" 4 nw4cExpDialog_CmtpaFileOut -an nw4cExpDialog_CmtsaFileOut "right" -an nw4cExpDialog_CmtsaFileOut "bottom" -af nw4cExpDialog_CenvFileOut "left" (270 + $adjustSpace + $afterMaya2011Adjust * 20) -ac nw4cExpDialog_CenvFileOut "top" 4 nw4cExpDialog_CmtsaFileOut -an nw4cExpDialog_CenvFileOut "right" -an nw4cExpDialog_CenvFileOut "bottom" -ac nw4cExpDialog_SearchAnimBtn "left" 32 nw4cExpDialog_CenvFileOut -af nw4cExpDialog_SearchAnimBtn "top" 4 -an nw4cExpDialog_SearchAnimBtn "right" -an nw4cExpDialog_SearchAnimBtn "bottom" $form; } else { // カスタム UI を使用せずにマテリアルアニメーションを .cmata ファイルにまとめて出力する // 場合の出力ファイル設定の配置を行う。 formLayout -e -af nw4cExpDialog_CmdlFileOut "left" $adjustSpace -af nw4cExpDialog_CmdlFileOut "top" 4 -an nw4cExpDialog_CmdlFileOut "right" -an nw4cExpDialog_CmdlFileOut "bottom" -af nw4cExpDialog_CtexFileOut "left" $adjustSpace -ac nw4cExpDialog_CtexFileOut "top" 4 nw4cExpDialog_CmdlFileOut -an nw4cExpDialog_CtexFileOut "right" -an nw4cExpDialog_CtexFileOut "bottom" -af nw4cExpDialog_CmdlaFileOut "left" $adjustSpace -ac nw4cExpDialog_CmdlaFileOut "top" 4 nw4cExpDialog_CtexFileOut -an nw4cExpDialog_CmdlaFileOut "right" -an nw4cExpDialog_CmdlaFileOut "bottom" -af nw4cExpDialog_CsklaFileOut "left" ($adjustSpace) -ac nw4cExpDialog_CsklaFileOut "top" 4 nw4cExpDialog_CmdlaFileOut -an nw4cExpDialog_CsklaFileOut "right" -an nw4cExpDialog_CsklaFileOut "bottom" -af nw4cExpDialog_CmataFileOut "left" (220 + $adjustSpace + $afterMaya2011Adjust * 20) -af nw4cExpDialog_CmataFileOut "top" 4 -an nw4cExpDialog_CmataFileOut "right" -an nw4cExpDialog_CmataFileOut "bottom" -af nw4cExpDialog_CcamFileOut "left" (220 + $adjustSpace + $afterMaya2011Adjust * 20) -ac nw4cExpDialog_CcamFileOut "top" 4 nw4cExpDialog_CmataFileOut -an nw4cExpDialog_CcamFileOut "right" -an nw4cExpDialog_CcamFileOut "bottom" -af nw4cExpDialog_ClgtFileOut "left" (220 + $adjustSpace + $afterMaya2011Adjust * 20) -ac nw4cExpDialog_ClgtFileOut "top" 4 nw4cExpDialog_CcamFileOut -an nw4cExpDialog_ClgtFileOut "right" -an nw4cExpDialog_ClgtFileOut "bottom" -af nw4cExpDialog_CenvFileOut "left" (220 + $adjustSpace + $afterMaya2011Adjust * 20) -ac nw4cExpDialog_CenvFileOut "top" 4 nw4cExpDialog_ClgtFileOut -an nw4cExpDialog_CenvFileOut "right" -af nw4cExpDialog_CenvFileOut "bottom" 4 -ac nw4cExpDialog_SearchAnimBtn "left" 32 nw4cExpDialog_CenvFileOut -af nw4cExpDialog_SearchAnimBtn "top" 4 -an nw4cExpDialog_SearchAnimBtn "right" -an nw4cExpDialog_SearchAnimBtn "bottom" $form; } setParent ..; // frameLayout control -e -vis 0 nw4cExpDialog_SearchAnimBtn; // (debug) //----------------------------------------------------------------------------- // optimization frameLayout -l "Optimization Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; columnLayout -adj 1 -rs 4; optionMenuGrp -l "Compress Node" -cw 1 120 -rat 1 "both" 4 -cw 1 (140 + $adjustSpace) -cw 2 150 nw4cExpDialog_CompressNode; menuItem -l "None"; menuItem -l "Cull Useless Node"; menuItem -l "Cull Uninfluential Node"; menuItem -l "Unite Compressible Node"; menuItem -l "Unite All Node"; //menuItem -l "Merge Useless Node"; optionMenuGrp -l "Compress Material" -cw 1 110 -rat 1 "both" 4 -cw 1 (140 + $adjustSpace) -cw 2 150 nw4cExpDialog_CompressMaterial; menuItem -l "None"; menuItem -l "Compress Same Material"; //checkBox -l "Combine Polygon" -v 0 // nw4cExpDialog_CombinePolygon; rowColumnLayout -nc 2 -cw 1 (250 + $adjustSpace + $afterMaya2011Adjust * 30) -cw 2 300; checkBoxGrp -l "" -ncb 1 -cw 1 (140 + $adjustSpace) -cw 2 120 -l1 "Optimize Primitive" -v1 1 nw4cExpDialog_OptimizePrimitive; checkBoxGrp -l "" -ncb 1 -cw 1 (34 - $afterMaya2011Adjust * 20) -cw 2 220 -l1 "Convert To Model" -v1 0 -cc "nw4cExpDialog_ConvertToModelCB" nw4cExpDialog_ConvertToModel; setParent ..; // rowColumnLayout //checkBoxGrp -l "" -ncb 1 -cw 1 100 -cw 2 160 // -l1 "Delete Useless Vertex Data" -v1 0 // nw4cExpDialog_DelUselessVtxData; setParent ..; // columnLayout setParent ..; // frameLayout //----------------------------------------------------------------------------- // quantization frameLayout -l "Quantization Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; columnLayout -adj 1 -rs 4; rowColumnLayout -nc 3 -cw 1 (200+$adjustSpace + $afterMaya2011Adjust * 10) -cw 2 (164 + $afterMaya2011Adjust * 10) -cw 3 (164 + $afterMaya2011Adjust * 10); optionMenuGrp -l "Position" -cw 1 (140 + $adjustSpace) nw4cExpDialog_QuantPos; menuItem -l "Float"; menuItem -l "Short"; menuItem -l "Byte"; optionMenuGrp -l "Normal" -cw 1 92 nw4cExpDialog_QuantNrm; menuItem -l "Float"; menuItem -l "Short"; menuItem -l "Byte"; optionMenuGrp -l "Tex Coord" -cw 1 78 nw4cExpDialog_QuantTex; menuItem -l "Float"; menuItem -l "Short"; menuItem -l "Byte"; setParent ..; // rowColumnLayout setParent ..; // columnLayout setParent ..; // frameLayout //----------------------------------------------------------------------------- // model frameLayout -l "Model Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; columnLayout -adj 1 -rs 4; rowColumnLayout -nc 2 -cw 1 (282+$adjustSpace + $afterMaya2011Adjust * 25) -cw 2 270; optionMenuGrp -l "Adjust Skinning" -cw 1 (140 + $adjustSpace) -rat 1 "both" 4 nw4cExpDialog_AdjustSkinning; menuItem -l "None If Possible"; menuItem -l "Rigid Skinning"; optionMenuGrp -l "Mesh Visibility Mode" -cw 1 120 -rat 1 "both" 4 nw4cExpDialog_MeshVisibilityMode; menuItem -l "Bind By Index"; menuItem -l "Bind By Name"; setParent ..; // rowColumnLayout rowColumnLayout -nc 2 -cw 1 (285+$adjustSpace + $afterMaya2011Adjust * 29) -cw 2 240; checkBoxGrp -l "" -ncb 1 -cw 1 (140 + $adjustSpace) -l1 "Non-Uniform Scale" -v1 0 nw4cExpDialog_NonUniformScale; intFieldGrp -nf 1 -l "Max Reserved Uniform Registers" -cw2 180 45 -v1 0 -cc "nw4cExpDialog_MaxReservedUniformRegistersCB" nw4cExpDialog_MaxReservedUniformRegisters; setParent ..; // rowColumnLayout setParent ..; // columnLayout setParent ..; // frameLayout //----------------------------------------------------------------------------- // anim frameLayout -l "Animation Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; columnLayout -adj 1 -rs 4; rowColumnLayout -nc 3 -cw 1 (283+$adjustSpace + $afterMaya2011Adjust * 21) -cw 2 160 -cw 3 100; checkBoxGrp -l "" -ncb 1 -cw 1 (140+$adjustSpace) -l1 "Bake All Animation" -v1 1 nw4cExpDialog_BakeAll; optionMenuGrp -l "Frame Precision" -cw 1 100 nw4cExpDialog_FramePrecision; menuItem -l "1.0"; menuItem -l "0.5"; menuItem -l "0.2"; menuItem -l "0.1"; checkBoxGrp -l "" -ncb 1 -cw 1 44 -cw 2 100 -l1 "Loop" -v1 0 nw4cExpDialog_LoopAnim; setParent ..; // rowColumnLayout rowColumnLayout -nc 2 -cw 1 (270+$adjustSpace) -cw 2 200; checkBoxGrp -l "" -ncb 1 -cw 1 (140+$adjustSpace) -cw 2 120 -l1 "Frame Format" -v1 0 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_FrameFormat; text -l ""; // dummy setParent ..; // rowColumnLayout intSliderGrp -l "Scale Quantize Quality" -cw 1 (140+$adjustSpace) -cw 2 45 -cw 3 300 -min 0 -max 9 -v 9 -adj 0 nw4cExpDialog_ScaleQuantizeQuality; intSliderGrp -l "Rotate Quantize Quality" -cw 1 (140+$adjustSpace) -cw 2 45 -cw 3 300 -min 0 -max 9 -v 9 -adj 0 nw4cExpDialog_RotateQuantizeQuality; intSliderGrp -l "Translate Quantize Quality" -cw 1 (140+$adjustSpace) -cw 2 45 -cw 3 300 -min 0 -max 9 -v 9 -adj 0 nw4cExpDialog_TranslateQuantizeQuality; setParent ..; // columnLayout setParent ..; // frameLayout //----------------------------------------------------------------------------- // tolerance frameLayout -l "Tolerance Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; columnLayout -adj 1 -rs 4; string $form = `formLayout -h 75`; // create control in tab order floatFieldGrp -nf 1 -l "Node Translate" -cw2 140 45 -pre 4 -v1 0.01 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolT\"" nw4cExpDialog_TolT; floatFieldGrp -nf 1 -l "Node Rotate" -cw2 140 45 -pre 4 -v1 0.1 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolR\"" nw4cExpDialog_TolR; floatFieldGrp -nf 1 -l "Node Scale" -cw2 140 45 -pre 4 -v1 0.1 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolS\"" nw4cExpDialog_TolS; floatFieldGrp -nf 1 -l "Texture Translate" -cw2 100 45 -pre 4 -v1 0.01 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolTexT\"" nw4cExpDialog_TolTexT; floatFieldGrp -nf 1 -l "Texture Rotate" -cw2 100 45 -pre 4 -v1 0.1 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolTexR\"" nw4cExpDialog_TolTexR; floatFieldGrp -nf 1 -l "Texture Scale" -cw2 100 45 -pre 4 -v1 0.1 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolTexS\"" nw4cExpDialog_TolTexS; floatFieldGrp -nf 1 -l "Color" -cw2 60 45 -pre 4 -v1 0.001 -cc "nw4cExpDialog_ToleranceColorCB \"nw4cExpDialog_TolC\"" nw4cExpDialog_TolC; setParent ..; // formLayout // layout control formLayout -e -w 440 -af nw4cExpDialog_TolT "left" (0+$adjustSpace) -af nw4cExpDialog_TolT "top" 0 -an nw4cExpDialog_TolT "right" -an nw4cExpDialog_TolT "bottom" -af nw4cExpDialog_TolR "left" (0+$adjustSpace) -af nw4cExpDialog_TolR "top" 25 -an nw4cExpDialog_TolR "right" -an nw4cExpDialog_TolR "bottom" -af nw4cExpDialog_TolS "left" (0+$adjustSpace) -af nw4cExpDialog_TolS "top" 50 -an nw4cExpDialog_TolS "right" -an nw4cExpDialog_TolS "bottom" -af nw4cExpDialog_TolTexT "left" (210+$adjustSpace) -af nw4cExpDialog_TolTexT "top" 0 -an nw4cExpDialog_TolTexT "right" -an nw4cExpDialog_TolTexT "bottom" -af nw4cExpDialog_TolTexR "left" (210+$adjustSpace) -af nw4cExpDialog_TolTexR "top" 25 -an nw4cExpDialog_TolTexR "right" -an nw4cExpDialog_TolTexR "bottom" -af nw4cExpDialog_TolTexS "left" (210+$adjustSpace) -af nw4cExpDialog_TolTexS "top" 50 -an nw4cExpDialog_TolTexS "right" -an nw4cExpDialog_TolTexS "bottom" -af nw4cExpDialog_TolC "left" (420+$adjustSpace) -af nw4cExpDialog_TolC "top" 0 -an nw4cExpDialog_TolC "right" -an nw4cExpDialog_TolC "bottom" $form; setParent ..; // columnLayout setParent ..; // frameLayout //----------------------------------------------------------------------------- // close layout setParent ..; // columnLayout setParent ..; // scrollLayout //----------------------------------------------------------------------------- // setting menu CreateSettingMenu($parent); //----------------------------------------------------------------------------- // end waitCursor -st 0; setUITemplate -ppt; //----------------------------------------------------------------------------- // set help tag to save window size setOptionBoxHelpTag("nw4cExpDialog"); //----------------------------------------------------------------------------- // set button & menu command string $applyBtn = getOptionBoxApplyBtn(); button -e -l "Export" -c "nw4cExpDialog_ExportCB" $applyBtn; string $saveBtn = getOptionBoxSaveBtn(); button -e -c "nw4cExpDialog_SaveSettingsCB" $saveBtn; string $resetBtn = getOptionBoxResetBtn(); button -e -c "nw4cExpDialog_ResetOptionVariable" $resetBtn; string $helpMenu = getOptionBoxHelpItem(); menuItem -e -l "Help on NW4C Export..." -c "NW4C_ShowHelp \"html/export.html\" \"\"" $helpMenu; //----------------------------------------------------------------------------- // set option cotrol SetOptionControl(); //----------------------------------------------------------------------------- // show option box setFocus(getOptionBoxApplyAndCloseBtn()); showOptionBox(); return 1; } /****************************************************************************** main ******************************************************************************/ global proc NW4C_ExpDialog() { //----------------------------------------------------------------------------- // load plugin LoadPlugin(); //----------------------------------------------------------------------------- // open option window OpenOptionWindow(); } /****************************************************************************** export direct ******************************************************************************/ global proc NW4C_ExpDirect() { //----------------------------------------------------------------------------- // load plugin LoadPlugin(); //----------------------------------------------------------------------------- // init option variable SetOptionVariable(0); //----------------------------------------------------------------------------- // export DoExportCmd(0); } /****************************************************************************** export direct force (no overwrite check) ******************************************************************************/ global proc NW4C_ExpDirectForce() { //----------------------------------------------------------------------------- // load plugin LoadPlugin(); //----------------------------------------------------------------------------- // init option variable SetOptionVariable(0); //----------------------------------------------------------------------------- // export DoExportCmd(1); }