1-- NW4C Material Tool(2010/09/02) 2-- Version 0.4.3 3-- (c)2010 Nintendo 4 5rollout nw4cMaterialRollout "NW4C Set Material Attribute" width:480 height:550 6( 7 groupBox grp1 "Selected Material" pos:[8,8] width:464 height:170 8 --label lblSelectedNode "" pos:[16,24] width:368 height:64 9 dotNetControl lv_mtl "System.Windows.Forms.ListView" pos:[16,24] width:450 height:150 10 -- 11 groupBox grp2 "Set" pos:[8,184] width:464 height:126 12 dropDownList ddlSetFaceCulling "Face Culling" pos:[16,200] width:152 height:41 \ 13 items:#("Back Face", "Front Face", "Always", "Never") 14 dropDownList ddlSetCompress "Compress" pos:[184,200] width:152 height:41 \ 15 items:#("Compress if possible", "Don�ft compress") 16 checkbox chkSetFragmentLighting "Fragment Lighting" pos:[16,244] width:152 height:16 17 checkbox chkSetVertexLighting "Vertex Lighting" pos:[184,244] width:152 height:16 18 dropDownList ddlSetBlendMode "Blend Mode" pos:[16,264] width:152 height:41 \ 19 items:#("Auto", "Opaque", "Alpha Test", "Translucent", "Add", "Sub", "Multiply") 20 -- 21 groupBox grp3 "Search" pos:[8,318] width:464 height:200 22 label lbl2 "Face Culling" pos:[16,334] width:80 height:16 23 checkbox chkSFC_Front "Front Face" pos:[144,334] width:80 height:16 24 checkbox chkSFC_Back "Back Face" pos:[224,334] width:80 height:16 25 checkbox chkSFC_Always "Always" pos:[304,334] width:64 height:16 26 checkbox chkSFC_Never "Never" pos:[368,334] width:56 height:16 27 label lbl3 "Fragment Lighting" pos:[16,358] width:120 height:16 28 checkbox chkSFL_Off "off" pos:[144,358] width:48 height:16 29 checkbox chkSFL_On "on" pos:[192,358] width:40 height:16 30 label lbl4 "Vertex Lighting" pos:[16,382] width:120 height:16 31 checkbox chkSVL_Off "off" pos:[144,382] width:48 height:16 32 checkbox chkSVL_On "on" pos:[192,382] width:40 height:16 33 label lbl5 "Compress" pos:[16,406] width:120 height:16 34 checkbox chkSC_On "If possible" pos:[144,406] width:80 height:16 35 checkbox chkSC_Off "Don't" pos:[224,406] width:104 height:16 36 37 38 label lbl6 "Blend Mode" pos:[16,430] width:120 height:16 39 checkbox chkBM_Auto "Auto" pos:[144,430] width:80 height:16 40 checkbox chkBM_Opaque "Opaque" pos:[224,430] width:80 height:16 41 checkbox chkBM_AlphaTest "Alpha Test" pos:[304,430] width:80 height:16 42 checkbox chkBM_Translucent "Translucent" pos:[144,454] width:80 height:16 43 checkbox chkBM_Add "Add" pos:[234,454] width:60 height:16 44 checkbox chkBM_Sub "Sub" pos:[294,454] width:60 height:16 45 checkbox chkBM_Multiply "Multiply" pos:[358,454] width:80 height:16 46 47 -- 48 radioButtons rdoSearchType "" pos:[192,494] width:98 height:16 labels:#("AND", "OR") columns:2 49 button btnSearch "Search" pos:[304,484] width:112 height:24 50 button btnClose "Close" pos:[8,522] width:464 height:24 51 52 local donotRedraw 53 local mtls = #() 54 local nodeCallbacks =#() 55 fn initListView = 56 ( 57 lv_mtl.gridLines = true 58 lv_mtl.View = (dotNetClass "System.Windows.Forms.View").Details 59 lv_mtl.fullRowSelect = true 60 lv_mtl.AutoSize = true 61 lv_mtl.MultiSelect = false 62 lv_mtl.Columns.add "Material Name" 63 lv_mtl.Columns.add "Face Culling" 64 lv_mtl.Columns.add "Fragment" 65 lv_mtl.Columns.add "Vertex" 66 lv_mtl.Columns.add "Compress " 67 lv_mtl.Columns.add "BlendMode" 68 lv_mtl.sorting = (dotNetClass "System.Windows.Forms.SortOrder").Ascending 69 lv_mtl.AutoResizeColumns ((dotNetClass "System.Windows.Forms.ColumnHeaderAutoResizeStyle").HeaderSize) 70 ) 71 72 fn getMtlAttribute m create = 73 ( 74 local attrib = m.custAttributes["NW4C Material Custom Attribute"] 75 if attrib == undefined then 76 ( 77 --if not create do return undefined 78 attrib = nw4c_mtl_custom_attribute() 79 append m.custAttributes attrib 80 ) 81 return attrib 82 ) 83 84 fn getSelMtls sel = 85 ( 86 local smtls = #() 87 for n in sel do 88 ( 89 local mtl = n.material 90 if mtl != undefined do 91 ( 92 appendIfUnique smtls mtl 93 if(classOf mtl == Multimaterial) do 94 ( 95 for submtl in mtl.materialList do 96 ( 97 appendIfUnique smtls submtl 98 ) 99 ) 100 ) 101 ) 102 return smtls 103 ) 104 105 fn enableUI flag = 106 ( 107 ddlSetFaceCulling.enabled = flag 108 ddlSetCompress.enabled = flag 109 chkSetFragmentLighting.enabled = flag 110 chkSetVertexLighting.enabled = flag 111 ddlSetBlendMode.enabled = flag 112 ) 113 114 fn loadAttributeToUI attr = 115 ( 116 if (classof attr) != nw4c_mtl_custom_attribute do return() 117 118 ddlSetFaceCulling.selection = attr.faceCulling + 1 119 ddlSetCompress.selection = attr.compress + 1 120 chkSetFragmentLighting.checked = attr.fragmentLighting 121 chkSetVertexLighting.checked = attr.vertexLighting 122 ddlSetBlendMode.selection = attr.blendMode + 1 123 ) 124 125 fn updateSelection = 126 ( 127 if donotRedraw do return() 128 lv_mtl.Items.Clear() 129 --print "updateSelection" 130 --print mtls 131 132 local str = "" 133 --local mtls = getSelMtls selection 134 135 local lvItems =#() 136 for m in mtls do 137 ( 138 local attr = getMtlAttribute m true 139 140 local li = dotNetObject "System.Windows.Forms.ListViewItem" m.name 141 local sub_li 142 str = case attr.faceCulling of 143 ( 144 0: "Back Face" 145 1: "Front Face" 146 2: "Always" 147 default: "Never" 148 ) 149 sub_li = li.SubItems.add str 150 151 sub_li = li.SubItems.add (if attr.fragmentLighting then "on" else "off") 152 sub_li = li.SubItems.add (if attr.vertexLighting then "on" else "off") 153 154 str = case attr.compress of 155 ( 156 0: "If possible" 157 default: "Don�ft" 158 ) 159 sub_li = li.SubItems.add str 160 161 str = case attr.blendMode of 162 ( 163 0: "Auto" 164 1: "Opaque" 165 2: "Alpha Test" 166 3: "Translucent" 167 4: "Add" 168 5: "Sub" 169 default: "Multiply" 170 ) 171 sub_li = li.SubItems.add str 172 173 append lvItems li 174 ) 175 --print lvItems 176 lv_mtl.Items.AddRange lvItems 177 178 --lblSelectedNode.text = str 179 if mtls.count > 0 then 180 ( 181 enableUI true 182 loadAttributeToUI (getMtlAttribute mtls[1] false) 183 ) 184 else 185 ( 186 enableUI false 187 ) 188 ) 189 190 fn mtlUpdateCallback ev nd = 191 ( 192 format "mtlUpdateCallback %(%), %\n" (classof ev) (ev as string) (nd as string) 193 print ev 194 print nd 195 updateSelection() 196 ) 197 198 fn updateNodeCallbacks = 199 ( 200 local nodes =#() 201 nodeCallbacks =#() 202 gc() 203 for m in mtls do 204 ( 205 local n = refs.dependentNodes m 206 if n != undefined do 207 ( 208 if (appendIfUnique nodes n) do 209 ( 210 local cb = NodeEventCallback mouseUp:true delay:1000 materialOtherEvent:mtlUpdateCallback 211 append nodeCallbacks cb 212 ) 213 ) 214 ) 215 ) 216 217 fn setMtlAttributes = 218 ( 219 --local mtls = getSelMtls selection 220 local attr 221 for m in mtls do 222 ( 223 attr = getMtlAttribute m true 224 attr.faceCulling = ddlSetFaceCulling.selection - 1 225 attr.compress = ddlSetCompress.selection - 1 226 attr.fragmentLighting = chkSetFragmentLighting.checked 227 attr.vertexLighting = chkSetVertexLighting.checked 228 attr.blendMode = ddlSetBlendMode.selection - 1 229 ) 230 updateSelection() 231 ) 232 233 fn selectionCallback = 234 ( 235 mtls = getSelMtls selection 236 --updateNodeCallbacks() 237 updateSelection() 238 ) 239 240 fn addCallback = 241 ( 242 callbacks.addScript #selectionSetChanged "nw4cMaterialRollout.selectionCallback()" id:#nw4cMtlSelectionChange 243 ) 244 fn removeCallback = 245 ( 246 callbacks.removeScripts id:#nw4cMtlSelectionChange 247 ) 248 249 -- �z����̑S�Ă�bool��False�Ȃ�true 250 fn isAllBoolFalse bools = 251 ( 252 if classof bools != Array do return false 253 local allOn = true, allOff = false 254 for b in bools do 255 ( 256 allOn = allOn and b 257 allOff = allOff or b 258 ) 259 local ret = if allOn or not allOff then true else false 260 --format "isAllBoolSame % \n" ret 261 --return ret 262 return (not allOff) 263 ) 264 on lv_mtl SelectedIndexChanged e do 265 ( 266 local numItems = lv_mtl.Items.Count 267 for i = 0 to (numItems - 1) do 268 ( 269 lv_mtl.Items.Item[i].Selected = false 270 ) 271 ) 272 on btnSearch pressed do 273 ( 274 removeCallback() 275 local allMtls = getSelMtls objects 276 mtls = #() 277 local searchFaceCull, searchFragLight, searchVtxLight, searchCompress, searchBlend 278 -- face 279 local fc_front = chkSFC_Front.checked 280 local fc_back = chkSFC_Back.checked 281 local fc_always = chkSFC_Always.checked 282 local fc_never = chkSFC_Never.checked 283 searchFaceCull = not (isAllBoolFalse #(fc_front, fc_back,fc_always,fc_never) ) 284 285 local fl_on = chkSFL_On.checked 286 local fl_off = chkSFL_Off.checked 287 searchFragLight = not (isAllBoolFalse #(fl_on, fl_off) ) 288 289 local vl_on = chkSVL_On.checked 290 local vl_off = chkSVL_Off.checked 291 searchVtxLight = not (isAllBoolFalse #(vl_on, vl_off) ) 292 293 local comp_on = chkSC_On.checked 294 local comp_off = chkSC_Off.checked 295 searchCompress = not (isAllBoolFalse #(comp_on, comp_off) ) 296 297 local bmAuto = chkBM_Auto.checked 298 local bmOpaque = chkBM_Opaque.checked 299 local bmAlphaTest = chkBM_AlphaTest.checked 300 local bmTranslucent = chkBM_Translucent.checked 301 local bmAdd = chkBM_Add.checked 302 local bmSub = chkBM_Sub.checked 303 local bmMultiply = chkBM_Multiply.checked 304 searchBlend = not (isAllBoolFalse #(bmAuto, bmOpaque, bmAlphaTest, bmTranslucent, bmAdd, bmSub, bmMultiply) ) 305 306 local isSearchAnd = if rdoSearchType.state == 1 then true else false 307 308 for m in allMtls do 309 ( 310 local compare = true -- ���̏����Ŕ�r���邩�ǂ����H 311 local ret =false -- ���̃}�e���A������r�������������ǂ��� 312 local attr = getMtlAttribute m true 313 if searchFaceCull and compare do 314 ( 315 ret = case attr.faceCulling of 316 ( 317 0: fc_back 318 1: fc_front 319 2: fc_always 320 3: fc_never 321 ) 322 if ret and (not isSearchAnd) then compare = false -- ���̔�r���������A���[�h��OR�Ȃ瑼�̔�r�͕s�v 323 else if (not ret) and isSearchAnd do compare = false -- ���̔�r�����������A���[�h��AND�Ȃ瑼�̔�r�͕s�v 324 ) 325 326 if searchFragLight and compare do 327 ( 328 ret = (attr.fragmentLighting == fl_on) or (attr.fragmentLighting == (not fl_off)) 329 if ret and (not isSearchAnd) then compare = false 330 else if (not ret) and isSearchAnd do compare = false 331 ) 332 333 if searchVtxLight and compare do 334 ( 335 ret = (attr.vertexLighting == vl_on) or (attr.vertexLighting == (not vl_off)) 336 if ret and (not isSearchAnd) then compare = false 337 else if (not ret) and isSearchAnd do compare = false 338 ) 339 340 if searchCompress and compare do 341 ( 342 local isComp = (attr.compress == 0) 343 ret = (isComp == comp_on) or (isComp == (not comp_off)) 344 if ret and (not isSearchAnd) then compare = false 345 else if (not ret) and isSearchAnd do compare = false 346 ) 347 348 if searchBlend and compare do 349 ( 350 ret = case attr.blendMode of 351 ( 352 0: bmAuto 353 1: bmOpaque 354 2: bmAlphaTest 355 3: bmTranslucent 356 4: bmAdd 357 5: bmSub 358 6: bmMultiply 359 default: bmAuto 360 ) 361 if ret and (not isSearchAnd) then compare = false 362 else if (not ret) and isSearchAnd do compare = false 363 ) 364 365 -- ���������}�e���A����z��ɒlj� 366 if ret do 367 ( 368 append mtls m 369 ) 370 ) 371 --print mtls 372 clearSelection() 373 for m in mtls do 374 ( 375 selectMore (refs.dependentNodes m) 376 ) 377 --updateNodeCallbacks() 378 updateSelection() 379 addCallback() 380 ) 381 382 383/* 384 on lv_mtl ColumnClick evt do 385 ( 386 if (lv_mtl.ListViewItemSorter.Column != evt.Column) then 387 ( 388 lv_mtl.ListViewItemSorter.Column = evt.Column 389 lv_mtl.ListViewItemSorter.Reversed = false 390 ) 391 else 392 ( 393 lv_mtl.ListViewItemSorter.Reversed = (not lv_mtl.ListViewItemSorter.Reversed) 394 ) 395 lv_mtl.Sort() 396 ) 397*/ 398 on ddlSetFaceCulling selected i do setMtlAttributes() 399 on ddlSetCompress selected i do setMtlAttributes() 400 on chkSetFragmentLighting changed i do setMtlAttributes() 401 on chkSetVertexLighting changed i do setMtlAttributes() 402 on ddlSetBlendMode selected i do setMtlAttributes() 403 404 on nw4cMaterialRollout open do 405 ( 406 donotRedraw = false 407 initListView() 408 addCallback() 409 --updateSelection() 410 selectionCallback() 411 ) 412 on nw4cMaterialRollout close do 413 ( 414 removeCallback() 415 ) 416 on btnClose pressed do DestroyDialog nw4cMaterialRollout 417)-- mtl rollout 418 419rollout nw4cRenderPriorityRollout "NW4C Set Render Priority" width:480 height:400 420( 421 groupBox grp1 "Selected Material" pos:[8,8] width:464 height:170 422 dotNetControl lv_mtl "System.Windows.Forms.ListView" pos:[16,24] width:450 height:150 423 424 groupBox grp2 "Set" pos:[8,187] width:464 height:61 425 label lbl6 "Render Priority:" pos:[24,208] width:104 height:16 426 radioButtons rdoSetPriorityType "" pos:[128,208] width:87 height:32 labels:#("Don't care", "") columns:1 default:1 427 spinner spnSetPriority "" pos:[152,224] width:56 height:16 range:[1,255,1] type:#integer scale:1 enabled:false 428 label lbl7 "1(High Priority) - 255(Low Priority)" pos:[224,224] width:240 height:16 429 430 groupBox grp4 "Search" pos:[8,256] width:464 height:104 431 label lbl8 "Render Priority:" pos:[24,280] width:104 height:16 432 radioButtons rdoSearchPriorityType "" pos:[128,280] width:89 height:48 433 labels:#("Don't care", "Condition", "All Material") columns:1 default:1 \ 434 dropDownList ddlSearchConditionType "" pos:[208,292] width:96 height:22 default:1 enabled:false \ 435 items:#("< : under", "<= : below", "= : exactly", ">= : above", "> : over") 436 spinner spnSearchPriority "" pos:[312,294] width:48 height:16 range:[1,255,1] type:#integer scale:1 enabled:false 437 438 button btnSearch "Search" pos:[280,328] width:112 height:24 439 button btnClose "Close" pos:[8,368] width:464 height:24 440 441 local mtls =#() 442 443 fn getMtlAttribute m create = 444 ( 445 local attrib = m.custAttributes["NW4C Material Custom Attribute"] 446 if attrib == undefined then 447 ( 448 --if not create do return undefined 449 attrib = nw4c_mtl_custom_attribute() 450 append m.custAttributes attrib 451 ) 452 return attrib 453 ) 454 455 fn initListView = 456 ( 457 lv_mtl.gridLines = true 458 lv_mtl.View = (dotNetClass "System.Windows.Forms.View").Details 459 lv_mtl.fullRowSelect = true 460 lv_mtl.AutoSize = true 461 lv_mtl.MultiSelect = false 462 lv_mtl.LabelEdit = true 463 lv_mtl.AllowColumnReorder = true 464 lv_mtl.Columns.add "Render Priority" 465 lv_mtl.Columns.add "Material Name" 466 lv_mtl.Columns.Item[0].DisplayIndex = 1 467 lv_mtl.Columns.Item[1].DisplayIndex = 0 468 --lv_mtl.sorting = (dotNetClass "System.Windows.Forms.SortOrder").Ascending 469 lv_mtl.AutoResizeColumns ((dotNetClass "System.Windows.Forms.ColumnHeaderAutoResizeStyle").HeaderSize) 470 471 ) 472 473 fn getSelMtls sel = 474 ( 475 local smtls = #() 476 for n in sel do 477 ( 478 local mtl = n.material 479 if mtl != undefined do 480 ( 481 appendIfUnique smtls mtl 482 if(classOf mtl == Multimaterial) do 483 ( 484 for submtl in mtl.materialList do 485 ( 486 appendIfUnique smtls submtl 487 ) 488 ) 489 ) 490 ) 491 return smtls 492 ) 493 494 fn updateSelection = 495 ( 496 lv_mtl.Items.Clear() 497 498 local str = "" 499 --local mtls = getSelMtls selection 500 501 local lvItems =#() 502 for m in mtls do 503 ( 504 local attr = getMtlAttribute m true 505 local val = 0 506 if attr.renderPriorityType == 1 do 507 ( 508 val = attr.renderPriority 509 ) 510 local li = dotNetObject "System.Windows.Forms.ListViewItem" (val as string) 511 local sub_li = li.SubItems.add m.name 512 append lvItems li 513 ) 514 lv_mtl.Items.AddRange lvItems 515 ) 516 517 fn setMtlAttributes = 518 ( 519 --local mtls = getSelMtls selection 520 local attr 521 undo "Edit render priority" on 522 ( 523 spnSetPriority.enabled = (rdoSetPriorityType.state == 2) 524 for m in mtls do 525 ( 526 attr = getMtlAttribute m true 527 local val = 0 528 if rdoSetPriorityType.state == 1 then 529 ( 530 attr.renderPriorityType = 0 531 ) 532 else 533 ( 534 attr.renderPriorityType = 1 535 attr.renderPriority = spnSetPriority.value 536 ) 537 ) 538 ) 539 updateSelection() 540 ) 541 542 fn selectionCallback = 543 ( 544 mtls = getSelMtls selection 545 updateSelection() 546 ) 547 548 fn addCallback = 549 ( 550 callbacks.addScript #selectionSetChanged "nw4cRenderPriorityRollout.selectionCallback()" \ 551 id:#nw4cRenderPrioritySelectionChange 552 ) 553 fn removeCallback = 554 ( 555 callbacks.removeScripts id:#nw4cRenderPrioritySelectionChange 556 ) 557 558 on btnSearch pressed do 559 ( 560 removeCallback() 561 local allMtls = getSelMtls objects 562 mtls = #() 563 564 for m in allMtls do 565 ( 566 local attr = getMtlAttribute m true 567 local ret= false 568 569 case rdoSearchPriorityType.state of 570 ( 571 1: ( -- Don't care 572 if attr.renderPriorityType == 0 do 573 ( 574 ret = true 575 ) 576 ) 577 2: ( -- condition 578 if attr.renderPriorityType == 1 do 579 ( 580 local v = spnSearchPriority.value 581 case ddlSearchConditionType.selection of 582 ( 583 1: ( -- under 584 ret = (attr.renderPriority < v) 585 ) 586 2: ( -- below 587 ret = (attr.renderPriority <= v) 588 ) 589 3: ( -- exactly 590 ret = (attr.renderPriority == v) 591 ) 592 4: ( -- above 593 ret = (attr.renderPriority >= v) 594 ) 595 5: ( -- over 596 ret = (attr.renderPriority > v) 597 ) 598 ) 599 ) 600 ) 601 default: ret = true 602 ) 603 604 -- ���������}�e���A����z��ɒlj� 605 if ret do 606 ( 607 append mtls m 608 ) 609 ) 610 611 clearSelection() 612 for m in mtls do 613 ( 614 selectMore (refs.dependentNodes m) 615 ) 616 617 updateSelection() 618 addCallback() 619 ) 620 621 on lv_mtl AfterLabelEdit ev do 622 ( 623 local str = ev.Label 624 local cancel = true 625 if str != undefined do 626 ( 627 local v = str as Integer 628 if v != undefined do 629 ( 630 if (1 <= v) and (v <= 255) do 631 ( 632 local subItem = lv_mtl.Items.item[ev.Item].subitems 633 local eMtl = subItem.Item[1].Text 634 --format "set priority \"%\" = %\n" eMtl v 635 local attr = undefined 636 for m in sceneMaterials while attr == undefined do 637 ( 638 if m.name == eMtl then 639 ( 640 attr = getMtlAttribute m true 641 ) 642 else if(classOf m == Multimaterial) do 643 ( 644 for submtl in m.materialList while attr == undefined do 645 ( 646 if submtl.name == eMtl then 647 ( 648 attr = getMtlAttribute submtl true 649 ) 650 ) 651 ) 652 ) 653 654 if attr != undefined do 655 ( 656 attr.renderPriorityType = if (v == 0) then 0 else 1 657 attr.renderPriority = v 658 cancel = false 659 ) 660 ) 661 ) 662 ) 663 ev.CancelEdit = cancel 664 ) 665 666 on rdoSetPriorityType changed i do setMtlAttributes() 667 on spnSetPriority changed i do setMtlAttributes() 668 669 on rdoSearchPriorityType changed i do 670 ( 671 ddlSearchConditionType.enabled = (i == 2) 672 spnSearchPriority.enabled = (i == 2) 673 ) 674 675 676 on nw4cRenderPriorityRollout lbuttondown mp do 677 ( 678 --print mp 679 ) 680 681 682 on nw4cRenderPriorityRollout open do 683 ( 684 mtls = #() 685 --donotRedraw = false 686 initListView() 687 addCallback() 688 --updateSelection() 689 selectionCallback() 690 ) 691 on nw4cRenderPriorityRollout close do 692 ( 693 removeCallback() 694 ) 695 on btnClose pressed do DestroyDialog nw4cRenderPriorityRollout 696)-- priority rollout 697 698 699-- Material editor menu 700macroScript AddMaterialAttribute category:"NW4C" 701( 702 --local mtl = meditMaterials[activeMeditSlot] 703 local mtl = medit.GetCurMtl() 704 if (mtl != undefined) and (superClassOf mtl == material) do 705 ( 706 nw4cMaterialRollout.getMtlAttribute mtl true 707 ) 708) 709 710macroScript DeleteMaterialAttribute category:"NW4C" 711( 712 --local mtl = meditMaterials[activeMeditSlot] 713 local mtl = medit.GetCurMtl() 714 if (mtl != undefined) and (superClassOf mtl == material) do 715 ( 716 deleteItem mtl.custAttributes "NW4C Material Custom Attribute" 717 ) 718) 719 720fn getNw4cMtlMenu = 721( 722 local mtlMenuBar = nw4cmax.GetMtlEditorMenu() 723 for i = 1 to mtlMenuBar.numitems() do 724 ( 725 local mi = mtlMenuBar.getItem i 726 if ( (mi.getTitle()) == "NW4C" ) do 727 ( 728 return mi 729 ) 730 ) 731 732 -- NW4C���j���[�����o�^ 733 local subMenu = menuMan.createMenu "NW4C" 734 local subMenuItem = menuMan.createSubMenuItem "Test Menu" subMenu 735 -- �T�u���j���[���Ōォ�� 2 �Ԗڂ̃X���b�g�ɒlj����܂��B 736 mtlMenuBar.addItem subMenuItem -1 737 return subMenuItem 738) 739 740fn resetMtlMenuActions mi = 741( 742 local menu = mi.getSubMenu() 743 -- �܂��o�^�ς݂̃T�u���j���[�A�C�e�����폜 744 while (menu.numItems() > 0) do 745 ( 746 menu.removeItemByPosition 1 747 ) 748 749 local dialogItem 750 751 dialogItem = menuMan.createActionItem "AddMaterialAttribute" "NW4C" 752 dialogItem.setTitle "Add Attribute" 753 dialogItem.setUseCustomTitle true 754 menu.addItem dialogItem -1 755 756 dialogItem = menuMan.createActionItem "DeleteMaterialAttribute" "NW4C" 757 dialogItem.setTitle "Delete Attribute" 758 dialogItem.setUseCustomTitle true 759 menu.addItem dialogItem -1 760) 761