This repository was archived by the owner on Jun 26, 2021. It is now read-only.
forked from MicroGSD/RoadArchitect
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGSDRoadEditor.cs
1509 lines (1348 loc) · 70.1 KB
/
GSDRoadEditor.cs
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
#if UNITY_EDITOR
#region "Imports"
using UnityEngine;
using UnityEditor;
using GSD.Roads;
using GSD;
//using System.Collections; // Unused
#endregion
[CustomEditor(typeof(GSDRoad))]
public class GSDRoadEditor : Editor
{
private static string[] RoadMaterialDropdownEnumDesc = new string[]{
"Asphalt",
"Dirt",
"Brick",
"Cobblestone"
};
protected GSDRoad RS { get { return (GSDRoad) target; } }
//Serialized properties:
private SerializedProperty t_opt_GizmosEnabled;
private SerializedProperty t_opt_Lanes;
private SerializedProperty t_opt_LaneWidth;
private SerializedProperty t_opt_bShouldersEnabled;
private SerializedProperty t_opt_ShoulderWidth;
private SerializedProperty t_opt_RoadDefinition;
private SerializedProperty t_opt_UseDefaultMaterials;
private SerializedProperty t_opt_bMaxGradeEnabled;
private SerializedProperty t_opt_MaxGrade;
private SerializedProperty t_opt_bMultithreading;
private SerializedProperty t_opt_bSaveMeshes;
private SerializedProperty t_opt_TerrainSubtract_Match;
private SerializedProperty t_opt_MagnitudeThreshold;
private SerializedProperty t_opt_HeightModEnabled;
private SerializedProperty t_opt_DetailModEnabled;
private SerializedProperty t_opt_TreeModEnabled;
private SerializedProperty t_opt_MatchHeightsDistance;
private SerializedProperty t_opt_ClearDetailsDistance;
private SerializedProperty t_opt_ClearDetailsDistanceHeight;
private SerializedProperty t_opt_ClearTreesDistance;
private SerializedProperty t_opt_ClearTreesDistanceHeight;
private SerializedProperty t_opt_SaveTerrainHistoryOnDisk;
private SerializedProperty t_opt_bRoadCuts;
private SerializedProperty t_opt_bDynamicCuts;
private SerializedProperty t_opt_bShoulderCuts;
private SerializedProperty t_bEditorCameraRotate;
private SerializedProperty t_EditorCameraMetersPerSecond;
private SerializedProperty t_opt_bUseMeshColliders;
private SerializedProperty t_opt_tRoadMaterialDropdown;
private SerializedProperty t_opt_bIsStatic;
private SerializedProperty t_opt_bIsLightmapped;
private SerializedProperty t_opt_desiredRampHeight;
private SerializedProperty t_RoadMaterial1;
private SerializedProperty t_RoadMaterial2;
private SerializedProperty t_RoadMaterial3;
private SerializedProperty t_RoadMaterial4;
private SerializedProperty t_RoadMaterialMarker1;
private SerializedProperty t_RoadMaterialMarker2;
private SerializedProperty t_RoadMaterialMarker3;
private SerializedProperty t_RoadMaterialMarker4;
private SerializedProperty t_ShoulderMaterial1;
private SerializedProperty t_ShoulderMaterial2;
private SerializedProperty t_ShoulderMaterial3;
private SerializedProperty t_ShoulderMaterial4;
private SerializedProperty t_ShoulderMaterialMarker1;
private SerializedProperty t_ShoulderMaterialMarker2;
private SerializedProperty t_ShoulderMaterialMarker3;
private SerializedProperty t_ShoulderMaterialMarker4;
private SerializedProperty t_RoadPhysicMaterial;
private SerializedProperty t_ShoulderPhysicMaterial;
//Editor only variables:
private string status = "Show help";
private const string tOnlineHelpDesc = "Visit the online manual for the most effective help.";
private bool bShowCutsHelp = false;
private bool bShowMatsHelp = false;
private bool bShowHelpRoad = false;
private bool bShowHelpTerrain = false;
private bool bShowCameraHelp = false;
private GUIStyle GSDLoadButton = null;
private bool bResetTH = false;
public enum tempEnum { Two, Four, Six };
private Texture btnRefreshText = null;
private Texture btnDeleteText = null;
private Texture btnRefreshTextReal = null;
private tempEnum LanesEnum = tempEnum.Two;
private tempEnum tLanesEnum = tempEnum.Two;
private static string[] tempEnumDescriptions = new string[]{
"Two",
"Four",
"Six"
};
private GUIStyle WarningLabelStyle;
private Texture2D WarningLabelBG;
private GUIStyle GSDImageButton = null;
private GUIStyle GSDMaybeButton = null;
private bool bHasInit = false;
private Texture2D LoadBtnBG = null;
private Texture2D LoadBtnBGGlow = null;
//Buffers:
//private float TempChangeChecker = 0f;
//private bool bMatChange = false;
private bool bNeedRoadUpdate = false;
private bool bSetDefaultMats = false;
private bool bApplyMatsCheck = false;
private bool t_bApplyMatsCheck = false;
private void OnEnable()
{
t_opt_GizmosEnabled = serializedObject.FindProperty("opt_GizmosEnabled");
t_opt_Lanes = serializedObject.FindProperty("opt_Lanes");
t_opt_LaneWidth = serializedObject.FindProperty("opt_LaneWidth");
t_opt_bShouldersEnabled = serializedObject.FindProperty("opt_bShouldersEnabled");
t_opt_ShoulderWidth = serializedObject.FindProperty("opt_ShoulderWidth");
t_opt_RoadDefinition = serializedObject.FindProperty("opt_RoadDefinition");
t_opt_UseDefaultMaterials = serializedObject.FindProperty("opt_UseDefaultMaterials");
t_opt_bMaxGradeEnabled = serializedObject.FindProperty("opt_bMaxGradeEnabled");
t_opt_MaxGrade = serializedObject.FindProperty("opt_MaxGrade");
t_opt_bMultithreading = serializedObject.FindProperty("opt_bMultithreading");
t_opt_bSaveMeshes = serializedObject.FindProperty("opt_bSaveMeshes");
t_opt_TerrainSubtract_Match = serializedObject.FindProperty("opt_TerrainSubtract_Match");
t_opt_MagnitudeThreshold = serializedObject.FindProperty("opt_MagnitudeThreshold");
t_opt_HeightModEnabled = serializedObject.FindProperty("opt_HeightModEnabled");
t_opt_DetailModEnabled = serializedObject.FindProperty("opt_DetailModEnabled");
t_opt_TreeModEnabled = serializedObject.FindProperty("opt_TreeModEnabled");
t_opt_MatchHeightsDistance = serializedObject.FindProperty("opt_MatchHeightsDistance");
t_opt_ClearDetailsDistance = serializedObject.FindProperty("opt_ClearDetailsDistance");
t_opt_ClearDetailsDistanceHeight = serializedObject.FindProperty("opt_ClearDetailsDistanceHeight");
t_opt_ClearTreesDistance = serializedObject.FindProperty("opt_ClearTreesDistance");
t_opt_ClearTreesDistanceHeight = serializedObject.FindProperty("opt_ClearTreesDistanceHeight");
t_opt_SaveTerrainHistoryOnDisk = serializedObject.FindProperty("opt_SaveTerrainHistoryOnDisk");
t_opt_bRoadCuts = serializedObject.FindProperty("opt_bRoadCuts");
t_opt_bDynamicCuts = serializedObject.FindProperty("opt_bDynamicCuts");
t_opt_bShoulderCuts = serializedObject.FindProperty("opt_bShoulderCuts");
t_bEditorCameraRotate = serializedObject.FindProperty("bEditorCameraRotate");
t_EditorCameraMetersPerSecond = serializedObject.FindProperty("EditorCameraMetersPerSecond");
t_opt_bUseMeshColliders = serializedObject.FindProperty("opt_bUseMeshColliders");
t_opt_tRoadMaterialDropdown = serializedObject.FindProperty("opt_tRoadMaterialDropdown");
t_opt_bIsStatic = serializedObject.FindProperty("opt_bIsStatic");
t_opt_bIsLightmapped = serializedObject.FindProperty("opt_bIsLightmapped");
t_opt_desiredRampHeight = serializedObject.FindProperty("opt_desiredRampHeight");
t_RoadMaterial1 = serializedObject.FindProperty("RoadMaterial1");
t_RoadMaterial2 = serializedObject.FindProperty("RoadMaterial2");
t_RoadMaterial3 = serializedObject.FindProperty("RoadMaterial3");
t_RoadMaterial4 = serializedObject.FindProperty("RoadMaterial4");
t_RoadMaterialMarker1 = serializedObject.FindProperty("RoadMaterialMarker1");
t_RoadMaterialMarker2 = serializedObject.FindProperty("RoadMaterialMarker2");
t_RoadMaterialMarker3 = serializedObject.FindProperty("RoadMaterialMarker3");
t_RoadMaterialMarker4 = serializedObject.FindProperty("RoadMaterialMarker4");
t_ShoulderMaterial1 = serializedObject.FindProperty("ShoulderMaterial1");
t_ShoulderMaterial2 = serializedObject.FindProperty("ShoulderMaterial2");
t_ShoulderMaterial3 = serializedObject.FindProperty("ShoulderMaterial3");
t_ShoulderMaterial4 = serializedObject.FindProperty("ShoulderMaterial4");
t_ShoulderMaterialMarker1 = serializedObject.FindProperty("ShoulderMaterialMarker1");
t_ShoulderMaterialMarker2 = serializedObject.FindProperty("ShoulderMaterialMarker2");
t_ShoulderMaterialMarker3 = serializedObject.FindProperty("ShoulderMaterialMarker3");
t_ShoulderMaterialMarker4 = serializedObject.FindProperty("ShoulderMaterialMarker4");
t_RoadPhysicMaterial = serializedObject.FindProperty("RoadPhysicMaterial");
t_ShoulderPhysicMaterial = serializedObject.FindProperty("ShoulderPhysicMaterial");
}
private void Init()
{
bHasInit = true;
EditorStyles.label.wordWrap = true;
if (WarningLabelBG == null)
{
WarningLabelBG = (Texture2D) AssetDatabase.LoadAssetAtPath(GSD.Roads.GSDRoadUtilityEditor.GetBasePath() + "/Editor/Icons/WarningLabelBG.png", typeof(Texture2D)) as Texture2D;
}
if (btnRefreshText == null)
{
btnRefreshText = (Texture) AssetDatabase.LoadAssetAtPath(GSD.Roads.GSDRoadUtilityEditor.GetBasePath() + "/Editor/Icons/refresh2.png", typeof(Texture)) as Texture;
}
if (btnRefreshTextReal == null)
{
btnRefreshTextReal = (Texture) AssetDatabase.LoadAssetAtPath(GSD.Roads.GSDRoadUtilityEditor.GetBasePath() + "/Editor/Icons/refresh.png", typeof(Texture)) as Texture;
}
if (LoadBtnBG == null)
{
LoadBtnBG = (Texture2D) AssetDatabase.LoadAssetAtPath(GSD.Roads.GSDRoadUtilityEditor.GetBasePath() + "/Editor/Icons/otherbg.png", typeof(Texture2D)) as Texture2D;
}
if (LoadBtnBGGlow == null)
{
LoadBtnBGGlow = (Texture2D) AssetDatabase.LoadAssetAtPath(GSD.Roads.GSDRoadUtilityEditor.GetBasePath() + "/Editor/Icons/otherbg2.png", typeof(Texture2D)) as Texture2D;
}
if (btnDeleteText == null)
{
btnDeleteText = (Texture) AssetDatabase.LoadAssetAtPath(GSD.Roads.GSDRoadUtilityEditor.GetBasePath() + "/Editor/Icons/delete.png", typeof(Texture)) as Texture;
}
if (WarningLabelStyle == null)
{
WarningLabelStyle = new GUIStyle(GUI.skin.textArea);
WarningLabelStyle.normal.textColor = Color.red;
WarningLabelStyle.active.textColor = Color.red;
WarningLabelStyle.hover.textColor = Color.red;
WarningLabelStyle.normal.background = WarningLabelBG;
WarningLabelStyle.active.background = WarningLabelBG;
WarningLabelStyle.hover.background = WarningLabelBG;
WarningLabelStyle.padding = new RectOffset(8, 8, 8, 8);
}
if (GSDImageButton == null)
{
GSDImageButton = new GUIStyle(GUI.skin.button);
GSDImageButton.contentOffset = new Vector2(0f, 0f);
GSDImageButton.border = new RectOffset(0, 0, 0, 0);
GSDImageButton.fixedHeight = 16f;
GSDImageButton.padding = new RectOffset(0, 0, 0, 0);
GSDImageButton.normal.background = null;
}
if (GSDLoadButton == null)
{
GSDLoadButton = new GUIStyle(GUI.skin.button);
GSDLoadButton.contentOffset = new Vector2(0f, 1f);
GSDLoadButton.normal.textColor = new Color(1f, 1f, 1f, 1f);
GSDLoadButton.normal.background = LoadBtnBG;
GSDLoadButton.active.background = LoadBtnBGGlow;
GSDLoadButton.focused.background = LoadBtnBGGlow;
GSDLoadButton.hover.background = LoadBtnBGGlow;
GSDLoadButton.fixedHeight = 16f;
GSDLoadButton.fixedWidth = 128f;
}
if (GSDMaybeButton == null)
{
GSDMaybeButton = new GUIStyle(GUI.skin.button);
GSDMaybeButton.normal.textColor = new Color(0f, 0f, 0f, 1f);
}
}
public override void OnInspectorGUI()
{
if (Event.current.type == EventType.ValidateCommand)
{
switch (Event.current.commandName)
{
case "UndoRedoPerformed":
TriggerRoadUpdate();
break;
}
}
serializedObject.Update();
bNeedRoadUpdate = false;
bSetDefaultMats = false;
//Graphic null checks:
if (!bHasInit)
{
Init();
}
RAEditorUtilitys.Line();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(RS.transform.name, EditorStyles.boldLabel);
if (GUILayout.Button("Update road", GSDLoadButton))
{
RS.EditorUpdateMe = true;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.LabelField("Hold ctrl and click terrain to add nodes.");
EditorGUILayout.LabelField("Hold shift and click terrain to insert nodes.");
EditorGUILayout.LabelField("Select nodes on spline to add objects.");
EditorGUILayout.LabelField("Road options:");
EditorGUILayout.BeginVertical("box");
if (GUILayout.Button("Online manual", EditorStyles.miniButton, GUILayout.Width(120f)))
{
Application.OpenURL("https://github.com/MicroGSD/RoadArchitect/wiki");
}
//Option: Gizmos input:
t_opt_GizmosEnabled.boolValue = EditorGUILayout.Toggle("Gizmos: ", RS.opt_GizmosEnabled);
RS.selectedColor = EditorGUILayout.ColorField("Gizmo Selected Color: ", RS.selectedColor);
RS.Color_NodeDefaultColor = EditorGUILayout.ColorField("Gizmo Default Color: ", RS.Color_NodeDefaultColor);
//Option: Lane count:
if (RS.opt_Lanes == 2)
{
LanesEnum = tempEnum.Two;
}
else if (RS.opt_Lanes == 4)
{
LanesEnum = tempEnum.Four;
}
else
{
LanesEnum = tempEnum.Six;
}
tLanesEnum = (tempEnum) EditorGUILayout.Popup("Lanes: ", (int) LanesEnum, tempEnumDescriptions);
if (tLanesEnum == tempEnum.Two)
{
t_opt_Lanes.intValue = 2;
}
else if (tLanesEnum == tempEnum.Four)
{
t_opt_Lanes.intValue = 4;
}
else if (tLanesEnum == tempEnum.Six)
{
t_opt_Lanes.intValue = 6;
}
//Option: Lane and road width:
EditorGUILayout.BeginHorizontal();
t_opt_LaneWidth.floatValue = EditorGUILayout.FloatField("Lane width:", RS.opt_LaneWidth);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_LaneWidth.floatValue = 5f;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.LabelField("Road width: " + RS.RoadWidth().ToString("F1") + " meters");
//Option: Shoulders enabled:
t_opt_bShouldersEnabled.boolValue = EditorGUILayout.Toggle("Shoulders enabled:", RS.opt_bShouldersEnabled);
//Option: Shoulders width:
if (RS.opt_bShouldersEnabled)
{
EditorGUILayout.BeginHorizontal();
t_opt_ShoulderWidth.floatValue = EditorGUILayout.FloatField("Shoulders width:", RS.opt_ShoulderWidth);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_ShoulderWidth.floatValue = 3f;
}
EditorGUILayout.EndHorizontal();
}
//Option: Road definition:
EditorGUILayout.BeginHorizontal();
t_opt_RoadDefinition.floatValue = EditorGUILayout.FloatField("Road definition:", RS.opt_RoadDefinition);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_RoadDefinition.floatValue = 5f;
}
EditorGUILayout.EndHorizontal();
//Option: Use default materials:
t_opt_UseDefaultMaterials.boolValue = EditorGUILayout.Toggle("Use default materials:", RS.opt_UseDefaultMaterials);
//Dropdown:
if (RS.opt_UseDefaultMaterials)
{
int Old = (int) RS.opt_tRoadMaterialDropdown;
t_opt_tRoadMaterialDropdown.enumValueIndex = (int) EditorGUILayout.Popup("Road material: ", (int) RS.opt_tRoadMaterialDropdown, RoadMaterialDropdownEnumDesc, GUILayout.Width(250f));
if (t_opt_tRoadMaterialDropdown.enumValueIndex != Old)
{
if (t_opt_tRoadMaterialDropdown.enumValueIndex > 0)
{
t_opt_bShouldersEnabled.boolValue = false;
}
else
{
t_opt_bShouldersEnabled.boolValue = true;
}
}
}
//Option: Max grade enabled:
t_opt_bMaxGradeEnabled.boolValue = EditorGUILayout.Toggle("Max grade enforced: ", RS.opt_bMaxGradeEnabled);
//Option: Max grade value:
if (RS.opt_bMaxGradeEnabled)
{
EditorGUILayout.BeginHorizontal();
t_opt_MaxGrade.floatValue = EditorGUILayout.Slider("Max road grade: ", RS.opt_MaxGrade, 0f, 1f);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_MaxGrade.floatValue = 0.08f;
}
EditorGUILayout.EndHorizontal();
}
//Mesh colliders:
if (RS.GSDRS != null)
{
t_opt_bUseMeshColliders.boolValue = EditorGUILayout.Toggle("Use mesh colliders: ", RS.opt_bUseMeshColliders);
}
//Option: Multi-threading option: workaround for UAS submission rules:
if (RS.GSDRS.opt_bMultithreading != RS.opt_bMultithreading)
{
RS.GSDRS.opt_bMultithreading = RS.opt_bMultithreading;
RS.GSDRS.UpdateAllRoads_MultiThreadOptions();
}
if (RS.GSDRS != null)
{
t_opt_bMultithreading.boolValue = EditorGUILayout.Toggle("Multithreading: ", RS.GSDRS.opt_bMultithreading);
}
//Static:
if (RS.GSDRS != null)
{
t_opt_bIsStatic.boolValue = EditorGUILayout.Toggle("Static: ", RS.opt_bIsStatic);
}
//Used for lightmapping:
if (RS.GSDRS != null)
{
t_opt_bIsLightmapped.boolValue = EditorGUILayout.Toggle("Lightmapped: ", RS.opt_bIsLightmapped);
t_opt_desiredRampHeight.floatValue = EditorGUILayout.FloatField("Ramp Height:", RS.opt_desiredRampHeight);
}
//Option: Save meshes as unity assets options:
if (RS.GSDRS.opt_bSaveMeshes != RS.opt_bSaveMeshes)
{
RS.GSDRS.opt_bSaveMeshes = RS.opt_bSaveMeshes;
RS.GSDRS.UpdateAllRoads_SaveMeshesAsAssetsOptions();
}
if (RS.GSDRS != null)
{
t_opt_bSaveMeshes.boolValue = EditorGUILayout.Toggle("Save mesh assets: ", RS.GSDRS.opt_bSaveMeshes);
}
if (RS.GSDRS.opt_bSaveMeshes)
{
GUILayout.Label("WARNING: Saving meshes as assets is very slow and can increase road generation time by several minutes.", WarningLabelStyle);
}
if (GUILayout.Button("Duplicate road", EditorStyles.miniButton, GUILayout.Width(120f)))
{
RS.DuplicateRoad();
}
bShowHelpRoad = EditorGUILayout.Foldout(bShowHelpRoad, status);
if (bShowHelpRoad)
{
EditorGUILayout.BeginVertical("box");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Road options quick help:", EditorStyles.boldLabel);
if (GUILayout.Button("Online manual", EditorStyles.miniButton, GUILayout.Width(120f)))
{
Application.OpenURL("https://github.com/MicroGSD/RoadArchitect/wiki");
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.HelpBox(tOnlineHelpDesc, MessageType.Info);
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Gizmos:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Enable or disable most gizmos for this road. Disable mesh collider gizmos via the unity menu if necessary or desired.", EditorStyles.miniLabel);
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Lanes:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Select the number of lanes for this road.");
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Lane width:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Modify the width per lane, in meters.");
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Road width:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Displays the road width without considering shoulders, in meters.");
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Shoulders enabled:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Enables or disables shoulders.");
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Shoulders width:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Modify the width of shoulders, in meters.");
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Road definition: ", EditorStyles.boldLabel);
EditorGUILayout.LabelField("The meter spacing between mesh triangles on the road and shoulder.");
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Use default materials: ", EditorStyles.boldLabel);
EditorGUILayout.LabelField("When enabled will use default materials for the road system, allowing certain aspects of generation to automatically determine the correct materials to utilize.");
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Max grade enforced: ", EditorStyles.boldLabel);
EditorGUILayout.LabelField("When enabled enforces a maximum grade on a per node basis.");
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Max road grade: ", EditorStyles.boldLabel);
EditorGUILayout.LabelField("The maximum road grade allowed on a per node basis.");
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Multithreading:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("When enabled allows for multi-threaded road generation.");
EditorGUILayout.EndVertical();
GUILayout.Space(4f);
EditorGUILayout.BeginVertical();
EditorGUILayout.LabelField("Save mesh assets:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("When enabled saves all generated meshes as .asset files.");
GUILayout.Space(4f);
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
}
EditorGUILayout.LabelField(" = Resets settings to default.");
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndVertical();
EditorGUILayout.LabelField("Terrain options:");
EditorGUILayout.BeginVertical("box");
//Option: Terrain subtraction:
EditorGUILayout.BeginHorizontal();
t_opt_TerrainSubtract_Match.floatValue = EditorGUILayout.Slider("Terrain subtraction: ", RS.opt_TerrainSubtract_Match, 0.01f, 1f);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_TerrainSubtract_Match.floatValue = 0.01f;
}
EditorGUILayout.EndHorizontal();
//Option: Spline magnitude limit:
EditorGUILayout.BeginHorizontal();
t_opt_MagnitudeThreshold.floatValue = EditorGUILayout.Slider("Spline magnitude limit: ", RS.opt_MagnitudeThreshold, 128f, 8192f);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_MagnitudeThreshold.floatValue = 300f;
}
EditorGUILayout.EndHorizontal();
//Option: Height modification
t_opt_HeightModEnabled.boolValue = EditorGUILayout.Toggle("Height modification: ", RS.opt_HeightModEnabled);
//Option: Active detail removal
t_opt_DetailModEnabled.boolValue = EditorGUILayout.Toggle("Active detail removal: ", RS.opt_DetailModEnabled);
//Option: Active tree removal
t_opt_TreeModEnabled.boolValue = EditorGUILayout.Toggle("Active tree removal: ", RS.opt_TreeModEnabled);
//Option: heights width
if (RS.opt_HeightModEnabled)
{
EditorGUILayout.BeginHorizontal();
t_opt_MatchHeightsDistance.floatValue = EditorGUILayout.Slider("Heights match width: ", RS.opt_MatchHeightsDistance, 0.01f, 512f);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_MatchHeightsDistance.floatValue = 50f;
}
EditorGUILayout.EndHorizontal();
}
//Option: details width and height
if (RS.opt_DetailModEnabled)
{
EditorGUILayout.BeginHorizontal();
t_opt_ClearDetailsDistance.floatValue = EditorGUILayout.Slider("Details clear width: ", RS.opt_ClearDetailsDistance, 0.01f, 512f);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_ClearDetailsDistance.floatValue = 30f;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
t_opt_ClearDetailsDistanceHeight.floatValue = EditorGUILayout.Slider("Details clear height: ", RS.opt_ClearDetailsDistanceHeight, 0.01f, 512f);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_ClearDetailsDistanceHeight.floatValue = 5f;
}
EditorGUILayout.EndHorizontal();
}
//Option: tree widths and height
if (RS.opt_TreeModEnabled)
{
EditorGUILayout.BeginHorizontal();
t_opt_ClearTreesDistance.floatValue = EditorGUILayout.Slider("Trees clear width: ", RS.opt_ClearTreesDistance, 0.01f, 512f);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_ClearTreesDistance.floatValue = 30f;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
t_opt_ClearTreesDistanceHeight.floatValue = EditorGUILayout.Slider("Trees clear height: ", RS.opt_ClearTreesDistanceHeight, 0.01f, 512f);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_ClearTreesDistanceHeight.floatValue = 50f;
}
EditorGUILayout.EndHorizontal();
}
//Option: terrain history save type:
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Store terrain history separate from scene:");
t_opt_SaveTerrainHistoryOnDisk.boolValue = EditorGUILayout.Toggle(RS.opt_SaveTerrainHistoryOnDisk, GUILayout.Width(50f));
EditorGUILayout.EndHorizontal();
EditorGUILayout.LabelField("Terrain history size: " + RS.TerrainHistoryByteSize);
bShowHelpTerrain = EditorGUILayout.Foldout(bShowHelpTerrain, status);
if (bShowHelpTerrain)
{
EditorGUILayout.BeginVertical("box");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Terrain options quick help:", EditorStyles.boldLabel);
if (GUILayout.Button("Online manual", EditorStyles.miniButton, GUILayout.Width(120f)))
{
Application.OpenURL("https://github.com/MicroGSD/RoadArchitect/wiki");
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.HelpBox(tOnlineHelpDesc, MessageType.Info);
EditorGUILayout.LabelField("Terrain subtraction: ", EditorStyles.boldLabel);
EditorGUILayout.LabelField("This value, in meters, will be subtracted from the terrain match height to prevent z-fighting.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Spline magnitude limit: ", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Limits the magnitude of the spline nodes. Lower limit is better for typical roads with node seperation of around 100 to 300 meters. Higher limits will allow for less tension when using very spread out nodes.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Height Modification:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Enables or disables height matching for the terrain.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Active detail removal:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Enables or disables active detail removal. Memory intensive on large terrains with large amounts of details. Recommended to not use this option and instead remove details and trees via splat maps with other addons.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Active tree removal:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Enables or disables active tree removal. Memory intensive on large terrains with large amounts of trees. Recommended to not use this option and instead remove details and trees via splat maps with other addons.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Heights match width:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("The distance to the left and right of the road in which terrain heights will be matched to the road.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Details clear width:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("The distance between the road and detail, width wise, in which details will be removed.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Details clear height:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("The distance between the road and detail, height wise, in which details will be removed.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Tree clear width:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("The distance between the road and tree, width wise, in which trees will be removed.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Tree clear height:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("The distance between the road and tree, height wise, in which trees will be removed.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Store terrain history separate from scene:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("If enabled, stores the terrain history immediately on disk after use, saving memory while in editor.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Terrain history size:", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Shows the size, in kilobytes, of the terrain history in memory or on disk.");
GUILayout.Space(4f);
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
}
EditorGUILayout.LabelField(" = Resets settings to default.");
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndVertical();
GUILayout.Label("Road and shoulder splitting:");
EditorGUILayout.BeginVertical("box");
GUILayout.Space(4f);
//Option: road cuts:
if (!RS.opt_bDynamicCuts)
{
EditorGUILayout.BeginHorizontal();
t_opt_bRoadCuts.boolValue = EditorGUILayout.Toggle("Auto split road: ", RS.opt_bRoadCuts);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_bDynamicCuts.boolValue = false;
t_opt_bRoadCuts.boolValue = true;
t_opt_bShoulderCuts.boolValue = true;
}
EditorGUILayout.EndHorizontal();
if (RS.opt_bShouldersEnabled)
{
t_opt_bShoulderCuts.boolValue = EditorGUILayout.Toggle("Auto split shoulders: ", RS.opt_bShoulderCuts);
}
}
else
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Manual road splitting: true");
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_opt_bDynamicCuts.boolValue = false;
t_opt_bRoadCuts.boolValue = true;
t_opt_bShoulderCuts.boolValue = true;
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.LabelField("Manual shoulder splitting: true");
}
t_opt_bDynamicCuts.boolValue = EditorGUILayout.Toggle("Manual splitting: ", RS.opt_bDynamicCuts);
bShowCutsHelp = EditorGUILayout.Foldout(bShowCutsHelp, status);
if (bShowCutsHelp)
{
EditorGUILayout.BeginVertical("box");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Road splitting quick help:", EditorStyles.boldLabel);
if (GUILayout.Button("Online manual", EditorStyles.miniButton, GUILayout.Width(120f)))
{
Application.OpenURL("https://github.com/MicroGSD/RoadArchitect/wiki");
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.HelpBox(tOnlineHelpDesc, MessageType.Info);
EditorGUILayout.LabelField("Typically auto-split will be the best choice for performance and other reasons.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Choosing split options will split the road/shoulder up into pieces mirroring the locations of nodes.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Splitting allows for more detailed and flexible road texturing options such as passing sections, other different road lines per section, road debris and more.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Choosing split options may also speed up mesh collider collision calculations if bounds calculations are involved.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Which splitting option to choose?", EditorStyles.boldLabel);
EditorGUILayout.LabelField("Choose no splitting if you desire a single material set for this entire road and your game experiences no collison processing slowdowns from one large mesh collider. This option will create less game objects than automatic and manual splitting.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Choose automatic road and shoulder splitting if you desire multiple materials (such as yellow double lines for certain sections and white dotted for others) for this road and or your game experiences collision processing slowdowns from one large mesh collider.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Choose manual road and shoulder splitting if you desire the same as automatic splitting and desire more freedom over the process. This option will result in less gameobjects and larger mesh colliders when compared to automatic splitting.");
GUILayout.Space(4f);
RAEditorUtilitys.Line();
EditorGUILayout.LabelField("Manual splitting information: ");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Choosing manual splitting will force the user to select individual nodes to cut instead of the cuts being performed automatically. This option is recommended if bigger mesh colliders do not cause a slowdown in performance, as it lowers the overall gameobject count.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Manual splitting will not split up the mesh colliders like automatic cuts, so the colliders may get large & complex and cost more CPU to process collisions. If this option is chosen, please verify your game's collision processing speed and if you run into long collision processing times split more road sections");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Example usages of manual splitting");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Example hill: Goal is to have double yellow no passing lines on a two lane road but only while the road is near or on the hill. " +
"Pick nodes on either sides of the hill and mark both as road cut. Everything between these two nodes will be its own section, " +
"allowing you to apply double yellow no passing lines for just the hill.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Example mountains: In the mountains, the road is curvy and the grade is high. " +
"There's a flat straight spot that you want to allow passing in, by marking the road with white dotted passing lines. " +
"At the beginning of the flat straight section, mark the node as road cut. Now at the end of the flat straight section, mark this node as road cut. " +
"This will create a road section between the two nodes, allowing you to apply white dotted passing lines for just the flat straight section.");
GUILayout.Space(4f);
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
}
EditorGUILayout.LabelField(" = Resets settings to default.");
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
}
else
{
GUILayout.Space(4f);
}
EditorGUILayout.EndVertical();
//Camera:
EditorGUILayout.LabelField("Editor camera travel:");
EditorGUILayout.BeginVertical("box");
EditorGUILayout.BeginHorizontal();
//Option: Editor camera meters per sec
t_EditorCameraMetersPerSecond.floatValue = EditorGUILayout.Slider("Camera meters/sec:", RS.EditorCameraMetersPerSecond, 1f, 512f);
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
t_EditorCameraMetersPerSecond.floatValue = 60f;
}
EditorGUILayout.EndHorizontal();
//Option: Editor camera auto rotate:
t_bEditorCameraRotate.boolValue = EditorGUILayout.Toggle("Camera auto rotate: ", RS.bEditorCameraRotate);
if (RS.EditorPlayCamera == null)
{
RS.EditorCameraSetSingle();
}
RS.EditorPlayCamera = (Camera) EditorGUILayout.ObjectField("Editor play camera:", RS.EditorPlayCamera, typeof(Camera), true);
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("Reset", GUILayout.Width(70f)))
{
RS.QuitEditorCamera();
RS.DoEditorCameraLoop();
}
if (GUILayout.Button("<<", GUILayout.Width(40f)))
{
RS.EditorCameraPos -= 0.1f;
RS.DoEditorCameraLoop();
}
if (RS.bEditorCameraMoving == true)
{
if (GUILayout.Button("Pause", GUILayout.Width(70f)))
{
RS.bEditorCameraMoving = false;
}
}
else
{
if (GUILayout.Button("Play", GUILayout.Width(70f)))
{
RS.bEditorCameraMoving = true;
}
}
if (GUILayout.Button(">>", GUILayout.Width(40f)))
{
RS.EditorCameraPos += 0.1f;
RS.DoEditorCameraLoop();
}
EditorGUILayout.EndHorizontal();
GUILayout.Space(4);
bShowCameraHelp = EditorGUILayout.Foldout(bShowCameraHelp, status);
if (bShowCameraHelp)
{
EditorGUILayout.BeginVertical("box");
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Editor camera quick help:", EditorStyles.boldLabel);
if (GUILayout.Button("Online manual", EditorStyles.miniButton, GUILayout.Width(120f)))
{
Application.OpenURL("https://github.com/MicroGSD/RoadArchitect/wiki");
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.HelpBox(tOnlineHelpDesc, MessageType.Info);
EditorGUILayout.LabelField("Use this section to travel along the road while in the editor sceneview.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Camera meters/sec is the speed at which the camera moves along the road.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Auto rotate will automatically rotate the camera to look forward at the current road's tangent. Note: You can still zoom in and out with the camera with this option selected.");
GUILayout.Space(4f);
EditorGUILayout.LabelField("Note: Materials act differently in the editor scene view compared to actual gameplay. Try the game camera if the materials are z fighting and having other issues.");
GUILayout.Space(4f);
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
}
EditorGUILayout.LabelField(" = Resets settings to default.");
EditorGUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndVertical();
GUILayout.Label("Materials:");
EditorGUILayout.BeginVertical("box");
//Road material defaults:
EditorGUILayout.BeginHorizontal();
GUILayout.Label("Road base material(s) defaults:");
//Option: Set mats to defaults:
bSetDefaultMats = false;
if (GUILayout.Button(btnRefreshText, GSDImageButton, GUILayout.Width(16f)))
{
bSetDefaultMats = true;
}
EditorGUILayout.EndHorizontal();
// EditorGUILayout.PropertyField (t_RoadMaterial1, new GUIContent (" Mat #1: "));
// if(RS.RoadMaterial1 != null){ EditorGUILayout.PropertyField (t_RoadMaterial2, new GUIContent (" Mat #2: ")); }
// if(RS.RoadMaterial2 != null){EditorGUILayout.PropertyField (t_RoadMaterial3, new GUIContent (" Mat #3: ")); }
// if(RS.RoadMaterial3 != null){EditorGUILayout.PropertyField (t_RoadMaterial4, new GUIContent (" Mat #4: ")); }
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterial1, new GUIContent(" Mat #1: "));
if (RS.RoadMaterial1 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{
RS.RoadMaterial1 = null; }
EditorGUILayout.EndHorizontal();
if (RS.RoadMaterial1 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterial2, new GUIContent(" Mat #2: "));
if (RS.RoadMaterial2 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.RoadMaterial2 = null; }
EditorGUILayout.EndHorizontal();
}
if (RS.RoadMaterial1 != null && RS.RoadMaterial2 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterial3, new GUIContent(" Mat #3: "));
if (RS.RoadMaterial3 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.RoadMaterial3 = null; }
EditorGUILayout.EndHorizontal();
}
if (RS.RoadMaterial1 != null && RS.RoadMaterial2 != null && RS.RoadMaterial3 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterial4, new GUIContent(" Mat #4: "));
if (RS.RoadMaterial4 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.RoadMaterial4 = null; }
EditorGUILayout.EndHorizontal();
}
// //Road marker material defaults:
GUILayout.Label("Road marker material(s) defaults:");
// EditorGUILayout.PropertyField (t_RoadMaterialMarker1, new GUIContent (" Mat #1: "));
// if(RS.RoadMaterialMarker1 != null){EditorGUILayout.PropertyField (t_RoadMaterialMarker2, new GUIContent (" Mat #2: ")); }
// if(RS.RoadMaterialMarker2 != null){EditorGUILayout.PropertyField (t_RoadMaterialMarker3, new GUIContent (" Mat #3: ")); }
// if(RS.RoadMaterialMarker3 != null){EditorGUILayout.PropertyField (t_RoadMaterialMarker4, new GUIContent (" Mat #4: ")); }
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterialMarker1, new GUIContent(" Mat #1: "));
if (RS.RoadMaterialMarker1 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{
RS.RoadMaterialMarker1 = null; }
EditorGUILayout.EndHorizontal();
if (RS.RoadMaterialMarker1 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterialMarker2, new GUIContent(" Mat #2: "));
if (RS.RoadMaterialMarker2 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{
RS.RoadMaterialMarker2 = null; }
EditorGUILayout.EndHorizontal();
}
if (RS.RoadMaterialMarker1 != null && RS.RoadMaterialMarker2 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterialMarker3, new GUIContent(" Mat #3: "));
if (RS.RoadMaterialMarker3 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{
RS.RoadMaterialMarker3 = null; }
EditorGUILayout.EndHorizontal();
}
if (RS.RoadMaterialMarker1 != null && RS.RoadMaterialMarker2 != null && RS.RoadMaterialMarker3 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_RoadMaterialMarker4, new GUIContent(" Mat #4: "));
if (RS.RoadMaterialMarker4 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{
RS.RoadMaterialMarker4 = null; }
EditorGUILayout.EndHorizontal();
}
// //Shoulder material defaults:
if (RS.opt_bShouldersEnabled)
{
GUILayout.Label("Shoulder base material(s) defaults:");
// EditorGUILayout.PropertyField (t_ShoulderMaterial1, new GUIContent (" Mat #1: "));
// if(RS.ShoulderMaterial1 != null){EditorGUILayout.PropertyField (t_ShoulderMaterial2, new GUIContent (" Mat #2: ")); }
// if(RS.ShoulderMaterial2 != null){EditorGUILayout.PropertyField (t_ShoulderMaterial3, new GUIContent (" Mat #3: ")); }
// if(RS.ShoulderMaterial3 != null){EditorGUILayout.PropertyField (t_ShoulderMaterial4, new GUIContent (" Mat #4: ")); }
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_ShoulderMaterial1, new GUIContent(" Mat #1: "));
if (RS.ShoulderMaterial1 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{
RS.ShoulderMaterial1 = null; }
EditorGUILayout.EndHorizontal();
if (RS.ShoulderMaterial1 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_ShoulderMaterial2, new GUIContent(" Mat #2: "));
if (RS.ShoulderMaterial2 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{ RS.ShoulderMaterial2 = null; }
EditorGUILayout.EndHorizontal();
}
if (RS.ShoulderMaterial1 != null && RS.ShoulderMaterial2 != null)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.PropertyField(t_ShoulderMaterial3, new GUIContent(" Mat #3: "));
if (RS.ShoulderMaterial3 != null && GUILayout.Button(btnDeleteText, GSDImageButton, GUILayout.Width(16f)))
{
RS.ShoulderMaterial3 = null; }
EditorGUILayout.EndHorizontal();
}
if (RS.ShoulderMaterial1 != null && RS.ShoulderMaterial2 != null && RS.ShoulderMaterial3 != null)
{