File size: 78,141 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
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
-- ========== GENERATED BY XTemplate Editor (Alt-F3) DO NOT EDIT MANUALLY! ==========

PlaceObj('XTemplate', {
	SortKey = 200,
	group = "Shortcuts",
	id = "DebugShortcuts",
	save_in = "Libs/Debug",
	PlaceObj('XTemplateGroup', {
		'__condition', function (parent, context) return true end,
	}, {
		PlaceObj('XTemplateAction', {
			'ActionTranslate', false,
			'ActionMenubar', "DevMenu",
			'OnActionEffect', "popup",
			'replace_matching_id', true,
		}, {
			PlaceObj('XTemplateForEach', {
				'comment', "Preset editors",
				'array', function (parent, context) return ClassDescendantsList("Preset") end,
				'condition', function (parent, context, item, i) local class = g_Classes[item] local PresetClass = class and class.PresetClass or item return class and class.GedEditor and class.GedEditor ~= "" and class.EditorMenubarName and (PresetClass == item or g_Classes[PresetClass].GedEditor ~= class.GedEditor) end,
				'run_after', function (child, context, item, i, n, last)
					local class = g_Classes[item]
					child.ActionId = "PresetEditor" .. item
					child.ActionName = class.EditorMenubarName ~= "" and class.EditorMenubarName or item
					child:SetActionShortcuts(class.EditorShortcut, child.ActionShortcut2, child.ActionGamepad)
					child.ActionIcon = class.EditorIcon
					child:SetActionMenubar(class.EditorMenubar)
					child:SetActionSortKey(class.EditorMenubarSortKey)
					child.OnAction = function()
						OpenPresetEditor(item)
					end
				end,
			}, {
				PlaceObj('XTemplateAction', {
					'ActionTranslate', false,
				}),
				}),
			PlaceObj('XTemplateAction', {
				'comment', "Calls Preset:OpenEditor() of the current map thus selecting it in the editor",
				'ActionId', "MapDataPresetEditorOpen",
				'ActionTranslate', false,
				'ActionName', "Edit Map Data",
				'ActionIcon', "CommonAssets/UI/Icons/earth global globe internet world",
				'ActionMenubar', "Map",
				'OnAction', function (self, host, source, ...)
					(CurrentMap ~= "" and mapdata or MapDataPreset):OpenEditor()
				end,
			}),
			PlaceObj('XTemplateAction', {
				'ActionId', "Debug",
				'ActionTranslate', false,
				'ActionName', "Debug",
				'ActionMenubar', "DevMenu",
				'OnActionEffect', "popup",
				'replace_matching_id', true,
			}, {
				PlaceObj('XTemplateAction', {
					'comment', "(Ctrl-Alt-0)",
					'ActionId', "DE_TogglePathVisuals",
					'ActionMode', "Game",
					'ActionTranslate', false,
					'ActionName', "Toggle Path Visuals",
					'ActionIcon', "CommonAssets/UI/Icons/collapse",
					'ActionShortcut', "Ctrl-Alt-0",
					'ActionShortcut2', "Ctrl-Alt-Numpad 0",
					'OnAction', function (self, host, source, ...) DbgTogglePaths() end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "DE_ToggleFlightMap",
					'ActionTranslate', false,
					'ActionName', "Toggle Flight Map",
					'ActionIcon', "CommonAssets/UI/Icons/collapse",
					'OnAction', function (self, host, source, ...) DbgFlightToggleFlightMap() end,
					'__condition', function (parent, context) return const.FlightTile and Platform.developer end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Toggle Console Log",
					'RolloverText', "Toggle Console Log",
					'ActionId', "DE_ConsoleLogToggle",
					'ActionTranslate', false,
					'ActionName', "Toggle Console Log",
					'ActionIcon', "CommonAssets/UI/Icons/clipboard document paper report sheet.png",
					'OnAction', function (self, host, source, ...) ConsoleSetEnabled(not ConsoleEnabled) end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Inspect a live XWindow, its children, properties, focus, mouse target, etc. (Alt-X)",
					'RolloverText', "Inspect a live XWindow, its children, properties, focus, mouse target, etc. (Alt-X)",
					'ActionId', "DE_XWindowInspector",
					'ActionTranslate', false,
					'ActionName', "XWindow Inspector",
					'ActionIcon', "CommonAssets/UI/Icons/information mark question.png",
					'ActionShortcut', "Alt-X",
					'OnAction', function (self, host, source, ...)
						OpenXWindowInspector({EditorShortcut = self.ActionShortcut})
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Open the XTemplate the current window was spawned for in the XTemplate Editor",
					'RolloverText', "Open the XTemplate the current window was spawned for in the XTemplate Editor.",
					'ActionId', "DE_XTemplateEdit",
					'ActionTranslate', false,
					'ActionName', "Edit in XTemplate Editor",
					'ActionShortcut', "Ctrl-Alt-X",
					'OnAction', function (self, host, source, ...)
						CreateRealTimeThread(function()
							local target = terminal.desktop:GetMouseTarget(terminal.GetMousePos())
							local initial_target = target
							local template_id
							while target do
								template_id = rawget(target, "__dbg_template_template") or rawget(target, "__dbg_template")
								if template_id then break end
								target = target.parent
							end
							if not template_id then
								XFlashWindow(initial_target)
								CreateMessageBox(nil, Untranslated("Error"), Untranslated("Could not find the XTemplate this window was spawned from."))
								return
							end
							
							local gedTarget = GetParentOfKind(target, "GedApp")
							if gedTarget then
								context.dark_mode = gedTarget.dark_mode
							end
							XTemplates[template_id]:OpenEditor()
							XFlashWindow(target)
						end)
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'RolloverText', "Inspect the XWindow currently under the mouse.",
					'ActionId', "DE_InspectXWindowUnderMouse",
					'ActionTranslate', false,
					'ActionName', "Inspect XWindow Under Mouse",
					'ActionIcon', "CommonAssets/UI/Icons/information mark question.png",
					'ActionShortcut', "Alt-F8",
					'OnAction', function (self, host, source, ...)
						local pt = terminal.desktop.last_mouse_pos
						local target = terminal.desktop:GetMouseTarget(pt) or terminal.desktop
						if target then
							Inspect(target)
						end
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Examine the object under cursor (F8)",
					'ActionId', "DE_ExamineObject",
					'ActionTranslate', false,
					'ActionName', "Examine the object under cursor",
					'ActionShortcut', "F8",
					'OnAction', function (self, host, source, ...)
						local solid, transparent = GetPreciseCursorObj()
						local o = transparent or solid or GetTerrainCursorObj()
						if IsValid(o) then
							Inspect(o)
						else
							print("There is no valid object under the cursor")
						end
					end,
					'replace_matching_id', true,
				}),
				}),
			PlaceObj('XTemplateAction', {
				'ActionId', "Map",
				'ActionTranslate', false,
				'ActionName', "Map",
				'ActionMenubar', "DevMenu",
				'OnActionEffect', "popup",
				'replace_matching_id', true,
			}, {
				PlaceObj('XTemplateAction', {
					'comment', "Change Map (F5)",
					'RolloverText', "Change Map (F5)",
					'ActionId', "DE_ChangeMap",
					'ActionTranslate', false,
					'ActionName', "Change Map",
					'ActionIcon', "CommonAssets/UI/Icons/chart map paper sheet travel.png",
					'ActionShortcut', "F5",
					'OnAction', function (self, host, source, ...)
						XEditorChooseAndChangeMap()
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Reload Map (Ctrl-F5)",
					'RolloverText', "Reload Map (Ctrl-F5)",
					'ActionId', "DE_ReloadMap",
					'ActionTranslate', false,
					'ActionName', "Reload Map",
					'ActionIcon', "CommonAssets/UI/Icons/loop refresh restart.png",
					'ActionShortcut', "Ctrl-F5",
					'OnAction', function (self, host, source, ...)
						if mapdata and mapdata.GameLogic then
							CloseMenuDialogs()
						end
						CreateRealTimeThread(DevReloadMap)
					end,
					'__condition', function (parent, context) return not editor.IsModdingEditor() end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Go to empty Map (Ctrl-Shift-F5)",
					'RolloverText', "Go to empty Map (Ctrl-Shift-F5)",
					'ActionId', "DE_LoadEmptyMap",
					'ActionTranslate', false,
					'ActionName', "Load Empty Map",
					'ActionIcon', "CommonAssets/UI/Icons/document note paper.png",
					'ActionShortcut', "Ctrl-Shift-F5",
					'OnAction', function (self, host, source, ...)
						CreateRealTimeThread( function()
							CloseMenuDialogs()
							ChangeMap("__Empty")
							StoreLastLoadedMap()
							XShortcutsSetMode("Game")
						end )
					end,
					'__condition', function (parent, context) return MapData.__Empty and not editor.IsModdingEditor() end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionTranslate', false,
					'ActionName', "-----",
					'ActionIcon', "CommonAssets/UI/Icons/cancel close cross delete remove trash.png",
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Map.Generate",
					'ActionTranslate', false,
					'ActionName', "Generate ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'ActionId', "ValidateAllPrefabMaps",
						'ActionTranslate', false,
						'ActionName', "Validate All Prefab Maps (thorough)",
						'ActionIcon', "CommonAssets/UI/Icons/disk guardar save.png",
						'OnAction', function (self, host, source, ...)
							CreateRealTimeThread(WaitValidateAllMaps, { validate_properties = true }, IsPrefabMap)
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'ActionId', "ResaveAllPrefabs",
						'ActionTranslate', false,
						'ActionName', "Resave All Prefabs",
						'ActionIcon', "CommonAssets/UI/Icons/disk guardar save.png",
						'OnAction', function (self, host, source, ...) ResaveAllPrefabs() end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'ActionId', "ResaveAllGameMaps",
						'ActionTranslate', false,
						'ActionName', "Resave All Game Maps",
						'ActionIcon', "CommonAssets/UI/Icons/disk guardar save.png",
						'OnAction', function (self, host, source, ...) ResaveAllGameMaps() end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'ActionId', "G_Regenerate",
						'ActionTranslate', false,
						'ActionName', "Regenerate Random Maps...",
						'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
						'OnActionEffect', "popup",
						'replace_matching_id', true,
					}, {
						PlaceObj('XTemplateAction', {
							'ActionId', "RegenerateCurrent",
							'ActionTranslate', false,
							'ActionName', "Regenerate Current Map",
							'ActionIcon', "CommonAssets/UI/Icons/factory.png",
							'OnAction', function (self, host, source, ...)
								RegenerateMap(nil, true)
							end,
						}),
						PlaceObj('XTemplateAction', {
							'ActionId', "RegenerateAll",
							'ActionTranslate', false,
							'ActionName', "Regenerate All Random Maps",
							'ActionIcon', "CommonAssets/UI/Icons/factory.png",
							'OnAction', function (self, host, source, ...)
								RegenerateRandomMaps()
							end,
						}),
						PlaceObj('XTemplateForEach', {
							'array', function (parent, context) return GetRegenerateMapLists() end,
							'run_after', function (child, context, item, i, n, last)
								child.ActionId = "Regenerate_" .. item
								child.ActionName = "Regenerate " .. item
								child.OnActionParam = item
							end,
						}, {
							PlaceObj('XTemplateAction', {
								'ActionTranslate', false,
								'ActionIcon', "CommonAssets/UI/Icons/gear option setting setup.png",
								'OnAction', function (self, host, source, ...)
									RegenerateMapList(self.OnActionParam)
								end,
							}),
							}),
						}),
					}),
				PlaceObj('XTemplateAction', {
					'ActionId', "MarkerViewer",
					'ActionTranslate', false,
					'ActionName', "Marker Viewer",
					'ActionIcon', "CommonAssets/UI/Icons/flag marker nation.png",
					'OnAction', function (self, host, source, ...)
						OpenMarkerViewer()
					end,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "RoomEditor",
					'ActionTranslate', false,
					'ActionName', "Room Editor",
					'ActionIcon', "CommonAssets/UI/Icons/building office.png",
					'ActionShortcut', "Ctrl-Shift-R",
					'OnAction', function (self, host, source, ...)
						OpenGedRoomEditor()
					end,
					'__condition', function (parent, context) return config.MapEditorRooms end,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Collections Editor (Ctrl-Alt-C)",
					'RolloverText', "Collections Editor (Ctrl-Alt-C)",
					'ActionId', "E_CollectionsEditor",
					'ActionTranslate', false,
					'ActionName', "Collections Editor",
					'ActionIcon', "CommonAssets/UI/Icons/cabinet cupboard drawer furniture interior.png",
					'ActionShortcut', "Ctrl-Alt-C",
					'OnAction', function (self, host, source, ...) OpenCollectionsEditor() end,
					'replace_matching_id', true,
				}),
				}),
			PlaceObj('XTemplateAction', {
				'ActionId', "Editors",
				'ActionTranslate', false,
				'ActionName', "Editors",
				'ActionMenubar', "DevMenu",
				'OnActionEffect', "popup",
				'replace_matching_id', true,
			}, {
				PlaceObj('XTemplateAction', {
					'ActionId', "Editors.UI",
					'ActionTranslate', false,
					'ActionName', "UI ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Editors.Humans",
					'ActionTranslate', false,
					'ActionName', "Humans ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Editors.Lists",
					'ActionTranslate', false,
					'ActionName', "Lists ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Editors.Other",
					'ActionTranslate', false,
					'ActionName', "Other ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Editors.Art",
					'ActionTranslate', false,
					'ActionName', "Art & FX ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'ActionId', "BillboardEditor",
						'ActionTranslate', false,
						'ActionName', "Billboard Editor",
						'ActionIcon', "CommonAssets/UI/Icons/gallery images media photos thumbnail.png",
						'OnAction', function (self, host, source, ...)
							OpenGedApp("BillboardEditor", BillboardsTree())
						end,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Particle editor",
						'ActionId', "E_FX_ParticleEditor",
						'ActionTranslate', false,
						'ActionName', "Particle Editor",
						'ActionIcon', "CommonAssets/UI/Icons/outline starburst.png",
						'ActionShortcut', "Ctrl-Alt-P",
						'OnAction', function (self, host, source, ...)
							local sel = editor and editor.GetSel()
							if sel and #sel > 0 then
								for key, value in ipairs(sel) do
									if IsKindOf(value, "ParSystem") then
										local par_name = value:GetParticlesName()
										local par_sys = ParticleSystemPresets[par_name]
										if par_sys then
											par_sys:OpenEditor(true)
											return
										end
									end
								end
							end
							
							OpenPresetEditor("ParticleSystemPreset")
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'ActionId', "E_FX_AnimMetadataEditor",
						'ActionTranslate', false,
						'ActionName', "Anim Metadata Editor",
						'ActionIcon', "CommonAssets/UI/Icons/video.tga",
						'OnAction', function (self, host, source, ...)
							OpenAnimationMomentsEditor()
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'ActionId', "E_FX_SkinDecalEditor",
						'ActionTranslate', false,
						'ActionName', "Skin Decal Editor",
						'ActionIcon', "CommonAssets/UI/Icons/video.tga",
						'OnAction', function (self, host, source, ...)
							OpenSkinDecalEditor()
						end,
						'replace_matching_id', true,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Editors.Audio",
					'ActionTranslate', false,
					'ActionName', "Audio ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Sound Debug",
						'RolloverText', "Toggle Sound Debug",
						'ActionId', "E_SoundToggleDebug",
						'ActionTranslate', false,
						'ActionName', "Toggle Sound Debug",
						'ActionIcon', "CommonAssets/UI/Icons/volume.png",
						'ActionShortcut', "Ctrl-\\",
						'OnAction', function (self, host, source, ...)
							ToggleSoundDebug()
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Listener Update",
						'RolloverText', "Toggle Listener Update",
						'ActionId', "E_ToggleListenerUpdate",
						'ActionTranslate', false,
						'ActionName', "Toggle Listener Update",
						'ActionIcon', "CommonAssets/UI/Icons/volume.png",
						'OnAction', function (self, host, source, ...)
							ToggleListenerUpdate()
						end,
						'replace_matching_id', true,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'ActionId', "ModEditor",
					'ActionTranslate', false,
					'ActionName', "Mod Editor",
					'ActionIcon', "CommonAssets/UI/Icons/outline puzzle",
					'OnAction', function (self, host, source, ...)
						ModEditorOpen()
					end,
					'__condition', function (parent, context) return config.Mods end,
					'replace_matching_id', true,
				}),
				}),
			PlaceObj('XTemplateAction', {
				'ActionId', "Scripting",
				'ActionTranslate', false,
				'ActionName', "Scripting",
				'ActionMenubar', "DevMenu",
				'OnActionEffect', "popup",
				'replace_matching_id', true,
			}, {
				PlaceObj('XTemplateAction', {
					'ActionId', "StoryBitsLog",
					'ActionTranslate', false,
					'ActionName', "Story Bits Log",
					'ActionIcon', "CommonAssets/UI/Icons/clipboard.png",
					'OnAction', function (self, host, source, ...)
						if g_StoryBitsLog then
							OpenGedApp("StoryBitLog", g_StoryBitsLog)
						else
							print("Story Bits log is unavailable.")
						end
					end,
					'replace_matching_id', true,
				}),
				}),
			PlaceObj('XTemplateAction', {
				'ActionId', "Render",
				'ActionTranslate', false,
				'ActionName', "Render",
				'ActionMenubar', "DevMenu",
				'OnActionEffect', "popup",
				'__condition', function (parent, context) return const.DebugRender end,
				'replace_matching_id', true,
			}, {
				PlaceObj('XTemplateAction', {
					'comment', "Toggle Framerate Boost (Alt-+ or Alt-Numpad +)",
					'ActionId', "DbgToggleFramerateBoost",
					'ActionTranslate', false,
					'ActionName', "Toggle Framerate Boost",
					'ActionShortcut', "Alt-+",
					'ActionShortcut2', "Alt-Numpad +",
					'OnAction', function (self, host, source, ...)
						ToggleFramerateBoost()
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', " (Ctrl-Shift-I)",
					'RolloverText', " (Ctrl-Shift-I)",
					'ActionId', "G_ChangeFPSIndicator",
					'ActionMode', "Game",
					'ActionTranslate', false,
					'ActionName', "Change FPS Indicator mode",
					'ActionIcon', "CommonAssets/UI/Icons/chart graph growth increase profit stock.png",
					'ActionShortcut', "Ctrl-Shift-I",
					'OnAction', function (self, host, source, ...)
						local mode = hr.FpsCounter
						mode = mode + 1
						if mode >= 3 then mode = 0 end
						if mode == 0 then print("framerate indicator off")
						else if mode == 1 then print("show frames-per-second")
						else if mode == 2 then print("show (milli)seconds-per-frame")
						end end end
						hr.FpsCounter = mode
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', 'Cycle "Object Details"',
					'RolloverText', "Editor settings",
					'ActionId', "E_EditorCycleObjectDetails",
					'ActionTranslate', false,
					'ActionName', 'Cycle "Object Details"',
					'ActionIcon', "CommonAssets/UI/Menu/object_options.tga",
					'ActionShortcut', "Ctrl-Alt-/",
					'OnAction', function (self, host, source, ...)
						local details
						if EngineOptions.ObjectDetail == "Very Low" then
							details = "Low"
						elseif EngineOptions.ObjectDetail == "Low" then
							details = "Medium"
						elseif EngineOptions.ObjectDetail == "Medium" then
							details = "High"
						else	-- EngineOptions.ObjectDetail == "High"
							details = table.find(OptionsData.Options.ObjectDetail, "value", "Very Low") and "Very Low" or "Low"
						end
						EngineSetObjectDetail(details, IsEditorActive() and "dont apply filters")
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Render.Debug Textures",
					'ActionTranslate', false,
					'ActionName', "Debug Textures ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Wireframe",
						'RolloverText', "Toggle Wireframe (Ctrl-Alt-W)",
						'ActionId', "G_Wireframe",
						'ActionTranslate', false,
						'ActionName', "Toggle Wireframe",
						'ActionIcon', "CommonAssets/UI/Menu/Wireframe.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr["Wireframe"] == 1
						end,
						'OnAction', function (self, host, source, ...)
							ToggleHR "Wireframe"
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Base Color Maps",
						'RolloverText', "Toggle Base Color Maps",
						'ActionId', "G_DisableBaseColorMaps",
						'ActionTranslate', false,
						'ActionName', "Toggle Base Color Maps",
						'ActionIcon', "CommonAssets/UI/Menu/DisableBaseColorMaps.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr["DisableBaseColorMaps"] == 1
						end,
						'OnAction', function (self, host, source, ...)
							ToggleHR "DisableBaseColorMaps"
							hr.TR_ForceReloadNoTextures = 1
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle RM Maps",
						'RolloverText', "Toggle RM Maps",
						'ActionId', "G_DisableRMMaps",
						'ActionTranslate', false,
						'ActionName', "Toggle RM Maps",
						'ActionIcon', "CommonAssets/UI/Menu/DisableRMMaps.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr["DisableRMMaps"] == 1
						end,
						'OnAction', function (self, host, source, ...)
							ToggleHR "DisableRMMaps"
							hr.TR_ForceReloadNoTextures = 1
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Normal Maps",
						'RolloverText', "Toggle Normal Maps",
						'ActionId', "G_DisableNormalMaps",
						'ActionTranslate', false,
						'ActionName', "Toggle Normal Maps",
						'ActionIcon', "CommonAssets/UI/Menu/DisableNormalMaps.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr["DisableNormalMaps"] == 1
						end,
						'OnAction', function (self, host, source, ...)
							ToggleHR "DisableNormalMaps"
							hr.TR_ForceReloadNoTextures = 1
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle AO Maps",
						'RolloverText', "Toggle AO Maps",
						'ActionId', "G_DisableAOMaps",
						'ActionTranslate', false,
						'ActionName', "Toggle AO Maps",
						'ActionIcon', "CommonAssets/UI/Menu/DisableAOMaps.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr["DisableAOMaps"] == 1
						end,
						'OnAction', function (self, host, source, ...)
							ToggleHR "DisableAOMaps"
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Self-Illumination Maps",
						'RolloverText', "Toggle Self-Illumination Maps",
						'ActionId', "G_DisableSIMaps",
						'ActionTranslate', false,
						'ActionName', "Toggle Self-illumination Maps",
						'ActionIcon', "CommonAssets/UI/Menu/DisableSIMaps.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr["DisableSIMaps"] == 1
						end,
						'OnAction', function (self, host, source, ...)
							ToggleHR "DisableSIMaps"
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Colorization Maps",
						'RolloverText', "Toggle Colorization Maps",
						'ActionId', "G_DisableColorizationMaps",
						'ActionTranslate', false,
						'ActionName', "Toggle Colorization Maps",
						'ActionIcon', "CommonAssets/UI/Menu/DisableBaseColorMaps.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr["DisableColorizationMaps"] == 1
						end,
						'OnAction', function (self, host, source, ...)
							ToggleHR "DisableColorizationMaps"
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle the height the terrain uses for blend",
						'RolloverText', "Toggle the height the terrain uses for blend",
						'ActionId', "G_ToggleTerrainHeight",
						'ActionTranslate', false,
						'ActionName', "Toggle Terrain Height",
						'ActionIcon', "CommonAssets/UI/Menu/ToggleTerrainHeight.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr["TR_ShowHeight"] == 1
						end,
						'OnAction', function (self, host, source, ...)
							ToggleHR "TR_ShowHeight"
							hr.TR_ForceReloadNoTextures = 1
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle color picker for screen render target (Alt-Shift-I)",
						'RolloverText', "Toggle color picker for screen render target (Alt-Shift-I)",
						'ActionId', "E_Colorpicker",
						'ActionTranslate', false,
						'ActionName', "Toggle Color picker",
						'ActionIcon', "CommonAssets/UI/Icons/color drop graphic paint picker tool.png",
						'ActionShortcut', "Alt-Shift-I",
						'OnAction', function (self, host, source, ...)
							local state =  GetPostProcPredicate("debug_color_pick")
							SetPostProcPredicate("debug_color_pick", not state)
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'RolloverText', T(709899432615, --[[XTemplate DebugShortcuts RolloverText]] "Toggle Fsr2 textures debug display"),
						'ActionId', "G_TemporalDebug",
						'ActionName', T(103678002139, --[[XTemplate DebugShortcuts ActionName]] "Toggle Temporal Upscaler debug"),
						'ActionIcon', "CommonAssets/UI/Menu/DisableBaseColorMaps.tga",
						'ActionShortcut', "Alt-Shift-J",
						'OnAction', function (self, host, source, ...)
							local modes = { "None", "Motion Vectors", "Reactivity Mask", "Transparency Mask", "Adjust Reactivity" }
							hr.TemporalDebug=hr.TemporalDebug+1
							if hr.TemporalDebug > #modes - 1 then
								hr.TemporalDebug = 0
							end
							print("TemporalDebug mode: ", modes[hr.TemporalDebug+1])
						end,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle stretch factor usage",
						'RolloverText', "Toggle stretch factor usage",
						'ActionId', "G_ToggleStretchFactorUsage",
						'ActionTranslate', false,
						'ActionName', "ToggleStretchFactorUsage",
						'ActionIcon', "CommonAssets/UI/Menu/ToggleStretchFactor.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr["DbgUseStretchFactor"] == 1
						end,
						'OnAction', function (self, host, source, ...)
							ToggleHR "DbgUseStretchFactor"
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggleuv density",
						'RolloverText', "Toggle uv density",
						'ActionId', "G_ToggleUVDensity",
						'ActionTranslate', false,
						'ActionName', "Toggle UV Density",
						'ActionIcon', "CommonAssets/UI/Menu/ForceDiffuseMaps.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr.UseCheckerboardAsBaseColor == 1
						end,
						'OnAction', function (self, host, source, ...)
							ToggleHR "UseCheckerboardAsBaseColor"
							hr.DisableBaseColorMaps = hr.UseCheckerboardAsBaseColor
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle SatGammaModifier rendering",
						'RolloverText', "Toggle SatGammaModifier rendering",
						'ActionId', "G_ToggleSatGamma",
						'ActionTranslate', false,
						'ActionName', "Toggle SatGamma Modifier",
						'ActionIcon', "CommonAssets/UI/Menu/toggle_dtm_slots.tga",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr.UseSatGammaModifier ~= 0
						end,
						'OnAction', function (self, host, source, ...)
							hr.UseSatGammaModifier = 1 - hr.UseSatGammaModifier
							RecreateRenderObjects()
						end,
						'replace_matching_id', true,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'comment', "Finds duplicated objects",
					'RolloverText', "Finds duplicated objects",
					'ActionId', "DbgFindOverlappingObjects",
					'ActionTranslate', false,
					'ActionName', "Find overlapping objects",
					'ActionIcon', "CommonAssets/UI/Icons/copy duplicate paste 2.png",
					'OnAction', function (self, host, source, ...) ReportOverlappingObjects() end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Follow cam for 2nd player",
					'RolloverText', "Follow cam for 2nd player",
					'ActionId', "DbgFollowCamera",
					'ActionTranslate', false,
					'ActionName', "Follow cam for 2nd player",
					'OnAction', function (self, host, source, ...) StartFollowCam() end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Render everything two-sided",
					'RolloverText', "Render everything two-sided",
					'ActionId', "G_ForceTwoSidedMode",
					'ActionTranslate', false,
					'ActionName', "Force two-sided mode",
					'ActionIcon', "CommonAssets/UI/Menu/ForceTwoSidedMode.tga",
					'ActionToggle', true,
					'ActionToggled', function (self, host)
						return hr["ForceTwoSidedMode"] == 1
					end,
					'OnAction', function (self, host, source, ...) ToggleHR("ForceTwoSidedMode") end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Shows/Hides the frustum",
					'RolloverText', "Shows/Hides the frustum",
					'ActionId', "DbgShowFrustum",
					'ActionTranslate', false,
					'ActionName', "Frustum",
					'ActionToggle', true,
					'ActionToggled', function (self, host)
						return hr.ShowFrustum == 1
					end,
					'OnAction', function (self, host, source, ...) ToggleHR "ShowFrustum" end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', " (Shift-U)",
					'RolloverText', " (Shift-U)",
					'ActionId', "G_LockCamera",
					'ActionMode', "Game",
					'ActionTranslate', false,
					'ActionName', "Lock Camera",
					'ActionIcon', "CommonAssets/UI/Icons/lock login padlock password safe secure.png",
					'ActionShortcut', "Shift-U",
					'ActionToggle', true,
					'ActionToggled', function (self, host)
						return camera.IsLocked(1)
					end,
					'OnAction', function (self, host, source, ...)
						if camera.IsLocked(1) then
							camera.Unlock(1) 
						else
							camera.Lock(1)
						end
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', " (Ctrl-I)",
					'RolloverText', " (Ctrl-I)",
					'ActionId', "G_MoveFPSIndicator",
					'ActionMode', "Game",
					'ActionTranslate', false,
					'ActionName', "Move FPS Indicator",
					'ActionIcon', "CommonAssets/UI/Icons/drag move.png",
					'ActionShortcut', "Ctrl-I",
					'OnAction', function (self, host, source, ...)
						local pos = hr.FpsCounterPos
						pos = pos + 1
						if pos < 4 then
							hr.FpsCounterPos = pos
						else
							hr.FpsCounterPos = 0
						end
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Toggles the object counter",
					'RolloverText', "Toggles the object counter",
					'ActionId', "DbgObjectCounter",
					'ActionTranslate', false,
					'ActionName', "Object counter",
					'ActionIcon', "CommonAssets/UI/Icons/th.png",
					'ActionToggle', true,
					'ActionToggled', function (self, host)
						return hr.ObjectCounter == 1
					end,
					'OnAction', function (self, host, source, ...) ToggleHR "ObjectCounter" end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Render.Objects, Billboards & Particles",
					'ActionTranslate', false,
					'ActionName', "Objects, Billboards & Particles ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'comment', " (Ctrl-Shift-O)",
						'RolloverText', " (Ctrl-Shift-O)",
						'ActionId', "G_SimulateParticles",
						'ActionTranslate', false,
						'ActionName', "Toggle Particle Simulation",
						'ActionShortcut', "Ctrl-Shift-O",
						'OnAction', function (self, host, source, ...) ToggleHR("SimulateParticles") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Ctrl-Shift-P)",
						'RolloverText', " (Ctrl-Shift-P)",
						'ActionId', "G_RenderParticles",
						'ActionTranslate', false,
						'ActionName', "Toggle Particle Rendering",
						'ActionShortcut', "Ctrl-Shift-P",
						'OnAction', function (self, host, source, ...) ToggleHR("RenderParticles") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Shift-T)",
						'RolloverText', " (Shift-T)",
						'ActionId', "G_ObjectBillboards",
						'ActionTranslate', false,
						'ActionName', "Toggle Billboards",
						'ActionShortcut', "Shift-T",
						'OnAction', function (self, host, source, ...) ToggleHR("ObjectBillboards") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'ActionId', "G_MapObjects",
						'ActionTranslate', false,
						'ActionName', "Toggle Map Objects",
						'OnAction', function (self, host, source, ...) ToggleHR("RenderMapObjects") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Shift-O)",
						'RolloverText', " (Shift-O)",
						'ActionId', "G_Outsiders",
						'ActionTranslate', false,
						'ActionName', "Toggle Outsider Objects",
						'ActionShortcut', "Shift-O",
						'OnAction', function (self, host, source, ...) ToggleHR("RenderOutsiders") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Shift-N)",
						'RolloverText', " (Shift-N)",
						'ActionId', "G_RenderOBBs",
						'ActionTranslate', false,
						'ActionName', "Render Oriented Bounding Boxes",
						'ActionShortcut', "Shift-N",
						'OnAction', function (self, host, source, ...) ToggleHR("RenderOBBs") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Shift-B)",
						'RolloverText', " (Shift-B)",
						'ActionId', "G_RenderBSpheres",
						'ActionTranslate', false,
						'ActionName', "Render Bounding Spheres",
						'ActionShortcut', "Shift-B",
						'OnAction', function (self, host, source, ...) ToggleHR("RenderBSpheres") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Ctrl-C)",
						'RolloverText', " (Ctrl-C)",
						'ActionId', "G_ObjectCull",
						'ActionTranslate', false,
						'ActionName', "Toggle Object Cull",
						'ActionShortcut', "Ctrl-C",
						'OnAction', function (self, host, source, ...) ToggleHR("ObjectCull") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Ctrl-Alt-Z)",
						'RolloverText', " (Ctrl-Alt-Z)",
						'ActionId', "G_ObjectLOD",
						'ActionTranslate', false,
						'ActionName', "Toggle Object LOD",
						'ActionShortcut', "Ctrl-Alt-Z",
						'OnAction', function (self, host, source, ...)
							if ToggleHR("VisualizeLOD") then
								print("0 red, 1 green, 2 blue, 3 yellow, 4 pink, 5 cyan")
							end
						end,
						'replace_matching_id', true,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'comment', "Toggles the building of render queues",
					'RolloverText', "Toggles the building of render queues",
					'ActionId', "G_TogglePauseRQ",
					'ActionMode', "Game",
					'ActionTranslate', false,
					'ActionName', "Pause RQ",
					'OnAction', function (self, host, source, ...) ToggleHR("PauseRQ") end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Toggle postprocess (Ctrl-0)",
					'RolloverText', "Toggle postprocess (Ctrl-0)",
					'ActionId', "G_Postprocess",
					'ActionTranslate', false,
					'ActionName', "Postprocess",
					'ActionIcon', "CommonAssets/UI/Menu/toggle_post.tga",
					'ActionShortcut', "Ctrl-0",
					'ActionToggle', true,
					'ActionToggled', function (self, host)
						return hr["EnablePostprocess"] == 1
					end,
					'OnAction', function (self, host, source, ...) ToggleHR "EnablePostprocess" end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Render.Profiler HUD",
					'ActionTranslate', false,
					'ActionName', "Profiler HUD ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Profiler HUD (Alt-Shift-0)",
						'ActionId', "ProfilerHUDEnable",
						'ActionTranslate', false,
						'ActionName', "Toggle Profiler",
						'ActionShortcut', "Alt-Shift-0",
						'OnAction', function (self, host, source, ...)
							ToggleHR "ProfilerHUD"
							ToggleHR "EnableGPUProfiler"
							ProfilerHUD_InitColors()
							UIL.Invalidate() 
						end,
						'__condition', function (parent, context) return hr.ProfilerHUD end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Live update (Alt-Shift-9)",
						'RolloverText', " (Alt-Shift-9)",
						'ActionId', "ProfilerHUDRefresh",
						'ActionTranslate', false,
						'ActionName', "Live update",
						'ActionShortcut', "Alt-Shift-9",
						'OnAction', function (self, host, source, ...)
							if hr.ProfilerHUDRefreshInterval == 0 then 
								hr.ProfilerHUDRefreshInterval = 1000
							else
								hr.ProfilerHUDRefreshInterval = 0
							end
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Alt-Shift-8)",
						'RolloverText', " (Alt-Shift-8)",
						'ActionId', "ProfilerHUDForceCapture",
						'ActionTranslate', false,
						'ActionName', "Force capture",
						'ActionShortcut', "Alt-Shift-8",
						'OnAction', function (self, host, source, ...)
							hr.ProfilerHUDForceCapture = 1
							UIL.Invalidate()
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Alt-Shift-7)",
						'RolloverText', " (Alt-Shift-7)",
						'ActionId', "ProfilerHUDExclusiveTiming",
						'ActionTranslate', false,
						'ActionName', "Toggle Exclusive Timing",
						'ActionShortcut', "Alt-Shift-7",
						'OnAction', function (self, host, source, ...)
							hr.ProfilerHUDExclusiveTiming = not hr.ProfilerHUDExclusiveTiming
							UIL.Invalidate()
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "(Alt-Shift-6)",
						'RolloverText', "(Alt-Shift-6)",
						'ActionId', "ProfilerHUDSaveCapture",
						'ActionTranslate', false,
						'ActionName', "Save capture",
						'ActionShortcut', "Alt-Shift-6",
						'OnAction', function (self, host, source, ...)
							hr.ProfilerHUDSaveCapture = 1
							UIL.Invalidate()
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "(Alt-Shift-5)",
						'RolloverText', "(Alt-Shift-5)",
						'ActionId', "ProfilerHUDAutoSaveFrameSpike",
						'ActionTranslate', false,
						'ActionName', "Auto Save Frame Spike",
						'ActionShortcut', "Alt-Shift-5",
						'OnAction', function (self, host, source, ...)
							if hr.ProfilerHUDAutoSaveCapture == 0 then
								hr.ProfilerHUDAutoSaveCapture = 100
							elseif hr.ProfilerHUDAutoSaveCapture == 100 then
								hr.ProfilerHUDAutoSaveCapture = 200 
							elseif hr.ProfilerHUDAutoSaveCapture == 200 then
								hr.ProfilerHUDAutoSaveCapture = 300
							elseif hr.ProfilerHUDAutoSaveCapture == 300 then 
								hr.ProfilerHUDAutoSaveCapture = 0
							end
							UIL.Invalidate()
						end,
						'replace_matching_id', true,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'ActionId', "G_RelativeZoom",
					'ActionMode', "Game",
					'ActionTranslate', false,
					'ActionName', "Relaitve Zoom",
					'OnAction', function (self, host, source, ...) hr.CameraRTSRelativeZoomingMode = 1 - hr.CameraRTSRelativeZoomingMode end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Render.Reload",
					'ActionMode', "Game",
					'ActionTranslate', false,
					'ActionName', "Reload ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'comment', " (Shift-R)",
						'RolloverText', " (Shift-R)",
						'ActionId', "G_ReloadShaders",
						'ActionTranslate', false,
						'ActionName', "Reload Shaders",
						'ActionShortcut', "Shift-R",
						'OnAction', function (self, host, source, ...) ReloadShaders() end,
						'replace_matching_id', true,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Render.Render targets",
					'ActionTranslate', false,
					'ActionName', "Render targets ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'comment', " (Ctrl-Shift-2)",
						'RolloverText', " (Ctrl-Shift-2)",
						'ActionId', "DbgShowRTEnable",
						'ActionTranslate', false,
						'ActionName', "Toggle RTs",
						'ActionShortcut', "Ctrl-Shift-2",
						'OnAction', function (self, host, source, ...) ToggleHR "ShowRTEnable" end,
						'replace_matching_id', true,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'comment', "Save a screenshot",
					'RolloverText', "Save a screenshot",
					'ActionId', "G_SaveScreenShot",
					'ActionTranslate', false,
					'ActionName', "Save Screenshot",
					'ActionIcon', "CommonAssets/UI/Menu/ToggleEnvMap.tga",
					'OnAction', function (self, host, source, ...)
						local imageName = GenerateScreenshotFilename("")
						CreateRealTimeThread(function() 
							WaitNextFrame(3)
							WriteScreenshot(imageName)
							os.execute("start " .. lfs.currentdir())
						end)
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Capture the GPU with RenderDoc",
					'RolloverText', "Make a GPU capture using RenderDoc",
					'ActionId', "G_RenderDocCapture",
					'ActionTranslate', false,
					'ActionName', "RenderDoc Capture",
					'ActionIcon', "CommonAssets/UI/Menu/RenderDoc_logo",
					'OnAction', function (self, host, source, ...)
						hr.CaptureRenderDoc = 1
						print("The RenderDoc capture was saved in AppData/Local/Temp/RenderDoc");
					end,
					'__condition', function (parent, context) return hr.CaptureRenderDoc end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Shows/Hides the shadow frustum",
					'RolloverText', "Shows/Hides the shadow frustum",
					'ActionId', "DbgShadowShowFrustum",
					'ActionTranslate', false,
					'ActionName', "Shadow frustum",
					'ActionToggle', true,
					'ActionToggled', function (self, host)
						return hr.ShadowShowFrustum == 1
					end,
					'OnAction', function (self, host, source, ...) ToggleHR "ShadowShowFrustum" end,
					'__condition', function (parent, context) return hr.ShadowShowFrustum end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'RolloverText', "Toggles lights shadow statistics",
					'ActionId', "Render.Lights",
					'ActionTranslate', false,
					'ActionName', "Lights...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'comment', "Toggles lights shadow statistics",
						'RolloverText', "Toggles lights shadow statistics",
						'ActionId', "DbgLightsShadowStatistics",
						'ActionTranslate', false,
						'ActionName', "Lights Shadow Stats",
						'ActionShortcut', "Alt-Shift-X",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr.LightShadowsStatistics ~= 0
						end,
						'OnAction', function (self, host, source, ...)
							if hr.LightShadowsStatistics == 0 then
								ShowLightShadowsStats(1000)
							else
								HideLightShadowsStats()
							end
						end,
						'__condition', function (parent, context) return hr.LightShadowsStatistics end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Cycle through Lights Objects",
						'RolloverText', "Cycle through Lights Objects",
						'ActionId', "CycleLightsPrev",
						'ActionTranslate', false,
						'ActionName', "Cycle through Lights(Previous)",
						'ActionShortcut', "Alt-Shift-V",
						'OnAction', function (self, host, source, ...)
							ViewNextLight(-1)
						end,
						'__condition', function (parent, context) return rawget(_G, "ViewNextLight") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Cycle through Lights Objects",
						'RolloverText', "Cycle through Lights Objects",
						'ActionId', "CycleLightsNext",
						'ActionTranslate', false,
						'ActionName', "Cycle through Lights(Next)",
						'ActionShortcut', "Alt-V",
						'OnAction', function (self, host, source, ...)
							ViewNextLight(1)
						end,
						'__condition', function (parent, context) return rawget(_G, "ViewNextLight") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Capture Screen Lights",
						'RolloverText', "Capture Screen Lights for cycling them",
						'ActionId', "CaptureScreenLights",
						'ActionTranslate', false,
						'ActionName', "Capture Screen Lights",
						'ActionShortcut', "Ctrl-Alt-Shift-X",
						'OnAction', function (self, host, source, ...)
							CaptureScreenLights()
						end,
						'__condition', function (parent, context) return rawget(_G, "CaptureScreenLights") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Cycle through Screen Lights",
						'RolloverText', "Cycle through Lights Objects",
						'ActionId', "CycleScreenLightsPrev",
						'ActionTranslate', false,
						'ActionName', "Cycle through Screen Lights(Previous)",
						'ActionShortcut', "Alt-Shift-F",
						'OnAction', function (self, host, source, ...)
							ViewNextLight(-1, "screen lights")
						end,
						'__condition', function (parent, context) return rawget(_G, "ViewNextLight") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Cycle through Lights",
						'RolloverText', "Cycle through Lights Objects",
						'ActionId', "CycleScreenLightsNext",
						'ActionTranslate', false,
						'ActionName', "Cycle through Screen Lights(Next)",
						'ActionShortcut', "Alt-F",
						'OnAction', function (self, host, source, ...)
							ViewNextLight(1, "screen lights")
						end,
						'__condition', function (parent, context) return rawget(_G, "ViewNextLight") end,
						'replace_matching_id', true,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'comment', " (0)",
					'RolloverText', " (0)",
					'ActionId', "G_Statistics",
					'ActionMode', "Game",
					'ActionTranslate', false,
					'ActionName', "Show Statistics",
					'ActionShortcut', "0",
					'ActionShortcut2', "Alt-0",
					'ActionToggle', true,
					'ActionToggled', function (self, host)
						return hr.RenderStatistics ~= 0
					end,
					'OnAction', function (self, host, source, ...)
						local stats = config.RenderStatistics or { 0, 5, -1 }
						local i = table.find(stats, hr.RenderStatistics)
						if i then -- match, set the next one
							hr.RenderStatistics = stats[i + 1] or stats[1]
						else -- no match - toggle between 0 and -1
							hr.RenderStatistics = hr.RenderStatistics == 0 and -1 or 0
						end
					end,
					'__condition', function (parent, context) return hr.RenderStatistics end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', " (0)",
					'RolloverText', " (0)",
					'ActionId', "Histograms",
					'ActionTranslate', false,
					'ActionName', "Show Histograms",
					'OnAction', function (self, host, source, ...)
						ToggleHistogram()
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Override DIPs to consist of a single triangle (Ctrl-Shift-1)",
					'RolloverText', "Override DIPs to consist of a single triangle (Ctrl-Shift-1)",
					'ActionId', "G_RenderSingleTriangle",
					'ActionTranslate', false,
					'ActionName', "Single Triangle DIPs",
					'ActionIcon', "CommonAssets/UI/Menu/RenderSingleTriangle.tga",
					'ActionShortcut', "Ctrl-Shift-1",
					'OnAction', function (self, host, source, ...)
						if hr.PrimitiveCountModifier == 1 then 
							hr.PrimitiveCountModifier = -100
						else 
							hr.PrimitiveCountModifier = 1
						end 
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Shows render statistics",
					'RolloverText', "Shows render statistics",
					'ActionId', "DbgSubsystemsRenderCosts",
					'ActionTranslate', false,
					'ActionName', "Subsystems render costs",
					'OnAction', function (self, host, source, ...)
						CreateMapRealTimeThread(
							function()
								local function Print100f( v )
									local str = ""
									str = str .. (v/100)
									v = abs( v - (v/100)*100 )
									str = str .. "." .. (v/10)
									v = v - (v/10)*10
									str = str .. v
									return str
								end
								local function GetMs100()
									local ms = hr.RenderStatsFrameTimeGPU
									return ms*100
								end
								local function WaitRenderFrames( ms, weight100 )
									weight100 = weight100 or 10
									local t0 = GetClock()
									local time = 0
									local ms100 = 0
									local arr = {}
									local frame = 1
									WaitNextFrame(hr.RenderStatsSmoothing)
									while time < ms do
										WaitNextFrame()
										arr[frame] = GetMs100()
										--ms100 = (ms100*(100-weight100) + GetMs100()*weight100) / 100
										time = GetClock()-t0
										frame = frame + 1
										if frame > 30 then frame = 1 end
									end
									ms100 = 0
									for i=1,#arr do
										ms100 = ms100 + arr[i]
									end
									ms100 = ms100 / #arr
									return ms100
								end
						
						-- the table that describes all cases we would like to test for performance
						
								local saved_value = false
								local tests = {{
										name = "Post processing",
										start = function() hr.EnablePostprocess = 0 end,
										finish = function() hr.EnablePostprocess = 1 end,
									}, {
										name = "Particles",
										start = function() hr.RenderParticles = 0 end,
										finish = function() hr.RenderParticles = 1 end,
									}, {
										name = "Transparents",
										start = function() hr.RenderTransparent = 0 end,
										finish = function() hr.RenderTransparent = 1 end,
									}, {
										name = "Billboards",
										start = function() hr.RenderBillboards = 0 end,
										finish = function() hr.RenderBillboards = 1 end,
									}, {
										name = "Objects",
										start = function() hr.RenderMapObjects = 0 end,
										finish = function() hr.RenderMapObjects = 1 end,
									}, {
										name = "Streaming",
										start = function() hr.StreamingForceFallbacks = 1 end,
										finish = function() hr.StreamingForceFallbacks = 0 end,
									}, {						
										name = "Shadowmap",
										start = function() hr.Shadowmap = 0 end,
										finish = function() hr.Shadowmap = 1 end,
									}, {
										name = "Shadowmap 1k",
										start = function() saved_value = hr.ShadowmapSize hr.ShadowmapSize = 1024 end,
										finish = function() hr.ShadowmapSize = saved_value end,
									},  {
										name = "Shadowmap 880",
										start = function() saved_value = hr.ShadowmapSize hr.ShadowmapSize = 880 end,
										finish = function() hr.ShadowmapSize = saved_value end,
									}, {
										name = "Skinned objects",
										start = function() hr.RenderSkinned = 0 end,
										finish = function() hr.RenderSkinned = 1 end,
									}, {
										name = "Decals",
										start = function() hr.RenderDecals = 0 end,
										finish = function() hr.RenderDecals = 1 end,
									}, 
								}
						
								print( "Render subsystems test started ("..#tests.." tests) - please wait..." )
						
								local saved_preciseselection = hr.EnablePreciseSelection
								hr.EnablePreciseSelection = 0
						
								local frame_ms = WaitRenderFrames( 12000, 5 )
								print( "   0. Whole frame: "..Print100f(frame_ms).." ms - "..(1000/(frame_ms/100)).." fps" )
						
								for i=1,#tests do
									tests[i].start()
									local ms = WaitRenderFrames( 10000, 10 )
									local diff = frame_ms - ms
									local percent = diff*100/frame_ms
									print( "   "..i..". "..tests[i].name..":      "..Print100f(diff).." ms      "..percent.." %" )
									tests[i].finish()
									WaitRenderFrames( 2000 )
								end
								print( "done." )
								hr.EnablePreciseSelection = saved_preciseselection
							end
						)
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Render.Surfaces",
					'ActionTranslate', false,
					'ActionName', "Surfaces ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'comment', "Toggles the grid (Alt-G)",
						'ActionId', "E-Grid",
						'ActionTranslate', false,
						'ActionName', "Toggle Alignment Grid",
						'ActionShortcut', "Alt-G",
						'OnAction', function (self, host, source, ...)
							-- Transfer grid sizes, boxes, etc
							local grid_properties = rawget(_G, "g_ActiveGridProperties") or config.DeveloperGridDefaultProperties or empty_table
							table.overwrite(hr, grid_properties)
							
							local grids = config.DeveloperGrids
							local show_construction_grid = rawget(_G, "ShowConstructionGridWithDevGrid") or empty_func
							for idx, grid in ipairs(config.DeveloperGrids) do
								if GetPostProcPredicate(grid) then
									SetPostProcPredicate(grid, false)
									if hr.TerrainDebugDraw ~= 0 then show_construction_grid() end
									if idx ~= #grids then
										SetPostProcPredicate(grids[idx+1], true)
										if hr.TerrainDebugDraw ~= 0 then show_construction_grid(grids[idx + 1]) end
									end
									hr.TemporalReset()
									return
								end
							end
							SetPostProcPredicate(grids[1], true)
							if hr.TerrainDebugDraw ~= 0 then show_construction_grid(grids[1]) end
							hr.TemporalReset()
						end,
						'__condition', function (parent, context) return config.DeveloperGrids end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Collisions (Ctrl-Shift-K)",
						'RolloverText', "Toggle Collisions (Ctrl-Shift-K)",
						'ActionId', "G_ToggleCollisions",
						'ActionTranslate', false,
						'ActionName', "Toggle Collisions",
						'ActionIcon', "CommonAssets/UI/Menu/ToggleCollisions.tga",
						'ActionShortcut', "Ctrl-Shift-K",
						'OnAction', function (self, host, source, ...)
							if hr.ShowCollisionSurfaces == 0 and hr.ShowColliders == 0 then
								print("Showing collision surfaces")
								hr.ShowCollisionSurfaces = 1
							elseif hr.ShowCollisionSurfaces ~= 0 and const.maxCollidersPerObject > 0 then
								print("Showing colliders")
								hr.ShowCollisionSurfaces = 0
								hr.ShowColliders = -1
								OpenDialog("CollisionsLegend")
							else
								print("Collision display off")
								hr.ShowColliders = 0
								hr.ShowCollisionSurfaces = 0
								CloseDialog("CollisionsLegend")
							end
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Walk (Ctrl-Shift-L)",
						'RolloverText', "Toggle Walk (Ctrl-Shift-L)",
						'ActionId', "G_ToggleWalk",
						'ActionTranslate', false,
						'ActionName', "Toggle Walk",
						'ActionIcon', "CommonAssets/UI/Menu/ToggleWalk.tga",
						'ActionShortcut', "Ctrl-Shift-L",
						'OnAction', function (self, host, source, ...) ToggleHR("ShowWalk") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle BlockPass (Shift-K)",
						'RolloverText', "Toggle BlockPass (Shift-K)",
						'ActionId', "G_ToggleBlockPass",
						'ActionTranslate', false,
						'ActionName', "Toggle BlockPass",
						'ActionIcon', "CommonAssets/UI/Menu/ToggleBlockPass.tga",
						'ActionShortcut', "Shift-K",
						'OnAction', function (self, host, source, ...) ToggleHR("ShowBlockPass") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle Build",
						'RolloverText', "Toggle Build",
						'ActionId', "G_ToggleBuild",
						'ActionTranslate', false,
						'ActionName', "Toggle Build",
						'ActionIcon', "CommonAssets/UI/Menu/ToggleWalk.tga",
						'OnAction', function (self, host, source, ...) ToggleHR("ShowBuildSurfaces") end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "(Ctrl-Shift-9)",
						'ActionId', "G_DebugDrawTunnels",
						'ActionTranslate', false,
						'ActionName', "Toggle Tunnels",
						'ActionShortcut', "Ctrl-Shift-9",
						'OnAction', function (self, host, source, ...)
							ToggleDrawTunnels()
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "(Ctrl-Alt-9)",
						'ActionId', "G_TunnelHelpers",
						'ActionTranslate', false,
						'ActionName', "Tunnel Helpers",
						'ActionIcon', "CommonAssets/UI/Menu/object_options.tga",
						'ActionShortcut', "Ctrl-Alt-9",
						'OnAction', function (self, host, source, ...)
							local tunnels = 0
							MapForEach("map", "SlabTunnel", function(tunnel)
								local helper = PlaceObject("SlabTunnelHelper")
								helper:SetPos(tunnel:GetPos())
								helper.tunnel = tunnel
								if tunnel.dbg_tunnel_color then
									helper:SetColorModifier(tunnel.dbg_tunnel_color)
								end
								helper:SetScale(35)
								tunnels = tunnels + 1
							end)
							print(string.format("%d Tunnel helpers created", tunnels))
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'ActionId', "G_PathDebugDraw",
						'ActionTranslate', false,
						'ActionName', "Toggle Path",
						'OnAction', function (self, host, source, ...)
							if hr.TerrainDebugDraw == 1 and DbgGetTerrainOverlay() == "path" and terrain.GetPassGridsCount() > 1 then
								DbgSetTerrainOverlay("path_large")
								print("path_large")
							else
								DbgSetTerrainOverlay("path")
								print("path")
								ToggleHR("TerrainDebugDraw")
								if hr.TerrainDebugDraw == 0 then
									pf.DbgDrawFindPath() -- clear last path info
								end
							end
						end,
						'__condition', function (parent, context) return const.DebugOverlay end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Ctrl-8)",
						'RolloverText', " (Ctrl-8)",
						'ActionId', "G_WindDebugDraw",
						'ActionTranslate', false,
						'ActionName', "Toggle Wind",
						'ActionShortcut', "Ctrl-8",
						'OnAction', function (self, host, source, ...)
							DbgDrawWind(not g_DebugWindDraw)
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Ctrl-Shift-8)",
						'RolloverText', " (Ctrl-Shift-8)",
						'ActionId', "G_WindDebugDrawTexts",
						'ActionTranslate', false,
						'ActionName', "Toggle Wind + Numbers",
						'ActionShortcut', "Ctrl-Shift-8",
						'OnAction', function (self, host, source, ...)
							DbgDrawWind(not g_DebugWindDraw, "texts")
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Ctrl-Alt-8)",
						'RolloverText', " (Ctrl-Alt-8)",
						'ActionId', "G_WindDebugDrawTextsTiles",
						'ActionTranslate', false,
						'ActionName', "Toggle Wind + Numbers + Tiles",
						'ActionShortcut', "Ctrl-Alt-8",
						'OnAction', function (self, host, source, ...)
							DbgDrawWind(not g_DebugWindDraw, "texts", "show tiles around cursor")
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Ctrl-9)",
						'RolloverText', " (Ctrl-9)",
						'ActionId', "G_TerrainDebugDraw",
						'ActionTranslate', false,
						'ActionName', "Toggle Passability",
						'ActionShortcut', "Ctrl-9",
						'OnAction', function (self, host, source, ...)
							if hr.TerrainDebugDraw == 0 then
								DbgSetTerrainOverlay("passability")
								EnablePassability3DVisualization(true)
								hr.TerrainDebugDraw = 1
							else
								EnablePassability3DVisualization(false)
								hr.TerrainDebugDraw = 0
							end
						end,
						'__condition', function (parent, context) return const.DebugOverlay end,
						'replace_matching_id', true,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'comment', " (Shift-C)",
					'RolloverText', " (Shift-C)",
					'ActionId', "G_CameraChange",
					'ActionMode', "Game",
					'ActionTranslate', false,
					'ActionName', "Toggle Camera Type",
					'ActionShortcut', "Shift-C",
					'OnAction', function (self, host, source, ...)
						CheatToggleFlyCamera()
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'ActionId', "Render.Toggle Render",
					'ActionTranslate', false,
					'ActionName', "Toggle Render ...",
					'ActionIcon', "CommonAssets/UI/Menu/folder.tga",
					'OnActionEffect', "popup",
					'replace_matching_id', true,
				}, {
					PlaceObj('XTemplateAction', {
						'comment', "Toggles the rendering of the shadows",
						'RolloverText', "Toggles the rendering of the shadows",
						'ActionId', "DbgRenderShadows",
						'ActionTranslate', false,
						'ActionName', "Shadow",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr.Shadowmap == 1
						end,
						'OnAction', function (self, host, source, ...) ToggleHR "Shadowmap" end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggles the rendering of the objects",
						'RolloverText', "Toggles the rendering of the objects",
						'ActionId', "DbgRenderObjects",
						'ActionTranslate', false,
						'ActionName', "Objects",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr.RenderMapObjects == 1
						end,
						'OnAction', function (self, host, source, ...) ToggleHR "RenderMapObjects" end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggles the rendering of the BSpheres",
						'RolloverText', "Toggles the rendering of the BSpheres",
						'ActionId', "DbgShowBSpheres",
						'ActionTranslate', false,
						'ActionName', "BSpheres",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr.RenderBSpheres == 1
						end,
						'OnAction', function (self, host, source, ...) ToggleHR "RenderBSpheres" end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggles the rendering of the billboards",
						'RolloverText', "Toggles the rendering of the billboards",
						'ActionId', "DbgRenderBillboards",
						'ActionTranslate', false,
						'ActionName', "Billboards",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr.RenderBillboards == 1
						end,
						'OnAction', function (self, host, source, ...) ToggleHR "RenderBillboards" end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggles the rendering of the terrain bounding boxes",
						'RolloverText', "Toggles the rendering of the terrain bounding boxes",
						'ActionId', "DbgShowTerrainBBoxes",
						'ActionTranslate', false,
						'ActionName', "Terrain bboxes",
						'ActionToggle', true,
						'ActionToggled', function (self, host)
							return hr.TerrainAABB == 1
						end,
						'OnAction', function (self, host, source, ...) ToggleHR "TerrainAABB" end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', " (Shift-Z)",
						'RolloverText', " (Shift-Z)",
						'ActionId', "G_Shadowmap",
						'ActionTranslate', false,
						'ActionName', "Toggle Shadowmap",
						'ActionShortcut', "Shift-Z",
						'OnAction', function (self, host, source, ...) ToggleHR "Shadowmap" end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'ActionId', "DbgCycleUpscalingModes",
						'ActionTranslate', false,
						'ActionName', "Cycle Upscaling Modes",
						'OnAction', function (self, host, source, ...)
							CycleUpscaling()
						end,
						'replace_matching_id', true,
					}),
					}),
				PlaceObj('XTemplateAction', {
					'comment', "Toggle Safearea Lines",
					'RolloverText', "Toggle Safearea Lines",
					'ActionId', "G_ToggleSafeareaLines",
					'ActionTranslate', false,
					'ActionName', "Toggle Safearea Lines",
					'OnAction', function (self, host, source, ...)
						ToggleSafearea()
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Toggle Obj Mask Mode",
					'ActionId', "DbgToggleObjMaskMode",
					'ActionTranslate', false,
					'ActionName', "Toggle Obj Mask Mode",
					'ActionToggle', true,
					'ActionToggled', function (self, host)
						return hr.DeferMode == DeferModes["OBJ_MASK"]
					end,
					'OnAction', function (self, host, source, ...)
						if hr.DeferMode ~= DeferModes["OBJ_MASK"] then
							OpenDevDSForceModeDlg("OBJ_MASK")
						else
							CloseDialog("DevDSForceModeDlg")
						end
					end,
					'__condition', function (parent, context) return Platform.developer end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Toggle Skinned Decal Space",
					'ActionId', "DbgToggleToggleSkinnedDecalSpace",
					'ActionTranslate', false,
					'ActionName', "Toggle Skinned Decal Space",
					'ActionToggle', true,
					'ActionToggled', function (self, host)
						return hr.ShowSkinnedDecalSpace ~= 0
					end,
					'OnAction', function (self, host, source, ...)
						hr.ShowSkinnedDecalSpace = 1 - hr.ShowSkinnedDecalSpace
					end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Show decals",
					'RolloverText', "Show decals",
					'ActionId', "G_ShowDecals",
					'ActionTranslate', false,
					'ActionName', "Toggle Decals",
					'ActionIcon', "CommonAssets/UI/Icons/art brush creative design graphic paint.png",
					'ActionToggle', true,
					'ActionToggled', function (self, host)
						return hr.DecalsRenderBoxes == 1
					end,
					'OnAction', function (self, host, source, ...) hr.DecalsRenderBoxes = 1 - hr.DecalsRenderBoxes end,
					'replace_matching_id', true,
				}),
				}),
			PlaceObj('XTemplateAction', {
				'ActionId', "Tools",
				'ActionTranslate', false,
				'ActionName', "Tools",
				'ActionMenubar', "DevMenu",
				'OnActionEffect', "popup",
				'replace_matching_id', true,
			}, {
				PlaceObj('XTemplateAction', {
					'comment', "Enter/Exit Editor (F3)",
					'RolloverText', "Editor mode (F3)",
					'ActionId', "MO_Editor",
					'ActionTranslate', false,
					'ActionName', "Enter/Exit Editor",
					'ActionIcon', "CommonAssets/UI/Icons/door emergency enter entry exit login.png",
					'ActionShortcut', "F3",
					'OnAction', function (self, host, source, ...)
						ToggleEnterExitEditor()
					end,
					'__condition', function (parent, context) return not editor.IsModdingEditor() end,
					'replace_matching_id', true,
				}),
				PlaceObj('XTemplateAction', {
					'comment', "Clear ignored errors",
					'RolloverText', "Clear ignored errors",
					'ActionId', "Clear Ignored Errors",
					'ActionTranslate', false,
					'ActionName', "Clear Ignored Errors",
					'ActionIcon', "CommonAssets/UI/Icons/bathroom commode restroom toilet washroom.png",
					'OnAction', function (self, host, source, ...)
						ClearIgnoredErrors()
					end,
					'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', "Write screenshot (-PrtScr)",
						'RolloverText', "Write screenshot (-PrtScr)",
						'ActionId', "DE_Screenshot",
						'ActionTranslate', false,
						'ActionName', "Screenshot",
						'ActionShortcut', "-PrtScr",
						'OnAction', function (self, host, source, ...)
							WriteScreenshot(GenerateScreenshotFilename("SS", "AppData/"))
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Isolated object screenshot (-Ctrl-Alt-PrtScr)",
						'RolloverText', "Isolated object screenshot (-Ctrl-Alt-PrtScr)",
						'ActionId', "DE_Isolated_Object_Screenshot",
						'ActionTranslate', false,
						'ActionName', "Isolated Object Screenshot",
						'ActionShortcut', "-Ctrl-Alt-PrtScr",
						'OnAction', function (self, host, source, ...)
							IsolatedObjectScreenshot()
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Report Bug (Ctrl-F1)",
						'RolloverText', "Report Bug (Ctrl-F1)",
						'ActionId', "DE_BugReport",
						'ActionTranslate', false,
						'ActionName', "Report Bug",
						'ActionIcon', "CommonAssets/UI/Icons/bacteria bug insect protection security virus.png",
						'ActionShortcut', "Ctrl-F1",
						'OnAction', function (self, host, source, ...)
							CreateRealTimeThread(CreateXBugReportDlg)
						end,
						'__condition', function (parent, context) return not Platform.steamdeck and not Platform.demo or Platform.asserts end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Toggle UI in screenshots (-Ctrl-Shift-PrtScr)",
						'RolloverText', "Toggle UI in screenshots (-Ctrl-Shift-PrtScr)",
						'ActionId', "DE_ToggleScreenshotInterface",
						'ActionTranslate', false,
						'ActionName', "Toggle UI in screenshots",
						'ActionShortcut', "-Ctrl-Shift-PrtScr",
						'OnAction', function (self, host, source, ...)
							hr.InterfaceInScreenshot = hr.InterfaceInScreenshot ~= 0 and 0 or 1
							print("UI in screenshots is now", hr.InterfaceInScreenshot ~= 0 and "enabled" or "disabled")
						end,
						'replace_matching_id', true,
					}),
					PlaceObj('XTemplateAction', {
						'comment', "Write upsampled screenshot (-Ctrl-PrtScr)",
						'RolloverText', "Write upsampled screenshot (-Ctrl-PrtScr)",
						'ActionId', "DE_UpsampledScreenshot",
						'ActionTranslate', false,
						'ActionName', "Upsampled Screenshot",
						'ActionShortcut', "-Ctrl-PrtScr",
						'OnAction', function (self, host, source, ...)
							if Platform.developer then
								CreateRealTimeThread(function()
									WaitNextFrame(3)
									LockCamera("Screenshot")
									local store = {}
									Msg("BeforeUpsampledScreenshot", store)
									WaitNextFrame()
									MovieWriteScreenshot(GenerateScreenshotFilename("SSAA", "AppData/"), 0, 64, false)
									WaitNextFrame()
									Msg("AfterUpsampledScreenshot", store)
									UnlockCamera("Screenshot")
								end)
							end
						end,
						'replace_matching_id', true,
					}),
					}),
				}),
			}),
		PlaceObj('XTemplateAction', {
			'RolloverText', "Toggle terrain types display",
			'ActionId', "G_ShowTerrainTypes",
			'ActionTranslate', false,
			'ActionName', "Terrain types",
			'ActionShortcut', "Ctrl-Alt-1",
			'OnAction', function (self, host, source, ...)
				DbgToggleOverlay("type")
			end,
			'replace_matching_id', true,
		}),
		PlaceObj('XTemplateAction', {
			'RolloverText', "Toggle grass density display",
			'ActionId', "G_ShowGrassDensity",
			'ActionTranslate', false,
			'ActionName', "Grass density",
			'ActionShortcut', "Ctrl-Alt-2",
			'OnAction', function (self, host, source, ...)
				DbgToggleOverlay("grass_density")
			end,
			'replace_matching_id', true,
		}),
		PlaceObj('XTemplateAction', {
			'comment', "Toggles the buildable debug grid (Ctrl-B)",
			'ActionId', "ToggleBuildable",
			'ActionTranslate', false,
			'ActionShortcut', "Ctrl-B",
			'OnAction', function (self, host, source, ...)
				DbgToggleBuildableGrid()
			end,
			'__condition', function (parent, context) return Libs.Sim end,
			'replace_matching_id', true,
		}),
		PlaceObj('XTemplateAction', {
			'comment', "Editor actions",
			'ActionMode', "Editor",
		}, {
			PlaceObj('XTemplateAction', {
				'comment', " (Ctrl-C)",
				'ActionId', "E_CopyToClipboard",
				'ActionTranslate', false,
				'ActionShortcut', "Ctrl-C",
				'OnAction', function (self, host, source, ...)
					if IsEditorActive() and selo() then
						ExecuteWithStatusUI("Copying to clipboard...", XEditorCopyToClipboard)
					end
				end,
				'replace_matching_id', true,
			}),
			PlaceObj('XTemplateAction', {
				'comment', " (Ctrl-X)",
				'ActionId', "E_CutToClipboard",
				'ActionTranslate', false,
				'ActionShortcut', "Ctrl-X",
				'ActionState', function (self, host)
					return IsEditorActive() and "enabled" or "disabled"
				end,
				'OnAction', function (self, host, source, ...)
					if IsEditorActive() and selo() then
						ExecuteWithStatusUI("Cutting to clipboard...", function() XEditorCopyToClipboard() editor.DelSelWithUndoRedo() end)
					end
				end,
				'replace_matching_id', true,
			}),
			PlaceObj('XTemplateAction', {
				'comment', "Paste (Ctrl-V)",
				'ActionId', "G_Paste",
				'ActionTranslate', false,
				'ActionShortcut', "Ctrl-V",
				'OnAction', function (self, host, source, ...)
					if IsEditorActive() then
						local clipboard = GetFromClipboard(-1)
						if clipboard then
							if clipboard:starts_with("--[[HGE place script]]--") then
								editor.PasteFromClipboard()
							else
								local lua_code = GetFromClipboard(-1)
								if not lua_code:starts_with(XEditorCopyScriptTag) then
									ExecuteWithStatusUI("No objects in clipboard.", function() Sleep(500) end)
									return
								end
								ExecuteWithStatusUI("Pasting...", XEditorPasteFromClipboard)
							end
						end
					end
				end,
				'replace_matching_id', true,
			}),
			PlaceObj('XTemplateAction', {
				'comment', "Adds the visible objects to the selection (Ctrl-Alt-Space)",
				'ActionId', "Dbg_AddVisibleClassToSelection",
				'ActionTranslate', false,
				'ActionShortcut', "Ctrl-Alt-Space",
				'OnAction', function (self, host, source, ...)
					local ol = editor.GetSel()
					if #ol == 0 then
						print( "Select something first!" )
					else
						local num = #ol
						local locked = Collection.GetLockedCollection()
						editor.AddToSel(XEditorGetVisibleObjects(function(obj)
							for i = 1, num do
								if ol[i].class == obj.class and (not locked or obj:GetRootCollection() == locked) then
									return true
								end
							end
							return false
						end))
					end
				end,
				'replace_matching_id', true,
			}),
			PlaceObj('XTemplateAction', {
				'comment', " (Ctrl-Shift-V)",
				'ActionId', "G_PasteNoZ",
				'ActionTranslate', false,
				'ActionShortcut', "Ctrl-Shift-V",
				'OnAction', function (self, host, source, ...) editor.PasteFromClipboard(true) end,
				'replace_matching_id', true,
			}),
			}),
		PlaceObj('XTemplateAction', {
			'comment', "Execute last console command (.)",
			'ActionId', "LastCommand",
			'ActionTranslate', false,
			'ActionShortcut', ".",
			'OnAction', function (self, host, source, ...)
				if rawget(_G, "dlgConsole") then
					dlgConsole:ExecuteLast()
				end
			end,
			'replace_matching_id', true,
		}),
		PlaceObj('XTemplateAction', {
			'comment', "Delete slab without deleting suppressed slabs underneath.",
			'ActionId', "DeleteSelectedSlabsWithoutPropagation",
			'ActionTranslate', false,
			'ActionShortcut', "Ctrl-Delete",
			'OnAction', function (self, host, source, ...)
				DeleteSelectedSlabsWithoutPropagation()
			end,
			'replace_matching_id', true,
		}),
		}),
})