Skip to content

Commit 9e22149

Browse files
committedJul 2, 2021
Merge remote-tracking branch 'origin/master' into release-2021.2
2 parents 19b90e5 + 90c47ce commit 9e22149

22 files changed

+117
-91
lines changed
 

‎Assets/Scripts/Editor/Map/MapAnnotations.cs

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2019-2020 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
@@ -16,6 +16,7 @@
1616
using UnityEngine.SceneManagement;
1717
using System.Text.RegularExpressions;
1818
using Simulator.Editor;
19+
using UnityEditor.SceneManagement;
1920

2021
public class MapAnnotations : EditorWindow
2122
{
@@ -84,6 +85,8 @@ private enum SignType { STOP, YIELD };
8485
private Vector2 scrollPos;
8586
private int ExtraLinesCnt;
8687

88+
private Scene CurrentActiveScene;
89+
8790
[MenuItem("Simulator/Annotate HD Map #&m", false, 100)]
8891
public static void Open()
8992
{
@@ -231,6 +234,7 @@ private void OnEnable()
231234
if (targetWaypointGO != null)
232235
DestroyImmediate(targetWaypointGO);
233236
mapHolder = FindObjectOfType<MapHolder>();
237+
CurrentActiveScene = EditorSceneManager.GetActiveScene();
234238
}
235239

236240
private void OnSelectionChange()
@@ -271,6 +275,13 @@ private void OnDisable()
271275

272276
private void Update()
273277
{
278+
if (CurrentActiveScene != EditorSceneManager.GetActiveScene())
279+
{
280+
CurrentActiveScene = EditorSceneManager.GetActiveScene();
281+
mapHolder = FindObjectOfType<MapHolder>();
282+
OnSelectionChange();
283+
}
284+
274285
switch (MapAnnotationTool.createMode)
275286
{
276287
case MapAnnotationTool.CreateMode.NONE:
@@ -368,6 +379,28 @@ private void OnGUI()
368379
GUILayout.EndHorizontal();
369380
GUILayout.Space(20);
370381

382+
if (mapHolder)
383+
{
384+
MapAnnotationTool.WAYPOINT_SIZE = mapHolder.MapWaypointSize;
385+
EditorGUILayout.LabelField("Gizmo Size", titleLabelStyle, GUILayout.ExpandWidth(true));
386+
GUILayout.BeginHorizontal("box");
387+
if (!EditorGUIUtility.isProSkin)
388+
GUI.backgroundColor = nonProColor;
389+
GUILayout.Space(10);
390+
var prevSize = MapAnnotationTool.WAYPOINT_SIZE;
391+
MapAnnotationTool.WAYPOINT_SIZE = EditorGUILayout.Slider(MapAnnotationTool.WAYPOINT_SIZE, 0.02f, 1f, GUILayout.ExpandWidth(true));
392+
mapHolder.MapWaypointSize = MapAnnotationTool.WAYPOINT_SIZE;
393+
if (prevSize != MapAnnotationTool.WAYPOINT_SIZE)
394+
{
395+
SceneView.RepaintAll();
396+
EditorUtility.SetDirty(mapHolder);
397+
}
398+
if (!EditorGUIUtility.isProSkin)
399+
GUI.backgroundColor = Color.white;
400+
GUILayout.EndHorizontal();
401+
GUILayout.Space(20);
402+
}
403+
371404
EditorGUILayout.LabelField("Create Modes", titleLabelStyle, GUILayout.ExpandWidth(true));
372405
if (!EditorGUIUtility.isProSkin)
373406
GUI.backgroundColor = nonProColor;
@@ -981,6 +1014,8 @@ private void CreateMapHolder()
9811014
{
9821015
MapAnnotations tool = (MapAnnotations)GetWindow(typeof(MapAnnotations));
9831016

1017+
MapOrigin.Find();
1018+
9841019
var tempGO = new GameObject("Map" + SceneManager.GetActiveScene().name);
9851020
tempGO.transform.position = Vector3.zero;
9861021
tempGO.transform.rotation = Quaternion.identity;
@@ -994,7 +1029,7 @@ private void CreateMapHolder()
9941029
Undo.RegisterCreatedObjectUndo(tempGO, nameof(tempGO));
9951030

9961031
SceneView.RepaintAll();
997-
Debug.Log("Holder object for this scenes annotations, intersections and lanes created");
1032+
Debug.Log("MapHolder object for this scenes annotations created", tempGO);
9981033
}
9991034

10001035
private void CreateIntersectionHolder()

‎Assets/Scripts/Editor/Map/MapOriginEditor.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
@@ -48,14 +48,11 @@ public override void OnInspectorGUI()
4848
origin.AltitudeOffset = EditorGUILayout.FloatField("Altitude Offset", origin.AltitudeOffset);
4949

5050
int currentlySelected = -1;
51-
if (origin.TimeZoneSerialized != null)
51+
currentlySelected = Array.FindIndex(TimeZones, tz => tz.DisplayName == origin.TimeZoneString);
52+
if (currentlySelected == -1)
5253
{
53-
currentlySelected = Array.FindIndex(TimeZones, tz => tz.DisplayName == origin.TimeZoneString);
54-
if (currentlySelected == -1)
55-
{
56-
var timeZone = origin.TimeZone;
57-
currentlySelected = Array.FindIndex(TimeZones, tz => tz.BaseUtcOffset == timeZone.BaseUtcOffset);
58-
}
54+
var timeZone = origin.TimeZone;
55+
currentlySelected = Array.FindIndex(TimeZones, tz => tz.BaseUtcOffset == timeZone.BaseUtcOffset);
5956
}
6057

6158
var values = TimeZones.Select(tz => tz.DisplayName.Replace("&", "&&")).ToArray();
@@ -66,9 +63,12 @@ public override void OnInspectorGUI()
6663
{
6764
origin.TimeZoneSerialized = TimeZones[currentlySelected].ToSerializedString();
6865
origin.TimeZoneString = TimeZones[currentlySelected].DisplayName;
66+
6967
EditorUtility.SetDirty(origin);
68+
Repaint();
7069
}
7170
}
71+
7272
if (GUILayout.Button("Add Reference Point"))
7373
{
7474
AddReferencePoint(origin);

‎Assets/Scripts/Map/MapAnnotationTool.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
*
66
*/
77

8-
using System.Collections;
9-
using System.Collections.Generic;
108
using UnityEngine;
119

1210
namespace Simulator.Map
@@ -41,6 +39,7 @@ public enum PedestrianPathType
4139
public static bool SHOW_MAP_SELECTED { get; set; } = false;
4240
public static float PROXIMITY { get; set; } = 1.0f;
4341
public static float EXPORT_SCALE_FACTOR = 1.0f;
44-
public static float ARROWSIZE = 50.0f;
42+
public static float ARROWSIZE => 100f * WAYPOINT_SIZE;
43+
public static float WAYPOINT_SIZE { get; set; } = 0.5f;
4544
}
4645
}

‎Assets/Scripts/Map/MapClearArea.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
9-
using System.Collections.Generic;
10-
using UnityEngine;
11-
using Simulator.Map;
12-
138
namespace Simulator.Map
149
{
1510
public class MapClearArea : MapDataPoints, IMapType
@@ -23,7 +18,7 @@ public override void Draw()
2318
{
2419
if (mapLocalPositions.Count < 3) return;
2520

26-
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, clearAreaColor + selectedColor);
21+
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, clearAreaColor + selectedColor);
2722
AnnotationGizmos.DrawLines(transform, mapLocalPositions, clearAreaColor + selectedColor);
2823
if (MapAnnotationTool.SHOW_HELP)
2924
{

‎Assets/Scripts/Map/MapCrossWalk.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
9-
using System.Collections.Generic;
10-
using UnityEngine;
11-
using Simulator.Map;
12-
138
namespace Simulator.Map
149
{
1510
public class MapCrossWalk : MapDataPoints, IMapType
@@ -23,7 +18,7 @@ public override void Draw()
2318
{
2419
if (mapLocalPositions.Count < 3) return;
2520

26-
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, crossWalkColor + selectedColor);
21+
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, crossWalkColor + selectedColor);
2722
AnnotationGizmos.DrawLines(transform, mapLocalPositions, crossWalkColor + selectedColor);
2823

2924
if (MapAnnotationTool.SHOW_HELP)

‎Assets/Scripts/Map/MapData.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
98
using System.Collections.Generic;
109
using UnityEngine;
11-
using Simulator.Map;
1210

1311
namespace Simulator.Map
1412
{
@@ -195,7 +193,7 @@ public static void DrawArrowHeads(Transform mainTrans, List<Vector3> localPoints
195193
{
196194
var start = mainTrans.TransformPoint(localPoints[i]);
197195
var end = mainTrans.TransformPoint(localPoints[i + 1]);
198-
DrawArrowHead(start, end, lineColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE * 1f, arrowPositionRatio: 0.5f); // TODO why reference map annotation tool?
196+
DrawArrowHead(start, end, lineColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE, arrowPositionRatio: 0.5f);
199197
}
200198
}
201199

‎Assets/Scripts/Map/MapHolder.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
9-
using System.Collections.Generic;
108
using UnityEngine;
119

1210
namespace Simulator.Map
@@ -15,5 +13,7 @@ public class MapHolder : MonoBehaviour
1513
{
1614
public Transform trafficLanesHolder;
1715
public Transform intersectionsHolder;
16+
[HideInInspector]
17+
public float MapWaypointSize = 0.5f;
1818
}
1919
}

‎Assets/Scripts/Map/MapIntersection.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
using System.Collections.Generic;
99
using UnityEngine;
10-
using Simulator.Controllable;
1110
using Simulator.Utilities;
1211

1312
namespace Simulator.Map
@@ -35,7 +34,6 @@ public class MapIntersection : MapData
3534

3635
[System.NonSerialized]
3736
List<MapSignal> signalGroup = new List<MapSignal>();
38-
private MonoBehaviour FixedUpdateManager;
3937
public bool isStopSignIntersection = false;
4038

4139
public void SetIntersectionData()
@@ -268,7 +266,7 @@ public override void Draw()
268266
var start = transform.position;
269267
var end = start + transform.up * 6f;
270268

271-
AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.PROXIMITY * 0.5f, intersectionColor + selectedColor);
269+
AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.WAYPOINT_SIZE, intersectionColor + selectedColor);
272270
Gizmos.color = intersectionColor + selectedColor;
273271
Gizmos.DrawLine(start, end);
274272
AnnotationGizmos.DrawArrowHead(start, end, intersectionColor + selectedColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE, arrowPositionRatio: 1f);

