1/****************************************************************************** 2 NintendoWare for CTR Maya Plugin 3 4 File: NW4C_SetMaterialAttr.mel 5 Description: set material attribute 6 Date: 2010/02/12 7 8 Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. 9******************************************************************************/ 10 11// UpdateWindow DoSearch 12// FaceCulling FragLighting VtxLighting NoCompress 13 14/****************************************************************************** 15 get selected SG 16 17 return SG size 18******************************************************************************/ 19proc int GetSelectedSG(string $sgs[]) 20{ 21 $sgs = `ls -sl -typ shadingEngine`; 22 if (size($sgs) == 0) 23 { 24 // get SG from selected material 25 string $mats[] = `ls -sl -mat`; 26 for ($mat in $mats) 27 { 28 if (!`attributeQuery -n $mat -ex "oc"`) 29 { 30 continue; 31 } 32 string $connectedSgs[] = 33 `listConnections -s 0 -d 1 -type shadingEngine ($mat + ".oc")`; 34 for ($sg in $connectedSgs) 35 { 36 if ($sg != "initialParticleSE" && 37 $sg != "swatchShadingGroup") 38 { 39 $sgs[size($sgs)] = $sg; 40 } 41 } 42 } 43 } 44 return size($sgs); 45} 46 47/****************************************************************************** 48 Face Culling 49******************************************************************************/ 50proc int ConvertFaceCulling_ToGUI(int $val) 51{ 52 // �A�g���r���[�g�l���� GUI �̃C���f�b�N�X�ɕϊ����� 53 // Attr GUI 54 // Front Face 0 ���� 1 55 // Back Face 1 ���� 0 56 // Always 2 ���� 3 57 // Never 3 ���� 2 58 int $faceExchangTable[4] = { 1, 0, 3, 2 }; 59 return $faceExchangTable[$val]; 60} 61 62proc int ConvertFaceCulling_ToAttr(int $val) 63{ 64 // GUI �̃C���f�b�N�X����A�g���r���[�g�l�ɕϊ����� 65 // GUI Attr 66 // Back Face 0 ���� 1 67 // Front Face 1 ���� 0 68 // Never 2 ���� 3 69 // Always 3 ���� 2 70 int $faceExchangTable[4] = { 1, 0, 3, 2 }; 71 return $faceExchangTable[$val]; 72} 73 74global proc int nw4cSetMaterialAttr_Get_FaceCulling(string $node) 75{ 76 return (`attributeQuery -n $node -ex "nw4cFaceCulling"`) ? 77 `getAttr ($node + ".nw4cFaceCulling")` : 1; 78} 79 80global proc nw4cSetMaterialAttr_Add_FaceCulling(string $node) 81{ 82 if (!`attributeQuery -n $node -ex "nw4cFaceCulling"`) 83 { 84 addAttr -ln "nw4cFaceCulling" -at "enum" 85 -en "Front Face=0:Back Face=1:Always=2:Never=3" -dv 1 -h 1 $node; 86 } 87} 88 89global proc nw4cSetMaterialAttr_Set_FaceCulling(string $node, int $val) 90{ 91 nw4cSetMaterialAttr_Add_FaceCulling($node); 92 setAttr ($node + ".nw4cFaceCulling") $val; 93} 94 95proc SetJob_FaceCulling(string $node) 96{ 97 if (!`attributeQuery -n $node -ex "nw4cFaceCulling"`) 98 { 99 return; 100 } 101 scriptJob -p nw4cSetMaterialAttr_FaceCulling -rp -ac ($node + ".nw4cFaceCulling") 102 ("optionMenuGrp -e -sl (ConvertFaceCulling_ToGUI(`nw4cSetMaterialAttr_Get_FaceCulling " 103 + $node + "` + 1)) nw4cSetMaterialAttr_FaceCulling"); 104} 105 106global proc nw4cSetMaterialAttr_FaceCullingCB(string $mainNode) 107{ 108 string $sgs[]; 109 GetSelectedSG($sgs); 110 111 int $val = `optionMenuGrp -q -sl nw4cSetMaterialAttr_FaceCulling` - 1; 112 for ($node in $sgs) 113 { 114 nw4cSetMaterialAttr_Set_FaceCulling($node, ConvertFaceCulling_ToAttr($val)); 115 } 116 117 SetJob_FaceCulling($mainNode); 118} 119 120/****************************************************************************** 121 fragment lighting 122******************************************************************************/ 123global proc int nw4cSetMaterialAttr_Get_FragLighting(string $node) 124{ 125 return (`attributeQuery -n $node -ex "nw4cFragLighting"`) ? 126 `getAttr ($node + ".nw4cFragLighting")` : 1; 127} 128 129global proc nw4cSetMaterialAttr_Add_FragLighting(string $node) 130{ 131 if (!`attributeQuery -n $node -ex "nw4cFragLighting"`) 132 { 133 addAttr -ln "nw4cFragLighting" -at "bool" -dv 1 -h 1 $node; 134 } 135} 136 137global proc nw4cSetMaterialAttr_Set_FragLighting(string $node, int $val) 138{ 139 nw4cSetMaterialAttr_Add_FragLighting($node); 140 setAttr ($node + ".nw4cFragLighting") $val; 141} 142 143proc SetJob_FragLighting(string $node) 144{ 145 if (!`attributeQuery -n $node -ex "nw4cFragLighting"`) 146 { 147 return; 148 } 149 scriptJob -p nw4cSetMaterialAttr_FragLighting -rp -ac ($node + ".nw4cFragLighting") 150 ("checkBoxGrp -e -v1 `nw4cSetMaterialAttr_Get_FragLighting " 151 + $node + "` nw4cSetMaterialAttr_FragLighting"); 152} 153 154global proc nw4cSetMaterialAttr_FragLightingCB(string $mainNode, int $val) 155{ 156 string $sgs[]; 157 GetSelectedSG($sgs); 158 159 for ($node in $sgs) 160 { 161 nw4cSetMaterialAttr_Set_FragLighting($node, $val); 162 } 163 164 SetJob_FragLighting($mainNode); 165} 166 167/****************************************************************************** 168 vertex lighting 169******************************************************************************/ 170global proc int nw4cSetMaterialAttr_Get_VtxLighting(string $node) 171{ 172 return (`attributeQuery -n $node -ex "nw4cVtxLighting"`) ? 173 `getAttr ($node + ".nw4cVtxLighting")` : 0; 174} 175 176global proc nw4cSetMaterialAttr_Add_VtxLighting(string $node) 177{ 178 if (!`attributeQuery -n $node -ex "nw4cVtxLighting"`) 179 { 180 addAttr -ln "nw4cVtxLighting" -at "bool" -dv 0 -h 1 $node; 181 } 182} 183 184global proc nw4cSetMaterialAttr_Set_VtxLighting(string $node, int $val) 185{ 186 nw4cSetMaterialAttr_Add_VtxLighting($node); 187 setAttr ($node + ".nw4cVtxLighting") $val; 188} 189 190proc SetJob_VtxLighting(string $node) 191{ 192 if (!`attributeQuery -n $node -ex "nw4cVtxLighting"`) 193 { 194 return; 195 } 196 scriptJob -p nw4cSetMaterialAttr_VtxLighting -rp -ac ($node + ".nw4cVtxLighting") 197 ("checkBoxGrp -e -v1 `nw4cSetMaterialAttr_Get_VtxLighting " 198 + $node + "` nw4cSetMaterialAttr_VtxLighting"); 199} 200 201global proc nw4cSetMaterialAttr_VtxLightingCB(string $mainNode, int $val) 202{ 203 string $sgs[]; 204 GetSelectedSG($sgs); 205 206 for ($node in $sgs) 207 { 208 nw4cSetMaterialAttr_Set_VtxLighting($node, $val); 209 } 210 211 SetJob_VtxLighting($mainNode); 212} 213 214/****************************************************************************** 215 Blend Mode 216******************************************************************************/ 217 218global proc int nw4cSetMaterialAttr_Get_BlendMode(string $node) 219{ 220 return (`attributeQuery -n $node -ex "nw4cBlendMode"`) ? 221 `getAttr ($node + ".nw4cBlendMode")` : 0; 222} 223 224global proc nw4cSetMaterialAttr_Add_BlendMode(string $node) 225{ 226 if (!`attributeQuery -n $node -ex "nw4cBlendMode"`) 227 { 228 addAttr -ln "nw4cBlendMode" -at "enum" 229 -en "Auto=0:Opaque=1:Alpha Test=2:Translucent=3:Add=4:Sub=5:Multiply=6" -dv 0 -h 1 $node; 230 } 231} 232 233global proc nw4cSetMaterialAttr_Set_BlendMode(string $node, int $val) 234{ 235 nw4cSetMaterialAttr_Add_BlendMode($node); 236 setAttr ($node + ".nw4cBlendMode") $val; 237} 238 239proc SetJob_BlendMode(string $node) 240{ 241 if (!`attributeQuery -n $node -ex "nw4cBlendMode"`) 242 { 243 return; 244 } 245 scriptJob -p nw4cSetMaterialAttr_BlendMode -rp -ac ($node + ".nw4cBlendMode") 246 ("optionMenuGrp -e -sl (`nw4cSetMaterialAttr_Get_BlendMode " 247 + $node + "` + 1) nw4cSetMaterialAttr_BlendMode"); 248} 249 250global proc nw4cSetMaterialAttr_BlendModeCB(string $mainNode) 251{ 252 string $sgs[]; 253 GetSelectedSG($sgs); 254 255 int $val = `optionMenuGrp -q -sl nw4cSetMaterialAttr_BlendMode` - 1; 256 for ($node in $sgs) 257 { 258 nw4cSetMaterialAttr_Set_BlendMode($node, $val); 259 } 260 261 SetJob_BlendMode($mainNode); 262} 263 264/****************************************************************************** 265 no compress 266******************************************************************************/ 267global proc int nw4cSetMaterialAttr_Get_NoCompress(string $node) 268{ 269 return (`attributeQuery -n $node -ex "nw4cNoCompressMat"`) ? 270 `getAttr ($node + ".nw4cNoCompressMat")` : 0; 271} 272 273global proc nw4cSetMaterialAttr_Add_NoCompress(string $node) 274{ 275 if (!`attributeQuery -n $node -ex "nw4cNoCompressMat"`) 276 { 277 addAttr -ln "nw4cNoCompressMat" -at "bool" -dv 0 -h 1 $node; 278 } 279} 280 281global proc nw4cSetMaterialAttr_Set_NoCompress(string $node, int $val) 282{ 283 nw4cSetMaterialAttr_Add_NoCompress($node); 284 setAttr ($node + ".nw4cNoCompressMat") $val; 285} 286 287proc SetJob_NoCompress(string $node) 288{ 289 if (!`attributeQuery -n $node -ex "nw4cNoCompressMat"`) 290 { 291 return; 292 } 293 scriptJob -p nw4cSetMaterialAttr_NoCompress -rp -ac ($node + ".nw4cNoCompressMat") 294 ("optionMenuGrp -e -sl (`nw4cSetMaterialAttr_Get_NoCompress " 295 + $node + "` + 1) nw4cSetMaterialAttr_NoCompress"); 296} 297 298global proc nw4cSetMaterialAttr_NoCompressCB(string $mainNode) 299{ 300 string $sgs[]; 301 GetSelectedSG($sgs); 302 303 int $val = `optionMenuGrp -q -sl nw4cSetMaterialAttr_NoCompress` - 1; 304 for ($node in $sgs) 305 { 306 nw4cSetMaterialAttr_Set_NoCompress($node, $val); 307 } 308 309 SetJob_NoCompress($mainNode); 310} 311 312/****************************************************************************** 313 get SG name with material 314******************************************************************************/ 315proc string GetSGNameWithMat(string $sg) 316{ 317 string $name = "( " + $sg + " )"; 318 string $ins[] = `listConnections -s 1 -d 0 ($sg + ".ss")`; 319 if (size($ins)) 320 { 321 $name = $ins[0] + " " + $name; 322 } 323 return $name; 324} 325 326/****************************************************************************** 327 update window 328******************************************************************************/ 329global proc nw4cSetMaterialAttr_UpdateWindow() 330{ 331 //----------------------------------------------------------------------------- 332 // get selection 333 string $sgs[]; 334 int $enableFlag = (GetSelectedSG($sgs) > 0); 335 336 //----------------------------------------------------------------------------- 337 // set node name 338 string $nodesName; 339 if ($enableFlag) 340 { 341 $nodesName = GetSGNameWithMat($sgs[0]); 342 int $nodeSize = size($sgs); 343 for ($inode = 1; $inode < $nodeSize; ++$inode) 344 { 345 if ($inode == 3) 346 { 347 $nodesName += ", ... (" + $nodeSize + ")"; 348 break; 349 } 350 $nodesName += ", " + GetSGNameWithMat($sgs[$inode]); 351 } 352 } 353 else 354 { 355 $nodesName = "(None)"; 356 } 357 text -e -l $nodesName nw4cSetMaterialAttr_NodeName; 358 359 //----------------------------------------------------------------------------- 360 // set current attr & change command 361 if ($enableFlag) 362 { 363 string $node = $sgs[0]; 364 365 int $faceCulling = `nw4cSetMaterialAttr_Get_FaceCulling $node`; 366 optionMenuGrp -e -sl (ConvertFaceCulling_ToGUI($faceCulling) + 1) 367 -cc ("nw4cSetMaterialAttr_FaceCullingCB " + $node) 368 nw4cSetMaterialAttr_FaceCulling; 369 370 checkBoxGrp -e -v1 `nw4cSetMaterialAttr_Get_FragLighting $node` 371 -cc ("nw4cSetMaterialAttr_FragLightingCB " + $node + " #1") 372 nw4cSetMaterialAttr_FragLighting; 373 374 checkBoxGrp -e -v1 `nw4cSetMaterialAttr_Get_VtxLighting $node` 375 -cc ("nw4cSetMaterialAttr_VtxLightingCB " + $node + " #1") 376 nw4cSetMaterialAttr_VtxLighting; 377 378 optionMenuGrp -e -sl (`nw4cSetMaterialAttr_Get_BlendMode $node` + 1) 379 -cc ("nw4cSetMaterialAttr_BlendModeCB " + $node) 380 nw4cSetMaterialAttr_BlendMode; 381 382 optionMenuGrp -e -sl (`nw4cSetMaterialAttr_Get_NoCompress $node` + 1) 383 -cc ("nw4cSetMaterialAttr_NoCompressCB " + $node) 384 nw4cSetMaterialAttr_NoCompress; 385 386 // setAttr �ȂǂŕύX���ꂽ�ꍇ�ɃR���g���[���̒l���X�V���邽�� 387 SetJob_FaceCulling($node); 388 SetJob_FragLighting($node); 389 SetJob_VtxLighting($node); 390 SetJob_NoCompress($node); 391 } 392 393 //----------------------------------------------------------------------------- 394 // set enable state 395 control -e -en $enableFlag nw4cSetMaterialAttr_FaceCulling; 396 control -e -en $enableFlag nw4cSetMaterialAttr_FragLighting; 397 control -e -en $enableFlag nw4cSetMaterialAttr_VtxLighting; 398 control -e -en $enableFlag nw4cSetMaterialAttr_BlendMode; 399 control -e -en $enableFlag nw4cSetMaterialAttr_NoCompress; 400} 401 402/****************************************************************************** 403 search check CB 404******************************************************************************/ 405global proc nw4cSetMaterialAttr_SearchCheckCB() 406{ 407 control -e -en 408 (`checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchFaceCulling` || 409 `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchFaceCulling` || 410 `checkBoxGrp -q -v3 nw4cSetMaterialAttr_SearchFaceCulling` || 411 `checkBoxGrp -q -v4 nw4cSetMaterialAttr_SearchFaceCulling` || 412 `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchFragLighting` || 413 `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchFragLighting` || 414 `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchVtxLighting` || 415 `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchVtxLighting` || 416 `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchBlendMode1` || 417 `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchBlendMode1` || 418 `checkBoxGrp -q -v3 nw4cSetMaterialAttr_SearchBlendMode1` || 419 `checkBoxGrp -q -v4 nw4cSetMaterialAttr_SearchBlendMode1` || 420 `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchBlendMode2` || 421 `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchBlendMode2` || 422 `checkBoxGrp -q -v3 nw4cSetMaterialAttr_SearchBlendMode2` || 423 `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchNoCompress` || 424 `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchNoCompress`) 425 nw4cSetMaterialAttr_SearchBtn; 426} 427 428/****************************************************************************** 429 do search 430******************************************************************************/ 431global proc nw4cSetMaterialAttr_DoSearch() 432{ 433 int $searchFaceCull1 = `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchFaceCulling` ? 434 0 : -1; // Front Face 435 int $searchFaceCull2 = `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchFaceCulling` ? 436 1 : -1; // BackFace 437 int $searchFaceCull3 = `checkBoxGrp -q -v3 nw4cSetMaterialAttr_SearchFaceCulling` ? 438 2 : -1; // Always 439 int $searchFaceCull4 = `checkBoxGrp -q -v4 nw4cSetMaterialAttr_SearchFaceCulling` ? 440 3 : -1; // Never 441 442 int $searchFragLit1 = `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchFragLighting` ? 443 0 : -1; // off 444 int $searchFragLit2 = `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchFragLighting` ? 445 1 : -1; // on 446 447 int $searchVtxLit1 = `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchVtxLighting` ? 448 0 : -1; // off 449 int $searchVtxLit2 = `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchVtxLighting` ? 450 1 : -1; // on 451 452 int $searchBlendMode1 = `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchBlendMode1` ? 453 0 : -1; // Auto 454 int $searchBlendMode2 = `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchBlendMode1` ? 455 1 : -1; // Opaque 456 int $searchBlendMode3 = `checkBoxGrp -q -v3 nw4cSetMaterialAttr_SearchBlendMode1` ? 457 2 : -1; // Alpha Test 458 int $searchBlendMode4 = `checkBoxGrp -q -v4 nw4cSetMaterialAttr_SearchBlendMode1` ? 459 3 : -1; // Translucent 460 int $searchBlendMode5 = `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchBlendMode2` ? 461 4 : -1; // Add 462 int $searchBlendMode6 = `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchBlendMode2` ? 463 5 : -1; // Sub 464 int $searchBlendMode7 = `checkBoxGrp -q -v3 nw4cSetMaterialAttr_SearchBlendMode2` ? 465 6 : -1; // Multiply 466 467 int $searchNoCompress1 = `checkBoxGrp -q -v1 nw4cSetMaterialAttr_SearchNoCompress` ? 468 0 : -1; // compress 469 int $searchNoCompress2 = `checkBoxGrp -q -v2 nw4cSetMaterialAttr_SearchNoCompress` ? 470 1 : -1; // no compress 471 472 int $andFlag = (`radioButtonGrp -q -sl nw4cSetMaterialAttr_SearchLogic` == 1); 473 474 int $nodeCount = 0; 475 select -cl; 476 string $sgs[] = `ls -typ shadingEngine`; 477 for ($node in $sgs) 478 { 479 if ($node == "initialParticleSE" || $node == "swatchShadingGroup") 480 { 481 continue; 482 } 483 484 int $faceCull = ConvertFaceCulling_ToGUI(nw4cSetMaterialAttr_Get_FaceCulling($node)); 485 int $faceCullMatch = 486 $faceCull == $searchFaceCull1 || 487 $faceCull == $searchFaceCull2 || 488 $faceCull == $searchFaceCull3 || 489 $faceCull == $searchFaceCull4 || 490 ($andFlag && $searchFaceCull1 == -1 && $searchFaceCull2 == -1 && 491 $searchFaceCull3 == -1 && $searchFaceCull4 == -1); 492 493 int $fragLit = nw4cSetMaterialAttr_Get_FragLighting($node); 494 int $fragLitMatch = 495 $fragLit == $searchFragLit1 || 496 $fragLit == $searchFragLit2 || 497 ($andFlag && $searchFragLit1 == -1 && $searchFragLit2 == -1); 498 499 int $vtxLit = nw4cSetMaterialAttr_Get_VtxLighting($node); 500 int $vtxLitMatch = 501 $vtxLit == $searchVtxLit1 || 502 $vtxLit == $searchVtxLit2 || 503 ($andFlag && $searchVtxLit1 == -1 && $searchVtxLit2 == -1); 504 505 int $blendMode = nw4cSetMaterialAttr_Get_BlendMode($node); 506 int $blendModeMatch = 507 $blendMode == $searchBlendMode1 || 508 $blendMode == $searchBlendMode2 || 509 $blendMode == $searchBlendMode3 || 510 $blendMode == $searchBlendMode4 || 511 $blendMode == $searchBlendMode5 || 512 $blendMode == $searchBlendMode6 || 513 $blendMode == $searchBlendMode7 || 514 ($andFlag && $searchBlendMode1 == -1 && $searchBlendMode2 == -1 && 515 $searchBlendMode3 == -1 && $searchBlendMode4 == -1 && 516 $searchBlendMode5 == -1 && $searchBlendMode6 == -1 && 517 $searchBlendMode7 == -1); 518 519 int $noCompress = nw4cSetMaterialAttr_Get_NoCompress($node); 520 int $noCompressMatch = 521 $noCompress == $searchNoCompress1 || 522 $noCompress == $searchNoCompress2 || 523 ($andFlag && $searchNoCompress1 == -1 && $searchNoCompress2 == -1); 524 525 int $match = ($andFlag) ? 526 ($faceCullMatch && $fragLitMatch && $vtxLitMatch && $blendModeMatch && $noCompressMatch): 527 ($faceCullMatch || $fragLitMatch || $vtxLitMatch || $blendModeMatch || $noCompressMatch); 528 if ($match) 529 { 530 select -add -ne $node; // shadingEngine 531 string $ins[] = `listConnections -s 1 -d 0 ($node + ".ss")`; 532 if (size($ins)) 533 { 534 select -add $ins[0]; // material 535 } 536 select -add $node; // shape or face 537 ++$nodeCount; 538 } 539 } 540 541 if ($nodeCount == 0) 542 { 543 print "Not found\n"; 544 } 545 else 546 { 547 string $msg = "Found: " + $nodeCount + " shadingEngine node"; 548 if ($nodeCount >= 2) 549 { 550 $msg += "s"; 551 } 552 print ($msg + "\n"); 553 } 554} 555 556/****************************************************************************** 557 main 558******************************************************************************/ 559global proc NW4C_SetMaterialAttr() 560{ 561 //----------------------------------------------------------------------------- 562 // create window 563 int $winW = 600; 564 int $winH = 448; 565 if (!`window -ex nw4cSetMaterialAttr_Win`) 566 { 567 window -t "NW4C Set Material Attribute" -wh $winW $winH -mxb 0 -mb 1 568 nw4cSetMaterialAttr_Win; 569 menu -l "Help"; 570 menuItem -l ("Help on " + `window -q -t nw4cSetMaterialAttr_Win` + "...") 571 -c "NW4C_ShowHelp \"html/NW4C_SetMaterialAttr.html\" \"\""; 572 573 columnLayout -adj 1 -cat "both" 4 -cal "center" -rs 4; 574 575 //----------------------------------------------------------------------------- 576 // node name 577 frameLayout -l "Selected Material ( Shading Group )" -cll 0 -cl 0 -bv 1 -bs "etchedIn"; 578 columnLayout -adj 1 -cal "center" -rs 8; 579 580 text -l "" nw4cSetMaterialAttr_NodeName; 581 582 setParent ..; // columnLayout 583 setParent ..; // formLayout 584 585 //----------------------------------------------------------------------------- 586 // set 587 frameLayout -l "Set" -cll 0 -cl 0 -bv 1 -bs "etchedIn"; 588 columnLayout -adj 1 -rs 8; 589 590 rowColumnLayout -nc 4 -cw 1 10 -cw 2 210 -cw 3 140 -cw 4 150; 591 text -l ""; // dummy 592 593 optionMenuGrp -l "Face Culling" -cw 1 70 -cal 1 "right" 594 nw4cSetMaterialAttr_FaceCulling; 595 menuItem -l "Back Face Culling"; 596 menuItem -l "Front Face Culling"; 597 menuItem -l "Never"; 598 menuItem -l "Always Culling"; 599 600 checkBoxGrp -ncb 1 -l "" 601 -l1 "Fragment Lighting" -v1 1 602 -cw2 10 130 603 nw4cSetMaterialAttr_FragLighting; 604 605 checkBoxGrp -ncb 1 -l "" 606 -l1 "Vertex Lighting" -v1 0 607 -cw2 10 130 608 nw4cSetMaterialAttr_VtxLighting; 609 setParent ..; // rowColumnLayout 610 611 rowColumnLayout -nc 4 -cw 1 10 -cw 2 210 -cw 3 250 -cw 4 100; 612 text -l ""; // dummy 613 614 optionMenuGrp -l "Blend Mode" 615 -cw 1 70 -rat 1 "both" 4 -cal 1 "right" 616 nw4cSetMaterialAttr_BlendMode; 617 menuItem -l "Auto"; 618 menuItem -l "Opaque"; 619 menuItem -l "Alpha Test"; 620 menuItem -l "Translucent"; 621 menuItem -l "Add"; 622 menuItem -l "Sub"; 623 menuItem -l "Multiply"; 624 625 optionMenuGrp -l "Compress" 626 -cw 1 70 -rat 1 "both" 4 -cal 1 "right" 627 nw4cSetMaterialAttr_NoCompress; 628 menuItem -l "Compress if possible"; 629 menuItem -l "Don't compress"; 630 631 text -l ""; // dummy 632 setParent ..; // rowColumnLayout 633 634 setParent ..; // columnLayout 635 setParent ..; // formLayout 636 637 //----------------------------------------------------------------------------- 638 // search 639 frameLayout -l "Search" -cll 0 -cl 0 -bv 1 -bs "etchedIn"; 640 columnLayout -adj 1 -rs 8; 641 642 checkBoxGrp -l "Face Culling" -ncb 4 -cw5 110 120 120 120 120 643 -la4 "Back Face Culling" "Front Face Culling" "Never" "Always Culling" 644 -cc "nw4cSetMaterialAttr_SearchCheckCB" 645 nw4cSetMaterialAttr_SearchFaceCulling; 646 647 checkBoxGrp -l "Fragment Lighting" -ncb 2 -cw3 110 120 120 648 -la2 "Off" "On" 649 -cc "nw4cSetMaterialAttr_SearchCheckCB" 650 nw4cSetMaterialAttr_SearchFragLighting; 651 652 checkBoxGrp -l "Vertex Lighting" -ncb 2 -cw3 110 120 120 653 -la2 "Off" "On" 654 -cc "nw4cSetMaterialAttr_SearchCheckCB" 655 nw4cSetMaterialAttr_SearchVtxLighting; 656 657 checkBoxGrp -l "Blend Mode" -ncb 4 -cw5 110 120 120 120 120 658 -la4 "Auto" "Opaque" "Alpha Test" "Translucent" 659 -cc "nw4cSetMaterialAttr_SearchCheckCB" 660 nw4cSetMaterialAttr_SearchBlendMode1; 661 662 checkBoxGrp -l " " -ncb 3 -cw4 110 120 120 120 663 -la3 "Add" "Sub" "Multiply" 664 -cc "nw4cSetMaterialAttr_SearchCheckCB" 665 nw4cSetMaterialAttr_SearchBlendMode2; 666 667 checkBoxGrp -l "Compress" -ncb 2 -cw3 110 120 120 668 -la2 "Compress" "No Compress" 669 -cc "nw4cSetMaterialAttr_SearchCheckCB" 670 nw4cSetMaterialAttr_SearchNoCompress; 671 672 rowColumnLayout -nc 2 -cw 1 315 -cw 2 150; 673 radioButtonGrp -l "" -nrb 2 -cw3 202 50 50 674 -rat 2 "both" 0 675 -rat 3 "both" 0 676 -la2 "and" "or" -sl 1 677 nw4cSetMaterialAttr_SearchLogic; 678 button -l "Search" 679 -c "nw4cSetMaterialAttr_DoSearch" 680 nw4cSetMaterialAttr_SearchBtn; 681 setParent ..; // rowColumnLayout 682 683 setParent ..; // columnLayout 684 setParent ..; // formLayout 685 686 //----------------------------------------------------------------------------- 687 // close button 688 string $closeCmd = "deleteUI nw4cSetMaterialAttr_Win"; 689 string $form = `formLayout -nd 100`; 690 string $closeBtn = `button -h 26 -l "Close" -c $closeCmd`; 691 formLayout -e 692 -af $closeBtn "top" 0 693 -af $closeBtn "left" 0 694 -af $closeBtn "bottom" 0 695 -af $closeBtn "right" 0 696 $form; 697 setParent ..; // formLayout 698 699 setParent ..; // columnLayout 700 701 setFocus $closeBtn; 702 703 //----------------------------------------------------------------------------- 704 // set selection change job 705 scriptJob -p nw4cSetMaterialAttr_Win 706 -e "SelectionChanged" "nw4cSetMaterialAttr_UpdateWindow"; 707 } 708 if (`window -q -w nw4cSetMaterialAttr_Win` < $winW) 709 { 710 window -e -w $winW nw4cSetMaterialAttr_Win; 711 } 712 if (`window -q -h nw4cSetMaterialAttr_Win` < $winH) 713 { 714 window -e -h $winH nw4cSetMaterialAttr_Win; 715 } 716 //window -e -wh $winW $winH nw4cSetMaterialAttr_Win; 717 718 //----------------------------------------------------------------------------- 719 // update window 720 nw4cSetMaterialAttr_UpdateWindow; 721 nw4cSetMaterialAttr_SearchCheckCB; 722 723 //----------------------------------------------------------------------------- 724 // show window 725 showWindow nw4cSetMaterialAttr_Win; 726} 727