File size: 60,875 Bytes
b6a38d7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 |
-- ========== GENERATED BY XTemplate Editor (Alt-F3) DO NOT EDIT MANUALLY! ==========
PlaceObj('XTemplate', {
SortKey = 100,
group = "Shortcuts",
id = "EditorShortcuts",
save_in = "Common",
PlaceObj('XTemplateGroup', {
'__condition', function (parent, context) return Platform.editor end,
}, {
PlaceObj('XTemplateAction', {
'comment', "Context menu actions",
'ActionMode', "Editor",
'ActionTranslate', false,
}, {
PlaceObj('XTemplateAction', {
'comment', "Toggle Spots",
'ActionId', "E_ToggleSpots",
'ActionTranslate', false,
'ActionName', "Toggle Spots",
'ActionIcon', "CommonAssets/UI/Menu/EV_OpenFirst.tga",
'OnAction', function (self, host, source, ...)
ToggleSpotVisibility(editor.GetSel())
end,
'ActionContexts', {
"SingleSelection",
"MultipleSelection",
},
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Toggle Surfaces",
'ActionId', "E_ToggleSurfaces",
'ActionTranslate', false,
'ActionName', "Toggle Surfaces",
'ActionIcon', "CommonAssets/UI/Menu/EV_OpenFirst.tga",
'ActionState', function (self, host)
local sel = editor.GetSel()
if sel and sel[1] and not HasAnySurfaces(sel[1], -1) then
return "hidden"
end
end,
'OnAction', function (self, host, source, ...)
ToggleSurfaceVisibility(editor.GetSel())
end,
'ActionContexts', {
"SingleSelection",
"MultipleSelection",
},
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Entity viewer",
'ActionId', "E_EV_OpenFirst",
'ActionTranslate', false,
'ActionName', "Entity viewer",
'ActionIcon', "CommonAssets/UI/Menu/EV_OpenFirst.tga",
'OnAction', function (self, host, source, ...)
CreateEntityViewer(editor.GetSel()[1])
end,
'ActionContexts', {
"SingleSelection",
"MultipleSelection",
},
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Art Spec",
'ActionId', "E_AS_OpenFirst",
'ActionTranslate', false,
'ActionName', "Art Spec",
'ActionIcon', "CommonAssets/UI/Menu/EV_OpenFirst.tga",
'OnAction', function (self, host, source, ...)
local entity = selo() and selo():GetEntity() or ""
local spec = EntitySpecPresets[entity]
if spec then
spec:OpenEditor()
elseif entity ~= "" then
print("No art spec defined for entity", entity)
end
end,
'ActionContexts', {
"SingleSelection",
"MultipleSelection",
},
'__condition', function (parent, context) return next(EntitySpecPresets) end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Anim Moments",
'ActionId', "E_AnimMoments",
'ActionTranslate', false,
'ActionName', "Anim Metadata",
'ActionIcon', "CommonAssets/UI/Icons/video.tga",
'ActionState', function (self, host)
local sel = editor.GetSel()
if sel and sel[1] and not sel[1]:IsAnimated() then
return "hidden"
end
end,
'OnAction', function (self, host, source, ...)
OpenAnimationMomentsEditor(editor.GetSel()[1])
end,
'ActionContexts', {
"SingleSelection",
},
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Properties (Ctrl-O); Ctrl-RMB is there only to be displayed in context menu",
'ActionId', "E_SelectedOptions",
'ActionTranslate', false,
'ActionName', "Properties",
'ActionIcon', "CommonAssets/UI/Menu/object_options.tga",
'ActionShortcut', "Ctrl-RMB",
'ActionShortcut2', "Ctrl-O",
'OnAction', function (self, host, source, ...) OpenGedGameObjectEditor(editor.GetSel()) end,
'ActionContexts', {
"SingleSelection",
"MultipleSelection",
},
'replace_matching_id', true,
}),
}),
PlaceObj('XTemplateAction', {
'ActionMode', "Editor",
'ActionTranslate', false,
'ActionMenubar', "DevMenu",
'OnActionEffect', "popup",
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'ActionId', "Editor",
'ActionTranslate', false,
'ActionName', "Editor",
'ActionMenubar', "DevMenu",
'OnActionEffect', "popup",
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'ActionId', "Editor.Selections",
'ActionTranslate', false,
'ActionName', "Selections ...",
'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
'OnActionEffect', "popup",
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'comment', "Select Route",
'RolloverText', "Select Route",
'ActionId', "DE_SelectRoute",
'ActionTranslate', false,
'ActionName', "Select Route",
'ActionIcon', "CommonAssets/UI/Menu/SelectRoute.tga",
'OnAction', function (self, host, source, ...)
local way_pt = selo()
if not way_pt then return end
local route = FindRouteWaypoints(way_pt.Route)
editor.ClearSel()
editor.AddToSel(route)
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Turn selected templates into spawned objects (Ctrl-Shift-Y)",
'RolloverText', "Turn selected templates into spawned objects (Ctrl-Shift-Y)",
'ActionId', "E_TurnSelectionToObjects",
'ActionTranslate', false,
'ActionName', "Spawn selected templates",
'ActionIcon', "CommonAssets/UI/Menu/SelectionToObjects.tga",
'ActionShortcut', "Ctrl-Shift-Y",
'OnAction', function (self, host, source, ...) Template.TurnTemplatesIntoObjects(editor.GetSel()) end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Turn selected objects into templates (Ctrl-Shift-T)",
'RolloverText', "Turn selected objects into templates (Ctrl-Shift-T)",
'ActionId', "E_TurnSelectionToTemplates",
'ActionTranslate', false,
'ActionName', "Turn selection to templates",
'ActionIcon', "CommonAssets/UI/Menu/SelectionToTemplates.tga",
'OnAction', function (self, host, source, ...) Template.TurnObjectsIntoTemplates(editor.GetSel()) end,
'replace_matching_id', true,
}),
}),
PlaceObj('XTemplateAction', {
'ActionId', "Editor.Objects",
'ActionTranslate', false,
'ActionName', "Objects ...",
'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
'OnActionEffect', "popup",
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'comment', "Removes texts from the selected objects",
'RolloverText', "Removes texts from the selected objects",
'ActionId', "E_RemoveTextsFromSelected",
'ActionTranslate', false,
'ActionName', "Remove Texts from Selected",
'OnAction', function (self, host, source, ...)
local objs = editor.GetSel()
for i = 1, #objs do
objs[i]:DestroyAttaches("Text")
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Removes texts from the selected objects",
'RolloverText', "Removes texts from the selected objects",
'ActionId', "E_RemoveAllTexts",
'ActionTranslate', false,
'ActionName', "Remove All Texts",
'OnAction', function (self, host, source, ...) RemoveAllTexts() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Adds LOD and distance indicators for the selected objects",
'RolloverText', "Adds LOD and distance indicators for the selected objects",
'ActionId', "E_ShowLOD",
'ActionTranslate', false,
'ActionName', "Show LOD info",
'OnAction', function (self, host, source, ...)
local objs = editor.GetSel()
for i = 1, #objs do
local o = objs[i]
local f = function()
local pDist = o:GetVisualPos() - camera.GetPos()
return "Distance: " .. tostring ( pDist:Len() / guim ) .. "\nLOD: " .. tostring ( o:GetCurrentLOD() )
end
o:AttachUpdatingText(f)
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Displays spots with orientation and name on the selected objects",
'RolloverText', "Displays spots with orientation and name on the selected objects",
'ActionId', "E_ShowSpots",
'ActionTranslate', false,
'ActionName', "Show Spots",
'OnAction', function (self, host, source, ...)
local objs = editor.GetSel()
for i = 1, #objs do
objs[i]:ShowSpots()
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Hides spots from the selected objects. If no objects are selected, it hides all spots",
'RolloverText', "Hides spots from the selected objects. If no objects are selected, it hides all spots",
'ActionId', "E_HideSpots",
'ActionTranslate', false,
'ActionName', "Hide Spots",
'OnAction', function (self, host, source, ...)
local objs = editor.GetSel()
for i = 1, #objs do
objs[i]:HideSpots()
end
end,
'replace_matching_id', true,
}),
}),
PlaceObj('XTemplateAction', {
'ActionId', "Editor.Window",
'ActionTranslate', false,
'ActionName', "Window ...",
'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
'OnActionEffect', "popup",
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Replay Particles",
'RolloverText', "Toggle Particles Replay",
'ActionId', "E_EditorToggleReplayParticles",
'ActionTranslate', false,
'ActionName', "Toggle Replay Particles",
'ActionIcon', "CommonAssets/UI/Menu/object_options.tga",
'ActionShortcut', "Alt-E",
'OnAction', function (self, host, source, ...)
EditorSettings:SetTestParticlesOnChange(not EditorSettings:GetTestParticlesOnChange())
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Replay Particles",
'RolloverText', "Toggle Particles Replay",
'ActionId', "E_EditorReplayParticles",
'ActionTranslate', false,
'ActionName', "Replay Particles",
'ActionIcon', "CommonAssets/UI/Menu/object_options.tga",
'ActionShortcut', "Shift-E",
'OnAction', function (self, host, source, ...)
RecreateSelectedParticle("no delay")
end,
'replace_matching_id', true,
}),
}),
PlaceObj('XTemplateAction', {
'ActionId', "Map",
'ActionTranslate', false,
'ActionName', "Map",
'ActionMenubar', "DevMenu",
'OnActionEffect', "popup",
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'comment', "Saves the map (Ctrl-S)",
'RolloverText', "Saves the map (Ctrl-S)",
'ActionId', "DE_SaveDefaultMap",
'ActionSortKey', "000",
'ActionTranslate', false,
'ActionName', "Save Map",
'ActionIcon', "CommonAssets/UI/Menu/save_city.tga",
'ActionShortcut', "Ctrl-S",
'OnAction', function (self, host, source, ...)
if cameraFly.IsActive() then return end
CreateRealTimeThread(XEditorSaveMap)
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Saves the list of entities present on the map",
'RolloverText', "Saves the list of entities present on the map",
'ActionId', "DE_SaveDefaultMapEntityList",
'ActionSortKey', "0001",
'ActionTranslate', false,
'ActionName', "Save Map Entity List",
'ActionIcon', "CommonAssets/UI/Menu/SaveMapEntityList.tga",
'OnAction', function (self, host, source, ...) SaveMapEntityList(GetMap() .. "entlist.txt") end,
'__condition', function (parent, context) return not editor.IsModdingEditor() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "OpenMapFolder",
'ActionSortKey', "0002",
'ActionTranslate', false,
'ActionName', "Open Map Folder",
'OnAction', function (self, host, source, ...) AsyncExec("explorer " .. ConvertToOSPath("svnAssets/Source/" .. GetMap())) end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "BuildingRulesEditor",
'ActionSortKey', "0004",
'ActionTranslate', false,
'ActionName', "Building Rules Editor",
'OnAction', function (self, host, source, ...)
OpenGedBuildingRulesEditor()
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "NewRoom",
'ActionSortKey', "0003",
'ActionTranslate', false,
'ActionName', "New Room",
'ActionToolbar', "EditorRoomTools",
'ActionToolbarSection', "Room",
'ActionShortcut', "Ctrl-Shift-N",
'OnAction', function (self, host, source, ...)
SetDialogMode("XEditor", "XCreateRoomTool")
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "NewGuides",
'ActionSortKey', "0004",
'ActionTranslate', false,
'ActionName', "New Guides",
'ActionToolbar', "EditorRoomTools",
'ActionToolbarSection', "Place Guides",
'ActionShortcut', "Ctrl-Shift-G",
'OnAction', function (self, host, source, ...)
SetDialogMode("XEditor", "XCreateGuidesTool")
end,
'__condition', function (parent, context) return const.SlabSizeX end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "ToggleRoomSelectionMode",
'ActionSortKey', "0005",
'ActionTranslate', false,
'ActionName', "Toggle Room Selection Mode",
'ActionShortcut', "Ctrl-;",
'OnAction', function (self, host, source, ...)
ToggleRoomSelectionMode()
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "ToggleDestroyedAttachSelection",
'ActionSortKey', "0005",
'ActionTranslate', false,
'ActionName', "Toggle Destroyed Attach Selection",
'ActionShortcut', "Ctrl-N",
'OnAction', function (self, host, source, ...)
ToggleDestroyedAttachSelectionMode()
end,
'__condition', function (parent, context) return Platform.developer and const.SlabSizeX and ShouldAttachSelectionShortcutWork() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "ToggleInvulnerabilityMarkings",
'ActionSortKey', "0005",
'ActionTranslate', false,
'ActionName', "Toggle Invulnerability Markings",
'ActionShortcut', "Ctrl-I",
'OnAction', function (self, host, source, ...)
ToggleInvulnerabilityMarkings()
end,
'__condition', function (parent, context) return Platform.developer and PersistableGlobals.DestructionInProgressObjs and const.SlabSizeX end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "CreateBlackPlanes",
'ActionSortKey', "0005",
'ActionTranslate', false,
'ActionName', "Create Black Planes From Edge Room Edges",
'OnAction', function (self, host, source, ...)
AnalyseRoomsAndPlaceBlackPlanesOnEdges()
end,
'__condition', function (parent, context) return Platform.developer and ShouldBlackPlanesShortcutWork() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "DeleteBlackPlanes",
'ActionSortKey', "0005",
'ActionTranslate', false,
'ActionName', "Delete All Black Planes",
'OnAction', function (self, host, source, ...)
CleanBlackPlanes()
end,
'__condition', function (parent, context) return Platform.developer and ShouldBlackPlanesShortcutWork() end,
'replace_matching_id', true,
}),
}),
PlaceObj('XTemplateAction', {
'ActionId', "Terrain",
'ActionTranslate', false,
'ActionName', "Terrain",
'ActionMenubar', "DevMenu",
'OnActionEffect', "popup",
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'comment', "Fix All Passability Holes",
'RolloverText', "Fix All Passability Holes",
'ActionId', "E_FindPassHoles",
'ActionTranslate', false,
'ActionName', "Fix All Passability Holes",
'ActionIcon', "CommonAssets/UI/Menu/passability.tga",
'OnAction', function (self, host, source, ...)
XEditorUndo:BeginOp{ passability = true, impassability = true, name = "Changed passability" }
table.map(terrain.FindAndFillPassabilityHoles(30, 31), StoreErrorSource)
XEditorUndo:EndOp()
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "ExportTerrainEditor",
'ActionSortKey', "_002",
'ActionTranslate', false,
'ActionName', "Export Terrain",
'OnAction', function (self, host, source, ...)
local filename = GetMapName() .. ".heightmap.raw"
if terrain.ExportHeightMap(filename) then
print(string.format("Terrain heightmap exported to <color 0 255 0>'%s'</color>.", ConvertToOSPath(filename)))
else
print(string.format("<color 255 0 0>Error exporting terrain heightmap!</color>"))
end
end,
'replace_matching_id', true,
}),
}),
PlaceObj('XTemplateAction', {
'ActionId', "Objects",
'ActionTranslate', false,
'ActionName', "Objects",
'ActionMenubar', "DevMenu",
'OnActionEffect', "popup",
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'comment', "Hide selected objects",
'RolloverText', "Hide selected objects",
'ActionId', "E_HideSelected",
'ActionTranslate', false,
'ActionName', "Hide selected",
'ActionIcon', "CommonAssets/UI/Menu/HideSelected.tga",
'OnAction', function (self, host, source, ...) editor.HideSelected() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Hide unselected objects",
'RolloverText', "Hide unselected objects",
'ActionId', "E_HideUnselected",
'ActionTranslate', false,
'ActionName', "Hide unselected",
'ActionIcon', "CommonAssets/UI/Menu/HideUnselected.tga",
'OnAction', function (self, host, source, ...) editor.HideUnselected() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Show all hidden objects",
'RolloverText', "Show all hidden objects",
'ActionId', "E_ShowAll",
'ActionTranslate', false,
'ActionName', "Show all",
'ActionIcon', "CommonAssets/UI/Menu/ShowAll.tga",
'OnAction', function (self, host, source, ...) editor.ShowHidden() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Add objects to collection (Ctrl-G)",
'RolloverText', "Add objects to collection (Ctrl-G)",
'ActionId', "E_AddToCollection",
'ActionTranslate', false,
'ActionName', "Add objects to collection",
'ActionShortcut', "Ctrl-G",
'OnAction', function (self, host, source, ...) Collection.AddToCollection() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Unlock collection (Alt-Shift-Z)",
'RolloverText', "Unlock collection (Alt-Shift-Z)",
'ActionId', "E_UnlockCollection",
'ActionTranslate', false,
'ActionName', "Unlock collection",
'ActionIcon', "CommonAssets/UI/Menu/UnlockCollection.tga",
'ActionShortcut', "Alt-Shift-Z",
'ActionToggle', true,
'ActionToggled', function (self, host)
return editor.GetLockedCollectionIdx() ~= 0
end,
'OnAction', function (self, host, source, ...) Collection.UnlockAll() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Create collection (G)",
'RolloverText', "Create collection (G)",
'ActionId', "E_CollectObjects",
'ActionTranslate', false,
'ActionName', "Create collection",
'ActionIcon', "CommonAssets/UI/Menu/CollectObjects.tga",
'ActionShortcut', "G",
'OnAction', function (self, host, source, ...)
if IsEditorActive() then
local sel = editor.GetSel()
if sel and #sel > 0 then
Collection.Collect(sel)
end
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Lock collection (Alt-Z)",
'RolloverText', "Lock collection (Alt-Z)",
'ActionId', "E_LockCollection",
'ActionTranslate', false,
'ActionName', "Lock selected collection",
'ActionIcon', "CommonAssets/UI/Menu/LockCollection.tga",
'ActionShortcut', "Alt-Z",
'OnAction', function (self, host, source, ...)
local obj = editor.GetSel()[1]
local col = obj and obj:GetRootCollection()
if col then
col:SetLocked(true)
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Select objects that share class with the selection",
'RolloverText', "Select objects that share class with the selection",
'ActionId', "E_SelectAllObjectsFromThisClass",
'ActionTranslate', false,
'ActionName', "Select objects that share class with the selection",
'OnAction', function (self, host, source, ...)
local sel = editor.GetSel()
if not sel or #sel == 0 then
return
end
local classes = table.get_unique(table.map(sel, "class"))
editor.ClearSel()
editor.AddToSel(MapGet("map", classes) or empty_table)
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Select all objects by a class name",
'RolloverText', "Select all objects by a class name",
'ActionId', "E_SelectObjectByClassName",
'ActionTranslate', false,
'ActionName', "Select objects by class name",
'ActionIcon', "CommonAssets/UI/Menu/SelectByClassName.tga",
'OnAction', function (self, host, source, ...)
CreateRealTimeThread( function()
local class = WaitInputText(nil, "Select by Class", "CObject")
if not class then return end
editor.SelectByClass(class)
end)
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Selection editor (Ctrl-E)",
'RolloverText', "Selection editor (Ctrl-E)",
'ActionId', "E_ObjsStats",
'ActionTranslate', false,
'ActionName', "Selection editor",
'ActionIcon', "CommonAssets/UI/Menu/SelectionEditor.tga",
'ActionShortcut', "Ctrl-E",
'OnAction', function (self, host, source, ...)
if cameraFly.IsActive() then return end
if not GetDialog("SelectionEditorDlg") then
XEditorSetDefaultTool()
OpenDialog("SelectionEditorDlg")
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Select Similar Slabs (Ctrl-.)",
'RolloverText', "Select Similar Slabs (Ctrl-.)",
'ActionId', "E_SelectSimilarSlabs",
'ActionTranslate', false,
'ActionName', "Select Similar Slabs",
'ActionShortcut', "Ctrl-.",
'OnAction', function (self, host, source, ...)
EditorSelectSimilarSlabs()
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Select Similar Slabs Precise (Ctrl-Shift-.)",
'RolloverText', "Select Similar Slabs Precise (Ctrl-Shift-.)",
'ActionId', "E_SelectSimilarSlabsPrecise",
'ActionTranslate', false,
'ActionName', "Select Similar Slabs Precise",
'ActionShortcut', "Ctrl-Shift-.",
'OnAction', function (self, host, source, ...)
EditorSelectSimilarSlabs(true)
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Destroy Selected Objects (Shift-D)",
'RolloverText', "Destroy Selected Objects (Shift-D)",
'ActionId', "E_DestroySelectedObjects",
'ActionTranslate', false,
'ActionName', "Destroy Selected Objects",
'ActionShortcut', "Shift-D",
'OnAction', function (self, host, source, ...)
EditorDestroyRepairSelectedObjs("destroy")
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Repair Selected Objects (Shift-R)",
'RolloverText', "Repair Selected Objects (Shift-R)",
'ActionId', "E_RepairSelectedObjects",
'ActionTranslate', false,
'ActionName', "Repair Selected Objects",
'ActionShortcut', "Shift-R",
'OnAction', function (self, host, source, ...)
EditorDestroyRepairSelectedObjs()
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Associate Lights For Destruction",
'RolloverText', "Associate Lights For Destruction",
'ActionId', "E_AssociateLightsForDestruction",
'ActionTranslate', false,
'ActionName', "Associate Lights For Destruction",
'ActionMenubar', "Map",
'ActionShortcut', "Shift-V",
'OnAction', function (self, host, source, ...)
AssociateLights()
end,
'__condition', function (parent, context) return rawget(_G, "ShouldShowAssociateLightsShortcut") and ShouldShowAssociateLightsShortcut() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Cycle Detail Class",
'RolloverText', "Cycle Detail Class",
'ActionId', "E_CycleDetailClass",
'ActionTranslate', false,
'ActionName', "Cycle Detail Class",
'ActionShortcut', "Shift-W",
'ActionMouseBindable', false,
'OnAction', function (self, host, source, ...)
editor.CycleDetailClass()
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'RolloverText', "Force Detail Class Eye Candy",
'ActionId', "E_ForceDetailClassEyeCandy",
'ActionTranslate', false,
'ActionName', "Force Detail Class Eye Candy",
'ActionShortcut', "Shift-Q",
'ActionMouseBindable', false,
'OnAction', function (self, host, source, ...)
editor.ForceEyeCandy()
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'RolloverText', "Force Eye Candy Outside Map",
'ActionId', "E_ForceDetailClassEyeCandyOutsideMap",
'ActionTranslate', false,
'ActionName', "Force Eye Candy Outside Map",
'ActionIcon', "CommonAssets/UI/Icons/diamond jewelry ruby",
'ActionMouseBindable', false,
'OnAction', function (self, host, source, ...)
editor.EyeCandyOutsideMap()
end,
'__condition', function (parent, context) return Platform.developer end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Toggle Detail Class Visualization",
'RolloverText', "Toggle Detail Class Visualization",
'ActionId', "E_ToggleDetailClassVisualization",
'ActionTranslate', false,
'ActionName', "Visualize Detail Class",
'ActionIcon', "CommonAssets/UI/Icons/accessory diamond",
'ActionMouseBindable', false,
'ActionToggle', true,
'ActionToggled', function (self, host)
return hr.VisualizeDetailClass == 1
end,
'OnAction', function (self, host, source, ...)
hr.VisualizeDetailClass = 1 - hr.VisualizeDetailClass
end,
'replace_matching_id', true,
}),
}),
PlaceObj('XTemplateAction', {
'ActionId', "Tools",
'ActionTranslate', false,
'ActionName', "Tools",
'ActionMenubar', "DevMenu",
'OnActionEffect', "popup",
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'ActionId', "Tools.Extras",
'ActionTranslate', false,
'ActionName', "Extras ...",
'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
'OnActionEffect', "popup",
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'comment', "Toggle Objects Rotation",
'RolloverText', "Toggle Objects Rotation",
'ActionId', "tex_EditorRotateSelObjects",
'ActionTranslate', false,
'ActionName', "Toggle Objects Rotation",
'ActionIcon', "CommonAssets/UI/Menu/RotateObjectsTool.tga",
'OnAction', function (self, host, source, ...)
local sel = editor:GetSel()
local objects = editor.RotatingObjects
for i = 1, #sel do
local selelem = sel[i]
local bFound = false
for j = #objects, 1, -1 do
local elem = objects[j]
-- remove
if elem.obj == selelem then
table.remove(objects, j)
selelem:SetAngle(60 * elem.angle)
bFound = true
end
end
-- add
if not bFound then
objects[#objects + 1] = { obj = selelem, angle = selelem:GetAngle()/60 }
end
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Show-Hide Collision Geometry of selected objects",
'RolloverText', "Show-Hide Collision Geometry of selected objects",
'ActionId', "E_ShowCollisionGeometry",
'ActionTranslate', false,
'ActionName', "Show-Hide Collision Geometry",
'ActionIcon', "CommonAssets/UI/Menu/CollisionGeometry.tga",
'OnAction', function (self, host, source, ...) ToggleHR("ShowSelectionCollisions") end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Toggle particles (Shift-P)",
'RolloverText', "Toggle particles (Shift-P)",
'ActionId', "E_ToggleParticles",
'ActionTranslate', false,
'ActionName', "Toggle Particles",
'ActionShortcut', "Shift-P",
'OnAction', function (self, host, source, ...)
ToggleInvisibleObjectHelpers()
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Toggle Camera Type (Ctrl-Shift-W)",
'RolloverText', "Toggle Camera Type (Ctrl-Shift-W)",
'ActionId', "E_CameraChange",
'ActionTranslate', false,
'ActionName', "Toggle Camera Type",
'ActionIcon', "CommonAssets/UI/Menu/CameraToggle.tga",
'ActionShortcut', "Ctrl-Shift-W",
'OnAction', function (self, host, source, ...)
if cameraRTS.IsActive() then
cameraFly.Activate(1)
elseif cameraFly.IsActive() then
cameraMax.Activate(1)
else
cameraRTS.Activate(1)
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Camera Save (Alt-,)",
'RolloverText', "Camera Save (Alt-,)",
'ActionId', "E_CameraSave",
'ActionTranslate', false,
'ActionName', "Camera Save",
'ActionIcon', "CommonAssets/UI/Menu/UnlockCamera.tga",
'ActionShortcut', "Alt-,",
'OnAction', function (self, host, source, ...)
LocalStorage.saved_camera = {GetCamera()}
SaveLocalStorage()
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Camera Load (Alt-.)",
'RolloverText', "Camera Load (Alt-.)",
'ActionId', "E_CameraLoad",
'ActionTranslate', false,
'ActionName', "Camera Load",
'ActionIcon', "CommonAssets/UI/Menu/CameraEditor.tga",
'ActionShortcut', "Alt-.",
'OnAction', function (self, host, source, ...)
if LocalStorage.saved_camera then
SetCamera(unpack_params(LocalStorage.saved_camera))
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Toggle spawned objects (Ctrl-Shift-H)",
'RolloverText', "Toggle spawned objects (Ctrl-Shift-H)",
'ActionId', "E_ToggleSpawnedObjects",
'ActionTranslate', false,
'ActionName', "Toggle spawned objects",
'ActionIcon', "CommonAssets/UI/Menu/ToggleSpawn.tga",
'ActionShortcut', "Ctrl-Shift-H",
'ActionToggle', true,
'ActionToggled', function (self, host)
return HiddenSpawnedObjects
end,
'OnAction', function (self, host, source, ...) ToggleSpawnedObjects() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "List new entities for the past 7 days",
'RolloverText', "List new entities for the past 7 days",
'ActionId', "List New Entities",
'ActionTranslate', false,
'ActionName', "List new entities",
'OnAction', function (self, host, source, ...)
CreateRealTimeThread(function() _ListNewEntities(7) end)
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Install URL handler",
'RolloverText', "Install URL handler",
'ActionId', "Install URL handler",
'ActionTranslate', false,
'ActionName', "Install URL handler",
'OnAction', function (self, host, source, ...)
CreateRealTimeThread(function() SetupHGRunUrl() end)
end,
'replace_matching_id', true,
}),
}),
PlaceObj('XTemplateAction', {
'ActionId', "Tools.Collections",
'ActionTranslate', false,
'ActionName', "Collections ...",
'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
'OnActionEffect', "popup",
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'comment', "Remove All Collections",
'RolloverText', "Remove All Collections",
'ActionId', "DE_RemoveAllCollections",
'ActionTranslate', false,
'ActionName', "Remove All Collections",
'OnAction', function (self, host, source, ...)
local removed = Collection.RemoveAll()
print(removed, "collections removed")
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Remove All Nested Collections",
'RolloverText', "Remove All Nested Collections",
'ActionId', "DE_RemoveAllNestedCollections",
'ActionTranslate', false,
'ActionName', "Remove Nested Collections",
'OnAction', function (self, host, source, ...)
local removed = Collection.RemoveAll(1)
print(removed, "collections removed")
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Remove All Single Object Collections",
'RolloverText', "Remove All Single Object Collections",
'ActionId', "DE_RemoveAllSingleObjectCollections",
'ActionTranslate', false,
'ActionName', "Remove Single Object Collections",
'OnAction', function (self, host, source, ...)
local cols, removed = Collection.GetValid("remove_invalid", 2)
print(removed, "collections removed")
end,
'replace_matching_id', true,
}),
}),
PlaceObj('XTemplateAction', {
'comment', "Align object to terrain (Shift-A)",
'RolloverText', "Align object to terrain (Shift-A)",
'ActionId', "E_AxisOrientation",
'ActionTranslate', false,
'ActionName', "Align object to terrain",
'ActionIcon', "CommonAssets/UI/Menu/Axis.tga",
'ActionShortcut', "Shift-A",
'OnAction', function (self, host, source, ...)
local function RndOffs(deg)
local pt
local sign
local x, y, z
sign = AsyncRand(2)
if sign==0 then sign = -1 end
x = sign*AsyncRand(deg)
sign = AsyncRand(2)
if sign==0 then sign = -1 end
y = sign*AsyncRand(deg)
sign = AsyncRand(2)
if sign==0 then sign = -1 end
z = sign*AsyncRand(deg)
pt = point(x,y,z)
return pt
end
local objects = editor:GetSel()
XEditorUndo:BeginOp{ objects = objects, name = string.format("Aligned %d objects to terrain", #objects) }
SuspendPassEdits("E_AxisOrientation")
rawset(_G, "sState", rawget(_G, "sState") or "Up")
if sState == "Up" then
for i = 1, #objects do
local obj = objects[i]
local dir, angle = obj:GetOrientation()
obj:SetOrientation(axis_z, angle)
end
sState = "terrain_normal"
elseif sState == "terrain_normal" then
for i = 1, #objects do
local obj = objects[i]
local dir, angle = obj:GetOrientation()
obj:SetOrientation(terrain.GetTerrainNormal(obj:GetPos()), angle)
end
sState = "terrain_normal_deviation"
elseif sState == "terrain_normal_deviation" then
for i = 1, #objects do
local obj = objects[i]
local dir, angle = obj:GetOrientation()
dir = terrain.GetTerrainNormal(obj:GetPos()) + RndOffs(30)
obj:SetOrientation(dir, angle)
end
sState = "Up"
end
ResumePassEdits("E_AxisOrientation")
XEditorUndo:EndOp(objects)
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', " (Alt-D)",
'RolloverText', " (Alt-D)",
'ActionId', "E_DistributeObjects",
'ActionTranslate', false,
'ActionName', "Distribute Objects",
'ActionShortcut', "Alt-D",
'OnAction', function (self, host, source, ...)
if g_DistribObjs then return end
local sel = editor.GetSel()
if #sel < 2 then
print("Select 2 (or more) objects")
return
end
g_DistribObjs = DistribObjs:new{
obj_sel = sel,
project = true,
}
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Mirror selected object (Shift-M)",
'RolloverText', "Mirror selected object (Shift-M)",
'ActionId', "E_Mirror",
'ActionTranslate', false,
'ActionName', "Mirror object",
'ActionIcon', "CommonAssets/UI/Menu/Mirror.tga",
'ActionShortcut', "Shift-M",
'OnAction', function (self, host, source, ...)
local sel = editor:GetSel()
editor.MirrorSel(sel)
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', " (Ctrl-Alt-R)",
'RolloverText', " (Ctrl-Alt-R)",
'ActionId', "E_CustomScale",
'ActionTranslate', false,
'ActionName', "Random Scale Objects",
'ActionShortcut', "Ctrl-Alt-R",
'OnAction', function (self, host, source, ...)
CreateRealTimeThread( function()
local ol = editor.GetSel()
local n = WaitInputText(nil, "Scale Range (e.g. 90-110)", LocalStorage.CustomEditorOps and LocalStorage.CustomEditorOps.E_CustomScale or "80-120")
if not n or not tonumber(n)then return end
local low, high
low = tonumber(n)
if low == nil then
low, high = string.match(n, "(%d+)%-(%d+)")
low = tonumber(low)
high = tonumber(high)
else
high = low
end
XEditorUndo:BeginOp{ objects = editor.GetSel(), name = string.format("Random scaled %d objects", #editor.GetSel()) }
for i=1,#ol do
local o = ol[i]
o:SetScale(low + AsyncRand(high - low + 1))
end
XEditorUndo:EndOp( editor.GetSel() )
LocalStorage.CustomEditorOps = LocalStorage.CustomEditorOps or {}
LocalStorage.CustomEditorOps.E_CustomScale = n
end )
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', " (Ctrl-R)",
'RolloverText', " (Ctrl-R)",
'ActionId', "E_RandomRotate",
'ActionTranslate', false,
'ActionName', "Random rotate objects",
'ActionShortcut', "Ctrl-R",
'OnAction', function (self, host, source, ...)
local ol = editor.GetSel()
XEditorUndo:BeginOp{ objects = editor.GetSel(), name = string.format("Random rotated %d objects", #editor.GetSel()) }
for i=1,#ol do
local o = ol[i]
o:SetAngle(AsyncRand(360*60))
end
XEditorUndo:EndOp( editor.GetSel() )
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', " (Ctrl-K)",
'RolloverText', " (Ctrl-K)",
'ActionId', "E_Rotate90X",
'ActionTranslate', false,
'ActionName', "Rotate Object 180",
'ActionShortcut', "Ctrl-K",
'OnAction', function (self, host, source, ...)
local ol = editor.GetSel()
XEditorUndo:BeginOp{ objects = editor.GetSel(), name = string.format("Rotated %d objects", #editor.GetSel()) }
for i=1,#ol do
local o = ol[i]
local axis, angle = ComposeRotation( axis_y, 90*60, o:GetAxis(), o:GetAngle() )
o:SetAxis( axis )
o:SetAngle( angle )
end
XEditorUndo:EndOp( editor.GetSel() )
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "(Ctrl-J)",
'RolloverText', "(Ctrl-J)",
'ActionId', "E_Rotate90Z",
'ActionTranslate', false,
'ActionName', "Rotate Object 90 Z",
'ActionShortcut', "Ctrl-J",
'OnAction', function (self, host, source, ...)
local ol = editor.GetSel()
XEditorUndo:BeginOp{ objects = editor.GetSel(), name = string.format("Rotated %d objects", #editor.GetSel()) }
for i=1,#ol do
local o = ol[i]
local axis, angle = ComposeRotation( axis_z, 90*60, o:GetAxis(), o:GetAngle() )
o:SetAxis( axis )
o:SetAngle( angle )
end
XEditorUndo:EndOp( editor.GetSel() )
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Select objects on the same floor (Shift-F)",
'RolloverText', "Select objects on the same floor (Shift-F)",
'ActionId', "SelectFloor",
'ActionTranslate', false,
'ActionName', "Select objects on the same floor",
'ActionIcon', "CommonAssets/UI/Menu/Cube.tga",
'ActionShortcut', "Shift-F",
'OnAction', function (self, host, source, ...) SelectSameFloorObjects(editor.GetSel()) end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Snap selected object(s) onto terrain (Ctrl-D)",
'RolloverText', "Snap selected object(s) onto terrain (Ctrl-D)",
'ActionId', "E_ResetZ",
'ActionTranslate', false,
'ActionName', "Snap objects to terrain",
'ActionShortcut', "Ctrl-D",
'OnAction', function (self, host, source, ...) editor.ResetZ() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "(Ctrl-Alt-I)",
'RolloverText', "(Ctrl-Alt-I)",
'ActionId', "E_RecreateRoomWallOrFloor",
'ActionTranslate', false,
'ActionName', "Recreate Room Slab Wall or Floor",
'ActionShortcut', "Ctrl-Alt-I",
'OnAction', function (self, host, source, ...)
RecreateSelectedSlabFloorWall()
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Snap selected object(s) onto room roof (Ctrl-Alt-D)",
'RolloverText', "Snap selected object(s) onto room roof (Ctrl-Alt-D)",
'ActionId', "E_SnapToRoof",
'ActionTranslate', false,
'ActionName', "Snap objects to roof",
'ActionShortcut', "Ctrl-Alt-D",
'OnAction', function (self, host, source, ...)
editor.SnapToRoof()
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Clear selected object(s)' roof flags (Alt-Shift-D)",
'RolloverText', "Clear selected object(s)' roof flags (Alt-Shift-D)",
'ActionId', "E_ClearRoofFlag",
'ActionTranslate', false,
'ActionName', "Clear objects roof flag",
'ActionShortcut', "Alt-Shift-D",
'OnAction', function (self, host, source, ...)
editor.ClearRoofFlags()
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Toggle whether an obj should hide with its encompassing room. (Alt-H)",
'RolloverText', "Toggle whether an obj should hide with its encompassing room. (Alt-H)",
'ActionId', "E_ToggleDontHideWithRoom",
'ActionTranslate', false,
'ActionName', "Toggle don't hide with room flag",
'ActionShortcut', "Alt-H",
'OnAction', function (self, host, source, ...)
editor.ToggleDontHideWithRoom()
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Snap selected object(s) onto terrain while preserving their relative positions. (Ctrl-Shift-D)",
'RolloverText', "Snap selected object(s) onto terrain while preserving their relative positions. (Ctrl-Shift-D)",
'ActionId', "E_ResetZRelative",
'ActionTranslate', false,
'ActionName', "Snap objects to terrain (Relative)",
'ActionShortcut', "Ctrl-Shift-D",
'OnAction', function (self, host, source, ...) editor.ResetZ(true) end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Toggle Force Night (for light objects)",
'RolloverText', "Toggle Force Night (for light objects)",
'ActionId', "Toggle Force Night",
'ActionTranslate', false,
'ActionName', "Toggle Force Night",
'ActionIcon', "CommonAssets/UI/Menu/ToggleEnvMap.tga",
'OnAction', function (self, host, source, ...)
EditorForceNight = not EditorForceNight
MapForEach("map", "LightObject", function(x) x:UpdateLight(CurrentLightmodel[1]) end)
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Toggle Transparency Cone",
'RolloverText', "Toggle Transparency Cone",
'ActionId', "Toggle Transparency Cone",
'ActionTranslate', false,
'ActionName', "Toggle Transparency Cone",
'ActionIcon', "CommonAssets/UI/Menu/ToggleEnvMap.tga",
'OnAction', function (self, host, source, ...) return ToggleTransparencyCone() end,
'replace_matching_id', true,
}),
}),
PlaceObj('XTemplateAction', {
'comment', "Replace object(s) with object(s) from other class (Shift-~)",
'ActionId', "E_ReplaceObjects",
'ActionTranslate', false,
'ActionShortcut', "Shift-~",
'OnAction', function (self, host, source, ...)
CreateRealTimeThread( function()
local c = selo()
if c and IsValid(c) then
local class = WaitInputText(nil, "Type class name(s)", c.class)
if class then
editor.ReplaceObjects(editor:GetSel(), class)
end
end
end)
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Array (Ctrl-Numpad *)",
'ActionId', "Array",
'ActionTranslate', false,
'ActionShortcut', "Ctrl-Numpad *",
'OnAction', function (self, host, source, ...)
CreateRealTimeThread( function()
local sel = editor.GetSel()
if #sel == 2 then
local n = WaitInputText(nil, "Number of objects", "3")
if not n then return end
n = tonumber(n)
if n and n > 2 then
XEditorUndo:BeginOp{ objects = sel }
local pt = sel[1]:GetVisualPos()
local vec = sel[2]:GetVisualPos() - pt
for i=3,n do
sel[i] = sel[2]:Clone()
sel[i]:SetGameFlags(const.gofPermanent)
sel[i]:SetPos( pt + (i-1) * vec )
end
XEditorUndo:EndOp(sel)
editor.ChangeSelWithUndoRedo(sel)
end
end
end)
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', " (V)",
'ActionId', "E_ViewSelection",
'ActionTranslate', false,
'ActionShortcut', "V",
'OnAction', function (self, host, source, ...)
local sel = editor.GetSel()
local cnt = #sel
local center = point30
for i = 1, cnt do
local bsc = sel[i]:GetBSphere()
center = center + bsc
end
if cnt > 0 then
-- find center of the selection
center = point( center:x() / cnt, center:y() / cnt, const.InvalidZ )
center = center:SetZ(terrain.GetHeight(center))
-- find the radius of the bounding sphere of the selection
local selSize = 0
for i = 1, cnt do
local bsc, bsr = sel[i]:GetBSphere()
local dist = bsc:Dist(center) + bsr
if selSize < dist then
selSize = dist
end
end
--print( selSize )
local pos, lookat = cameraMax.GetPosLookAt()
--local minZ, maxZ = cameraRTS.GetHeightInterval()
--local highestPoint = point( pos:x(), pos:y(), pos:z() + maxZ )
--local maxDistToEye = highestPoint:Dist(lookat)
--print( maxDistToEye )
-- move the camera position to look in the center of the selection
local vec = pos - lookat
-- if the distance from the camera to the selection center is smaller than the selection bsphere radius
-- move the camera back
local distToEye = vec:Dist(point30)
local scale = (selSize * 1000) / distToEye
--if (distToEye * scale) / 1000 > maxDistToEye then
-- scale = (maxDistToEye * 1000) / distToEye
-- print( "clamped" )
--end
if scale > 1000 then
--print( scale )
--print( vec )
vec = point( (vec:x() * scale) / 1000, (vec:y() * scale) / 1000, (vec:z() * scale) / 1000 )
--print( vec )
end
pos = center + vec
cameraMax.SetCamera( pos, center, 0 )
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Redo editor operation (Ctrl-Y)",
'ActionId', "E_Redo",
'ActionTranslate', false,
'ActionShortcut', "Ctrl-Y",
'OnAction', function (self, host, source, ...)
XEditorUndo:UndoRedo("redo")
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Disable group selection (Ctrl-Q)",
'RolloverText', "Disable group selection (Ctrl-Q)",
'ActionId', "E_DisableGroupSelection",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Editor/Tools/SelectSingleObject.tga",
'ActionToolbar', "EditorStatusbar",
'ActionShortcut', "Ctrl-Q",
'ActionToggle', true,
'ActionToggled', function (self, host)
return XEditorSelectSingleObjects == 1
end,
'OnAction', function (self, host, source, ...)
XEditorSelectSingleObjects = 1-XEditorSelectSingleObjects
local statusbar = GetDialog("XEditorStatusbar")
if statusbar then
statusbar:ActionsUpdated()
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Hide all texts (Alt-Shift-T)",
'RolloverText', "Hide all texts (Alt-Shift-T)",
'ActionId', "E_HideAllTexts",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Editor/Tools/HideTexts.tga",
'ActionToolbar', "EditorStatusbar",
'ActionShortcut', "Alt-Shift-T",
'ActionToggle', true,
'ActionToggled', function (self, host)
return XEditorHideTexts == true
end,
'OnAction', function (self, host, source, ...)
XEditorHideTexts = not XEditorHideTexts
XEditorUpdateHiddenTexts()
local statusbar = GetDialog("XEditorStatusbar")
if statusbar then
statusbar:ActionsUpdated()
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Hide code renderables (Alt-Shift-R)",
'RolloverText', "Hide code renderables (Alt-Shift-R)",
'ActionId', "E_HideCodeRenderables",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Editor/Tools/HideCodeRenderables.tga",
'ActionToolbar', "EditorStatusbar",
'ActionShortcut', "Alt-Shift-R",
'ActionToggle', true,
'ActionToggled', function (self, host)
return hr.RenderCodeRenderables == 0
end,
'OnAction', function (self, host, source, ...)
hr.RenderCodeRenderables = 1 - hr.RenderCodeRenderables
local tool = XEditorGetCurrentTool()
if tool.UsesCodeRenderables or IsKindOf(tool, "XEditorPlacementHelperHost") and tool.placement_helper.UsesCodeRenderables then
if XEditorIsDefaultTool() then
tool:SetHelperClass("XSelectObjectsHelper")
else
XEditorSetDefaultTool()
end
end
local statusbar = GetDialog("XEditorStatusbar")
if statusbar then
statusbar:ActionsUpdated()
end
end,
'__condition', function (parent, context) return not editor.IsModdingEditor() end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Open caves (Alt-Shift-E)",
'RolloverText', "Open caves (Alt-Shift-E)",
'ActionId', "E_OpenCaves",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Editor/Tools/CavesView",
'ActionToolbar', "EditorStatusbar",
'ActionShortcut', "Alt-Shift-E",
'ActionToggle', true,
'ActionToggled', function (self, host)
return CavesOpened
end,
'OnAction', function (self, host, source, ...)
EditorSetCavesOpen(not CavesOpened)
end,
'__condition', function (parent, context) return const.CaveTileSize end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Room tools (Alt-R)",
'RolloverText', "Room tools (Alt-R)",
'ActionId', "E_RoomTools",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Editor/Tools/RoomTools",
'ActionToolbar', "EditorStatusbar",
'ActionShortcut', "Alt-R",
'ActionToggle', true,
'ActionToggled', function (self, host)
return GetDialog("XEditorRoomTools")
end,
'OnAction', function (self, host, source, ...)
if GetDialog("XEditorRoomTools") then
CloseDialog("XEditorRoomTools")
else
OpenDialog("XEditorRoomTools")
end
local statusbar = GetDialog("XEditorStatusbar")
if statusbar then
statusbar:ActionsUpdated()
end
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Editor settings",
'RolloverText', "Editor settings (Ctrl-F3)",
'ActionId', "E_EditorSettings",
'ActionTranslate', false,
'ActionName', "Editor Settings",
'ActionIcon', "CommonAssets/UI/Editor/Tools/EditorSettings",
'ActionToolbar', "EditorStatusbar",
'ActionShortcut', "Ctrl-F3",
'OnAction', function (self, host, source, ...)
XEditorSettings:ToggleGedEditor()
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Editor settings",
'RolloverText', "Getting started (F1)",
'ActionId', "E_EditorHelpText",
'ActionTranslate', false,
'ActionName', "Help",
'ActionIcon', "CommonAssets/UI/Editor/Tools/Help",
'ActionToolbar', "EditorStatusbar",
'ActionShortcut', "F1",
'OnAction', function (self, host, source, ...)
GetDialog("XEditor"):ShowHelpText()
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', " (Ctrl-Pagedown)",
'ActionId', "E_ResetZ2",
'ActionTranslate', false,
'ActionShortcut', "Ctrl-Pagedown",
'OnAction', function (self, host, source, ...)
editor.ResetZ()
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Undo editor operation (Ctrl-Z)",
'ActionId', "E_Undo",
'ActionTranslate', false,
'ActionShortcut', "Ctrl-Z",
'OnAction', function (self, host, source, ...)
XEditorUndo:UndoRedo("undo")
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Measure tool (Alt-M)",
'RolloverText', "Measure tool (Alt-M)",
'ActionId', "DE_ToggleMeasure_Old",
'ActionSortKey', "00",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Menu/MeasureTool.tga",
'ActionShortcut', "Alt-M",
'ActionToggle', true,
'ActionToggled', function (self, host)
return GetDialogMode("XEditor") == "XMeasureTool"
end,
'OnAction', function (self, host, source, ...)
SetDialogMode("XEditor", "XMeasureTool")
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Show/Hide the User Actions toolbar (Tab)",
'ActionId', "DE_Toolbar",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Menu/default.tga",
'ActionShortcut', "Tab",
'OnAction', function (self, host, source, ...)
if IsEditorActive() then
XShortcutsTarget:Toggle()
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'comment', "Toggle between local and global coordinate systems for helpers (Shift-C)",
'ActionId', "DE_LocalCoordinates",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Menu/default.tga",
'ActionShortcut', "Shift-C",
'OnAction', function (self, host, source, ...)
if IsEditorActive() then
SetLocalCS(not GetLocalCS())
end
end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "SelectNorthWall",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Menu/default.tga",
'ActionShortcut', "Ctrl-[",
'OnAction', function (self, host, source, ...)
SelectedRoomSelectWall("North")
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "SelectEastWall",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Menu/default.tga",
'ActionShortcut', "Ctrl-]",
'OnAction', function (self, host, source, ...)
SelectedRoomSelectWall("East")
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "SelectWestWall",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Menu/default.tga",
'ActionShortcut', "Ctrl-P",
'OnAction', function (self, host, source, ...)
SelectedRoomSelectWall("West")
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "SelectSouthWall",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Menu/default.tga",
'ActionShortcut', "Ctrl-'",
'OnAction', function (self, host, source, ...)
SelectedRoomSelectWall("South")
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "ClearSelectedWall",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Menu/default.tga",
'ActionShortcut', "Ctrl--",
'OnAction', function (self, host, source, ...)
SelectedRoomClearSelectedWall()
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "ResetWallMaterials",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Menu/default.tga",
'ActionShortcut', "Ctrl-Backspace",
'OnAction', function (self, host, source, ...)
SelectedRoomResetWallMaterials()
end,
'__condition', function (parent, context) return config.MapEditorRooms end,
'replace_matching_id', true,
}),
PlaceObj('XTemplateAction', {
'ActionId', "ShowHideEditedMapVariation",
'ActionTranslate', false,
'ActionIcon', "CommonAssets/UI/Menu/default.tga",
'ActionShortcut', "M",
'OnAction', function (self, host, source, ...)
if CurrentMapVariation then
CreateRealTimeThread(XEditorHideShowVariation, CurrentMapVariation)
else
print("No map variation is currently active.")
end
end,
'__condition', function (parent, context) return Platform.developer end,
'replace_matching_id', true,
}),
}),
}),
PlaceObj('XTemplateAction', {
'comment', "Modding editor overrides",
'ActionId', "ModdingEditor",
'ActionTranslate', false,
'ActionName', "Modding Editor",
'ActionMenubar', "DevMenu",
'OnActionEffect', "popup",
'__condition', function (parent, context) return config.ModdingToolsInUserMode and config.Mods end,
'replace_matching_id', true,
}, {
PlaceObj('XTemplateAction', {
'comment', "Saves the map editor changes (Ctrl-S)",
'RolloverText', "Saves the map editor changes (Ctrl-S)",
'ActionId', "DE_SaveDefaultMap",
'ActionTranslate', false,
'ActionName', "Save Map",
'ActionIcon', "CommonAssets/UI/Menu/save_city.tga",
'ActionShortcut', "Ctrl-S",
'OnAction', function (self, host, source, ...)
if editor.ModItem and not editor.ModItem:IsPacked() then
CreateRealTimeThread(function()
editor.ModItem:SaveMap()
SetEditorMapDirty(false)
end)
end
end,
'replace_matching_id', true,
}),
}),
})
|