‎Assets/Scripts/Map/MapJunction.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
9-
using System.Collections.Generic;
10-
using UnityEngine;
11-
using Simulator.Map;
12-
138
namespace Simulator.Map
149
{
1510
public class MapJunction : MapDataPoints, IMapType
@@ -24,7 +19,7 @@ public override void Draw()
2419
{
2520
if (mapLocalPositions.Count < 2) return;
2621

27-
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, junctionColor);
22+
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, junctionColor);
2823
AnnotationGizmos.DrawLines(transform, mapLocalPositions, junctionColor);
2924
if (MapAnnotationTool.SHOW_HELP)
3025
{

‎Assets/Scripts/Map/MapLaneSection.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2019-2020 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
@@ -170,7 +170,7 @@ public override void Draw()
170170
{
171171
var start = transform.position;
172172
var end = start + transform.up * 2f;
173-
var size = new Vector3(MapAnnotationTool.PROXIMITY * 0.75f, MapAnnotationTool.PROXIMITY * 0.75f, MapAnnotationTool.PROXIMITY * 0.75f);
173+
var size = new Vector3(MapAnnotationTool.WAYPOINT_SIZE, MapAnnotationTool.WAYPOINT_SIZE, MapAnnotationTool.WAYPOINT_SIZE);
174174
AnnotationGizmos.DrawCubeWaypoint(transform.position, size, laneColor + selectedColor);
175175
Gizmos.color = laneColor + selectedColor;
176176
Gizmos.DrawLine(start, end);

‎Assets/Scripts/Map/MapLine.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
98
using System.Collections.Generic;
109
using UnityEngine;
11-
using Simulator.Map;
1210

1311
namespace Simulator.Map
1412
{
@@ -69,7 +67,7 @@ public override void Draw()
6967
UnityEditor.Handles.Label(transform.position, " " + lineType + " LINE");
7068
#endif
7169
}
72-
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, typeColor + selectedColor);
70+
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, typeColor + selectedColor);
7371
AnnotationGizmos.DrawLines(transform, mapLocalPositions, typeColor + selectedColor);
7472
}
7573
}

