1/****************************************************************************** 2 NintendoWare for CTR Maya Plugin 3 4 File: NW4C_ExpDialog.mel 5 Description: create export dialog 6 Date: 2010/10/07 7 8 Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. 9******************************************************************************/ 10 11// NW4C_ExpDirect 12// OpenOptionWindow CreateSettingMenu 13// SetOptionVariable SetOptionControl UpdateOptionVariableT ResetOptionVariable 14// ExportCB DoExportCmd CheckOptionValue 15// SetConsistentCallback 16// SaveSettingToScene LoadSettingFromScene DeleteUselessSettingNode 17// SaveSettingToFile LoadSettingFromFile GetOptionStringFromC3es 18// SearchAnim 19 20/****************************************************************************** 21 variables 22******************************************************************************/ 23global int $nw4cExpDialog_SettingLatestVer = 14; 24global string $nw4cExpDialog_c3esLatestVer = "1.4.0"; 25global int $nw4cExpDialog_LoadSettingJob = -1; 26 27/****************************************************************************** 28 load plugin 29******************************************************************************/ 30proc LoadPlugin() 31{ 32 if (!`pluginInfo -q -l "NW4C_Export.mll"`) 33 { 34 loadPlugin("NW4C_Export.mll"); 35 } 36} 37 38/****************************************************************************** 39 show error & stop 40******************************************************************************/ 41proc ShowError(string $msg) 42{ 43 if (!`about -batch`) 44 { 45 trace ("Error: " + $msg + "\n"); 46 } 47 error $msg; 48} 49 50/****************************************************************************** 51 use custom ui 52******************************************************************************/ 53proc int UseCustomUI() 54{ 55 // �J�X�^�� UI �̎g�p�ݒ�����ϐ� NW4C_MAYA_CUSTOM_UI ����擾����B 56 // ���ϐ��̐ݒ�l�� "0" �̎��̓J�X�^�� UI ���g�p�����A�T�t�B�b�N�X���w�肳��Ă��鎞�� 57 // �J�X�^�� UI ���g�p����B���ϐ�����`����Ă��Ȃ��ꍇ�� "0" ���ݒ肳��Ă���Ƃ݂Ȃ��B 58 string $val = `getenv "NW4C_MAYA_CUSTOM_UI"`; 59 if ($val == "" || $val == "0") 60 { 61 $val = "0"; 62 } 63 else 64 { 65 $val = "1"; 66 } 67 return int($val); 68} 69 70/****************************************************************************** 71 use 3DEditor 72******************************************************************************/ 73proc int Use3DEditor() 74{ 75 // 3DEditor �����݂��Ă��邩�m�F����B 76 int $exist = 0; 77 string $nw4cRoot = `getenv "NW4C_ROOT"`; 78 if ($nw4cRoot != "") 79 { 80 string $editorPath = ($nw4cRoot + "/tools/3DEditor/NW4C_3DEditor.exe"); 81 if (`filetest -e $editorPath`) 82 { 83 $exist = 1; 84 } 85 } 86 return $exist; 87} 88 89/****************************************************************************** 90 use non-uniform scale 91******************************************************************************/ 92proc int UseNonUniformScale() 93{ 94 // Non-Uniform Scale �̎g�p�ݒ�����ϐ� NW4C_USE_NON_UNIFORM_SCALE ����擾����B 95 // ���ϐ��̐ݒ�l�� "0" �Ⴕ���͋�̎��� Non-Uniform Scale ���g�p���Ȃ��B 96 string $val = `getenv "NW4C_USE_NON_UNIFORM_SCALE"`; 97 if ($val == "" || $val == "0") 98 { 99 $val = "0"; 100 } 101 else 102 { 103 $val = "1"; 104 } 105 return int($val); 106} 107 108/****************************************************************************** 109 find string in array 110******************************************************************************/ 111proc int FindStringInArray(string $array[], string $value) 112{ 113 int $size = size($array); 114 int $idx; 115 for ($idx = 0; $idx < $size; ++$idx) 116 { 117 if ($array[$idx] == $value) 118 { 119 return $idx; 120 } 121 } 122 return -1; 123} 124 125/****************************************************************************** 126 does save load scene setting 127******************************************************************************/ 128proc int DoesSaveLoadSceneSetting() 129{ 130 if (!`optionVar -ex nw4cExpDialog_SaveLoadSceneSetting`) 131 { 132 return 1; // default 133 } 134 //trace ("save load scene setting: " + `optionVar -q nw4cExpDialog_SaveLoadSceneSetting` + "\n"); 135 return `optionVar -q nw4cExpDialog_SaveLoadSceneSetting`; 136} 137 138/****************************************************************************** 139 load setting from option string 140******************************************************************************/ 141proc LoadSettingFromOptionString(int $version, string $opts) 142{ 143 print ("load NW4C export settings from scene (ver " 144 + ($version / 10) + "." + ($version % 10) + ")\n"); 145 146 //----------------------------------------------------------------------------- 147 // set option variable 148 optionVar -sv nw4cExport_Options $opts; 149 150 //----------------------------------------------------------------------------- 151 // refresh option box 152 if (`scrollLayout -ex nw4cExpDialog_ScrollLayout`) 153 { 154 if (`columnLayout -ex nw4cExpDialog_MainColumn`) 155 { 156 NW4C_ExpDialog; 157 } 158 } 159} 160 161/****************************************************************************** 162 load setting from scene (called when scene is opened) 163******************************************************************************/ 164global proc nw4cExpDialog_LoadSettingFromScene() 165{ 166 global int $nw4cExpDialog_SettingVer; 167 global string $nw4cExpDialog_SettingExportOptions; 168 169 //----------------------------------------------------------------------------- 170 // check save / load scene setting is enabled 171 if (!DoesSaveLoadSceneSetting()) 172 { 173 return; 174 } 175 176 //----------------------------------------------------------------------------- 177 // evaluate setting node 178 string $node = "nw4cExpDialog_Setting1"; 179 if (!`objExists $node`) 180 { 181 return; 182 } 183 if (nodeType($node) != "script") 184 { 185 return; 186 } 187 string $cmd = `getAttr ($node + ".b")`; 188 if (!size($cmd)) 189 { 190 return; 191 } 192 eval($cmd); 193 int $version = $nw4cExpDialog_SettingVer; 194 string $opts = $nw4cExpDialog_SettingExportOptions; 195 196 //----------------------------------------------------------------------------- 197 // load setting 198 if (size($opts)) 199 { 200 LoadSettingFromOptionString($version, $opts); 201 } 202} 203 204/****************************************************************************** 205 setting node function (called from script node) (do nothing now) 206******************************************************************************/ 207global proc nw4cExpDialog_SettingNodeFunc() 208{ 209 210} 211 212/****************************************************************************** 213 set consistent callback 214******************************************************************************/ 215global proc nw4cExpDialog_SetConsistentCallback() 216{ 217 // set load setting job at scene opened 218 global int $nw4cExpDialog_LoadSettingJob = -1; 219 $nw4cExpDialog_LoadSettingJob = `scriptJob -e "SceneOpened" 220 "if (`exists nw4cExpDialog_LoadSettingFromScene`) nw4cExpDialog_LoadSettingFromScene;"`; 221} 222 223/****************************************************************************** 224 delete useless setting node 225******************************************************************************/ 226proc DeleteUselessSettingNode() 227{ 228 string $nodes[] = `ls -typ script`; 229 string $node; 230 for ($node in $nodes) 231 { 232 if (gmatch($node, "*_nw4cExpDialog_Setting*") || 233 gmatch($node, "*:nw4cExpDialog_Setting*")) 234 { 235 if (`referenceQuery -inr $node`) // if referenced 236 { 237 print ("disable settings: " + $node + "\n"); 238 if (`getAttr -l ($node + ".st")`) 239 { 240 print "(locked)\n"; 241 } 242 else 243 { 244 catch(`setAttr ($node + ".st") 0`); // Demand 245 } 246 } 247 else 248 { 249 print ("delete settings: " + $node + "\n"); 250 catch(`delete $node`); 251 } 252 } 253 } 254} 255 256/****************************************************************************** 257 get setting node command 258******************************************************************************/ 259proc string GetSettingNodeCommand() 260{ 261 string $cmd = ""; 262 263 //----------------------------------------------------------------------------- 264 // setting version 265 global int $nw4cExpDialog_SettingLatestVer; 266 $cmd += "global int $nw4cExpDialog_SettingVer = " + $nw4cExpDialog_SettingLatestVer + ";\n"; 267 268 //----------------------------------------------------------------------------- 269 // export options 270 $cmd += "global string $nw4cExpDialog_SettingExportOptions = \"" 271 + `optionVar -q nw4cExport_Options` + "\";\n"; 272 273 //----------------------------------------------------------------------------- 274 // setting node function 275 $cmd += "if (`exists nw4cExpDialog_SettingNodeFunc`) " 276 + "nw4cExpDialog_SettingNodeFunc();\n"; 277 278 return $cmd; 279} 280 281/****************************************************************************** 282 save setting to scene 283******************************************************************************/ 284proc SaveSettingToScene(int $checkSceneSettingFlag) 285{ 286 //return; // never save (debug) 287 288 //----------------------------------------------------------------------------- 289 // check save / load flag 290 if ($checkSceneSettingFlag && !DoesSaveLoadSceneSetting()) 291 { 292 return; 293 } 294 295 //----------------------------------------------------------------------------- 296 // delete useless setting node 297 DeleteUselessSettingNode(); 298 299 //----------------------------------------------------------------------------- 300 // create setting node 301 string $node = "nw4cExpDialog_Setting1"; 302 if (!`objExists $node`) 303 { 304 string $selBak[] = `ls -sl`; 305 createNode script -n $node; 306 select $selBak; 307 } 308 309 //----------------------------------------------------------------------------- 310 // set setting node command & attr 311 if (`getAttr -l ($node + ".b")`) 312 { 313 print "NW4C export settings node is locked\n"; 314 return; 315 } 316 317 string $cmd = GetSettingNodeCommand(); 318 catch(`setAttr ($node + ".b") -type "string" $cmd`); 319 catch(`setAttr ($node + ".st") 1`); // Open/Close 320} 321 322/****************************************************************************** 323 save setting file folder 324******************************************************************************/ 325proc SaveSettingFileFolder(string $filePath) 326{ 327 string $settingFolder = substitute("[^/]*$", $filePath, ""); 328 optionVar -sv nw4cExpDialog_SettingFileFolder $settingFolder; 329} 330 331/****************************************************************************** 332 set setting file folder to currnet 333******************************************************************************/ 334proc SetSettingFileFolderToCurrent() 335{ 336 string $settingFolder = ""; 337 if (`optionVar -ex nw4cExpDialog_SettingFileFolder`) 338 { 339 $settingFolder = `optionVar -q nw4cExpDialog_SettingFileFolder`; 340 } 341 if (size($settingFolder) > 0 && `filetest -d $settingFolder`) 342 { 343 workspace -dir $settingFolder; 344 } 345} 346 347/****************************************************************************** 348 get float string for setting file 349******************************************************************************/ 350proc string GetFloatStringForSettingFile(float $val) 351{ 352 string $str = $val; 353 if (match("\\.", $str) == "") 354 { 355 $str += ".0"; 356 } 357 return $str; 358} 359 360/****************************************************************************** 361 save setting to file (do) 362******************************************************************************/ 363global proc nw4cExpDialog_SaveSettingToFileDo(string $filePath) 364{ 365 global string $nw4cExpDialog_c3esLatestVer; 366 367 int $useNonUniformScale = UseNonUniformScale(); 368 369 string $boolNames[2] = { "false", "true" }; 370 371 //----------------------------------------------------------------------------- 372 // add extension 373 if (match("\\.c3es$", $filePath) == "") 374 { 375 $filePath += ".c3es"; 376 } 377 378 //----------------------------------------------------------------------------- 379 // update option variable 380 nw4cExpDialog_UpdateOptionVariable(0); // no save setting to scene 381 382 //----------------------------------------------------------------------------- 383 // get generator version 384 string $generatorVersion = "?"; 385 if (`pluginInfo -q -l "NW4C_Export.mll"`) 386 { 387 $generatorVersion = eval("NW4C_ExportInfoCmd -p"); 388 } 389 390 //----------------------------------------------------------------------------- 391 // get date & time 392 if (size(match("^//", `pwd`)) != 0) 393 { 394 // if the current folder is on network drive 395 // change it on local drive for getting date & time properly 396 string $localFolder = getenv("TEMP"); 397 if (size($localFolder) > 0 && `filetest -d $localFolder`) 398 { 399 chdir($localFolder); 400 //trace ("change cur folder to " + $localFolder); 401 } 402 } 403 404 string $date = `system "echo %DATE%"`; 405 $date = match("[0-9/]+", $date); 406 $date = substituteAllString($date, "/", "-"); 407 string $time = `system "echo %TIME%"`; 408 $time = match("[0-9:]+", $time); 409 410 //----------------------------------------------------------------------------- 411 // parse export options 412 //----------------------------------------------------------------------------- 413 414 //----------------------------------------------------------------------------- 415 // init 416 string $processMode = "Single"; 417 string $exportTarget = "All"; 418 string $outputFileName = ""; 419 string $outputMode = "File"; 420 string $outputFolder = ""; 421 int $mergeCmdl = 0; 422 string $mergeCmdlPath = ""; 423 int $copyRelatedFiles = 0; 424 //int $mergeCmdlAuto = 1; 425 426 float $magnify = 1.0; 427 string $frameRange = "All"; 428 int $startFrame = 1; 429 int $endFrame = 100; 430 //string $texMatrixMode = "Maya"; 431 int $removeNamespace = 0; 432 433 int $outputCmdl = 1; 434 int $outputCtex = 1; 435 int $outputCmdla = 0; 436 int $outputCskla = 0; 437 int $outputCmata = 0; 438 int $outputCmcla = 0; 439 int $outputCmtpa = 0; 440 int $outputCmtsa = 0; 441 int $outputCcam = 0; 442 int $outputClgt = 0; 443 int $outputCenv = 0; 444 445 string $compressNode = "None"; 446 //int $combinePolygon = 0; 447 int $compressMaterial = 0; 448 int $optimizePrimitive = 1; 449 int $convertToModel = 0; 450 //int $delUselessVtxData = 0; 451 452 string $quantizePos = "Float"; 453 string $quantizeNrm = "Float"; 454 string $quantizeTex = "Float"; 455 int $frameFormat = 0; 456 int $scaleQuantizeQuality = 9; 457 int $rotateQuantizeQuality = 9; 458 int $translateQuantizeQuality = 9; 459 460 string $adjustSkinning = "None"; 461 string $meshVisibilityMode = "BindByIndex"; 462 int $nonUniformScale = 0; 463 int $maxReservedUniformRegisters = 0; 464 465 int $bakeAllAnim = 1; 466 float $framePrecision = 1.0; 467 int $loopAnim = 0; 468 469 float $toleranceScale = 0.1; 470 float $toleranceRotate = 0.1; 471 float $toleranceTranslate = 0.01; 472 float $toleranceTexScale = 0.1; 473 float $toleranceTexRotate = 0.1; 474 float $toleranceTexTranslate = 0.01; 475 float $toleranceColor = 0.001; 476 477 //----------------------------------------------------------------------------- 478 // get option var 479 string $optStr = ""; 480 if (`optionVar -ex nw4cExport_Options`) 481 { 482 $optStr = `optionVar -q nw4cExport_Options`; 483 } 484 485 //----------------------------------------------------------------------------- 486 // parse option var 487 string $opts[], $words[]; 488 tokenize($optStr, ";", $opts); 489 int $optSize = size($opts); 490 int $iopt; 491 for ($iopt = 0; $iopt < $optSize; ++$iopt) 492 { 493 tokenize($opts[$iopt], "=", $words); 494 string $tag = $words[0]; 495 string $val = $words[1]; 496 int $boolVal = ($val == "true" || $val == "On" || $val == "1"); 497 498 //----------------------------------------------------------------------------- 499 // output 500 if ($tag == "ProcessMode") 501 { 502 $processMode = $val; 503 } 504 else if ($tag == "ExportTarget") 505 { 506 $exportTarget = $val; 507 } 508 else if ($tag == "OutputFileName") 509 { 510 $outputFileName = $val; 511 } 512 else if ($tag == "OutputMode") 513 { 514 $outputMode = $val; 515 } 516 else if ($tag == "OutputFolder") 517 { 518 $outputFolder = $val; 519 } 520 else if ($tag == "MergeCmdl") 521 { 522 $mergeCmdl = $boolVal; 523 } 524 else if ($tag == "MergeCmdlPath") 525 { 526 $mergeCmdlPath = $val; 527 } 528 else if ($tag == "CopyRelatedFiles") 529 { 530 $copyRelatedFiles = $boolVal; 531 } 532 //else if ($tag == "MergeCmdlAuto") 533 //{ 534 // $mergeCmdlAuto = $boolVal; 535 //} 536 537 //----------------------------------------------------------------------------- 538 // general 539 else if ($tag == "Magnify") 540 { 541 $magnify = $val; 542 } 543 else if ($tag == "FrameRange") 544 { 545 $frameRange = $val; 546 } 547 else if ($tag == "StartFrame") 548 { 549 $startFrame = $val; 550 } 551 else if ($tag == "EndFrame") 552 { 553 $endFrame = $val; 554 } 555 //else if ($tag == "TexMatrixMode") 556 //{ 557 // $texMatrixMode = $val; 558 //} 559 else if ($tag == "RemoveNamespace") 560 { 561 $removeNamespace = $boolVal; 562 } 563 564 //----------------------------------------------------------------------------- 565 // file selection 566 else if ($tag == "OutputCmdl") 567 { 568 $outputCmdl = $boolVal; 569 } 570 else if ($tag == "OutputCtex") 571 { 572 $outputCtex = $boolVal; 573 } 574 else if ($tag == "OutputCmdla") 575 { 576 $outputCmdla = $boolVal; 577 } 578 else if ($tag == "OutputCskla") 579 { 580 $outputCskla = $boolVal; 581 } 582 else if ($tag == "OutputCmata") 583 { 584 $outputCmata = $boolVal; 585 } 586 else if ($tag == "OutputCmcla") 587 { 588 $outputCmcla = $boolVal; 589 } 590 else if ($tag == "OutputCmtpa") 591 { 592 $outputCmtpa = $boolVal; 593 } 594 else if ($tag == "OutputCmtsa") 595 { 596 $outputCmtsa = $boolVal; 597 } 598 else if ($tag == "OutputCcam") 599 { 600 $outputCcam = $boolVal; 601 } 602 else if ($tag == "OutputClgt") 603 { 604 $outputClgt = $boolVal; 605 } 606 else if ($tag == "OutputCenv") 607 { 608 $outputCenv = $boolVal; 609 } 610 611 //----------------------------------------------------------------------------- 612 // optimization 613 else if ($tag == "CompressNode") 614 { 615 $compressNode = $val; 616 } 617 //else if ($tag == "CombinePolygon") 618 //{ 619 // $combinePolygon = $boolVal; 620 //} 621 else if ($tag == "CompressMaterial") 622 { 623 $compressMaterial = $boolVal; 624 } 625 else if ($tag == "OptimizePrimitive") 626 { 627 $optimizePrimitive = $boolVal; 628 } 629 else if ($tag == "ConvertToModel") 630 { 631 $convertToModel = $boolVal; 632 } 633 634 //else if ($tag == "DelUselessVtxData") 635 //{ 636 // $delUselessVtxData = $boolVal; 637 //} 638 639 //----------------------------------------------------------------------------- 640 // quantization 641 else if ($tag == "QuantizePos") 642 { 643 $quantizePos = $val; 644 } 645 else if ($tag == "QuantizeNrm") 646 { 647 $quantizeNrm = $val; 648 } 649 else if ($tag == "QuantizeTex") 650 { 651 $quantizeTex = $val; 652 } 653 else if ($tag == "FrameFormat") 654 { 655 $frameFormat = $boolVal; 656 } 657 else if ($tag == "ScaleQuantizeQuality") 658 { 659 $scaleQuantizeQuality = $val; 660 } 661 else if ($tag == "RotateQuantizeQuality") 662 { 663 $rotateQuantizeQuality = $val; 664 } 665 else if ($tag == "TranslateQuantizeQuality") 666 { 667 $translateQuantizeQuality = $val; 668 } 669 670 //----------------------------------------------------------------------------- 671 // model 672 else if ($tag == "AdjustSkinning") 673 { 674 $adjustSkinning = $val; 675 } 676 else if ($tag == "MeshVisibilityMode") 677 { 678 $meshVisibilityMode = $val; 679 } 680 else if ($tag == "NonUniformScale") 681 { 682 $nonUniformScale = $boolVal; 683 } 684 else if ($tag == "MaxReservedUniformRegisters") 685 { 686 $maxReservedUniformRegisters = $val; 687 } 688 689 //----------------------------------------------------------------------------- 690 // animation 691 else if ($tag == "BakeAllAnim") 692 { 693 $bakeAllAnim = $boolVal; 694 } 695 else if ($tag == "FramePrecision") 696 { 697 if ($val == "2") 698 { 699 $framePrecision = 0.5; 700 } 701 else if ($val == "5") 702 { 703 $framePrecision = 0.2; 704 } 705 else if ($val == "10") 706 { 707 $framePrecision = 0.1; 708 } 709 } 710 else if ($tag == "LoopAnim") 711 { 712 $loopAnim = $boolVal; 713 } 714 715 //----------------------------------------------------------------------------- 716 // tolerance 717 else if ($tag == "ToleranceScale") 718 { 719 $toleranceScale = $val; 720 } 721 else if ($tag == "ToleranceRotate") 722 { 723 $toleranceRotate = $val; 724 } 725 else if ($tag == "ToleranceTranslate") 726 { 727 $toleranceTranslate = $val; 728 } 729 else if ($tag == "ToleranceTexScale") 730 { 731 $toleranceTexScale = $val; 732 } 733 else if ($tag == "ToleranceTexRotate") 734 { 735 $toleranceTexRotate = $val; 736 } 737 else if ($tag == "ToleranceTexTranslate") 738 { 739 $toleranceTexTranslate = $val; 740 } 741 else if ($tag == "ToleranceColor") 742 { 743 $toleranceColor = $val; 744 } 745 } 746 747 //----------------------------------------------------------------------------- 748 // open file 749 int $fid = fopen($filePath, "w"); 750 if ($fid == 0) 751 { 752 ShowError("Can't open file: " + $filePath); 753 } 754 755 //----------------------------------------------------------------------------- 756 // header 757 fprint($fid, "# NW4C_Export settings\r\n"); 758 fprint($fid, "SettingsVersion=\"" + $nw4cExpDialog_c3esLatestVer + "\"\r\n"); 759 fprint($fid, "GeneratorName=\"Maya " + `about -v` + " NW4C_Export\"\r\n"); 760 fprint($fid, "GeneratorVersion=\"" + $generatorVersion + "\"\r\n"); 761 fprint($fid, "Date=\"" + $date + "T" + $time + "\"\r\n"); 762 fprint($fid, "\r\n"); 763 764 //----------------------------------------------------------------------------- 765 // output options 766 fprint($fid, "# Output Options\r\n"); 767 fprint($fid, "ProcessMode=\"" + $processMode + "\"\r\n"); 768 fprint($fid, "ExportTarget=\"" + $exportTarget + "\"\r\n"); 769 fprint($fid, "OutputFileName=\"" + $outputFileName + "\"\r\n"); 770 fprint($fid, "OutputMode=\"" + $outputMode + "\"\r\n"); 771 fprint($fid, "OutputFolder=\"" + $outputFolder + "\"\r\n"); 772 fprint($fid, "MergeCmdl=\"" + $boolNames[$mergeCmdl] + "\"\r\n"); 773 fprint($fid, "MergeCmdlPath=\"" + $mergeCmdlPath + "\"\r\n"); 774 fprint($fid, "CopyRelatedFiles=\"" + $boolNames[$copyRelatedFiles] + "\"\r\n"); 775 //fprint($fid, "MergeCmdlAuto=\"" + $boolNames[$mergeCmdlAuto] + "\"\r\n"); 776 fprint($fid, "\r\n"); 777 778 //----------------------------------------------------------------------------- 779 // general options 780 fprint($fid, "# General Options\r\n"); 781 fprint($fid, "Magnify=\"" + GetFloatStringForSettingFile($magnify) + "\"\r\n"); 782 fprint($fid, "FrameRange=\"" + $frameRange + "\"\r\n"); 783 fprint($fid, "StartFrame=\"" + $startFrame + "\"\r\n"); 784 fprint($fid, "EndFrame=\"" + $endFrame + "\"\r\n"); 785 //fprint($fid, "TexMatrixMode=\"" + $texMatrixMode + "\"\r\n"); 786 fprint($fid, "RemoveNamespace=\"" + $boolNames[$removeNamespace] + "\"\r\n"); 787 fprint($fid, "\r\n"); 788 789 //----------------------------------------------------------------------------- 790 // output file selection 791 fprint($fid, "# Output File Selection\r\n"); 792 fprint($fid, "OutputCmdl=\"" + $boolNames[$outputCmdl] + "\"\r\n"); 793 fprint($fid, "OutputCtex=\"" + $boolNames[$outputCtex] + "\"\r\n"); 794 fprint($fid, "OutputCmdla=\"" + $boolNames[$outputCmdla] + "\"\r\n"); 795 fprint($fid, "OutputCskla=\"" + $boolNames[$outputCskla] + "\"\r\n"); 796 fprint($fid, "OutputCmata=\"" + $boolNames[$outputCmata] + "\"\r\n"); 797 fprint($fid, "OutputCmcla=\"" + $boolNames[$outputCmcla] + "\"\r\n"); 798 fprint($fid, "OutputCmtpa=\"" + $boolNames[$outputCmtpa] + "\"\r\n"); 799 fprint($fid, "OutputCmtsa=\"" + $boolNames[$outputCmtsa] + "\"\r\n"); 800 fprint($fid, "OutputCcam=\"" + $boolNames[$outputCcam] + "\"\r\n"); 801 fprint($fid, "OutputClgt=\"" + $boolNames[$outputClgt] + "\"\r\n"); 802 fprint($fid, "OutputCenv=\"" + $boolNames[$outputCenv] + "\"\r\n"); 803 fprint($fid, "\r\n"); 804 805 //----------------------------------------------------------------------------- 806 // optimization options 807 fprint($fid, "# Optimization Options\r\n"); 808 fprint($fid, "CompressNode=\"" + $compressNode + "\"\r\n"); 809 //fprint($fid, "CombinePolygon=\"" + $boolNames[$combinePolygon] + "\"\r\n"); 810 fprint($fid, "CompressMaterial=\"" + $boolNames[$compressMaterial] + "\"\r\n"); 811 fprint($fid, "OptimizePrimitive=\"" + $boolNames[$optimizePrimitive] + "\"\r\n"); 812 fprint($fid, "ConvertToModel=\"" + $boolNames[$convertToModel] + "\"\r\n"); 813 //fprint($fid, "DelUselessVtxData=\"" + $boolNames[$delUselessVtxData] + "\"\r\n"); 814 fprint($fid, "\r\n"); 815 816 //----------------------------------------------------------------------------- 817 // quantization options 818 fprint($fid, "# Quantization Options\r\n"); 819 fprint($fid, "QuantizePos=\"" + $quantizePos + "\"\r\n"); 820 fprint($fid, "QuantizeNrm=\"" + $quantizeNrm + "\"\r\n"); 821 fprint($fid, "QuantizeTex=\"" + $quantizeTex + "\"\r\n"); 822 fprint($fid, "\r\n"); 823 824 //----------------------------------------------------------------------------- 825 // model options 826 fprint($fid, "# Model Options\r\n"); 827 fprint($fid, "AdjustSkinning=\"" + $adjustSkinning + "\"\r\n"); 828 fprint($fid, "MeshVisibilityMode=\"" + $meshVisibilityMode + "\"\r\n"); 829 if ($useNonUniformScale) 830 { 831 fprint($fid, "NonUniformScale=\"" + $boolNames[$nonUniformScale] + "\"\r\n"); 832 } 833 fprint($fid, "MaxReservedUniformRegisters=\"" + $maxReservedUniformRegisters + "\"\r\n"); 834 835 836 fprint($fid, "\r\n"); 837 838 //----------------------------------------------------------------------------- 839 // animation options 840 fprint($fid, "# Animation Options\r\n"); 841 fprint($fid, "BakeAllAnim=\"" + $boolNames[$bakeAllAnim] + "\"\r\n"); 842 fprint($fid, "FramePrecision=\"" + GetFloatStringForSettingFile($framePrecision) + "\"\r\n"); 843 fprint($fid, "LoopAnim=\"" + $boolNames[$loopAnim] + "\"\r\n"); 844 fprint($fid, "FrameFormat=\"" + $boolNames[$frameFormat] + "\"\r\n"); 845 fprint($fid, "ScaleQuantizeQuality=\"" + $scaleQuantizeQuality + "\"\r\n"); 846 fprint($fid, "RotateQuantizeQuality=\"" + $rotateQuantizeQuality + "\"\r\n"); 847 fprint($fid, "TranslateQuantizeQuality=\"" + $translateQuantizeQuality + "\"\r\n"); 848 fprint($fid, "\r\n"); 849 850 //----------------------------------------------------------------------------- 851 // tolerance options 852 fprint($fid, "# Tolerance Options\r\n"); 853 fprint($fid, "ToleranceScale=\"" + GetFloatStringForSettingFile($toleranceScale) + "\"\r\n"); 854 fprint($fid, "ToleranceRotate=\"" + GetFloatStringForSettingFile($toleranceRotate) + "\"\r\n"); 855 fprint($fid, "ToleranceTranslate=\"" + GetFloatStringForSettingFile($toleranceTranslate) + "\"\r\n"); 856 fprint($fid, "ToleranceTexScale=\"" + GetFloatStringForSettingFile($toleranceTexScale) + "\"\r\n"); 857 fprint($fid, "ToleranceTexRotate=\"" + GetFloatStringForSettingFile($toleranceTexRotate) + "\"\r\n"); 858 fprint($fid, "ToleranceTexTranslate=\"" + GetFloatStringForSettingFile($toleranceTexTranslate) + "\"\r\n"); 859 fprint($fid, "ToleranceColor=\"" + GetFloatStringForSettingFile($toleranceColor) + "\"\r\n"); 860 fprint($fid, "\r\n"); 861 862 //----------------------------------------------------------------------------- 863 // close file 864 fclose($fid); 865 866 //----------------------------------------------------------------------------- 867 // end 868 print ("Saved to " + $filePath + "\n"); 869} 870 871/****************************************************************************** 872 save setting to file (file command) 873******************************************************************************/ 874global proc nw4cExpDialog_SaveSettingToFileFC(string $filePath, string $fileType) 875{ 876 //----------------------------------------------------------------------------- 877 // save setting file folder 878 SaveSettingFileFolder($filePath); 879 880 //----------------------------------------------------------------------------- 881 // do 882 nw4cExpDialog_SaveSettingToFileDo($filePath); 883} 884 885/****************************************************************************** 886 save setting to file (main) 887******************************************************************************/ 888global proc nw4cExpDialog_SaveSettingToFile() 889{ 890 //----------------------------------------------------------------------------- 891 // set setting file folder to currnet 892 SetSettingFileFolderToCurrent(); 893 894 //----------------------------------------------------------------------------- 895 // open file dialog 896 if (getApplicationVersionAsFloat() >= 2011) 897 { 898 string $c3esPath[] = `fileDialog2 -ds 2 899 -cap "Save C3es File" -ff "C3es File (*.c3es)"`; 900 if (size($c3esPath)) 901 { 902 nw4cExpDialog_SaveSettingToFileFC($c3esPath[0], ""); 903 } 904 } 905 else 906 { 907 fileBrowserDialog -m 1 -an "Save" -in "c3es" 908 -ft "Best Guess" 909 -fc "nw4cExpDialog_SaveSettingToFileFC"; 910 } 911} 912 913/****************************************************************************** 914 get option string from c3es 915******************************************************************************/ 916global proc string nw4cExpDialog_GetOptionStringFromC3es(string $filePath) 917{ 918 global string $nw4cExpDialog_c3esLatestVer; 919 int $useNonUniformScale = UseNonUniformScale(); 920 921 string $boolNames[2] = { "false", "true" }; 922 923 //----------------------------------------------------------------------------- 924 // init 925 string $settingsVersion = ""; 926 927 string $processMode = "Single"; 928 string $exportTarget = "All"; 929 string $outputFileName = ""; 930 string $outputMode = "File"; 931 string $outputFolder = ""; 932 int $mergeCmdl = 0; 933 string $mergeCmdlPath = ""; 934 int $copyRelatedFiles = 0; 935 //int $mergeCmdlAuto = 1; 936 937 float $magnify = 1.0; 938 string $frameRange = "All"; 939 int $startFrame = 1; 940 int $endFrame = 100; 941 //string $texMatrixMode = "Maya"; 942 int $removeNamespace = 0; 943 944 int $outputCmdl = 1; 945 int $outputCtex = 1; 946 int $outputCmdla = 0; 947 int $outputCskla = 0; 948 int $outputCmata = 0; 949 int $outputCmcla = 0; 950 int $outputCmtpa = 0; 951 int $outputCmtsa = 0; 952 int $outputCcam = 0; 953 int $outputClgt = 0; 954 int $outputCenv = 0; 955 956 string $compressNode = "None"; 957 //int $combinePolygon = 0; 958 int $compressMaterial = 0; 959 int $optimizePrimitive = 1; 960 int $convertToModel = 0; 961 //int $delUselessVtxData = 0; 962 963 string $quantizePos = "Float"; 964 string $quantizeNrm = "Float"; 965 string $quantizeTex = "Float"; 966 int $frameFormat = 0; 967 int $scaleQuantizeQuality = 9; 968 int $rotateQuantizeQuality = 9; 969 int $translateQuantizeQuality = 9; 970 971 string $adjustSkinning = "None"; 972 string $meshVisibilityMode = "IndexMode"; 973 int $nonUniformScale = 0; 974 int $maxReservedUniformRegisters = 0; 975 976 int $bakeAllAnim = 1; 977 int $framePrecision = 1; 978 int $loopAnim = 0; 979 980 float $toleranceScale = 0.1; 981 float $toleranceRotate = 0.1; 982 float $toleranceTranslate = 0.01; 983 float $toleranceTexScale = 0.1; 984 float $toleranceTexRotate = 0.1; 985 float $toleranceTexTranslate = 0.01; 986 float $toleranceColor = 0.001; 987 988 //----------------------------------------------------------------------------- 989 // open file 990 int $fid = fopen($filePath, "r"); 991 if ($fid == 0) 992 { 993 ShowError("Can't open file: " + $filePath); 994 } 995 996 //----------------------------------------------------------------------------- 997 // check header 998 string $line = fgetline($fid); 999 if (size(match("^# NW4C_Export settings", $line)) == 0) 1000 { 1001 fclose($fid); 1002 ShowError("c3es file is wrong: " + $filePath); 1003 } 1004 1005 //----------------------------------------------------------------------------- 1006 // parse 1007 string $words[]; 1008 while (!feof($fid)) 1009 { 1010 string $line = fgetline($fid); 1011 $line = substitute("\r*\n$", $line, ""); // cut [CR+LF] or [LF] 1012 // skip empty line & comment line 1013 if (size($line) == 0 || substring($line, 1, 1) == "#") 1014 { 1015 continue; 1016 } 1017 1018 tokenize($line, "=", $words); 1019 if (size($words) < 2) 1020 { 1021 continue; 1022 } 1023 string $tag = $words[0]; 1024 string $val = $words[1]; 1025 $val = substitute("^\"", $val, ""); // cut first double quote 1026 $val = substitute("\".*$", $val, ""); // cut last double quote 1027 int $boolVal = ($val == "true" || $val == "On" || $val == "1"); 1028 //print ($tag + ": " + $val + "\n"); 1029 1030 //----------------------------------------------------------------------------- 1031 // header 1032 if ($tag == "SettingsVersion") 1033 { 1034 $settingsVersion = $val; 1035 //if ($settingsVersion != $nw4cExpDialog_c3esLatestVer) 1036 //{ 1037 // fclose($fid); 1038 // ShowError("c3es file version is wrong: " + $settingsVersion); 1039 //} 1040 } 1041 1042 //----------------------------------------------------------------------------- 1043 // output 1044 else if ($tag == "ProcessMode") 1045 { 1046 $processMode = $val; 1047 } 1048 else if ($tag == "ExportTarget") 1049 { 1050 $exportTarget = $val; 1051 } 1052 else if ($tag == "OutputFileName") 1053 { 1054 $outputFileName = $val; 1055 } 1056 else if ($tag == "OutputMode") 1057 { 1058 $outputMode = $val; 1059 } 1060 else if ($tag == "OutputFolder") 1061 { 1062 $outputFolder = NW4C_GetUnixFilePath($val); 1063 } 1064 else if ($tag == "MergeCmdl") 1065 { 1066 $mergeCmdl = $boolVal; 1067 } 1068 else if ($tag == "MergeCmdlPath") 1069 { 1070 $mergeCmdlPath = NW4C_GetUnixFilePath($val); 1071 } 1072 else if ($tag == "CopyRelatedFiles") 1073 { 1074 $copyRelatedFiles = $boolVal; 1075 } 1076 //else if ($tag == "MergeCmdlAuto") 1077 //{ 1078 // $mergeCmdlAuto = $boolVal; 1079 //} 1080 1081 //----------------------------------------------------------------------------- 1082 // general 1083 else if ($tag == "Magnify") 1084 { 1085 $magnify = $val; 1086 } 1087 else if ($tag == "FrameRange") 1088 { 1089 $frameRange = $val; 1090 } 1091 else if ($tag == "StartFrame") 1092 { 1093 $startFrame = $val; 1094 } 1095 else if ($tag == "EndFrame") 1096 { 1097 $endFrame = $val; 1098 } 1099 //else if ($tag == "TexMatrixMode") 1100 //{ 1101 // $texMatrixMode = $val; 1102 //} 1103 else if ($tag == "RemoveNamespace") 1104 { 1105 $removeNamespace = $boolVal; 1106 } 1107 1108 //----------------------------------------------------------------------------- 1109 // file selection 1110 else if ($tag == "OutputCmdl") 1111 { 1112 $outputCmdl = $boolVal; 1113 } 1114 else if ($tag == "OutputCtex") 1115 { 1116 $outputCtex = $boolVal; 1117 } 1118 else if ($tag == "OutputCmdla") 1119 { 1120 $outputCmdla = $boolVal; 1121 } 1122 else if ($tag == "OutputCskla") 1123 { 1124 $outputCskla = $boolVal; 1125 } 1126 else if ($tag == "OutputCmata") 1127 { 1128 $outputCmata = $boolVal; 1129 } 1130 else if ($tag == "OutputCmcla") 1131 { 1132 $outputCmcla = $boolVal; 1133 } 1134 else if ($tag == "OutputCmtpa") 1135 { 1136 $outputCmtpa = $boolVal; 1137 } 1138 else if ($tag == "OutputCmtsa") 1139 { 1140 $outputCmtsa = $boolVal; 1141 } 1142 else if ($tag == "OutputCcam") 1143 { 1144 $outputCcam = $boolVal; 1145 } 1146 else if ($tag == "OutputClgt") 1147 { 1148 $outputClgt = $boolVal; 1149 } 1150 else if ($tag == "OutputCenv") 1151 { 1152 $outputCenv = $boolVal; 1153 } 1154 1155 //----------------------------------------------------------------------------- 1156 // optimization 1157 else if ($tag == "CompressNode") 1158 { 1159 $compressNode = $val; 1160 } 1161 //else if ($tag == "CombinePolygon") 1162 //{ 1163 // $combinePolygon = $boolVal; 1164 //} 1165 else if ($tag == "CompressMaterial") 1166 { 1167 $compressMaterial = $boolVal; 1168 } 1169 else if ($tag == "OptimizePrimitive") 1170 { 1171 $optimizePrimitive = $boolVal; 1172 } 1173 else if ($tag == "ConvertToModel") 1174 { 1175 // ConvertToModel �͉��ʌ݊����Ȃ����߁A1.3.0 �����O�ɏo�͂��ꂽ c3es 1176 // ���烍�[�h���鎞�͖������� 1177 if (strcmp($settingsVersion, "1.3.0") >= 0) 1178 { 1179 $convertToModel = $boolVal; 1180 } 1181 } 1182 //else if ($tag == "DelUselessVtxData") 1183 //{ 1184 // $delUselessVtxData = $boolVal; 1185 //} 1186 1187 //----------------------------------------------------------------------------- 1188 // quantization 1189 else if ($tag == "QuantizePos") 1190 { 1191 $quantizePos = $val; 1192 } 1193 else if ($tag == "QuantizeNrm") 1194 { 1195 $quantizeNrm = $val; 1196 } 1197 else if ($tag == "QuantizeTex") 1198 { 1199 $quantizeTex = $val; 1200 } 1201 else if ($tag == "FrameFormat") 1202 { 1203 $frameFormat = $boolVal; 1204 } 1205 else if ($tag == "ScaleQuantizeQuality") 1206 { 1207 $scaleQuantizeQuality = $val; 1208 } 1209 else if ($tag == "RotateQuantizeQuality") 1210 { 1211 $rotateQuantizeQuality = $val; 1212 } 1213 else if ($tag == "TranslateQuantizeQuality") 1214 { 1215 $translateQuantizeQuality = $val; 1216 } 1217 1218 //----------------------------------------------------------------------------- 1219 // model 1220 else if ($tag == "AdjustSkinning") 1221 { 1222 $adjustSkinning = $val; 1223 } 1224 else if ($tag == "MeshVisibilityMode") 1225 { 1226 $meshVisibilityMode = $val; 1227 } 1228 else if ($tag == "NonUniformScale") 1229 { 1230 $nonUniformScale = $boolVal; 1231 } 1232 else if ($tag == "MaxReservedUniformRegisters") 1233 { 1234 $maxReservedUniformRegisters = $val; 1235 } 1236 1237 //----------------------------------------------------------------------------- 1238 // anim 1239 else if ($tag == "BakeAllAnim") 1240 { 1241 $bakeAllAnim = $boolVal; 1242 } 1243 else if ($tag == "FramePrecision") 1244 { 1245 float $floatVal = $val; 1246 if ($floatVal == 0.5) 1247 { 1248 $framePrecision = 2; 1249 } 1250 else if ($floatVal == 0.2) 1251 { 1252 $framePrecision = 5; 1253 } 1254 else if ($floatVal == 0.1) 1255 { 1256 $framePrecision = 10; 1257 } 1258 } 1259 else if ($tag == "LoopAnim") 1260 { 1261 $loopAnim = $boolVal; 1262 } 1263 1264 //----------------------------------------------------------------------------- 1265 // tolerance 1266 else if ($tag == "ToleranceScale") 1267 { 1268 $toleranceScale = $val; 1269 } 1270 else if ($tag == "ToleranceRotate") 1271 { 1272 $toleranceRotate = $val; 1273 } 1274 else if ($tag == "ToleranceTranslate") 1275 { 1276 $toleranceTranslate = $val; 1277 } 1278 else if ($tag == "ToleranceTexScale") 1279 { 1280 $toleranceTexScale = $val; 1281 } 1282 else if ($tag == "ToleranceTexRotate") 1283 { 1284 $toleranceTexRotate = $val; 1285 } 1286 else if ($tag == "ToleranceTexTranslate") 1287 { 1288 $toleranceTexTranslate = $val; 1289 } 1290 else if ($tag == "ToleranceColor") 1291 { 1292 $toleranceColor = $val; 1293 } 1294 } 1295 1296 //----------------------------------------------------------------------------- 1297 // close file 1298 fclose($fid); 1299 1300 //----------------------------------------------------------------------------- 1301 // set option var 1302 string $optStr = ""; 1303 1304 $optStr += "ProcessMode=" + $processMode + ";"; 1305 $optStr += "ExportTarget=" + $exportTarget + ";"; 1306 $optStr += "OutputFileName=" + $outputFileName + ";"; 1307 $optStr += "OutputMode=" + $outputMode + ";"; 1308 $optStr += "OutputFolder=" + $outputFolder + ";"; 1309 $optStr += "MergeCmdl=" + $boolNames[$mergeCmdl] + ";"; 1310 $optStr += "MergeCmdlPath=" + $mergeCmdlPath + ";"; 1311 $optStr += "CopyRelatedFiles=" + $boolNames[$copyRelatedFiles] + ";"; 1312 //$optStr += "MergeCmdlAuto=" + $boolNames[$mergeCmdlAuto] + ";"; 1313 1314 $optStr += "Magnify=" + $magnify + ";"; 1315 $optStr += "FrameRange=" + $frameRange + ";"; 1316 $optStr += "StartFrame=" + $startFrame + ";"; 1317 $optStr += "EndFrame=" + $endFrame + ";"; 1318 //$optStr += "TexMatrixMode=" + $texMatrixMode + ";"; 1319 $optStr += "RemoveNamespace=" + $boolNames[$removeNamespace] + ";"; 1320 1321 $optStr += "OutputCmdl=" + $boolNames[$outputCmdl] + ";"; 1322 $optStr += "OutputCtex=" + $boolNames[$outputCtex] + ";"; 1323 $optStr += "OutputCmdla=" + $boolNames[$outputCmdla] + ";"; 1324 $optStr += "OutputCskla=" + $boolNames[$outputCskla] + ";"; 1325 $optStr += "OutputCmata=" + $boolNames[$outputCmata] + ";"; 1326 $optStr += "OutputCmcla=" + $boolNames[$outputCmcla] + ";"; 1327 $optStr += "OutputCmtpa=" + $boolNames[$outputCmtpa] + ";"; 1328 $optStr += "OutputCmtsa=" + $boolNames[$outputCmtsa] + ";"; 1329 $optStr += "OutputCcam=" + $boolNames[$outputCcam] + ";"; 1330 $optStr += "OutputClgt=" + $boolNames[$outputClgt] + ";"; 1331 $optStr += "OutputCenv=" + $boolNames[$outputCenv] + ";"; 1332 1333 $optStr += "CompressNode=" + $compressNode + ";"; 1334 //$optStr += "CombinePolygon=" + $boolNames[$combinePolygon] + ";"; 1335 $optStr += "CompressMaterial=" + $boolNames[$compressMaterial] + ";"; 1336 $optStr += "OptimizePrimitive=" + $boolNames[$optimizePrimitive] + ";"; 1337 $optStr += "ConvertToModel=" + $boolNames[$convertToModel] + ";"; 1338 //$optStr += "DelUselessVtxData=" + $boolNames[$delUselessVtxData] + ";"; 1339 1340 $optStr += "QuantizePos=" + $quantizePos + ";"; 1341 $optStr += "QuantizeNrm=" + $quantizeNrm + ";"; 1342 $optStr += "QuantizeTex=" + $quantizeTex + ";"; 1343 $optStr += "FrameFormat=" + $boolNames[$frameFormat] + ";"; 1344 $optStr += "ScaleQuantizeQuality=" + $scaleQuantizeQuality + ";"; 1345 $optStr += "RotateQuantizeQuality=" + $rotateQuantizeQuality + ";"; 1346 $optStr += "TranslateQuantizeQuality=" + $translateQuantizeQuality + ";"; 1347 1348 $optStr += "AdjustSkinning=" + $adjustSkinning + ";"; 1349 $optStr += "MeshVisibilityMode=" + $meshVisibilityMode + ";"; 1350 if ($useNonUniformScale) 1351 { 1352 $optStr += "NonUniformScale=" + $boolNames[$nonUniformScale] + ";"; 1353 } 1354 $optStr += "MaxReservedUniformRegisters=" + $maxReservedUniformRegisters + ";"; 1355 1356 $optStr += "BakeAllAnim=" + $boolNames[$bakeAllAnim] + ";"; 1357 $optStr += "FramePrecision=" + $framePrecision + ";"; 1358 $optStr += "LoopAnim=" + $boolNames[$loopAnim] + ";"; 1359 1360 1361 $optStr += "ToleranceScale=" + $toleranceScale + ";"; 1362 $optStr += "ToleranceRotate=" + $toleranceRotate + ";"; 1363 $optStr += "ToleranceTranslate=" + $toleranceTranslate + ";"; 1364 $optStr += "ToleranceTexScale=" + $toleranceTexScale + ";"; 1365 $optStr += "ToleranceTexRotate=" + $toleranceTexRotate + ";"; 1366 $optStr += "ToleranceTexTranslate=" + $toleranceTexTranslate + ";"; 1367 $optStr += "ToleranceColor=" + $toleranceColor + ";"; 1368 1369 return $optStr; 1370} 1371 1372/****************************************************************************** 1373 load setting from file (do) 1374******************************************************************************/ 1375global proc nw4cExpDialog_LoadSettingFromFileDo(string $filePath) 1376{ 1377 //----------------------------------------------------------------------------- 1378 // get option string from c3es 1379 $optStr = nw4cExpDialog_GetOptionStringFromC3es($filePath); 1380 optionVar -sv nw4cExport_Options $optStr; 1381 1382 //----------------------------------------------------------------------------- 1383 // update setting node 1384 SaveSettingToScene(1); 1385 1386 //----------------------------------------------------------------------------- 1387 // refresh option box 1388 if (`scrollLayout -ex nw4cExpDialog_ScrollLayout`) 1389 { 1390 if (`columnLayout -ex nw4cExpDialog_MainColumn`) 1391 { 1392 NW4C_ExpDialog; 1393 } 1394 } 1395 1396 //----------------------------------------------------------------------------- 1397 // end 1398 print ("Loaded from " + $filePath + "\n"); 1399} 1400 1401/****************************************************************************** 1402 load setting from file (file command) 1403******************************************************************************/ 1404global proc nw4cExpDialog_LoadSettingFromFileFC(string $filePath, string $fileType) 1405{ 1406 //----------------------------------------------------------------------------- 1407 // save setting file folder 1408 SaveSettingFileFolder($filePath); 1409 1410 //----------------------------------------------------------------------------- 1411 // do 1412 nw4cExpDialog_LoadSettingFromFileDo($filePath); 1413} 1414 1415/****************************************************************************** 1416 load setting from file (main) 1417******************************************************************************/ 1418global proc nw4cExpDialog_LoadSettingFromFile() 1419{ 1420 //----------------------------------------------------------------------------- 1421 // set setting file folder to currnet 1422 //SetSettingFileFolderToCurrent(); 1423 1424 //----------------------------------------------------------------------------- 1425 // open file dialog 1426 //fileBrowserDialog -m 0 -an "Load" -in "c3es" 1427 // -fc "nw4cExpDialog_LoadSettingFromFileFC"; 1428 1429 string $settingFolder = ""; 1430 if (`optionVar -ex nw4cExpDialog_SettingFileFolder`) 1431 { 1432 $settingFolder = `optionVar -q nw4cExpDialog_SettingFileFolder`; 1433 } 1434 1435 string $filePath; 1436 if (getApplicationVersionAsFloat() >= 2011) 1437 { 1438 string $paths[] = `fileDialog2 -fm 1 -ds 2 1439 -ff "C3es File (*.c3es)" -cap "Open C3es File" -dir $settingFolder`; 1440 if (size($paths) > 0) 1441 { 1442 $filePath = $paths[0]; 1443 } 1444 } 1445 else 1446 { 1447 string $dirMask = "*.c3es"; // fileDialog can use mask 1448 if (size($settingFolder) > 0 && `filetest -d $settingFolder`) 1449 { 1450 $dirMask = $settingFolder + $dirMask; 1451 } 1452 //trace ("dirMask: " + $dirMask); 1453 1454 $filePath = `fileDialog -dm $dirMask`; 1455 } 1456 if (size($filePath) > 0) 1457 { 1458 nw4cExpDialog_LoadSettingFromFileFC($filePath, ""); 1459 } 1460} 1461 1462/****************************************************************************** 1463 process mode callback 1464******************************************************************************/ 1465global proc nw4cExpDialog_ProcessModeCB() 1466{ 1467 if (!`control -q -vis nw4cExpDialog_ProcessMode`) 1468 { 1469 return; 1470 } 1471 int $animRangeFlag = (`radioButtonGrp -q -sl nw4cExpDialog_ProcessMode` == 2); 1472 int $useNWCS = (`radioButtonGrp -q -sl nw4cExpDialog_UseCreativeStudio` == 1); 1473 int $cmata = `checkBoxGrp -q -v1 nw4cExpDialog_CmataFileOut`; 1474 int $cmcla = `checkBoxGrp -q -v1 nw4cExpDialog_CmclaFileOut`;; 1475 int $cmtpa = `checkBoxGrp -q -v1 nw4cExpDialog_CmtpaFileOut`; 1476 int $cmtsa = `checkBoxGrp -q -v1 nw4cExpDialog_CmtsaFileOut`; 1477 int $ccam = `checkBoxGrp -q -v1 nw4cExpDialog_CcamFileOut`; 1478 int $clgt = `checkBoxGrp -q -v1 nw4cExpDialog_ClgtFileOut`; 1479 int $cenv = `checkBoxGrp -q -v1 nw4cExpDialog_CenvFileOut`; 1480 int $fileNameFlag; 1481 1482 $fileNameFlag = 1483 (!$animRangeFlag || $cmata || $cmcla || $cmtpa || $cmtsa || $ccam || $clgt || $cenv); 1484 1485 control -e -en $fileNameFlag nw4cExpDialog_OutFileName; 1486 control -e -en $fileNameFlag nw4cExpDialog_SceneToOutFileName; 1487 control -e -en $fileNameFlag nw4cExpDialog_NodeToOutFileName; 1488 control -e -en ($animRangeFlag==0) nw4cExpDialog_UseCreativeStudio; 1489 if ($animRangeFlag && $useNWCS) 1490 { 1491 radioButtonGrp -e -sl 1 nw4cExpDialog_OutInterFile; 1492 radioButtonGrp -e -sl 0 nw4cExpDialog_UseCreativeStudio; 1493 nw4cExpDialog_OutInterFileCB(); 1494 } 1495 1496 string $selectionStr = (!$animRangeFlag) ? 1497 "Selection ( Below )" : "Selection ( Tree )"; 1498 radioButtonGrp -e -l2 $selectionStr nw4cExpDialog_ExportTarget; 1499} 1500 1501/****************************************************************************** 1502 out inter file callback 1503******************************************************************************/ 1504global proc nw4cExpDialog_OutInterFileCB() 1505{ 1506 int $outInterFile = (`radioButtonGrp -q -sl nw4cExpDialog_OutInterFile` == 1); 1507 control -e -en $outInterFile nw4cExpDialog_OutFolder; 1508 control -e -en $outInterFile nw4cExpDialog_OutFolderBrowser; 1509 1510 int $useCs = (`radioButtonGrp -q -sl nw4cExpDialog_UseCreativeStudio` == 1); 1511 int $cmdl = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlFileOut`; 1512 int $mergeCmdl = `checkBoxGrp -q -v1 nw4cExpDialog_MergeCmdlFlag`; 1513 int $cmdlPathEnable = $cmdl && $mergeCmdl; 1514 control -e -en $cmdl nw4cExpDialog_MergeCmdlFlag; 1515 control -e -en $cmdlPathEnable nw4cExpDialog_MergeCmdlPath; 1516 control -e -en $cmdlPathEnable nw4cExpDialog_MergeCmdlBrowser; 1517 control -e -en $cmdlPathEnable nw4cExpDialog_CopyRelatedFiles; 1518 //control -e -en ($cmdlPathEnable && $useCs) nw4cExpDialog_MergeCmdlAuto; 1519} 1520 1521/****************************************************************************** 1522 set node name to file name 1523******************************************************************************/ 1524global proc nw4cExpDialog_SetNodeNameToFileName() 1525{ 1526 // get selection 1527 // ��ŊK�w�̐[���ׂ�̂� -l ���K�v 1528 string $xforms[] = `ls -l -sl -typ transform`; 1529 if (size($xforms) == 0) 1530 { 1531 $xforms = `ls -l -v -typ transform`; 1532 } 1533 if (size($xforms) == 0) 1534 { 1535 error "No transform node"; 1536 } 1537 1538 // find top level node 1539 string $name, $buf[]; 1540 int $depthMin = 10000; 1541 for ($xform in $xforms) 1542 { 1543 int $depth = tokenize($xform, "|", $buf); 1544 if ($depth < $depthMin) 1545 { 1546 $name = $xform; 1547 $depthMin = $depth; 1548 } 1549 } 1550 1551 // set name 1552 $name = substitute(".*|", $name, ""); // to short path 1553 textFieldGrp -e -tx $name nw4cExpDialog_OutFileName; 1554} 1555 1556/****************************************************************************** 1557 out folder browser callback 1558******************************************************************************/ 1559global proc nw4cExpDialog_OutFolderBrowserFC(string $filePath, string $fileType) 1560{ 1561 textFieldGrp -e -tx $filePath nw4cExpDialog_OutFolder; 1562} 1563 1564global proc nw4cExpDialog_OutFolderBrowserCB() 1565{ 1566 NW4C_SetCurDirFromFile(`textFieldGrp -q -tx nw4cExpDialog_OutFolder`); 1567 1568 eval("NW4C_FileDialog -m 4 -an \"Select\" -in \"Output Folder\" " + 1569 "-fc \"nw4cExpDialog_OutFolderBrowserFC\""); 1570 //fileBrowserDialog -m 4 -an "Select" -in "Output Folder" 1571 // -fc "nw4cExpDialog_OutFolderBrowserFC"; 1572} 1573 1574/****************************************************************************** 1575 merge cmdl browser callback 1576******************************************************************************/ 1577global proc nw4cExpDialog_MergeCmdlBrowserCB() 1578{ 1579 string $curPath = `textField -q -tx nw4cExpDialog_MergeCmdlPath`; 1580 if (size($curPath) > 0) 1581 { 1582 $curPath = dirname($curPath); 1583 $curPath = (`filetest -d $curPath`) ? ($curPath + "/") : ""; 1584 } 1585 string $newPath; 1586 if (getApplicationVersionAsFloat() >= 2011) 1587 { 1588 string $paths[] = 1589 `fileDialog2 -fm 1 -ds 2 -ff "Cmdl File (*.cmdl)" -cap "Select Cmdl File" -dir $curPath`; 1590 if (size($paths) > 0) 1591 { 1592 $newPath = $paths[0]; 1593 } 1594 } 1595 else 1596 { 1597 $newPath = `fileDialog -dm ($curPath + "*.cmdl")`; 1598 } 1599 if (size($newPath) > 0) 1600 { 1601 textField -e -tx $newPath nw4cExpDialog_MergeCmdlPath; 1602 } 1603} 1604 1605/****************************************************************************** 1606 magnify callback 1607******************************************************************************/ 1608global proc nw4cExpDialog_MagnifyCB() 1609{ 1610 float $magnify = `floatFieldGrp -q -v1 nw4cExpDialog_Magnify`; 1611 if ($magnify < 0.001) 1612 { 1613 floatFieldGrp -e -v1 0.001 nw4cExpDialog_Magnify; 1614 } 1615 else if ($magnify > 1000.0) 1616 { 1617 floatFieldGrp -e -v1 1000.0 nw4cExpDialog_Magnify; 1618 } 1619} 1620 1621/****************************************************************************** 1622 frame range callback 1623******************************************************************************/ 1624global proc nw4cExpDialog_FrameRangeCB() 1625{ 1626 int $frameRange = `radioButtonGrp -q -sl nw4cExpDialog_FrameRange` - 1; 1627 int $enableFlag = ($frameRange == 2); 1628 control -e -en $enableFlag nw4cExpDialog_StartFrame; 1629 control -e -en $enableFlag nw4cExpDialog_EndFrame; 1630} 1631 1632/****************************************************************************** 1633 frame start end callback 1634******************************************************************************/ 1635global proc nw4cExpDialog_FrameStartEndCB() 1636{ 1637 int $start = `intField -q -v nw4cExpDialog_StartFrame`; 1638 int $end = `intField -q -v nw4cExpDialog_EndFrame`; 1639 if ($start > $end) 1640 { 1641 intField -e -v $end nw4cExpDialog_StartFrame; 1642 intField -e -v $start nw4cExpDialog_EndFrame; 1643 } 1644} 1645 1646/****************************************************************************** 1647 convert to model callback 1648******************************************************************************/ 1649global proc nw4cExpDialog_ConvertToModelCB() 1650{ 1651 int $convertToModel = `checkBoxGrp -q -v1 nw4cExpDialog_ConvertToModel`; 1652 control -e -en ($convertToModel == 0) nw4cExpDialog_CompressNode; 1653} 1654 1655/****************************************************************************** 1656 max reserved uniform registers callback 1657******************************************************************************/ 1658global proc nw4cExpDialog_MaxReservedUniformRegistersCB() 1659{ 1660 int $val = `intFieldGrp -q -v1 nw4cExpDialog_MaxReservedUniformRegisters`; 1661 if ($val < 0 || $val > 57) 1662 { 1663 if ($val < 0 ) $val = 0; 1664 if ($val > 57 ) $val = 57; 1665 intFieldGrp -e -v1 $val nw4cExpDialog_MaxReservedUniformRegisters; 1666 } 1667} 1668 1669/****************************************************************************** 1670 model file callback 1671******************************************************************************/ 1672global proc nw4cExpDialog_ModelCB() 1673{ 1674 int $useNonUniformScale = UseNonUniformScale(); 1675 int $cmdl = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlFileOut`; 1676 int $cmdla = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlaFileOut`; 1677 1678 int $visAnim = ($cmdl || $cmdla); 1679 1680 control -e -en $cmdl nw4cExpDialog_CompressMaterial; 1681 control -e -en $cmdl nw4cExpDialog_OptimizePrimitive; 1682 //control -e -en $cmdl nw4cExpDialog_DelUselessVtxData; 1683 1684 control -e -en $cmdl nw4cExpDialog_QuantPos; 1685 control -e -en $cmdl nw4cExpDialog_QuantNrm; 1686 control -e -en $cmdl nw4cExpDialog_QuantTex; 1687 1688 control -e -en $cmdl nw4cExpDialog_AdjustSkinning; 1689 control -e -en $visAnim nw4cExpDialog_MeshVisibilityMode; 1690 if ($useNonUniformScale) 1691 { 1692 control -e -en $cmdl nw4cExpDialog_NonUniformScale; 1693 } 1694 control -e -en $cmdl nw4cExpDialog_MaxReservedUniformRegisters; 1695 1696 1697 nw4cExpDialog_OutInterFileCB(); // update merge cmdl file 1698} 1699 1700/****************************************************************************** 1701 anim file callback 1702******************************************************************************/ 1703global proc nw4cExpDialog_AnimCB() 1704{ 1705 //----------------------------------------------------------------------------- 1706 // get out file 1707 int $cmdl = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlFileOut`; 1708 int $cmdla = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlaFileOut`; 1709 int $cskla = `checkBoxGrp -q -v1 nw4cExpDialog_CsklaFileOut`; 1710 int $ccam = `checkBoxGrp -q -v1 nw4cExpDialog_CcamFileOut`; 1711 int $clgt = `checkBoxGrp -q -v1 nw4cExpDialog_ClgtFileOut`; 1712 int $cmata = `checkBoxGrp -q -v1 nw4cExpDialog_CmataFileOut`; 1713 int $cmcla = `checkBoxGrp -q -v1 nw4cExpDialog_CmclaFileOut`; 1714 int $cmtpa = `checkBoxGrp -q -v1 nw4cExpDialog_CmtpaFileOut`; 1715 int $cmtsa = `checkBoxGrp -q -v1 nw4cExpDialog_CmtsaFileOut`; 1716 int $anyAnim; 1717 int $visAnim; 1718 1719 $anyAnim = ($cmdla || $cskla || $cmata || $cmcla || $cmtpa || $cmtsa || $ccam || $clgt); 1720 $visAnim = ($cmdl || $cmdla); 1721 1722 //----------------------------------------------------------------------------- 1723 // get frame format 1724 int $frameFmt = `optionMenuGrp -q -sl nw4cExpDialog_FrameFormat` - 1; 1725 1726 //----------------------------------------------------------------------------- 1727 // out file 1728 control -e -en (!$cmata) nw4cExpDialog_CmclaFileOut; 1729 control -e -en (!$cmata) nw4cExpDialog_CmtpaFileOut; 1730 control -e -en (!$cmata) nw4cExpDialog_CmtsaFileOut; 1731 1732 //----------------------------------------------------------------------------- 1733 // process mode callback (enable/disable out file name) 1734 nw4cExpDialog_ProcessModeCB(); 1735 1736 //----------------------------------------------------------------------------- 1737 // quantization options 1738 control -e -en $cskla nw4cExpDialog_FrameFormat; 1739 control -e -en ($cskla && !$frameFmt) nw4cExpDialog_ScaleQuantizeQuality; 1740 control -e -en ($cskla && !$frameFmt) nw4cExpDialog_RotateQuantizeQuality; 1741 control -e -en ($cskla && !$frameFmt) nw4cExpDialog_TranslateQuantizeQuality; 1742 1743 //----------------------------------------------------------------------------- 1744 // model options 1745 control -e -en $visAnim nw4cExpDialog_MeshVisibilityMode; 1746 1747 //----------------------------------------------------------------------------- 1748 // animation options 1749 control -e -en $anyAnim nw4cExpDialog_BakeAll; 1750 control -e -en $anyAnim nw4cExpDialog_FramePrecision; 1751 control -e -en $anyAnim nw4cExpDialog_LoopAnim; 1752 1753 //----------------------------------------------------------------------------- 1754 // tolerance options 1755 int $nodeTolFlagRT = $cskla || $ccam || $clgt; 1756 int $nodeTolFlagS = $cskla; 1757 control -e -en $nodeTolFlagRT nw4cExpDialog_TolT; 1758 control -e -en $nodeTolFlagRT nw4cExpDialog_TolR; 1759 control -e -en $nodeTolFlagS nw4cExpDialog_TolS; 1760 1761 int $texTolFlagSRT = $cmata || $cmtsa; 1762 control -e -en $texTolFlagSRT nw4cExpDialog_TolTexT; 1763 control -e -en $texTolFlagSRT nw4cExpDialog_TolTexR; 1764 control -e -en $texTolFlagSRT nw4cExpDialog_TolTexS; 1765 1766 int $colorTolFlag = $cmata || $cmcla || $clgt; 1767 control -e -en $colorTolFlag nw4cExpDialog_TolC; 1768} 1769 1770/****************************************************************************** 1771 tolerance srt callback 1772******************************************************************************/ 1773global proc nw4cExpDialog_ToleranceSRTCB(string $field) 1774{ 1775 float $val = eval("floatFieldGrp -q -v1 " + $field); 1776 if ($val < 0.0) 1777 { 1778 eval("floatFieldGrp -e -v1 0.0 " + $field); 1779 } 1780} 1781 1782/****************************************************************************** 1783 tolerance color callback 1784******************************************************************************/ 1785global proc nw4cExpDialog_ToleranceColorCB(string $field) 1786{ 1787 float $val = eval("floatFieldGrp -q -v1 " + $field); 1788 if ($val < 0.0) 1789 { 1790 eval("floatFieldGrp -e -v1 0.0 " + $field); 1791 } 1792} 1793 1794/****************************************************************************** 1795 update all control state 1796******************************************************************************/ 1797proc nw4cExpDialog_UpdateAllControlState() 1798{ 1799 nw4cExpDialog_ProcessModeCB(); 1800 nw4cExpDialog_OutInterFileCB(); 1801 1802 nw4cExpDialog_MagnifyCB(); 1803 nw4cExpDialog_FrameRangeCB(); 1804 nw4cExpDialog_FrameStartEndCB(); 1805 1806 nw4cExpDialog_ConvertToModelCB(); 1807 1808 nw4cExpDialog_ModelCB(); 1809 nw4cExpDialog_AnimCB(); 1810 1811 nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolT"); 1812 nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolR"); 1813 nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolS"); 1814 1815 nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolTexT"); 1816 nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolTexR"); 1817 nw4cExpDialog_ToleranceSRTCB("nw4cExpDialog_TolTexS"); 1818 1819 nw4cExpDialog_ToleranceColorCB("nw4cExpDialog_TolC"); 1820} 1821 1822/****************************************************************************** 1823 set option variable 1824******************************************************************************/ 1825proc SetOptionVariable(int $resetFlag) 1826{ 1827 if ($resetFlag || !`optionVar -ex nw4cExport_Options`) 1828 { 1829 int $useNonUniformScale = UseNonUniformScale(); 1830 1831 string $optStr = 1832 "ProcessMode=Single;" + 1833 "ExportTarget=All;" + 1834 "OutputFileName=" + `file -q -namespace` + ";" + 1835 "OutputMode=File;" + 1836 "OutputFolder=" + `workspace -q -rd` + ";" + 1837 "MergeCmdl=false;" + 1838 "MergeCmdlPath=" + "" + ";" + 1839 "CopyRelatedFiles=false;" + 1840 //"MergeCmdlAuto=true;" + 1841 1842 "Magnify=1.0;" + 1843 "FrameRange=All;" + 1844 "StartFrame=1;" + 1845 "EndFrame=100;" + 1846 //"TexMatrixMode=Maya;" + 1847 "RemoveNamespace=false;" + 1848 1849 "OutputCmdl=true;" + 1850 "OutputCtex=true;" + 1851 "OutputCmdla=false;" + 1852 "OutputCskla=false;" + 1853 "OutputCmata=false;" + 1854 "OutputCmcla=false;" + 1855 "OutputCmtpa=false;" + 1856 "OutputCmtsa=false;"; 1857 1858 $optStr += 1859 "OutputCcam=false;" + 1860 "OutputClgt=false;" + 1861 "OutputCenv=false;" + 1862 1863 "CompressNode=None;" + 1864 //"CombinePolygon=true;" + 1865 "CompressMaterial=false;" + 1866 "OptimizePrimitive=true;" + 1867 "ConvertToModel=false;" + 1868 //"DelUselessVtxData=false;" + 1869 1870 "QuantizePos=Float;" + 1871 "QuantizeNrm=Float;" + 1872 "QuantizeTex=Float;" + 1873 "FrameFormat=false;" + 1874 "ScaleQuantizeQuality=9;" + 1875 "RotateQuantizeQuality=9;" + 1876 "TranslateQuantizeQuality=9;" + 1877 1878 "AdjustSkinning=None;" + 1879 "MeshVisibilityMode=BindByIndex;"; 1880 1881 if ($useNonUniformScale) 1882 { 1883 $optStr += 1884 "NonUniformScale=false;"; 1885 } 1886 1887 $optStr += 1888 "MaxReservedUniformRegisters=0;" + 1889 1890 "BakeAllAnim=true;" + 1891 "FramePrecision=1;" + 1892 "LoopAnim=false;" + 1893 1894 "ToleranceScale=0.1;" + 1895 "ToleranceRotate=0.1;" + 1896 "ToleranceTranslate=0.01;" + 1897 "ToleranceTexScale=0.1;" + 1898 "ToleranceTexRotate=0.1;" + 1899 "ToleranceTexTranslate=0.01;" + 1900 "ToleranceColor=0.001;" + 1901 1902 ""; 1903 optionVar -sv nw4cExport_Options $optStr; 1904 } 1905} 1906 1907/****************************************************************************** 1908 set option control 1909******************************************************************************/ 1910proc SetOptionControl() 1911{ 1912 global int $nw4cExpDialog_SettingVer; 1913 global int $nw4cExpDialog_SettingLatestVer; 1914 int $use3DEditor = Use3DEditor(); 1915 int $useNonUniformScale = UseNonUniformScale(); 1916 1917 if (`optionVar -ex nw4cExport_Options`) 1918 { 1919 string $optStr = `optionVar -q nw4cExport_Options`; 1920 if (size($optStr) > 0) 1921 { 1922 string $optList[]; 1923 tokenize($optStr, ";", $optList); 1924 int $iopt; 1925 for ($iopt = 0; $iopt < size($optList); ++$iopt) 1926 { 1927 string $words[]; 1928 tokenize($optList[$iopt], "=", $words); 1929 int $intVal; 1930 float $floatVal; 1931 int $boolVal = ($words[1] == "true" || $words[1] == "On" || $words[1] == "1"); 1932 1933 //----------------------------------------------------------------------------- 1934 // output 1935 if ($words[0] == "ProcessMode") 1936 { 1937 $intVal = ($words[1] == "AnimationRange"); 1938 radioButtonGrp -e -sl ($intVal + 1) nw4cExpDialog_ProcessMode; 1939 } 1940 else if ($words[0] == "ExportTarget") 1941 { 1942 $intVal = ($words[1] == "Selection"); 1943 radioButtonGrp -e -sl ($intVal + 1) nw4cExpDialog_ExportTarget; 1944 } 1945 else if ($words[0] == "OutputFileName") 1946 { 1947 textFieldGrp -e -tx $words[1] nw4cExpDialog_OutFileName; 1948 } 1949 else if ($words[0] == "OutputMode") 1950 { 1951 if ($words[1] == "File") 1952 { 1953 radioButtonGrp -e -sl 1 nw4cExpDialog_OutInterFile; 1954 } 1955 else if ($words[1] == "CreativeStudio") 1956 { 1957 radioButtonGrp -e -sl 1 nw4cExpDialog_UseCreativeStudio; 1958 } 1959 else if ($use3DEditor) 1960 { 1961 radioButtonGrp -e -sl 1 nw4cExpDialog_Use3DEditor; 1962 } 1963 } 1964 else if ($words[0] == "OutputFolder") 1965 { 1966 textFieldGrp -e -tx $words[1] nw4cExpDialog_OutFolder; 1967 } 1968 else if ($words[0] == "MergeCmdl") 1969 { 1970 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_MergeCmdlFlag; 1971 } 1972 else if ($words[0] == "MergeCmdlPath") 1973 { 1974 textField -e -tx $words[1] nw4cExpDialog_MergeCmdlPath; 1975 } 1976 else if ($words[0] == "CopyRelatedFiles") 1977 { 1978 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CopyRelatedFiles; 1979 } 1980 //else if ($words[0] == "MergeCmdlAuto") 1981 //{ 1982 // checkBoxGrp -e -v1 $boolVal nw4cExpDialog_MergeCmdlAuto; 1983 //} 1984 1985 //----------------------------------------------------------------------------- 1986 // general 1987 else if ($words[0] == "Magnify") 1988 { 1989 $floatVal = $words[1]; 1990 floatFieldGrp -e -v1 $floatVal nw4cExpDialog_Magnify; 1991 } 1992 else if ($words[0] == "FrameRange") 1993 { 1994 int $sel = 1; // All 1995 if ($words[1] == "Playback") 1996 { 1997 $sel = 2; 1998 } 1999 else if ($words[1] == "Range") 2000 { 2001 $sel = 3; 2002 } 2003 radioButtonGrp -e -sl $sel nw4cExpDialog_FrameRange; 2004 } 2005 else if ($words[0] == "StartFrame") 2006 { 2007 $intVal = $words[1]; 2008 intField -e -v $intVal nw4cExpDialog_StartFrame; 2009 } 2010 else if ($words[0] == "EndFrame") 2011 { 2012 $intVal = $words[1]; 2013 intField -e -v $intVal nw4cExpDialog_EndFrame; 2014 } 2015 //else if ($words[0] == "TexMatrixMode") 2016 //{ 2017 // int $sel = 1; // maya 2018 // if ($words[1] == "3dsmax") 2019 // { 2020 // $sel = 2; 2021 // } 2022 // optionMenuGrp -e -sl $sel nw4cExpDialog_TexMatrixMode; 2023 //} 2024 else if ($words[0] == "RemoveNamespace") 2025 { 2026 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_RemoveNamespace; 2027 } 2028 2029 //----------------------------------------------------------------------------- 2030 // file select 2031 else if ($words[0] == "OutputCmdl") 2032 { 2033 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmdlFileOut; 2034 } 2035 else if ($words[0] == "OutputCtex") 2036 { 2037 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CtexFileOut; 2038 } 2039 else if ($words[0] == "OutputCmdla") 2040 { 2041 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmdlaFileOut; 2042 } 2043 else if ($words[0] == "OutputCskla") 2044 { 2045 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CsklaFileOut; 2046 } 2047 else if ($words[0] == "OutputCmata") 2048 { 2049 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmataFileOut; 2050 } 2051 else if ($words[0] == "OutputCmcla") 2052 { 2053 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmclaFileOut; 2054 } 2055 else if ($words[0] == "OutputCmtpa") 2056 { 2057 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmtpaFileOut; 2058 } 2059 else if ($words[0] == "OutputCmtsa") 2060 { 2061 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CmtsaFileOut; 2062 } 2063 else if ($words[0] == "OutputCcam") 2064 { 2065 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CcamFileOut; 2066 } 2067 else if ($words[0] == "OutputClgt") 2068 { 2069 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_ClgtFileOut; 2070 } 2071 else if ($words[0] == "OutputCenv") 2072 { 2073 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_CenvFileOut; 2074 } 2075 2076 //----------------------------------------------------------------------------- 2077 // optimization 2078 else if ($words[0] == "CompressNode") 2079 { 2080 int $sel = 1; // None 2081 if ($words[1] == "Cull") 2082 { 2083 $sel = 2; 2084 } 2085 else if ($words[1] == "CullUninfluential") 2086 { 2087 $sel = 3; 2088 } 2089 else if ($words[1] == "UniteCompressible") 2090 { 2091 $sel = 4; 2092 } 2093 else if ($words[1] == "UniteAll") 2094 { 2095 $sel = 5; 2096 } 2097 optionMenuGrp -e -sl $sel nw4cExpDialog_CompressNode; 2098 } 2099 //else if ($words[0] == "CombinePolygon") 2100 //{ 2101 // checkBox -e -v $boolVal nw4cExpDialog_CombinePolygon; 2102 //} 2103 else if ($words[0] == "CompressMaterial") 2104 { 2105 optionMenuGrp -e -sl ($boolVal + 1) nw4cExpDialog_CompressMaterial; 2106 } 2107 else if ($words[0] == "OptimizePrimitive") 2108 { 2109 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_OptimizePrimitive; 2110 } 2111 else if ($words[0] == "ConvertToModel") 2112 { 2113 // ConvertToModel �͉��ʌ݊����Ȃ����߁A1.3.0 �����O�ɐݒ肳�ꂽ�o�̓I�v�V���� 2114 // ���烍�[�h���鎞�͖������� 2115 if ($nw4cExpDialog_SettingVer >= 13) 2116 { 2117 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_ConvertToModel; 2118 } 2119 } 2120 //else if ($words[0] == "DelUselessVtxData") 2121 //{ 2122 // checkBoxGrp -e -v1 $boolVal nw4cExpDialog_DelUselessVtxData; 2123 //} 2124 2125 //----------------------------------------------------------------------------- 2126 // quantization 2127 else if ($words[0] == "QuantizePos") 2128 { 2129 int $sel = 1; // Float 2130 if ($words[1] == "Float") 2131 { 2132 $sel = 1; 2133 } 2134 else if ($words[1] == "Short") 2135 { 2136 $sel = 2; 2137 } 2138 else if ($words[1] == "Byte") 2139 { 2140 $sel = 3; 2141 } 2142 optionMenuGrp -e -sl $sel nw4cExpDialog_QuantPos; 2143 } 2144 else if ($words[0] == "QuantizeNrm") 2145 { 2146 int $sel = 1; // Float 2147 if ($words[1] == "Float") 2148 { 2149 $sel = 1; 2150 } 2151 else if ($words[1] == "Short") 2152 { 2153 $sel = 2; 2154 } 2155 else if ($words[1] == "Byte") 2156 { 2157 $sel = 3; 2158 } 2159 optionMenuGrp -e -sl $sel nw4cExpDialog_QuantNrm; 2160 } 2161 else if ($words[0] == "QuantizeTex") 2162 { 2163 int $sel = 1; // Float 2164 if ($words[1] == "Float") 2165 { 2166 $sel = 1; 2167 } 2168 else if ($words[1] == "Short") 2169 { 2170 $sel = 2; 2171 } 2172 else if ($words[1] == "Byte") 2173 { 2174 $sel = 3; 2175 } 2176 optionMenuGrp -e -sl $sel nw4cExpDialog_QuantTex; 2177 } 2178 else if ($words[0] == "FrameFormat") 2179 { 2180 optionMenuGrp -e -sl ($boolVal + 1) nw4cExpDialog_FrameFormat; 2181 } 2182 else if ($words[0] == "ScaleQuantizeQuality") 2183 { 2184 $intVal = $words[1]; 2185 intSliderGrp -e -v $intVal nw4cExpDialog_ScaleQuantizeQuality; 2186 } 2187 else if ($words[0] == "RotateQuantizeQuality") 2188 { 2189 $intVal = $words[1]; 2190 intSliderGrp -e -v $intVal nw4cExpDialog_RotateQuantizeQuality; 2191 } 2192 else if ($words[0] == "TranslateQuantizeQuality") 2193 { 2194 $intVal = $words[1]; 2195 intSliderGrp -e -v $intVal nw4cExpDialog_TranslateQuantizeQuality; 2196 } 2197 //----------------------------------------------------------------------------- 2198 // model 2199 else if ($words[0] == "AdjustSkinning") 2200 { 2201 int $sel = 1; // None 2202 if ($words[1] == "None") 2203 { 2204 $sel = 1; 2205 } 2206 else if ($words[1] == "RigidSkinning") 2207 { 2208 $sel = 2; 2209 } 2210 optionMenuGrp -e -sl $sel nw4cExpDialog_AdjustSkinning; 2211 } 2212 else if ($words[0] == "MeshVisibilityMode") 2213 { 2214 int $sel = 1; // BindByIndex 2215 if ($words[1] == "BindByIndex") 2216 { 2217 $sel = 1; 2218 } 2219 else if ($words[1] == "BindByName") 2220 { 2221 $sel = 2; 2222 } 2223 optionMenuGrp -e -sl $sel nw4cExpDialog_MeshVisibilityMode; 2224 } 2225 else if ($words[0] == "NonUniformScale") 2226 { 2227 if ($useNonUniformScale) 2228 { 2229 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_NonUniformScale; 2230 } 2231 } 2232 else if ($words[0] == "MaxReservedUniformRegisters") 2233 { 2234 $intVal = $words[1]; 2235 intFieldGrp -e -v1 $intVal nw4cExpDialog_MaxReservedUniformRegisters; 2236 } 2237 2238 //----------------------------------------------------------------------------- 2239 // anim 2240 else if ($words[0] == "BakeAllAnim") 2241 { 2242 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_BakeAll; 2243 } 2244 else if ($words[0] == "FramePrecision") 2245 { 2246 $intVal = $words[1]; 2247 int $sel = 1; // 1.0 2248 if ($intVal == "2") // 0.5 2249 { 2250 $sel = 2; 2251 } 2252 else if ($intVal == "5") // 0.2 2253 { 2254 $sel = 3; 2255 } 2256 else if ($intVal == "10") // 0.1 2257 { 2258 $sel = 4; 2259 } 2260 optionMenuGrp -e -sl $sel nw4cExpDialog_FramePrecision; 2261 } 2262 else if ($words[0] == "LoopAnim") 2263 { 2264 checkBoxGrp -e -v1 $boolVal nw4cExpDialog_LoopAnim; 2265 } 2266 2267 //----------------------------------------------------------------------------- 2268 // tolerance 2269 else if ($words[0] == "ToleranceScale") 2270 { 2271 $floatVal = $words[1]; 2272 floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolS; 2273 } 2274 else if ($words[0] == "ToleranceRotate") 2275 { 2276 $floatVal = $words[1]; 2277 floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolR; 2278 } 2279 else if ($words[0] == "ToleranceTranslate") 2280 { 2281 $floatVal = $words[1]; 2282 floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolT; 2283 } 2284 else if ($words[0] == "ToleranceTexScale") 2285 { 2286 $floatVal = $words[1]; 2287 floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolTexS; 2288 } 2289 else if ($words[0] == "ToleranceTexRotate") 2290 { 2291 $floatVal = $words[1]; 2292 floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolTexR; 2293 } 2294 else if ($words[0] == "ToleranceTexTranslate") 2295 { 2296 $floatVal = $words[1]; 2297 floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolTexT; 2298 } 2299 else if ($words[0] == "ToleranceColor") 2300 { 2301 $floatVal = $words[1]; 2302 floatFieldGrp -e -v1 $floatVal nw4cExpDialog_TolC; 2303 } 2304 } 2305 } 2306 } 2307 2308 //----------------------------------------------------------------------------- 2309 // update control state 2310 nw4cExpDialog_UpdateAllControlState(); 2311 2312 //----------------------------------------------------------------------------- 2313 // ConvertToModel ���o�[�W�����ɂ���ē��삪�قȂ邽�߂̏����B 2314 // ��x���[�h����������̃o�[�W�������グ�āA�ȍ~�� ConvertToModel ��ǂݍ��ނ悤�ɂ���B 2315 $nw4cExpDialog_SettingVer = $nw4cExpDialog_SettingLatestVer; 2316} 2317 2318/****************************************************************************** 2319 check option value 2320******************************************************************************/ 2321proc CheckOptionValue() 2322{ 2323 int $use3DEditor = Use3DEditor(); 2324 int $animRangeFlag = (`radioButtonGrp -q -sl nw4cExpDialog_ProcessMode` == 2); 2325 2326 //int $cscaFlag = `checkBoxGrp -q -v1 nw4cExpDialog_CscaFileOut`; 2327 int $cscaFlag = 0; 2328 2329 if (!$animRangeFlag || $cscaFlag) 2330 { 2331 string $outputFileName = `textFieldGrp -q -tx nw4cExpDialog_OutFileName`; 2332 if (size($outputFileName) == 0) 2333 { 2334 ShowError("Output File Name is wrong"); 2335 } 2336 if (size(match("[=;:/*?<>|\"]", $outputFileName)) > 0 || 2337 NW4C_GetUnixFilePath($outputFileName) != $outputFileName) // check "\" 2338 { 2339 ShowError("Output File Name is wrong (please don't use [=] [;] [:] [/] [\\] [*] [?] [<] [>] [|] [double quote])"); 2340 } 2341 } 2342 2343 int $useCs = (`radioButtonGrp -q -sl nw4cExpDialog_UseCreativeStudio` == 1); 2344 int $use3DE = 0; 2345 if ($use3DEditor) 2346 { 2347 $use3DE = (`radioButtonGrp -q -sl nw4cExpDialog_Use3DEditor` == 1); 2348 } 2349 if (!$useCs && !$use3DE) 2350 { 2351 string $outputFolder = `textFieldGrp -q -tx nw4cExpDialog_OutFolder`; 2352 if (size($outputFolder) == 0) 2353 { 2354 ShowError("Output Folder is wrong"); 2355 } 2356 if (size(match("[=;*?<>|\"]", $outputFolder)) > 0) 2357 { 2358 ShowError("Output Folder is wrong (please don't use [=] [;] [*] [?] [<] [>] [|] [double quote])"); 2359 } 2360 } 2361 2362 int $outCmdl = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlFileOut`; 2363 int $mergeCmdl = `checkBoxGrp -q -v1 nw4cExpDialog_MergeCmdlFlag`; 2364 if ($outCmdl && $mergeCmdl) 2365 { 2366 string $mergeCmdlPath = `textField -q -tx nw4cExpDialog_MergeCmdlPath`; 2367 if (size($mergeCmdlPath) == 0) 2368 { 2369 ShowError("Path of cmdl file to merge is wrong"); 2370 } 2371 if (size(match("[=;*?<>|\"]", $mergeCmdlPath)) > 0) 2372 { 2373 ShowError("Path of cmdl file to merge is wrong (please don't use [=] [;] [*] [?] [<] [>] [|] [double quote])"); 2374 } 2375 } 2376} 2377 2378/****************************************************************************** 2379 update option variable (UpdateOptionVariableT) 2380******************************************************************************/ 2381global proc nw4cExpDialog_UpdateOptionVariable(int $saveSettingToScene) 2382{ 2383 int $use3DEditor = Use3DEditor(); 2384 int $useNonUniformScale = UseNonUniformScale(); 2385 int $intVal; 2386 float $floatVal; 2387 string $optStr = "", $path; 2388 2389 string $boolNames[2] = { "false", "true" }; 2390 2391 //----------------------------------------------------------------------------- 2392 // output 2393 $intVal = `radioButtonGrp -q -sl nw4cExpDialog_ProcessMode` - 1; 2394 string $processModeNames[] = { "Single", "AnimationRange" }; 2395 $optStr += "ProcessMode=" + $processModeNames[$intVal] + ";"; 2396 2397 $intVal = `radioButtonGrp -q -sl nw4cExpDialog_ExportTarget` - 1; 2398 string $exportTargetNames[] = { "All", "Selection" }; 2399 $optStr += "ExportTarget=" + $exportTargetNames[$intVal] + ";"; 2400 2401 $optStr += "OutputFileName=" + `textFieldGrp -q -tx nw4cExpDialog_OutFileName` + ";"; 2402 2403 $intVal = (`radioButtonGrp -q -sl nw4cExpDialog_UseCreativeStudio` == 1); 2404 if ($use3DEditor) 2405 { 2406 if (`radioButtonGrp -q -sl nw4cExpDialog_Use3DEditor` == 1) $intVal = 2; 2407 } 2408 string $outputTargetNames[] = { "File", "CreativeStudio", "3DEditor" }; 2409 $optStr += "OutputMode=" + $outputTargetNames[$intVal] + ";"; 2410 2411 $path = `textFieldGrp -q -tx nw4cExpDialog_OutFolder`; 2412 $optStr += "OutputFolder=" + NW4C_GetUnixFilePath($path) + ";"; 2413 2414 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_MergeCmdlFlag`; 2415 $optStr += "MergeCmdl=" + $boolNames[$intVal] + ";"; 2416 $path = `textField -q -tx nw4cExpDialog_MergeCmdlPath`; 2417 $optStr += "MergeCmdlPath=" + NW4C_GetUnixFilePath($path) + ";"; 2418 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CopyRelatedFiles`; 2419 $optStr += "CopyRelatedFiles=" + $boolNames[$intVal] + ";"; 2420// $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_MergeCmdlAuto`; 2421// $optStr += "MergeCmdlAuto=" + $boolNames[$intVal] + ";"; 2422 2423 //----------------------------------------------------------------------------- 2424 // general 2425 $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_Magnify`; 2426 $optStr += "Magnify=" + $floatVal + ";"; 2427 2428 $intVal = `radioButtonGrp -q -sl nw4cExpDialog_FrameRange` - 1; 2429 string $frameRangeNames[] = { "All", "Playback", "Range" }; 2430 $optStr += "FrameRange=" + $frameRangeNames[$intVal] + ";"; 2431 2432 $intVal = `intField -q -v nw4cExpDialog_StartFrame`; 2433 $optStr += "StartFrame=" + $intVal + ";"; 2434 2435 $intVal = `intField -q -v nw4cExpDialog_EndFrame`; 2436 $optStr += "EndFrame=" + $intVal + ";"; 2437 2438// $intVal = `optionMenuGrp -q -sl nw4cExpDialog_TexMatrixMode` - 1; 2439// string $texMatrixModeNames[] = { "Maya", "3dsMax" }; 2440// $optStr += "TexMatrixMode=" + $texMatrixModeNames[$intVal] + ";"; 2441 2442 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_RemoveNamespace`; 2443 $optStr += "RemoveNamespace=" + $boolNames[$intVal] + ";"; 2444 2445 //----------------------------------------------------------------------------- 2446 // file selection 2447 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlFileOut`; 2448 $optStr += "OutputCmdl=" + $boolNames[$intVal] + ";"; 2449 2450 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CtexFileOut`; 2451 $optStr += "OutputCtex=" + $boolNames[$intVal] + ";"; 2452 2453 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmdlaFileOut`; 2454 $optStr += "OutputCmdla=" + $boolNames[$intVal] + ";"; 2455 2456 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CsklaFileOut`; 2457 $optStr += "OutputCskla=" + $boolNames[$intVal] + ";"; 2458 2459 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmataFileOut`; 2460 $optStr += "OutputCmata=" + $boolNames[$intVal] + ";"; 2461 2462 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmclaFileOut`; 2463 $optStr += "OutputCmcla=" + $boolNames[$intVal] + ";"; 2464 2465 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmtpaFileOut`; 2466 $optStr += "OutputCmtpa=" + $boolNames[$intVal] + ";"; 2467 2468 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CmtsaFileOut`; 2469 $optStr += "OutputCmtsa=" + $boolNames[$intVal] + ";"; 2470 2471 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CcamFileOut`; 2472 $optStr += "OutputCcam=" + $boolNames[$intVal] + ";"; 2473 2474 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_ClgtFileOut`; 2475 $optStr += "OutputClgt=" + $boolNames[$intVal] + ";"; 2476 2477 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_CenvFileOut`; 2478 $optStr += "OutputCenv=" + $boolNames[$intVal] + ";"; 2479 2480 //----------------------------------------------------------------------------- 2481 // optimization 2482 $intVal = `optionMenuGrp -q -sl nw4cExpDialog_CompressNode` - 1; 2483 string $compressNodeNames[] = { 2484 "None", "Cull", "CullUninfluential", "UniteCompressible", "UniteAll" }; 2485 $optStr += "CompressNode=" + $compressNodeNames[$intVal] + ";"; 2486 2487// $intVal = `checkBox -q -v nw4cExpDialog_CombinePolygon`; 2488// $optStr += "CombinePolygon=" + $boolNames[$intVal] + ";"; 2489 2490 $intVal = `optionMenuGrp -q -sl nw4cExpDialog_CompressMaterial` - 1; 2491 $optStr += "CompressMaterial=" + $boolNames[$intVal] + ";"; 2492 2493 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_OptimizePrimitive`; 2494 $optStr += "OptimizePrimitive=" + $boolNames[$intVal] + ";"; 2495 2496 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_ConvertToModel`; 2497 $optStr += "ConvertToModel=" + $boolNames[$intVal] + ";"; 2498 2499// $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_DelUselessVtxData`; 2500// $optStr += "DelUselessVtxData=" + $boolNames[$intVal] + ";"; 2501 2502 //----------------------------------------------------------------------------- 2503 // quantization 2504 $intVal = `optionMenuGrp -q -sl nw4cExpDialog_QuantPos` - 1; 2505 string $quantPosNames[] = { "Float", "Short", "Byte", "Auto" }; 2506 $optStr += "QuantizePos=" + $quantPosNames[$intVal] + ";"; 2507 2508 $intVal = `optionMenuGrp -q -sl nw4cExpDialog_QuantNrm` - 1; 2509 string $quantNrmNames[] = { "Float", "Short", "Byte", "Auto" }; 2510 $optStr += "QuantizeNrm=" + $quantNrmNames[$intVal] + ";"; 2511 2512 $intVal = `optionMenuGrp -q -sl nw4cExpDialog_QuantTex` - 1; 2513 string $quantTexNames[] = { "Float", "Short", "Byte", "Auto" }; 2514 $optStr += "QuantizeTex=" + $quantTexNames[$intVal] + ";"; 2515 2516 $intVal = `optionMenuGrp -q -sl nw4cExpDialog_FrameFormat` - 1; 2517 $optStr += "FrameFormat=" + $boolNames[$intVal] + ";"; 2518 2519 $intVal = `intSliderGrp -q -v nw4cExpDialog_ScaleQuantizeQuality`; 2520 $optStr += "ScaleQuantizeQuality=" + $intVal + ";"; 2521 2522 $intVal = `intSliderGrp -q -v nw4cExpDialog_RotateQuantizeQuality`; 2523 $optStr += "RotateQuantizeQuality=" + $intVal + ";"; 2524 2525 $intVal = `intSliderGrp -q -v nw4cExpDialog_TranslateQuantizeQuality`; 2526 $optStr += "TranslateQuantizeQuality=" + $intVal + ";"; 2527 2528 //----------------------------------------------------------------------------- 2529 // model 2530 $intVal = `optionMenuGrp -q -sl nw4cExpDialog_AdjustSkinning` - 1; 2531 string $adjustSkinningNames[] = { 2532 "None", "RigidSkinning" }; 2533 $optStr += "AdjustSkinning=" + $adjustSkinningNames[$intVal] + ";"; 2534 $intVal = `optionMenuGrp -q -sl nw4cExpDialog_MeshVisibilityMode` - 1; 2535 string $meshVisibilityModeNames[] = { 2536 "BindByIndex", "BindByName" }; 2537 $optStr += "MeshVisibilityMode=" + $meshVisibilityModeNames[$intVal] + ";"; 2538 2539 if ($useNonUniformScale) 2540 { 2541 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_NonUniformScale`; 2542 $optStr += "NonUniformScale=" + $boolNames[$intVal] + ";"; 2543 } 2544 $intVal = `intFieldGrp -q -v1 nw4cExpDialog_MaxReservedUniformRegisters`; 2545 $optStr += "MaxReservedUniformRegisters=" + $intVal + ";"; 2546 2547 //----------------------------------------------------------------------------- 2548 // animation 2549 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_BakeAll`; 2550 $optStr += "BakeAllAnim=" + $boolNames[$intVal] + ";"; 2551 2552 $intVal = `optionMenuGrp -q -sl nw4cExpDialog_FramePrecision`; 2553 int $framePrecision = 1; 2554 if ($intVal == 2) // 0.5 2555 { 2556 $framePrecision = 2; 2557 } 2558 else if ($intVal == 3) // 0.2 2559 { 2560 $framePrecision = 5; 2561 } 2562 else if ($intVal == 4) // 0.1 2563 { 2564 $framePrecision = 10; 2565 } 2566 $optStr += "FramePrecision=" + $framePrecision + ";"; 2567 2568 $intVal = `checkBoxGrp -q -v1 nw4cExpDialog_LoopAnim`; 2569 $optStr += "LoopAnim=" + $boolNames[$intVal] + ";"; 2570 2571 //----------------------------------------------------------------------------- 2572 // tolerance 2573 $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolS`; 2574 $optStr += "ToleranceScale=" + $floatVal + ";"; 2575 2576 $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolR`; 2577 $optStr += "ToleranceRotate=" + $floatVal + ";"; 2578 2579 $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolT`; 2580 $optStr += "ToleranceTranslate=" + $floatVal + ";"; 2581 2582 $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolTexT`; 2583 $optStr += "ToleranceTexTranslate=" + $floatVal + ";"; 2584 2585 $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolTexR`; 2586 $optStr += "ToleranceTexRotate=" + $floatVal + ";"; 2587 2588 $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolTexS`; 2589 $optStr += "ToleranceTexScale=" + $floatVal + ";"; 2590 2591 $floatVal = `floatFieldGrp -q -v1 nw4cExpDialog_TolC`; 2592 $optStr += "ToleranceColor=" + $floatVal + ";"; 2593 2594 //----------------------------------------------------------------------------- 2595 // set option var 2596 optionVar -sv nw4cExport_Options $optStr; 2597 2598 //----------------------------------------------------------------------------- 2599 // save setting to scene 2600 if ($saveSettingToScene) 2601 { 2602 SaveSettingToScene(1); 2603 } 2604} 2605 2606/****************************************************************************** 2607 reset option variable 2608******************************************************************************/ 2609global proc nw4cExpDialog_ResetOptionVariable() 2610{ 2611 //----------------------------------------------------------------------------- 2612 // reset export dialog options 2613 SetOptionVariable(1); 2614 SetOptionControl(); 2615 2616 //----------------------------------------------------------------------------- 2617 // save setting to scene 2618 SaveSettingToScene(1); 2619} 2620 2621/****************************************************************************** 2622 do export command 2623******************************************************************************/ 2624proc DoExportCmd(int $forceOverwrite) 2625{ 2626 //----------------------------------------------------------------------------- 2627 // load plugin 2628 LoadPlugin(); 2629 2630 //----------------------------------------------------------------------------- 2631 // get options 2632 string $optStr = ""; 2633 if (`optionVar -ex nw4cExport_Options`) 2634 { 2635 $optStr = `optionVar -q nw4cExport_Options`; 2636 } 2637 2638 //----------------------------------------------------------------------------- 2639 // export 2640 string $cmd = "NW4C_ExportCmd "; 2641 if ($forceOverwrite) 2642 { 2643 $cmd += "-f "; 2644 } 2645 $cmd += "-op \"" + $optStr + "\""; 2646 //trace ("cmd: " + $cmd); 2647 if (catch(eval($cmd))) 2648 { 2649 //error "NW4C_Export Failed"; 2650 } 2651} 2652 2653/****************************************************************************** 2654 export callback 2655******************************************************************************/ 2656global proc nw4cExpDialog_ExportCB() 2657{ 2658 CheckOptionValue(); 2659 nw4cExpDialog_UpdateOptionVariable(1); 2660 DoExportCmd(0); 2661} 2662 2663/****************************************************************************** 2664 save settings callback 2665******************************************************************************/ 2666global proc nw4cExpDialog_SaveSettingsCB() 2667{ 2668 CheckOptionValue(); 2669 nw4cExpDialog_UpdateOptionVariable(1); 2670} 2671 2672/****************************************************************************** 2673 setting menu command (post menu command) 2674******************************************************************************/ 2675global proc nw4cExpDialog_SettingMenuCmd() 2676{ 2677 int $sceneSettingFlag = DoesSaveLoadSceneSetting(); 2678 int $settingNodeFlag = `objExists nw4cExpDialog_Setting1`; 2679 menuItem -e -cb $sceneSettingFlag nw4cExpDialog_SaveLoadSceneSettingMenu; 2680 menuItem -e -en $settingNodeFlag nw4cExpDialog_DeleteSceneSettingMenu; 2681} 2682 2683/****************************************************************************** 2684 save load scene setting menu command 2685******************************************************************************/ 2686global proc nw4cExpDialog_SaveLoadSceneSettingMenuCmd() 2687{ 2688 int $sceneSettingFlag = DoesSaveLoadSceneSetting(); 2689 $sceneSettingFlag = !$sceneSettingFlag; 2690 optionVar -iv nw4cExpDialog_SaveLoadSceneSetting $sceneSettingFlag; 2691 menuItem -e -cb $sceneSettingFlag nw4cExpDialog_SaveLoadSceneSettingMenu; 2692} 2693 2694/****************************************************************************** 2695 delete scene setting menu command 2696******************************************************************************/ 2697global proc nw4cExpDialog_DeleteSceneSettingMenuCmd() 2698{ 2699 DeleteUselessSettingNode(); 2700 2701 string $node = "nw4cExpDialog_Setting1"; 2702 if (`referenceQuery -inr $node`) 2703 { 2704 print "NW4C export settings node is referenced\n"; 2705 } 2706 else 2707 { 2708 catch(`delete $node`); 2709 } 2710} 2711 2712/****************************************************************************** 2713 create setting menu 2714******************************************************************************/ 2715proc CreateSettingMenu(string $parent) 2716{ 2717 //----------------------------------------------------------------------------- 2718 // get option box 2719 global string $gOptionBox; 2720 if (!`window -ex $gOptionBox`) 2721 { 2722 return; 2723 } 2724 2725 //----------------------------------------------------------------------------- 2726 // delete previous menu 2727 if (`menu -q -ex nw4cExpDialog_SettingMenu`) 2728 { 2729 deleteUI nw4cExpDialog_SettingMenu; 2730 } 2731 2732 //----------------------------------------------------------------------------- 2733 // create menu 2734 int $sceneSettingFlag = DoesSaveLoadSceneSetting(); 2735 menu -l "NW4C Settings" -p $gOptionBox 2736 -pmc "nw4cExpDialog_SettingMenuCmd" 2737 nw4cExpDialog_SettingMenu; 2738 2739 menuItem -l "Save / Load Scene Settings" -cb $sceneSettingFlag 2740 -ann "Save settings to scene when exporting & Load settings from scene when opening scene" 2741 -c "nw4cExpDialog_SaveLoadSceneSettingMenuCmd" 2742 nw4cExpDialog_SaveLoadSceneSettingMenu; 2743 menuItem -l "Delete Scene Settings" 2744 -ann "Delete script node for settings" 2745 -c "nw4cExpDialog_DeleteSceneSettingMenuCmd" 2746 nw4cExpDialog_DeleteSceneSettingMenu; 2747 2748 menuItem -d 1; 2749 2750 menuItem -l "Load Settings from c3es File" 2751 -ann "Load settings from \".c3es\" file" 2752 -c "nw4cExpDialog_LoadSettingFromFile" 2753 nw4cExpDialog_LoadSettingFromFileMenu; 2754 menuItem -l "Save Settings to c3es File" 2755 -ann "Save settings to \".c3es\" file" 2756 -c "nw4cExpDialog_SaveSettingToFile" 2757 nw4cExpDialog_SaveSettingToMenu; 2758 2759 //----------------------------------------------------------------------------- 2760 // set script job to delete menu 2761 scriptJob -p $gOptionBox -uid nw4cExpDialog_ScrollLayout 2762 "if (!`scrollLayout -ex nw4cExpDialog_ScrollLayout`) { deleteUI nw4cExpDialog_SettingMenu; }"; 2763} 2764 2765/****************************************************************************** 2766 is no compress node 2767******************************************************************************/ 2768proc int IsNoCompressNode(string $node) 2769{ 2770 return (`attributeQuery -n $node -ex "nw4cNoCompressNode"`) ? 2771 `getAttr ($node + ".nw4cNoCompressNode")` : 0; 2772} 2773 2774/****************************************************************************** 2775 is scene anim object 2776******************************************************************************/ 2777proc int IsSceneAnimObject(string $node) 2778{ 2779 string $type = nodeType($node); 2780 string $childs[] = `listRelatives -pa -s $node`; 2781 if (size(`ls -cameras -lights -typ environmentFog $childs`) > 0 || 2782 $type == "lookAt") 2783 { 2784 return true; 2785 } 2786 return false; 2787} 2788 2789/****************************************************************************** 2790 is constraint node 2791******************************************************************************/ 2792proc int IsConstraintNode(string $node) 2793{ 2794 return (size(`ls -typ constraint $node`) != 0); 2795} 2796 2797/****************************************************************************** 2798 is needless locator or group 2799******************************************************************************/ 2800proc int IsNeedlessLocatorOrGroup(string $node) 2801{ 2802 if (nodeType($node) == "transform") 2803 { 2804 string $childs[] = `listRelatives -pa -ni $node`; 2805 if (size($childs) == 0) // empty group 2806 { 2807 return true; 2808 } 2809 else if (size($childs) == 1) 2810 { 2811 string $childType = nodeType($childs[0]); 2812 if ($childType == "locator") // locator without child 2813 { 2814 return true; 2815 } 2816 } 2817 } 2818 return false; 2819} 2820 2821/****************************************************************************** 2822 is blend shape target 2823******************************************************************************/ 2824proc int IsBlendShapeTarget(string $node) 2825{ 2826 string $shapes[] = `listRelatives -pa -ni -s $node`; 2827 if (size($shapes) && nodeType($shapes[0]) == "mesh") 2828 { 2829 string $cons[] = `listConnections -s 0 -d 1 ($shapes[0] + ".worldMesh")`; 2830 if (size($cons) && nodeType($cons[0]) == "blendShape") 2831 { 2832 return true; 2833 } 2834 } 2835 return false; 2836} 2837 2838/****************************************************************************** 2839 is animation range control node 2840******************************************************************************/ 2841proc int IsAnimRangeControlNode(string $node) 2842{ 2843 return `attributeQuery -n $node -ex "nw4c_AnimRangeEnable"`; 2844} 2845 2846/****************************************************************************** 2847 is effective node 2848******************************************************************************/ 2849proc int IsEffectiveNode(string $node) 2850{ 2851 if (IsNoCompressNode($node)) 2852 { 2853 return true; 2854 } 2855 2856 string $type = nodeType($node); 2857 if ($type == "ikHandle" || 2858 $type == "ikEffector" || 2859 IsConstraintNode($node) || 2860 IsNeedlessLocatorOrGroup($node) || 2861 IsBlendShapeTarget($node) || 2862 IsAnimRangeControlNode($node)) 2863 { 2864 return false; 2865 } 2866 2867 if (`getAttr ($node + ".template")`) 2868 { 2869 return false; 2870 } 2871 if (`getAttr ($node + ".overrideEnabled")`) 2872 { 2873 if (!`getAttr ($node + ".overrideVisibility")` || 2874 !`getAttr ($node + ".overrideShading")` || 2875 `getAttr ($node + ".overrideDisplayType")` == 1) // Template 2876 { 2877 return false; 2878 } 2879 } 2880 2881 return true; 2882} 2883 2884/****************************************************************************** 2885 remove no output child (both argments must be long path) 2886******************************************************************************/ 2887proc RemoveNoOutputChild(string $xforms[], string $noOutputs[]) 2888{ 2889 string $dsts[]; 2890 for ($xform in $xforms) 2891 { 2892 int $enable = true; 2893 for ($noOutput in $noOutputs) 2894 { 2895 if (gmatch($xform, $noOutput + "|*")) 2896 { 2897 $enable = false; 2898 //print ("remove by parent: " + $xform + " (" + $noOutput + ")\n"); 2899 } 2900 } 2901 if ($enable) 2902 { 2903 $dsts[size($dsts)] = $xform; 2904 } 2905 } 2906 $xforms = $dsts; 2907} 2908 2909/****************************************************************************** 2910 get animation range target nodes 2911******************************************************************************/ 2912proc GetAnimRangeTargetNodes(string $xforms[]) 2913{ 2914 string $roots[]; 2915 string $sels[] = `ls -l -sl -typ transform`; 2916 for ($sel in $sels) 2917 { 2918 string $root = match("|[^|]+", $sel); 2919 $roots[size($roots)] = $root; 2920 } 2921 $xforms = `ls -l -dag -typ transform $roots`; 2922} 2923 2924/****************************************************************************** 2925 get node parent list 2926******************************************************************************/ 2927proc GetNodeParentList(string $list[], string $node) 2928{ 2929 clear($list); 2930 while (1) 2931 { 2932 $list[size($list)] = $node; 2933 string $parents[] = `listRelatives -pa -p $node`; 2934 if (!size($parents)) 2935 { 2936 break; 2937 } 2938 $node = $parents[0]; 2939 } 2940} 2941 2942/****************************************************************************** 2943 is attr animated 2944******************************************************************************/ 2945proc int IsAttrAnimated(string $plug) 2946{ 2947 string $ins[] = `listConnections -s 1 -d 0 $plug`; 2948 if (size($ins)) 2949 { 2950 string $hists[] = `listHistory $ins[0]`; 2951 if (size(`ls -typ animCurve -typ expression $hists`)) 2952 { 2953 return true; 2954 } 2955 } 2956 return false; 2957} 2958 2959/****************************************************************************** 2960 is xform node animated 2961******************************************************************************/ 2962proc int IsXformNodeAnimated(string $xform, int $depth) 2963{ 2964 string $attrs[] = { "tx", "ty", "tz", "rx", "ry", "rz", "sx", "sy", "sz" }; 2965 string $compAttrs[] = { "t", "r", "s" }; 2966 2967 //----------------------------------------------------------------------------- 2968 // check search depth 2969 //print ("ixna: " + $xform + ", " + $depth + "\n"); 2970 if ($depth >= 3) 2971 { 2972 return false; 2973 } 2974 2975 //----------------------------------------------------------------------------- 2976 // child attr 2977 string $checkedCons[]; 2978 for ($attr in $attrs) 2979 { 2980 string $plug = $xform + "." + $attr; 2981 string $ins[] = `listConnections -s 1 -d 0 $plug`; 2982 if (size($ins)) 2983 { 2984 string $inNode = $ins[0]; 2985 string $inType = nodeType($inNode); 2986 string $hists[]; 2987 if (gmatch($inType, "animBlendNode*")) 2988 $hists = `listHistory $inNode`; 2989 else 2990 $hists = `listHistory $plug`; 2991 2992 //----------------------------------------------------------------------------- 2993 // curve & expression & rigid body 2994 if (size(`ls -typ animCurve -typ expression -typ rigidBody $hists`)) 2995 { 2996 return true; 2997 } 2998 2999 //----------------------------------------------------------------------------- 3000 // xform attr connection (node1.attr -> node2.attr) 3001 if ($inNode != $xform && 3002 size(`ls -et transform -et joint $inNode`)) 3003 { 3004 if (IsXformNodeAnimated($inNode, $depth + 1)) 3005 { 3006 return true; 3007 } 3008 } 3009 3010 //----------------------------------------------------------------------------- 3011 // constraint 3012 string $cons[] = `ls -typ constraint $hists`; 3013 if (size($cons)) 3014 { 3015 //return true; 3016 string $con = $cons[0]; 3017 if (FindStringInArray($checkedCons, $con) == -1) 3018 { 3019 string $targets[] = 3020 `listConnections -s 1 -d 0 -type transform ($con + ".tg")`; 3021 $targets = stringArrayRemoveDuplicates($targets); 3022 //print "tar:\n"; print $targets; 3023 for ($target in $targets) 3024 { 3025 if ($target != $xform && $target != $con) 3026 { 3027 string $list[]; 3028 GetNodeParentList($list, $target); 3029 for ($n in $list) 3030 { 3031 if (IsXformNodeAnimated($n, $depth + 1)) 3032 { 3033 return true; 3034 } 3035 } 3036 } 3037 } 3038 $checkedCons[size($checkedCons)] = $con; 3039 } 3040 } 3041 } 3042 } 3043 3044 //----------------------------------------------------------------------------- 3045 // compound attr 3046 for ($attr in $compAttrs) 3047 { 3048 string $plug = $xform + "." + $attr; 3049 string $ins[] = `listConnections -s 1 -d 0 $plug`; 3050 if (size($ins)) 3051 { 3052 string $inNode = $ins[0]; 3053 //----------------------------------------------------------------------------- 3054 // xform (curve -> node1.t -> node2.t) 3055 if (size(`ls -et transform -et joint $inNode`) && 3056 $inNode != $xform) 3057 { 3058 if (IsXformNodeAnimated($inNode, $depth + 1)) 3059 { 3060 return true; 3061 } 3062 } 3063 } 3064 } 3065 3066 return false; 3067} 3068 3069/****************************************************************************** 3070 is pole vector animated 3071******************************************************************************/ 3072proc int IsPoleVectorAnimated(string $ik) 3073{ 3074 string $attrs[] = { "pvx", "pvy", "pvz" }; 3075 3076 string $checkedCons[]; 3077 for ($attr in $attrs) 3078 { 3079 string $plug = $ik + "." + $attr; 3080 string $ins[] = `listConnections -s 1 -d 0 $plug`; 3081 if (size($ins)) 3082 { 3083 string $inNode = $ins[0]; 3084 //string $hists[] = `listHistory $inNode`; 3085 string $hists[] = `listHistory $plug`; 3086 3087 if (size(`ls -typ animCurve -typ expression $hists`)) 3088 { 3089 return true; 3090 } 3091 3092 if (nodeType($inNode) == "poleVectorConstraint") 3093 { 3094 string $con = $inNode; 3095 if (FindStringInArray($checkedCons, $con) == -1) 3096 { 3097 string $targets[] = 3098 `listConnections -s 1 -d 0 -type transform ($con + ".tg")`; 3099 $targets = stringArrayRemoveDuplicates($targets); 3100 //print "pole tar:\n"; print $targets; 3101 for ($target in $targets) 3102 { 3103 if ($target != $ik && $target != $con) 3104 { 3105 string $list[]; 3106 GetNodeParentList($list, $target); 3107 for ($n in $list) 3108 { 3109 if (IsXformNodeAnimated($n, 0)) 3110 { 3111 return true; 3112 } 3113 } 3114 } 3115 } 3116 $checkedCons[size($checkedCons)] = $con; 3117 } 3118 } 3119 } 3120 } 3121 3122 return false; 3123} 3124 3125/****************************************************************************** 3126 does ik controlled xform exist 3127******************************************************************************/ 3128proc int DoesIkControlledXformExist(string $xforms[], string $ik) 3129{ 3130 string $sjs[] = `listConnections -s 1 -d 0 ($ik + ".startJoint")`; 3131 string $efs[] = `listConnections -s 1 -d 0 ($ik + ".endEffector")`; 3132 if (size($sjs) && size($efs)) 3133 { 3134 string $node = $efs[0]; 3135 while ($node != $sjs[0]) 3136 { 3137 string $parents[] = `listRelatives -pa -p $node`; 3138 if (!size($parents)) 3139 { 3140 break; 3141 } 3142 $node = $parents[0]; 3143 if (FindStringInArray($xforms, $node) != -1) 3144 { 3145 return true; 3146 } 3147 } 3148 } 3149 return false; 3150} 3151 3152/****************************************************************************** 3153 does chara exist 3154******************************************************************************/ 3155proc int DoesCharaAnimExist(string $xforms[]) 3156{ 3157 //----------------------------------------------------------------------------- 3158 // check size 3159 if (!size($xforms)) 3160 { 3161 return false; 3162 } 3163 3164 //----------------------------------------------------------------------------- 3165 // check curve / expression / constraint / rigid body 3166 for ($xform in $xforms) 3167 { 3168 if (IsXformNodeAnimated($xform, 0)) 3169 { 3170 return true; 3171 } 3172 } 3173 3174 //----------------------------------------------------------------------------- 3175 // check IK 3176 string $iks[] = `ls -typ ikHandle`; 3177 for ($ik in $iks) 3178 { 3179 if (DoesIkControlledXformExist($xforms, $ik)) 3180 { 3181 if (IsXformNodeAnimated($ik, 0) || 3182 IsPoleVectorAnimated($ik)) 3183 { 3184 return true; 3185 } 3186 } 3187 } 3188 3189 return false; 3190} 3191 3192/****************************************************************************** 3193 does vis anim exist 3194******************************************************************************/ 3195proc int DoesVisAnimExist(string $xforms[], string $meshs[]) 3196{ 3197 for ($xform in $xforms) 3198 { 3199 if (IsAttrAnimated($xform + ".v")) 3200 { 3201 return true; 3202 } 3203 } 3204 3205 for ($mesh in $meshs) 3206 { 3207 if (IsAttrAnimated($mesh + ".v")) 3208 { 3209 return true; 3210 } 3211 } 3212 3213 return false; 3214} 3215 3216/****************************************************************************** 3217 get first file node 3218******************************************************************************/ 3219proc string GetFirstFileNode(string $plug) 3220{ 3221 string $ins[] = `listConnections -s 1 -d 0 $plug`; 3222 if (size($ins)) 3223 { 3224 string $file = $ins[0]; 3225 if (nodeType($file) == "layeredTexture") 3226 { 3227 $ins = `listConnections -s 1 -d 0 -type file ($file + ".cs")`; 3228 if (!size($ins)) 3229 { 3230 return ""; 3231 } 3232 $file = $ins[0]; 3233 } 3234 if (nodeType($file) == "file") 3235 { 3236 return $file; 3237 } 3238 } 3239 return ""; 3240} 3241 3242/****************************************************************************** 3243 does color anim exist 3244******************************************************************************/ 3245proc int DoesColorAnimExist(string $mats[]) 3246{ 3247 string $attrs[] = { "cr", "cg", "cb", "itr", "acr", "acg", "acb", "sr", "sg", "sb" }; 3248 string $colorGains[] = { "cgr", "cgg", "cgb" }; 3249 3250 for ($mat in $mats) 3251 { 3252 //----------------------------------------------------------------------------- 3253 // direct anim 3254 for ($attr in $attrs) 3255 { 3256 if (!`attributeQuery -n $mat -ex $attr`) 3257 { 3258 break; 3259 } 3260 if (IsAttrAnimated($mat + "." + $attr)) 3261 { 3262 return true; 3263 } 3264 } 3265 3266 //----------------------------------------------------------------------------- 3267 // color gain anim 3268 string $file = GetFirstFileNode($mat + ".c"); 3269 if (size($file)) 3270 { 3271 for ($attr in $colorGains) 3272 { 3273 if (IsAttrAnimated($file + "." + $attr)) 3274 { 3275 return true; 3276 } 3277 } 3278 } 3279 3280 //----------------------------------------------------------------------------- 3281 // alpha gain anim 3282 string $file = GetFirstFileNode($mat + ".it"); 3283 if (size($file)) 3284 { 3285 if (IsAttrAnimated($file + ".ag")) 3286 { 3287 return true; 3288 } 3289 } 3290 } 3291 3292 return false; 3293} 3294 3295/****************************************************************************** 3296 does tex pat anim exist 3297******************************************************************************/ 3298proc int DoesTexPatAnimExist(string $files[]) 3299{ 3300 for ($file in $files) 3301 { 3302 if (`getAttr ($file + ".ufe")`) 3303 { 3304 if (IsAttrAnimated($file + ".fe")) 3305 { 3306 return true; 3307 } 3308 //string $ins[] = `listConnections -s 1 -d 0 ($file + ".fe")`; 3309 //if (size($ins)) 3310 //{ 3311 // string $hists[] = `listHistory $ins[0]`; 3312 // if (size(`ls -typ animCurve $hists`)) // curve only 3313 // { 3314 // return true; 3315 // } 3316 //} 3317 } 3318 } 3319 3320 return false; 3321} 3322 3323/****************************************************************************** 3324 does tex srt anim exist 3325******************************************************************************/ 3326proc int DoesTexSrtAnimExist(string $files[]) 3327{ 3328 string $attrs[] = { "tfu", "tfv", "rf", "reu", "rev" }; 3329 3330 for ($file in $files) 3331 { 3332 string $ins[] = `listConnections -s 1 -d 0 -type place2dTexture ($file + ".uv")`; 3333 if (size($ins)) 3334 { 3335 string $place = $ins[0]; 3336 for ($attr in $attrs) 3337 { 3338 if (IsAttrAnimated($place + "." + $attr)) 3339 { 3340 return true; 3341 } 3342 } 3343 } 3344 } 3345 3346 return false; 3347} 3348 3349/****************************************************************************** 3350 does shape anim exist 3351******************************************************************************/ 3352proc int DoesShapeAnimExist(string $meshs[]) 3353{ 3354 if (!size(`ls -typ blendShape`)) // check blend shape exists in scene first 3355 { 3356 return false; 3357 } 3358 3359 for ($mesh in $meshs) 3360 { 3361 string $ins[] = `listConnections -s 1 -d 0 ($mesh + ".i")`; 3362 if (size($ins)) 3363 { 3364 string $hists[] = `listHistory $ins[0]`; 3365 string $bss[] = `ls -typ blendShape $hists`; 3366 for ($bs in $bss) 3367 { 3368 if (`getAttr ($bs + ".nds")` == 0) 3369 { 3370 return true; 3371 } 3372 } 3373 } 3374 } 3375 3376 return false; 3377} 3378 3379/****************************************************************************** 3380 get file node for attr 3381******************************************************************************/ 3382proc GetFileNodeForAttr(string $files[], string $plug) 3383{ 3384 string $ins[] = `listConnections -s 1 -d 0 $plug`; 3385 if (size($ins)) 3386 { 3387 string $hists[] = `listHistory $ins[0]`; 3388 string $fins[] = `ls -typ file $hists`; 3389 for ($file in $fins) 3390 { 3391 if (FindStringInArray($files, $file) == -1) 3392 { 3393 $files[size($files)] = $file; // append 3394 } 3395 } 3396 } 3397} 3398 3399/****************************************************************************** 3400 search anim 3401******************************************************************************/ 3402global proc nw4cExpDialog_SearchAnim() 3403{ 3404 //----------------------------------------------------------------------------- 3405 // get mode 3406 int $animRangeFlag = (`radioButtonGrp -q -sl nw4cExpDialog_ProcessMode` == 2); 3407 3408 int $selFlag = (`radioButtonGrp -q -sl nw4cExpDialog_ExportTarget` == 2); 3409 3410 //----------------------------------------------------------------------------- 3411 // begin wait cursor 3412 //waitCursor -st 1; 3413 3414 //----------------------------------------------------------------------------- 3415 // get target transform 3416 string $tarXforms[]; 3417 if (!$selFlag) // all 3418 { 3419 $tarXforms = `ls -l -typ transform`; 3420 } 3421 else if (!$animRangeFlag) // sel (below) 3422 { 3423 $tarXforms = `ls -l -sl -dag -typ transform`; 3424 } 3425 else // sel (tree) 3426 { 3427 GetAnimRangeTargetNodes($tarXforms); 3428 } 3429 3430 //----------------------------------------------------------------------------- 3431 // get effective transform 3432 string $xforms[]; 3433 string $noOutputs[]; 3434 for ($xform in $tarXforms) 3435 { 3436 if (!IsSceneAnimObject($xform)) 3437 { 3438 if (IsEffectiveNode($xform)) 3439 { 3440 $xforms[size($xforms)] = $xform; 3441 } 3442 else 3443 { 3444 $noOutputs[size($noOutputs)] = $xform; 3445 } 3446 } 3447 } 3448 RemoveNoOutputChild($xforms, $noOutputs); 3449 3450 //print "-- xforms --\n"; print $xforms; 3451 if (size($xforms) == 0) 3452 { 3453 if (!$selFlag) 3454 { 3455 warning "No effective node"; 3456 } 3457 else 3458 { 3459 warning "Effective node is not selected"; 3460 } 3461 } 3462 3463 //----------------------------------------------------------------------------- 3464 // get mesh 3465 string $meshs[]; 3466 for ($xform in $xforms) 3467 { 3468 string $shapes[] = `listRelatives -pa -ni -s $xform`; 3469 if (size($shapes) && nodeType($shapes[0]) == "mesh" && 3470 !`getAttr ($shapes[0] + ".template")`) 3471 { 3472 $meshs[size($meshs)] = $shapes[0]; 3473 } 3474 } 3475 3476 //----------------------------------------------------------------------------- 3477 // get material & file 3478 string $mats[]; 3479 string $files[]; 3480 for ($mesh in $meshs) 3481 { 3482 string $sgs[] = `listSets -t 1 -o $mesh`; 3483 for ($sg in $sgs) 3484 { 3485 string $ins[] = `listConnections -s 1 -d 0 -type lambert ($sg + ".ss")`; 3486 if (size($ins)) 3487 { 3488 string $mat = $ins[0]; 3489 if (FindStringInArray($mats, $mat) == -1) 3490 { 3491 $mats[size($mats)] = $mat; 3492 GetFileNodeForAttr($files, $mat + ".c"); 3493 GetFileNodeForAttr($files, $mat + ".n"); // for nrm map 3494 } 3495 } 3496 } 3497 } 3498 3499 //----------------------------------------------------------------------------- 3500 // search & check 3501 //checkBoxGrp -e -v1 (DoesCharaAnimExist($xforms)) nw4cExpDialog_CsklaFileOut; 3502 //checkBoxGrp -e -v1 (DoesVisAnimExist($xforms, $meshs)) nw4cExpDialog_CviaFileOut; 3503 //checkBoxGrp -e -v1 (DoesColorAnimExist($mats)) nw4cExpDialog_CclaFileOut; 3504 //checkBoxGrp -e -v1 (DoesTexPatAnimExist($files)) nw4cExpDialog_CtpaFileOut; 3505 //checkBoxGrp -e -v1 (DoesTexSrtAnimExist($files)) nw4cExpDialog_CtsaFileOut; 3506 //checkBoxGrp -e -v1 (DoesShapeAnimExist($meshs)) nw4cExpDialog_CshaFileOut; 3507 3508 //----------------------------------------------------------------------------- 3509 // update control 3510 nw4cExpDialog_AnimCB(); 3511 3512 //----------------------------------------------------------------------------- 3513 // end wait cursor 3514 //waitCursor -st 0; 3515} 3516 3517/****************************************************************************** 3518 open option window 3519 3520 return 1 if success, 0 otherwise 3521******************************************************************************/ 3522proc int OpenOptionWindow() 3523{ 3524 int $adjustSpace = 20; // Don't zero it ! 3525 int $useCustomUI = UseCustomUI(); 3526 int $use3DEditor = Use3DEditor(); 3527 int $useNonUniformScale = UseNonUniformScale(); 3528 int $afterMaya2011Adjust = 0; 3529 if (getApplicationVersionAsFloat() >= 2011) 3530 { 3531 $afterMaya2011Adjust = 1; 3532 // Maya 2011 �ȍ~�̓_�C�A���O�̍����ɗ]�T���Ȃ��Ȃ�̂ŁA 3533 // �]���� 10 �h�b�g�����Ă����B 3534 $adjustSpace += 10; 3535 } 3536 3537 //----------------------------------------------------------------------------- 3538 // init option variable 3539 SetOptionVariable(0); 3540 3541 //----------------------------------------------------------------------------- 3542 // get option box 3543 string $optionBox = getOptionBox(); 3544 if (size($optionBox) == 0) 3545 { 3546 return 0; 3547 } 3548 setParent $optionBox; 3549 3550 setOptionBoxTitle("NW4C Export Options"); 3551 3552 //----------------------------------------------------------------------------- 3553 // create control 3554 //----------------------------------------------------------------------------- 3555 3556 //----------------------------------------------------------------------------- 3557 // begin 3558 setUITemplate -pst DefaultTemplate; 3559 waitCursor -st 1; 3560 3561 //----------------------------------------------------------------------------- 3562 // create layout 3563 scrollLayout -childResizable 1 -minChildWidth 508 nw4cExpDialog_ScrollLayout; 3564 // horizontal scroll bar is appear if layout width < minChildWidth 3565 string $parent = `columnLayout -adj 1 -cat "both" 5 -co "both" 5 3566 nw4cExpDialog_MainColumn`; 3567 $parent = substitute(".*|", $parent, ""); // to short name 3568 setParent $parent; 3569 3570 //----------------------------------------------------------------------------- 3571 // output options 3572 frameLayout -l "Output Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; 3573 string $outForm = `formLayout -nd 100`; 3574 radioButtonGrp -l "Process Mode" -vis 1 -nrb 2 -cw 1 (103+$adjustSpace) -cw 2 95 3575 -la2 "Single" "Animation Range" -sl 1 3576 -cc "nw4cExpDialog_ProcessModeCB" 3577 nw4cExpDialog_ProcessMode; 3578 string $sep1 = `separator -vis 1 -st "in" -h 3`; 3579 3580 radioButtonGrp -l "Export Target" -nrb 2 -cw 1 (103+$adjustSpace) -cw 2 95 3581 -la2 "All" "Selection" -sl 1 3582 nw4cExpDialog_ExportTarget; 3583 3584 textFieldGrp -l "Output File Name" -cw2 (103+$adjustSpace) 160 3585 nw4cExpDialog_OutFileName; 3586 button -l "Scene" -w 50 3587 -c "textFieldGrp -e -tx `file -q -ns` nw4cExpDialog_OutFileName" 3588 nw4cExpDialog_SceneToOutFileName; 3589 button -l "Node" -w 50 -c "nw4cExpDialog_SetNodeNameToFileName" 3590 nw4cExpDialog_NodeToOutFileName; 3591 3592 //----------------------------------------------------------------------------- 3593 // out intermediate file 3594 string $sep2 = `separator -st "in" -h 3`; 3595 radioButtonGrp -l "" -nrb 1 -cw 1 (0+$adjustSpace) -cw 2 200 3596 -l1 "Output 3D Intermediate Files" -sl 1 3597 -cc "nw4cExpDialog_OutInterFileCB" 3598 nw4cExpDialog_OutInterFile; 3599 3600 textFieldGrp -l "Output Folder" -cw2 (104+$adjustSpace) 290 -adj 2 -rat 1 "both" 2 3601 nw4cExpDialog_OutFolder; 3602 symbolButton -i "navButtonBrowse.xpm" -w 25 -h 22 3603 -c "nw4cExpDialog_OutFolderBrowserCB" 3604 nw4cExpDialog_OutFolderBrowser; 3605 3606 //----------------------------------------------------------------------------- 3607 // use CreativeStudio 3608 radioButtonGrp -l "" -nrb 1 -cw 1 (0+$adjustSpace) -cw 2 200 3609 -l1 "Use CreativeStudio" 3610 -scl nw4cExpDialog_OutInterFile 3611 -cc "nw4cExpDialog_OutInterFileCB" 3612 nw4cExpDialog_UseCreativeStudio; 3613 3614 //----------------------------------------------------------------------------- 3615 // use 3DEditor 3616 if ($use3DEditor == 1) 3617 { 3618 radioButtonGrp -l "" -nrb 1 -cw 1 (0+$adjustSpace) -cw 2 200 3619 -l1 "Use 3DEditor" 3620 -scl nw4cExpDialog_OutInterFile 3621 -cc "nw4cExpDialog_OutInterFileCB" 3622 nw4cExpDialog_Use3DEditor; 3623 } 3624 3625 //----------------------------------------------------------------------------- 3626 // merge cmdl file 3627 string $sep3 = `separator -st "in" -h 3`; 3628 checkBoxGrp -l "" -ncb 1 -cw 1 (0+$adjustSpace) -cw 2 103 3629 -l1 "Merge cmdl File" -v1 0 3630 -cc "nw4cExpDialog_OutInterFileCB" 3631 nw4cExpDialog_MergeCmdlFlag; 3632 textField -w 290 3633 nw4cExpDialog_MergeCmdlPath; 3634 symbolButton -i "navButtonBrowse.xpm" -w 25 -h 22 3635 -c "nw4cExpDialog_MergeCmdlBrowserCB" 3636 nw4cExpDialog_MergeCmdlBrowser; 3637 checkBoxGrp -l "" -ncb 1 -cw 1 (0+$adjustSpace) -cw 2 123 3638 -l1 "Copy Related Files" -v1 0 3639 nw4cExpDialog_CopyRelatedFiles; 3640 3641 //checkBoxGrp -l "" -ncb 1 -cw 1 28 -cw 2 50 3642 // -l1 "Auto" -v1 1 3643 // nw4cExpDialog_MergeCmdlAuto; 3644 3645 if ($use3DEditor == 1) 3646 { 3647 formLayout -e 3648 -af nw4cExpDialog_ProcessMode "left" 0 3649 -af nw4cExpDialog_ProcessMode "top" 4 3650 -an nw4cExpDialog_ProcessMode "right" 3651 -an nw4cExpDialog_ProcessMode "bottom" 3652 -af $sep1 "left" 0 3653 -ac $sep1 "top" 4 nw4cExpDialog_ProcessMode 3654 -af $sep1 "right" 0 3655 -an $sep1 "bottom" 3656 3657 -af nw4cExpDialog_ExportTarget "left" 0 3658 -ac nw4cExpDialog_ExportTarget "top" 4 $sep1 3659 -an nw4cExpDialog_ExportTarget "right" 3660 -an nw4cExpDialog_ExportTarget "bottom" 3661 3662 -af nw4cExpDialog_OutFileName "left" 0 3663 -ac nw4cExpDialog_OutFileName "top" 4 nw4cExpDialog_ExportTarget 3664 -an nw4cExpDialog_OutFileName "right" 3665 -an nw4cExpDialog_OutFileName "bottom" 3666 -ac nw4cExpDialog_SceneToOutFileName "left" 5 nw4cExpDialog_OutFileName 3667 -ac nw4cExpDialog_SceneToOutFileName "top" 4 nw4cExpDialog_ExportTarget 3668 -an nw4cExpDialog_SceneToOutFileName "right" 3669 -an nw4cExpDialog_SceneToOutFileName "bottom" 3670 -ac nw4cExpDialog_NodeToOutFileName "left" 5 nw4cExpDialog_SceneToOutFileName 3671 -ac nw4cExpDialog_NodeToOutFileName "top" 4 nw4cExpDialog_ExportTarget 3672 -an nw4cExpDialog_NodeToOutFileName "right" 3673 -an nw4cExpDialog_NodeToOutFileName "bottom" 3674 -af $sep2 "left" 0 3675 -ac $sep2 "top" 4 nw4cExpDialog_OutFileName 3676 -af $sep2 "right" 0 3677 -an $sep2 "bottom" 3678 3679 -af nw4cExpDialog_OutInterFile "left" 0 3680 -ac nw4cExpDialog_OutInterFile "top" 4 $sep2 3681 -an nw4cExpDialog_OutInterFile "right" 3682 -an nw4cExpDialog_OutInterFile "bottom" 3683 3684 -af nw4cExpDialog_OutFolder "left" 0 3685 -ac nw4cExpDialog_OutFolder "top" 4 nw4cExpDialog_OutInterFile 3686 -ac nw4cExpDialog_OutFolder "right" 5 nw4cExpDialog_OutFolderBrowser 3687 -an nw4cExpDialog_OutFolder "bottom" 3688 -an nw4cExpDialog_OutFolderBrowser "left" 3689 -ac nw4cExpDialog_OutFolderBrowser "top" 4 nw4cExpDialog_OutInterFile 3690 -af nw4cExpDialog_OutFolderBrowser "right" 46 3691 -an nw4cExpDialog_OutFolderBrowser "bottom" 3692 3693 -af nw4cExpDialog_UseCreativeStudio "left" 0 3694 -ac nw4cExpDialog_UseCreativeStudio "top" 4 nw4cExpDialog_OutFolder 3695 -an nw4cExpDialog_UseCreativeStudio "right" 3696 -an nw4cExpDialog_UseCreativeStudio "bottom" 3697 3698 -af nw4cExpDialog_Use3DEditor "left" 0 3699 -ac nw4cExpDialog_Use3DEditor "top" 4 nw4cExpDialog_UseCreativeStudio 3700 -an nw4cExpDialog_Use3DEditor "right" 3701 -an nw4cExpDialog_Use3DEditor "bottom" 3702 3703 -af $sep3 "left" 0 3704 -ac $sep3 "top" 4 nw4cExpDialog_Use3DEditor 3705 -af $sep3 "right" 0 3706 -an $sep3 "bottom" 3707 3708 3709 -af nw4cExpDialog_MergeCmdlFlag "left" 0 3710 -ac nw4cExpDialog_MergeCmdlFlag "top" (4+3) $sep3 3711 -an nw4cExpDialog_MergeCmdlFlag "right" 3712 -an nw4cExpDialog_MergeCmdlFlag "bottom" 3713 -ac nw4cExpDialog_MergeCmdlPath "left" 2 nw4cExpDialog_MergeCmdlFlag 3714 -ac nw4cExpDialog_MergeCmdlPath "top" 4 $sep3 3715 -ac nw4cExpDialog_MergeCmdlPath "right" 5 nw4cExpDialog_MergeCmdlBrowser 3716 -an nw4cExpDialog_MergeCmdlPath "bottom" 3717 -an nw4cExpDialog_MergeCmdlBrowser "left" 3718 -ac nw4cExpDialog_MergeCmdlBrowser "top" 4 $sep3 3719 -af nw4cExpDialog_MergeCmdlBrowser "right" 46 3720 -an nw4cExpDialog_MergeCmdlBrowser "bottom" 3721 3722 -af nw4cExpDialog_CopyRelatedFiles "left" 0 3723 -ac nw4cExpDialog_CopyRelatedFiles "top" 4 nw4cExpDialog_MergeCmdlFlag 3724 -an nw4cExpDialog_CopyRelatedFiles "right" 3725 -an nw4cExpDialog_CopyRelatedFiles "bottom" 3726 3727 //-af nw4cExpDialog_MergeCmdlAuto "left" 0 3728 //-ac nw4cExpDialog_MergeCmdlAuto "top" 4 nw4cExpDialog_MergeCmdlPath 3729 //-an nw4cExpDialog_MergeCmdlAuto "right" 3730 //-af nw4cExpDialog_MergeCmdlAuto "bottom" 4 3731 $outForm; 3732 } 3733 else 3734 { 3735 formLayout -e 3736 -af nw4cExpDialog_ProcessMode "left" 0 3737 -af nw4cExpDialog_ProcessMode "top" 4 3738 -an nw4cExpDialog_ProcessMode "right" 3739 -an nw4cExpDialog_ProcessMode "bottom" 3740 -af $sep1 "left" 0 3741 -ac $sep1 "top" 4 nw4cExpDialog_ProcessMode 3742 -af $sep1 "right" 0 3743 -an $sep1 "bottom" 3744 3745 -af nw4cExpDialog_ExportTarget "left" 0 3746 -ac nw4cExpDialog_ExportTarget "top" 4 $sep1 3747 -an nw4cExpDialog_ExportTarget "right" 3748 -an nw4cExpDialog_ExportTarget "bottom" 3749 3750 -af nw4cExpDialog_OutFileName "left" 0 3751 -ac nw4cExpDialog_OutFileName "top" 4 nw4cExpDialog_ExportTarget 3752 -an nw4cExpDialog_OutFileName "right" 3753 -an nw4cExpDialog_OutFileName "bottom" 3754 -ac nw4cExpDialog_SceneToOutFileName "left" 5 nw4cExpDialog_OutFileName 3755 -ac nw4cExpDialog_SceneToOutFileName "top" 4 nw4cExpDialog_ExportTarget 3756 -an nw4cExpDialog_SceneToOutFileName "right" 3757 -an nw4cExpDialog_SceneToOutFileName "bottom" 3758 -ac nw4cExpDialog_NodeToOutFileName "left" 5 nw4cExpDialog_SceneToOutFileName 3759 -ac nw4cExpDialog_NodeToOutFileName "top" 4 nw4cExpDialog_ExportTarget 3760 -an nw4cExpDialog_NodeToOutFileName "right" 3761 -an nw4cExpDialog_NodeToOutFileName "bottom" 3762 -af $sep2 "left" 0 3763 -ac $sep2 "top" 4 nw4cExpDialog_OutFileName 3764 -af $sep2 "right" 0 3765 -an $sep2 "bottom" 3766 3767 -af nw4cExpDialog_OutInterFile "left" 0 3768 -ac nw4cExpDialog_OutInterFile "top" 4 $sep2 3769 -an nw4cExpDialog_OutInterFile "right" 3770 -an nw4cExpDialog_OutInterFile "bottom" 3771 3772 -af nw4cExpDialog_OutFolder "left" 0 3773 -ac nw4cExpDialog_OutFolder "top" 4 nw4cExpDialog_OutInterFile 3774 -ac nw4cExpDialog_OutFolder "right" 5 nw4cExpDialog_OutFolderBrowser 3775 -an nw4cExpDialog_OutFolder "bottom" 3776 -an nw4cExpDialog_OutFolderBrowser "left" 3777 -ac nw4cExpDialog_OutFolderBrowser "top" 4 nw4cExpDialog_OutInterFile 3778 -af nw4cExpDialog_OutFolderBrowser "right" 46 3779 -an nw4cExpDialog_OutFolderBrowser "bottom" 3780 3781 -af nw4cExpDialog_UseCreativeStudio "left" 0 3782 -ac nw4cExpDialog_UseCreativeStudio "top" 4 nw4cExpDialog_OutFolder 3783 -an nw4cExpDialog_UseCreativeStudio "right" 3784 -an nw4cExpDialog_UseCreativeStudio "bottom" 3785 -af $sep3 "left" 0 3786 -ac $sep3 "top" 4 nw4cExpDialog_UseCreativeStudio 3787 -af $sep3 "right" 0 3788 -an $sep3 "bottom" 3789 3790 -af nw4cExpDialog_MergeCmdlFlag "left" 0 3791 -ac nw4cExpDialog_MergeCmdlFlag "top" (4+3) $sep3 3792 -an nw4cExpDialog_MergeCmdlFlag "right" 3793 -an nw4cExpDialog_MergeCmdlFlag "bottom" 3794 -ac nw4cExpDialog_MergeCmdlPath "left" 2 nw4cExpDialog_MergeCmdlFlag 3795 -ac nw4cExpDialog_MergeCmdlPath "top" 4 $sep3 3796 -ac nw4cExpDialog_MergeCmdlPath "right" 5 nw4cExpDialog_MergeCmdlBrowser 3797 -an nw4cExpDialog_MergeCmdlPath "bottom" 3798 -an nw4cExpDialog_MergeCmdlBrowser "left" 3799 -ac nw4cExpDialog_MergeCmdlBrowser "top" 4 $sep3 3800 -af nw4cExpDialog_MergeCmdlBrowser "right" 46 3801 -an nw4cExpDialog_MergeCmdlBrowser "bottom" 3802 3803 -af nw4cExpDialog_CopyRelatedFiles "left" 0 3804 -ac nw4cExpDialog_CopyRelatedFiles "top" 4 nw4cExpDialog_MergeCmdlFlag 3805 -an nw4cExpDialog_CopyRelatedFiles "right" 3806 -an nw4cExpDialog_CopyRelatedFiles "bottom" 3807 3808 //-af nw4cExpDialog_MergeCmdlAuto "left" 0 3809 //-ac nw4cExpDialog_MergeCmdlAuto "top" 4 nw4cExpDialog_MergeCmdlPath 3810 //-an nw4cExpDialog_MergeCmdlAuto "right" 3811 //-af nw4cExpDialog_MergeCmdlAuto "bottom" 4 3812 $outForm; 3813 } 3814 setParent ..; // formLayout 3815 setParent ..; // frameLayout 3816 3817 // general option �ȍ~�͂���ɗ]���� 20 �h�b�g�lj����� 3818 $adjustSpace += 20; 3819 3820 //----------------------------------------------------------------------------- 3821 // general 3822 frameLayout -l "General Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; 3823 columnLayout -adj 1 -rs 4; 3824 rowColumnLayout -nc 2 -cw 1 (215 + $adjustSpace) -cw 2 190; 3825 floatFieldGrp -l "Magnify" -nf 1 -cw 1 (140 + $adjustSpace) -cw 2 60 3826 -v1 1.0 -pre 4 3827 -cc "nw4cExpDialog_MagnifyCB" 3828 nw4cExpDialog_Magnify; 3829 text -l ""; // dummy 3830 //optionMenuGrp -l "Texture Matrix" -cw 1 120 -rat 1 "both" 4 3831 // nw4cExpDialog_TexMatrixMode; 3832 // menuItem -l "Maya"; 3833 // menuItem -l "3dsmax"; 3834 setParent ..; // rowColumnLayout 3835 rowColumnLayout -nc 4 -cw 1 (325 + $adjustSpace + $afterMaya2011Adjust * 25) -cw 2 50 -cw 3 5 -cw 4 50; 3836 radioButtonGrp -l "Start / End Frame" -nrb 3 3837 -cw4 (140 + $adjustSpace + $afterMaya2011Adjust * 25) 50 80 65 3838 -rat 2 "both" 0 3839 -rat 3 "both" 0 3840 -rat 4 "both" 0 3841 -la3 "All" "Playback" "Range" -sl 1 3842 -cc "nw4cExpDialog_FrameRangeCB" 3843 nw4cExpDialog_FrameRange; 3844 intField -v 1 3845 -cc "nw4cExpDialog_FrameStartEndCB" 3846 nw4cExpDialog_StartFrame; 3847 text -l ""; // dummy 3848 intField -v 100 3849 -cc "nw4cExpDialog_FrameStartEndCB" 3850 nw4cExpDialog_EndFrame; 3851 setParent ..; // rowColumnLayout 3852 checkBoxGrp -l "" -ncb 1 -cw 1 (140+$adjustSpace) -cw 2 120 3853 -l1 "Remove Namespace" -v1 0 3854 nw4cExpDialog_RemoveNamespace; 3855 setParent ..; // columnLayout 3856 setParent ..; // frameLayout 3857 3858 //----------------------------------------------------------------------------- 3859 // file selection 3860 frameLayout -l "Output File Selection" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; 3861 string $form = `formLayout`; 3862 checkBoxGrp -l "Model Data" -ncb 1 -l1 "[.cmdl]" -v1 1 3863 -cw 1 140 -cw 2 60 3864 -cc1 "nw4cExpDialog_ModelCB" nw4cExpDialog_CmdlFileOut; 3865 checkBoxGrp -l "Texture Data" -ncb 1 -l1 "[.ctex]" -v1 1 3866 -cw 1 140 -cw 2 60 3867 nw4cExpDialog_CtexFileOut; 3868 checkBoxGrp -l "Model Animation Data" -ncb 1 -l1 "[.cmdla]" -v1 0 3869 -cw 1 140 -cw 2 60 3870 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CmdlaFileOut; 3871 checkBoxGrp -l "Skeletal Animation Data" -ncb 1 -l1 "[.cskla]" -v1 0 3872 -cw 1 140 -cw 2 60 3873 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CsklaFileOut; 3874 checkBoxGrp -l "Material Animation Data" -ncb 1 -l1 "[.cmata]" -v1 0 3875 -cw 1 (140) -cw 2 60 3876 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CmataFileOut; 3877 // �J�X�^�� UI ���g�p����ꍇ�̓}�e���A���A�j���[�V������v�f�i�J���[�A 3878 // �e�N�X�`���p�^�[���A�e�N�X�`��SRT�j���ɏo�͐ݒ���s���B 3879 checkBoxGrp -l "Material Color Animation Data" -ncb 1 3880 -l1 (($useCustomUI == 1) ? "[.cmata]" : "[.cmcla]") 3881 -v1 0 -cw 1 (170 + $afterMaya2011Adjust * 20) -cw 2 60 3882 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CmclaFileOut; 3883 checkBoxGrp -l "Texture Pattern Animation Data" -ncb 1 3884 -l1 (($useCustomUI == 1) ? "[.cmata]" : "[.cmtpa]") 3885 -v1 0 -cw 1 (170 + $afterMaya2011Adjust * 20) -cw 2 60 3886 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CmtpaFileOut; 3887 checkBoxGrp -l "Texture SRT Animation Data" -ncb 1 3888 -l1 (($useCustomUI == 1) ? "[.cmata]" : "[.cmtsa]") 3889 -v1 0 -cw 1 (170 + $afterMaya2011Adjust * 20) -cw 2 60 3890 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CmtsaFileOut; 3891 checkBoxGrp -l "Camera Data" -ncb 1 -l1 "[.ccam]" -v1 0 3892 -cw 1 140 -cw 2 60 3893 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_CcamFileOut; 3894 checkBoxGrp -l "Light Data" -ncb 1 -l1 "[.clgt]" -v1 0 3895 -cw 1 140 -cw 2 60 3896 -cc "nw4cExpDialog_AnimCB" nw4cExpDialog_ClgtFileOut; 3897 checkBoxGrp -l "Environment Data" -ncb 1 -l1 "[.cenv]" -v1 0 3898 -cw 1 (140) -cw 2 60 3899 -cc "nw4cExpDialog_ProcessModeCB" nw4cExpDialog_CenvFileOut; 3900 button -l "Search Animation" -w 104 3901 -c "nw4cExpDialog_SearchAnim" 3902 nw4cExpDialog_SearchAnimBtn; 3903 setParent ..; // formLayout 3904 3905 formLayout -e 3906 -af nw4cExpDialog_CmdlFileOut "left" $adjustSpace 3907 -af nw4cExpDialog_CmdlFileOut "top" 4 3908 -an nw4cExpDialog_CmdlFileOut "right" 3909 -an nw4cExpDialog_CmdlFileOut "bottom" 3910 3911 -af nw4cExpDialog_CtexFileOut "left" $adjustSpace 3912 -ac nw4cExpDialog_CtexFileOut "top" 4 nw4cExpDialog_CmdlFileOut 3913 -an nw4cExpDialog_CtexFileOut "right" 3914 -an nw4cExpDialog_CtexFileOut "bottom" 3915 3916 -af nw4cExpDialog_CmdlaFileOut "left" $adjustSpace 3917 -ac nw4cExpDialog_CmdlaFileOut "top" 4 nw4cExpDialog_CtexFileOut 3918 -an nw4cExpDialog_CmdlaFileOut "right" 3919 -an nw4cExpDialog_CmdlaFileOut "bottom" 3920 3921 -af nw4cExpDialog_CsklaFileOut "left" $adjustSpace 3922 -ac nw4cExpDialog_CsklaFileOut "top" 4 nw4cExpDialog_CmdlaFileOut 3923 -an nw4cExpDialog_CsklaFileOut "right" 3924 -an nw4cExpDialog_CsklaFileOut "bottom" 3925 3926 -af nw4cExpDialog_CcamFileOut "left" $adjustSpace 3927 -ac nw4cExpDialog_CcamFileOut "top" 4 nw4cExpDialog_CsklaFileOut 3928 -an nw4cExpDialog_CcamFileOut "right" 3929 -an nw4cExpDialog_CcamFileOut "bottom" 3930 3931 -af nw4cExpDialog_ClgtFileOut "left" $adjustSpace 3932 -ac nw4cExpDialog_ClgtFileOut "top" 4 nw4cExpDialog_CcamFileOut 3933 -an nw4cExpDialog_ClgtFileOut "right" 3934 -an nw4cExpDialog_ClgtFileOut "bottom" 3935 3936 -af nw4cExpDialog_CmataFileOut "left" (270 + $adjustSpace + $afterMaya2011Adjust * 20) 3937 -af nw4cExpDialog_CmataFileOut "top" 4 3938 -an nw4cExpDialog_CmataFileOut "right" 3939 -an nw4cExpDialog_CmataFileOut "bottom" 3940 3941 -af nw4cExpDialog_CmclaFileOut "left" (240 + $adjustSpace + $afterMaya2011Adjust * 0) 3942 -ac nw4cExpDialog_CmclaFileOut "top" 4 nw4cExpDialog_CmataFileOut 3943 -an nw4cExpDialog_CmclaFileOut "right" 3944 -an nw4cExpDialog_CmclaFileOut "bottom" 3945 3946 -af nw4cExpDialog_CmtpaFileOut "left" (240 + $adjustSpace + $afterMaya2011Adjust * 0) 3947 -ac nw4cExpDialog_CmtpaFileOut "top" 4 nw4cExpDialog_CmclaFileOut 3948 -an nw4cExpDialog_CmtpaFileOut "right" 3949 -an nw4cExpDialog_CmtpaFileOut "bottom" 3950 3951 -af nw4cExpDialog_CmtsaFileOut "left" (240 + $adjustSpace + $afterMaya2011Adjust * 0) 3952 -ac nw4cExpDialog_CmtsaFileOut "top" 4 nw4cExpDialog_CmtpaFileOut 3953 -an nw4cExpDialog_CmtsaFileOut "right" 3954 -an nw4cExpDialog_CmtsaFileOut "bottom" 3955 3956 -af nw4cExpDialog_CenvFileOut "left" (270 + $adjustSpace + $afterMaya2011Adjust * 20) 3957 -ac nw4cExpDialog_CenvFileOut "top" 4 nw4cExpDialog_CmtsaFileOut 3958 -an nw4cExpDialog_CenvFileOut "right" 3959 -an nw4cExpDialog_CenvFileOut "bottom" 3960 3961 -ac nw4cExpDialog_SearchAnimBtn "left" 32 nw4cExpDialog_CenvFileOut 3962 -af nw4cExpDialog_SearchAnimBtn "top" 4 3963 -an nw4cExpDialog_SearchAnimBtn "right" 3964 -an nw4cExpDialog_SearchAnimBtn "bottom" 3965 $form; 3966 setParent ..; // frameLayout 3967 control -e -vis 0 nw4cExpDialog_SearchAnimBtn; // (debug) 3968 3969 //----------------------------------------------------------------------------- 3970 // optimization 3971 frameLayout -l "Optimization Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; 3972 columnLayout -adj 1 -rs 4; 3973 3974 optionMenuGrp -l "Compress Node" -cw 1 120 3975 -rat 1 "both" 4 -cw 1 (140 + $adjustSpace) -cw 2 150 3976 nw4cExpDialog_CompressNode; 3977 menuItem -l "None"; 3978 menuItem -l "Cull Useless Node"; 3979 menuItem -l "Cull Uninfluential Node"; 3980 menuItem -l "Unite Compressible Node"; 3981 menuItem -l "Unite All Node"; 3982 //menuItem -l "Merge Useless Node"; 3983 3984 optionMenuGrp -l "Compress Material" -cw 1 110 3985 -rat 1 "both" 4 -cw 1 (140 + $adjustSpace) -cw 2 150 3986 nw4cExpDialog_CompressMaterial; 3987 menuItem -l "None"; 3988 menuItem -l "Compress Same Material"; 3989 //checkBox -l "Combine Polygon" -v 0 3990 // nw4cExpDialog_CombinePolygon; 3991 rowColumnLayout -nc 2 -cw 1 (250 + $adjustSpace + $afterMaya2011Adjust * 30) -cw 2 300; 3992 checkBoxGrp -l "" -ncb 1 -cw 1 (140 + $adjustSpace) -cw 2 120 3993 -l1 "Optimize Primitive" -v1 1 3994 nw4cExpDialog_OptimizePrimitive; 3995 3996 checkBoxGrp -l "" -ncb 1 -cw 1 (34 - $afterMaya2011Adjust * 20) -cw 2 220 3997 -l1 "Convert To Model" -v1 0 3998 -cc "nw4cExpDialog_ConvertToModelCB" 3999 nw4cExpDialog_ConvertToModel; 4000 setParent ..; // rowColumnLayout 4001 4002 //checkBoxGrp -l "" -ncb 1 -cw 1 100 -cw 2 160 4003 // -l1 "Delete Useless Vertex Data" -v1 0 4004 // nw4cExpDialog_DelUselessVtxData; 4005 4006 setParent ..; // columnLayout 4007 setParent ..; // frameLayout 4008 4009 //----------------------------------------------------------------------------- 4010 // quantization 4011 frameLayout -l "Quantization Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; 4012 columnLayout -adj 1 -rs 4; 4013 rowColumnLayout -nc 3 -cw 1 (200+$adjustSpace + $afterMaya2011Adjust * 10) 4014 -cw 2 (144 + $afterMaya2011Adjust * 10) -cw 3 (144 + $afterMaya2011Adjust * 10); 4015 optionMenuGrp -l "Position" -cw 1 (140 + $adjustSpace) 4016 nw4cExpDialog_QuantPos; 4017 menuItem -l "Float"; 4018 menuItem -l "Short"; 4019 menuItem -l "Byte"; 4020 optionMenuGrp -l "Normal" -cw 1 70 4021 nw4cExpDialog_QuantNrm; 4022 menuItem -l "Float"; 4023 menuItem -l "Short"; 4024 menuItem -l "Byte"; 4025 optionMenuGrp -l "Tex Coord" -cw 1 70 4026 nw4cExpDialog_QuantTex; 4027 menuItem -l "Float"; 4028 menuItem -l "Short"; 4029 menuItem -l "Byte"; 4030 setParent ..; // rowColumnLayout 4031 setParent ..; // columnLayout 4032 setParent ..; // frameLayout 4033 4034 //----------------------------------------------------------------------------- 4035 // model 4036 frameLayout -l "Model Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; 4037 columnLayout -adj 1 -rs 4; 4038 rowColumnLayout -nc 2 -cw 1 (254 + $adjustSpace + $afterMaya2011Adjust * 25) -cw 2 270; 4039 optionMenuGrp -l "Adjust Skinning" -cw 1 (140 + $adjustSpace) 4040 -rat 1 "both" 4 4041 nw4cExpDialog_AdjustSkinning; 4042 menuItem -l "None If Possible"; 4043 menuItem -l "Rigid Skinning"; 4044 4045 optionMenuGrp -l "Mesh Visibility Mode" -cw 1 120 4046 -rat 1 "both" 4 4047 nw4cExpDialog_MeshVisibilityMode; 4048 menuItem -l "Bind By Index"; 4049 menuItem -l "Bind By Name"; 4050 setParent ..; // rowColumnLayout 4051 4052 if ($useNonUniformScale) 4053 { 4054 rowColumnLayout -nc 2 -cw 1 (257 + $adjustSpace + $afterMaya2011Adjust * 29) -cw 2 240; 4055 4056 checkBoxGrp -l "" -ncb 1 -cw 1 (140 + $adjustSpace) 4057 -l1 "Non-Uniform Scale" -v1 0 4058 nw4cExpDialog_NonUniformScale; 4059 4060 intFieldGrp -nf 1 -l "Max Reserved Uniform Registers" -cw2 180 45 4061 -v1 0 -cc "nw4cExpDialog_MaxReservedUniformRegistersCB" 4062 nw4cExpDialog_MaxReservedUniformRegisters; 4063 4064 setParent ..; // rowColumnLayout 4065 } 4066 else 4067 { 4068 intFieldGrp -nf 1 -l "Max Reserved Uniform Registers" -cw2 (140 + $adjustSpace) 45 4069 -v1 0 -cc "nw4cExpDialog_MaxReservedUniformRegistersCB" 4070 nw4cExpDialog_MaxReservedUniformRegisters; 4071 } 4072 4073 setParent ..; // columnLayout 4074 setParent ..; // frameLayout 4075 4076 //----------------------------------------------------------------------------- 4077 // anim 4078 frameLayout -l "Animation Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; 4079 columnLayout -adj 1 -rs 4; 4080 rowColumnLayout -nc 3 -cw 1 (255+$adjustSpace + $afterMaya2011Adjust * 21) -cw 2 155 -cw 3 100; 4081 checkBoxGrp -l "" -ncb 1 -cw 1 (140+$adjustSpace) 4082 -l1 "Bake All Animation" -v1 1 4083 nw4cExpDialog_BakeAll; 4084 optionMenuGrp -l "Frame Precision" -cw 1 100 4085 nw4cExpDialog_FramePrecision; 4086 menuItem -l "1.0"; 4087 menuItem -l "0.5"; 4088 menuItem -l "0.2"; 4089 menuItem -l "0.1"; 4090 checkBoxGrp -l "" -ncb 1 -cw 1 20 -cw 2 100 4091 -l1 "Loop" -v1 0 4092 nw4cExpDialog_LoopAnim; 4093 setParent ..; // rowColumnLayout 4094 rowColumnLayout -nc 2 -cw 1 (235+$adjustSpace) -cw 2 200; 4095 optionMenuGrp -l "Frame Format" -cw 1 (140 + $adjustSpace) 4096 -rat 1 "both" 4 4097 -cc "nw4cExpDialog_AnimCB" 4098 nw4cExpDialog_FrameFormat; 4099 menuItem -l "Key Frame"; 4100 menuItem -l "Full Frame"; 4101 text -l ""; // dummy 4102 setParent ..; // rowColumnLayout 4103 4104 intSliderGrp -l "Scale Quantize Quality" 4105 -cw 1 (140+$adjustSpace) -cw 2 45 -cw 3 300 4106 -min 0 -max 9 -v 9 -adj 0 4107 nw4cExpDialog_ScaleQuantizeQuality; 4108 4109 intSliderGrp -l "Rotate Quantize Quality" 4110 -cw 1 (140+$adjustSpace) -cw 2 45 -cw 3 300 4111 -min 0 -max 9 -v 9 -adj 0 4112 nw4cExpDialog_RotateQuantizeQuality; 4113 4114 intSliderGrp -l "Translate Quantize Quality" 4115 -cw 1 (140+$adjustSpace) -cw 2 45 -cw 3 300 4116 -min 0 -max 9 -v 9 -adj 0 4117 nw4cExpDialog_TranslateQuantizeQuality; 4118 4119 setParent ..; // columnLayout 4120 setParent ..; // frameLayout 4121 4122 //----------------------------------------------------------------------------- 4123 // tolerance 4124 frameLayout -l "Tolerance Options" -cll 1 -cl 0 -bv 1 -bs "etchedIn"; 4125 columnLayout -adj 1 -rs 4; 4126 string $form = `formLayout -h 75`; 4127 // create control in tab order 4128 floatFieldGrp -nf 1 -l "Node Translate" -cw2 140 45 4129 -pre 4 -v1 0.01 4130 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolT\"" 4131 nw4cExpDialog_TolT; 4132 floatFieldGrp -nf 1 -l "Node Rotate" -cw2 140 45 4133 -pre 4 -v1 0.1 4134 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolR\"" 4135 nw4cExpDialog_TolR; 4136 floatFieldGrp -nf 1 -l "Node Scale" -cw2 140 45 4137 -pre 4 -v1 0.1 4138 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolS\"" 4139 nw4cExpDialog_TolS; 4140 4141 floatFieldGrp -nf 1 -l "Texture Translate" -cw2 100 45 4142 -pre 4 -v1 0.01 4143 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolTexT\"" 4144 nw4cExpDialog_TolTexT; 4145 floatFieldGrp -nf 1 -l "Texture Rotate" -cw2 100 45 4146 -pre 4 -v1 0.1 4147 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolTexR\"" 4148 nw4cExpDialog_TolTexR; 4149 floatFieldGrp -nf 1 -l "Texture Scale" -cw2 100 45 4150 -pre 4 -v1 0.1 4151 -cc "nw4cExpDialog_ToleranceSRTCB \"nw4cExpDialog_TolTexS\"" 4152 nw4cExpDialog_TolTexS; 4153 4154 floatFieldGrp -nf 1 -l "Color" -cw2 60 45 4155 -pre 4 -v1 0.001 4156 -cc "nw4cExpDialog_ToleranceColorCB \"nw4cExpDialog_TolC\"" 4157 nw4cExpDialog_TolC; 4158 setParent ..; // formLayout 4159 // layout control 4160 formLayout -e -w 440 4161 -af nw4cExpDialog_TolT "left" (0 + $adjustSpace) 4162 -af nw4cExpDialog_TolT "top" 0 4163 -an nw4cExpDialog_TolT "right" 4164 -an nw4cExpDialog_TolT "bottom" 4165 4166 -af nw4cExpDialog_TolR "left" (0 + $adjustSpace) 4167 -af nw4cExpDialog_TolR "top" 25 4168 -an nw4cExpDialog_TolR "right" 4169 -an nw4cExpDialog_TolR "bottom" 4170 4171 -af nw4cExpDialog_TolS "left" (0 + $adjustSpace) 4172 -af nw4cExpDialog_TolS "top" 50 4173 -an nw4cExpDialog_TolS "right" 4174 -an nw4cExpDialog_TolS "bottom" 4175 4176 -af nw4cExpDialog_TolTexT "left" (210 + $adjustSpace) 4177 -af nw4cExpDialog_TolTexT "top" 0 4178 -an nw4cExpDialog_TolTexT "right" 4179 -an nw4cExpDialog_TolTexT "bottom" 4180 4181 -af nw4cExpDialog_TolTexR "left" (210 + $adjustSpace) 4182 -af nw4cExpDialog_TolTexR "top" 25 4183 -an nw4cExpDialog_TolTexR "right" 4184 -an nw4cExpDialog_TolTexR "bottom" 4185 4186 -af nw4cExpDialog_TolTexS "left" (210 + $adjustSpace) 4187 -af nw4cExpDialog_TolTexS "top" 50 4188 -an nw4cExpDialog_TolTexS "right" 4189 -an nw4cExpDialog_TolTexS "bottom" 4190 4191 -af nw4cExpDialog_TolC "left" (370 + $adjustSpace) 4192 -af nw4cExpDialog_TolC "top" 0 4193 -an nw4cExpDialog_TolC "right" 4194 -an nw4cExpDialog_TolC "bottom" 4195 $form; 4196 setParent ..; // columnLayout 4197 setParent ..; // frameLayout 4198 4199 //----------------------------------------------------------------------------- 4200 // close layout 4201 setParent ..; // columnLayout 4202 setParent ..; // scrollLayout 4203 4204 //----------------------------------------------------------------------------- 4205 // setting menu 4206 CreateSettingMenu($parent); 4207 4208 //----------------------------------------------------------------------------- 4209 // end 4210 waitCursor -st 0; 4211 setUITemplate -ppt; 4212 4213 //----------------------------------------------------------------------------- 4214 // set help tag to save window size 4215 setOptionBoxHelpTag("nw4cExpDialog"); 4216 4217 //----------------------------------------------------------------------------- 4218 // set button & menu command 4219 string $applyBtn = getOptionBoxApplyBtn(); 4220 button -e -l "Export" -c "nw4cExpDialog_ExportCB" $applyBtn; 4221 4222 string $saveBtn = getOptionBoxSaveBtn(); 4223 button -e -c "nw4cExpDialog_SaveSettingsCB" $saveBtn; 4224 4225 string $resetBtn = getOptionBoxResetBtn(); 4226 button -e -c "nw4cExpDialog_ResetOptionVariable" $resetBtn; 4227 4228 string $helpMenu = getOptionBoxHelpItem(); 4229 menuItem -e -l "Help on NW4C Export..." 4230 -c "NW4C_ShowHelp \"html/export.html\" \"\"" $helpMenu; 4231 4232 //----------------------------------------------------------------------------- 4233 // set option cotrol 4234 SetOptionControl(); 4235 4236 //----------------------------------------------------------------------------- 4237 // show option box 4238 setFocus(getOptionBoxApplyAndCloseBtn()); 4239 showOptionBox(); 4240 4241 return 1; 4242} 4243 4244/****************************************************************************** 4245 main 4246******************************************************************************/ 4247global proc NW4C_ExpDialog() 4248{ 4249 //----------------------------------------------------------------------------- 4250 // load plugin 4251 LoadPlugin(); 4252 4253 //----------------------------------------------------------------------------- 4254 // open option window 4255 OpenOptionWindow(); 4256} 4257 4258/****************************************************************************** 4259 export direct 4260******************************************************************************/ 4261global proc NW4C_ExpDirect() 4262{ 4263 //----------------------------------------------------------------------------- 4264 // load plugin 4265 LoadPlugin(); 4266 4267 //----------------------------------------------------------------------------- 4268 // init option variable 4269 SetOptionVariable(0); 4270 4271 //----------------------------------------------------------------------------- 4272 // export 4273 DoExportCmd(0); 4274} 4275 4276/****************************************************************************** 4277 export direct force (no overwrite check) 4278******************************************************************************/ 4279global proc NW4C_ExpDirectForce() 4280{ 4281 //----------------------------------------------------------------------------- 4282 // load plugin 4283 LoadPlugin(); 4284 4285 //----------------------------------------------------------------------------- 4286 // init option variable 4287 SetOptionVariable(0); 4288 4289 //----------------------------------------------------------------------------- 4290 // export 4291 DoExportCmd(1); 4292} 4293