‎Assets/Scripts/Map/MapOrigin.cs

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright (c) 2019-2020 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
@@ -42,7 +42,7 @@ public partial class MapOrigin : MonoBehaviour
4242
public double OriginEasting;
4343
public double OriginNorthing;
4444
public int UTMZoneId;
45-
public float AltitudeOffset;
45+
public float AltitudeOffset = 0f;
4646

4747
[HideInInspector]
4848
public string TimeZoneSerialized;
@@ -58,7 +58,7 @@ public partial class MapOrigin : MonoBehaviour
5858
public bool IgnorePedBounds = false;
5959
[HideInInspector]
6060
public bool IgnorePedVisible = false; // TODO fix this disabled for now in SpawnManager
61-
public int NPCSizeMask = 1;
61+
public int NPCSizeMask = 1<<0 | 1<<1 | 1<<2 | 1<<3| 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9 | 1<<11 | 1<<12;
6262
public int NPCMaxCount = 10;
6363
public int NPCSpawnBoundSize = 200;
6464

@@ -74,6 +74,10 @@ public static MapOrigin Find()
7474
{
7575
Debug.LogWarning("Map is missing MapOrigin component! Adding temporary MapOrigin. Please add to scene and set origin");
7676
origin = new GameObject("MapOrigin").AddComponent<MapOrigin>();
77+
origin.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
78+
origin.OriginEasting = 592720;
79+
origin.OriginNorthing = 4134479;
80+
origin.UTMZoneId = 10;
7781
}
7882

7983
return origin;

‎Assets/Scripts/Map/MapParkingSpace.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
9-
using System.Collections.Generic;
10-
using UnityEngine;
11-
128
namespace Simulator.Map
139
{
1410
public class MapParkingSpace : MapDataPoints, IMapType
@@ -23,7 +19,7 @@ public override void Draw()
2319
{
2420
if (mapLocalPositions.Count < 2) return;
2521

26-
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, parkingSpaceColor + selectedColor);
22+
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, parkingSpaceColor + selectedColor);
2723
AnnotationGizmos.DrawLines(transform, mapLocalPositions, parkingSpaceColor + selectedColor);
2824
if (MapAnnotationTool.SHOW_HELP)
2925
{

‎Assets/Scripts/Map/MapPedestrianLane.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public override void Draw()
2121
{
2222
if (mapLocalPositions.Count < 2) return;
2323

24-
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, pedestrianColor + selectedColor);
24+
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, pedestrianColor + selectedColor);
2525
AnnotationGizmos.DrawLines(transform, mapLocalPositions, pedestrianColor + selectedColor);
2626
AnnotationGizmos.DrawArrowHeads(transform, mapLocalPositions, pedestrianColor + selectedColor);
2727
if (MapAnnotationTool.SHOW_HELP)

‎Assets/Scripts/Map/MapPole.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
98
using System.Collections.Generic;
109
using UnityEngine;
11-
using Simulator.Map;
1210

1311
namespace Simulator.Map
1412
{
@@ -22,7 +20,7 @@ public override void Draw()
2220
var start = transform.position;
2321
var end = start + transform.up * 4f;
2422

25-
AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.PROXIMITY * 0.35f, poleColor + selectedColor);
23+
AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.WAYPOINT_SIZE * 0.5f, poleColor + selectedColor);
2624
Gizmos.color = poleColor + selectedColor;
2725
Gizmos.DrawLine(start, end);
2826
AnnotationGizmos.DrawArrowHead(start, end, poleColor + selectedColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE, arrowPositionRatio: 1f);

‎Assets/Scripts/Map/MapSign.cs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
9-
using System.Collections.Generic;
108
using UnityEngine;
11-
using Simulator.Map;
129

1310
namespace Simulator.Map
1411
{
@@ -32,7 +29,7 @@ public override void Draw()
3229
var start = transform.position;
3330
var end = start + transform.up * 2f;
3431

35-
AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.PROXIMITY * 0.35f, stopSignColor + selectedColor);
32+
AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.WAYPOINT_SIZE * 0.5f, stopSignColor + selectedColor);
3633
Gizmos.color = stopSignColor + selectedColor;
3734
Gizmos.DrawLine(start, end);
3835
AnnotationGizmos.DrawArrowHead(start, end, stopSignColor + selectedColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE, arrowPositionRatio: 1f);

‎Assets/Scripts/Map/MapSignal.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public override void Draw()
316316

317317
var signalColor = GetTypeColor(signalData[i]) + selectedColor;
318318

319-
AnnotationGizmos.DrawWaypoint(start, MapAnnotationTool.PROXIMITY * 0.15f, signalColor);
319+
AnnotationGizmos.DrawWaypoint(start, MapAnnotationTool.WAYPOINT_SIZE * 0.25f, signalColor);
320320
Gizmos.color = signalColor;
321321
Gizmos.DrawLine(start, end);
322322
AnnotationGizmos.DrawArrowHead(start, end, signalColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE, arrowPositionRatio: 1f);

‎Assets/Scripts/Map/MapSpeedBump.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
9-
using System.Collections.Generic;
10-
using UnityEngine;
11-
using Simulator.Map;
12-
138
namespace Simulator.Map
149
{
1510
public class MapSpeedBump : MapDataPoints, IMapType
@@ -24,7 +19,7 @@ public override void Draw()
2419
{
2520
if (mapLocalPositions.Count < 2) return;
2621

27-
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, speedBumpColor);
22+
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, speedBumpColor);
2823
AnnotationGizmos.DrawLines(transform, mapLocalPositions, speedBumpColor);
2924
if (MapAnnotationTool.SHOW_HELP)
3025
{

‎Assets/Scripts/Map/MapTargetWaypoint.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
98
using System.Collections.Generic;
109
using UnityEngine;
11-
using Simulator.Map;
1210

1311
namespace Simulator.Map
1412
{
@@ -46,7 +44,7 @@ private void Update()
4644

4745
public override void Draw()
4846
{
49-
AnnotationGizmos.DrawWaypoints(transform, new List<Vector3>() { Vector3.zero }, MapAnnotationTool.PROXIMITY * 0.75f, targetWaypointColor);
47+
AnnotationGizmos.DrawWaypoints(transform, new List<Vector3>() { Vector3.zero }, MapAnnotationTool.WAYPOINT_SIZE, targetWaypointColor);
5048
if (MapAnnotationTool.SHOW_HELP)
5149
{
5250
#if UNITY_EDITOR

‎Assets/Scripts/Map/MapTrafficLane.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public override void Draw()
6464
{
6565
if (mapLocalPositions.Count < 2) return;
6666

67-
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, laneColor + selectedColor);
67+
AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, laneColor + selectedColor);
6868
AnnotationGizmos.DrawLines(transform, mapLocalPositions, laneColor + selectedColor);
6969
AnnotationGizmos.DrawArrowHeads(transform, mapLocalPositions, laneColor + selectedColor);
7070
if (MapAnnotationTool.SHOW_HELP)
@@ -81,7 +81,7 @@ public override void Draw()
8181
{
8282
if (yl != null)
8383
{
84-
AnnotationGizmos.DrawWaypoints(yl.transform, yl.mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.25f, new Color(1f, 1f, 0f, 0.5f));
84+
AnnotationGizmos.DrawWaypoints(yl.transform, yl.mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE * 0.25f, new Color(1f, 1f, 0f, 0.5f));
8585
AnnotationGizmos.DrawLines(yl.transform, yl.mapLocalPositions, new Color(1f, 1f, 0f, 0.5f));
8686
AnnotationGizmos.DrawArrowHeads(yl.transform, yl.mapLocalPositions, new Color(1f, 1f, 0f, 0.5f));
8787
}

‎Assets/Scripts/Map/MapWaypoint.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
/**
2-
* Copyright (c) 2019 LG Electronics, Inc.
2+
* Copyright (c) 2019-2021 LG Electronics, Inc.
33
*
44
* This software contains code licensed as described in LICENSE.
55
*
66
*/
77

8-
using System.Collections;
98
using System.Collections.Generic;
109
using UnityEngine;
11-
using Simulator.Map;
1210

1311
namespace Simulator.Map
1412
{
@@ -46,7 +44,7 @@ private void Update()
4644

4745
public override void Draw()
4846
{
49-
AnnotationGizmos.DrawWaypoints(transform, new List<Vector3>() { Vector3.zero }, MapAnnotationTool.PROXIMITY * 0.5f, tempWaypointColor + selectedColor);
47+
AnnotationGizmos.DrawWaypoints(transform, new List<Vector3>() { Vector3.zero }, MapAnnotationTool.WAYPOINT_SIZE, tempWaypointColor + selectedColor);
5048
if (MapAnnotationTool.SHOW_HELP)
5149
{
5250
#if UNITY_EDITOR

‎Assets/Scripts/ScenarioEditor/Managers/ScenarioManager.cs

+31-4
Original file line numberDiff line numberDiff line change
@@ -274,17 +274,44 @@ private async Task Initialize()
274274
scenarioEditorExtensions.Add(scenarioManagerType, scenarioManager);
275275
}
276276
}
277-
await Task.WhenAll(tasks);
278-
277+
278+
try
279+
{
280+
await Task.WhenAll(tasks);
281+
}
282+
catch (Exception ex)
283+
{
284+
Debug.LogError(ex.Message);
285+
StopInitialization();
286+
return;
287+
}
288+
279289
//Initialize map
280290
var mapManager = GetExtension<ScenarioMapManager>();
281291
mapManager.MapChanged += OnMapLoaded;
282-
await mapManager.LoadMapAsync();
292+
try
293+
{
294+
await mapManager.LoadMapAsync();
295+
}
296+
catch (Exception ex)
297+
{
298+
Debug.LogError(ex.Message);
299+
StopInitialization();
300+
return;
301+
}
302+
283303
inspector.Initialize();
284304
loadingProcess.Update("Visual Scenario Editor has been loaded.");
285305
loadingProcess.NotifyCompletion();
286306
}
287307

308+
private void StopInitialization()
309+
{
310+
isInitialized = true;
311+
Deinitialize();
312+
Loader.ExitScenarioEditor();
313+
}
314+
288315
/// <summary>
289316
/// Deinitialization method
290317
/// </summary>
@@ -431,4 +458,4 @@ public void NewElementActivated(ScenarioElement scenarioElement)
431458
NewScenarioElement?.Invoke(scenarioElement);
432459
}
433460
}
434-
}
461+
}

0 commit comments

Comments
 (0)
Please sign in to comment.