diff --git a/Assets/Scripts/Editor/Map/MapAnnotations.cs b/Assets/Scripts/Editor/Map/MapAnnotations.cs index ff0464449..9e7a88fcd 100644 --- a/Assets/Scripts/Editor/Map/MapAnnotations.cs +++ b/Assets/Scripts/Editor/Map/MapAnnotations.cs @@ -1,5 +1,5 @@ /** - * Copyright (c) 2019-2020 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * @@ -16,6 +16,7 @@ using UnityEngine.SceneManagement; using System.Text.RegularExpressions; using Simulator.Editor; +using UnityEditor.SceneManagement; public class MapAnnotations : EditorWindow { @@ -84,6 +85,8 @@ private enum SignType { STOP, YIELD }; private Vector2 scrollPos; private int ExtraLinesCnt; + private Scene CurrentActiveScene; + [MenuItem("Simulator/Annotate HD Map #&m", false, 100)] public static void Open() { @@ -231,6 +234,7 @@ private void OnEnable() if (targetWaypointGO != null) DestroyImmediate(targetWaypointGO); mapHolder = FindObjectOfType(); + CurrentActiveScene = EditorSceneManager.GetActiveScene(); } private void OnSelectionChange() @@ -271,6 +275,13 @@ private void OnDisable() private void Update() { + if (CurrentActiveScene != EditorSceneManager.GetActiveScene()) + { + CurrentActiveScene = EditorSceneManager.GetActiveScene(); + mapHolder = FindObjectOfType(); + OnSelectionChange(); + } + switch (MapAnnotationTool.createMode) { case MapAnnotationTool.CreateMode.NONE: @@ -368,6 +379,28 @@ private void OnGUI() GUILayout.EndHorizontal(); GUILayout.Space(20); + if (mapHolder) + { + MapAnnotationTool.WAYPOINT_SIZE = mapHolder.MapWaypointSize; + EditorGUILayout.LabelField("Gizmo Size", titleLabelStyle, GUILayout.ExpandWidth(true)); + GUILayout.BeginHorizontal("box"); + if (!EditorGUIUtility.isProSkin) + GUI.backgroundColor = nonProColor; + GUILayout.Space(10); + var prevSize = MapAnnotationTool.WAYPOINT_SIZE; + MapAnnotationTool.WAYPOINT_SIZE = EditorGUILayout.Slider(MapAnnotationTool.WAYPOINT_SIZE, 0.02f, 1f, GUILayout.ExpandWidth(true)); + mapHolder.MapWaypointSize = MapAnnotationTool.WAYPOINT_SIZE; + if (prevSize != MapAnnotationTool.WAYPOINT_SIZE) + { + SceneView.RepaintAll(); + EditorUtility.SetDirty(mapHolder); + } + if (!EditorGUIUtility.isProSkin) + GUI.backgroundColor = Color.white; + GUILayout.EndHorizontal(); + GUILayout.Space(20); + } + EditorGUILayout.LabelField("Create Modes", titleLabelStyle, GUILayout.ExpandWidth(true)); if (!EditorGUIUtility.isProSkin) GUI.backgroundColor = nonProColor; @@ -981,6 +1014,8 @@ private void CreateMapHolder() { MapAnnotations tool = (MapAnnotations)GetWindow(typeof(MapAnnotations)); + MapOrigin.Find(); + var tempGO = new GameObject("Map" + SceneManager.GetActiveScene().name); tempGO.transform.position = Vector3.zero; tempGO.transform.rotation = Quaternion.identity; @@ -994,7 +1029,7 @@ private void CreateMapHolder() Undo.RegisterCreatedObjectUndo(tempGO, nameof(tempGO)); SceneView.RepaintAll(); - Debug.Log("Holder object for this scenes annotations, intersections and lanes created"); + Debug.Log("MapHolder object for this scenes annotations created", tempGO); } private void CreateIntersectionHolder() diff --git a/Assets/Scripts/Editor/Map/MapOriginEditor.cs b/Assets/Scripts/Editor/Map/MapOriginEditor.cs index f6b370cd2..18c2c7ead 100644 --- a/Assets/Scripts/Editor/Map/MapOriginEditor.cs +++ b/Assets/Scripts/Editor/Map/MapOriginEditor.cs @@ -1,5 +1,5 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * @@ -48,14 +48,11 @@ public override void OnInspectorGUI() origin.AltitudeOffset = EditorGUILayout.FloatField("Altitude Offset", origin.AltitudeOffset); int currentlySelected = -1; - if (origin.TimeZoneSerialized != null) + currentlySelected = Array.FindIndex(TimeZones, tz => tz.DisplayName == origin.TimeZoneString); + if (currentlySelected == -1) { - currentlySelected = Array.FindIndex(TimeZones, tz => tz.DisplayName == origin.TimeZoneString); - if (currentlySelected == -1) - { - var timeZone = origin.TimeZone; - currentlySelected = Array.FindIndex(TimeZones, tz => tz.BaseUtcOffset == timeZone.BaseUtcOffset); - } + var timeZone = origin.TimeZone; + currentlySelected = Array.FindIndex(TimeZones, tz => tz.BaseUtcOffset == timeZone.BaseUtcOffset); } var values = TimeZones.Select(tz => tz.DisplayName.Replace("&", "&&")).ToArray(); @@ -66,9 +63,12 @@ public override void OnInspectorGUI() { origin.TimeZoneSerialized = TimeZones[currentlySelected].ToSerializedString(); origin.TimeZoneString = TimeZones[currentlySelected].DisplayName; + EditorUtility.SetDirty(origin); + Repaint(); } } + if (GUILayout.Button("Add Reference Point")) { AddReferencePoint(origin); diff --git a/Assets/Scripts/Map/MapAnnotationTool.cs b/Assets/Scripts/Map/MapAnnotationTool.cs index b030de306..c84a05e04 100644 --- a/Assets/Scripts/Map/MapAnnotationTool.cs +++ b/Assets/Scripts/Map/MapAnnotationTool.cs @@ -5,8 +5,6 @@ * */ -using System.Collections; -using System.Collections.Generic; using UnityEngine; namespace Simulator.Map @@ -41,6 +39,7 @@ public enum PedestrianPathType public static bool SHOW_MAP_SELECTED { get; set; } = false; public static float PROXIMITY { get; set; } = 1.0f; public static float EXPORT_SCALE_FACTOR = 1.0f; - public static float ARROWSIZE = 50.0f; + public static float ARROWSIZE => 100f * WAYPOINT_SIZE; + public static float WAYPOINT_SIZE { get; set; } = 0.5f; } } \ No newline at end of file diff --git a/Assets/Scripts/Map/MapClearArea.cs b/Assets/Scripts/Map/MapClearArea.cs index 6ba4257d4..929bc046e 100644 --- a/Assets/Scripts/Map/MapClearArea.cs +++ b/Assets/Scripts/Map/MapClearArea.cs @@ -1,15 +1,10 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using Simulator.Map; - namespace Simulator.Map { public class MapClearArea : MapDataPoints, IMapType @@ -23,7 +18,7 @@ public override void Draw() { if (mapLocalPositions.Count < 3) return; - AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, clearAreaColor + selectedColor); + AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, clearAreaColor + selectedColor); AnnotationGizmos.DrawLines(transform, mapLocalPositions, clearAreaColor + selectedColor); if (MapAnnotationTool.SHOW_HELP) { diff --git a/Assets/Scripts/Map/MapCrossWalk.cs b/Assets/Scripts/Map/MapCrossWalk.cs index f151f7899..198093687 100644 --- a/Assets/Scripts/Map/MapCrossWalk.cs +++ b/Assets/Scripts/Map/MapCrossWalk.cs @@ -1,15 +1,10 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using Simulator.Map; - namespace Simulator.Map { public class MapCrossWalk : MapDataPoints, IMapType @@ -23,7 +18,7 @@ public override void Draw() { if (mapLocalPositions.Count < 3) return; - AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, crossWalkColor + selectedColor); + AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, crossWalkColor + selectedColor); AnnotationGizmos.DrawLines(transform, mapLocalPositions, crossWalkColor + selectedColor); if (MapAnnotationTool.SHOW_HELP) diff --git a/Assets/Scripts/Map/MapData.cs b/Assets/Scripts/Map/MapData.cs index e34c5896a..2daf7ace3 100644 --- a/Assets/Scripts/Map/MapData.cs +++ b/Assets/Scripts/Map/MapData.cs @@ -1,14 +1,12 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; using System.Collections.Generic; using UnityEngine; -using Simulator.Map; namespace Simulator.Map { @@ -195,7 +193,7 @@ public static void DrawArrowHeads(Transform mainTrans, List localPoints { var start = mainTrans.TransformPoint(localPoints[i]); var end = mainTrans.TransformPoint(localPoints[i + 1]); - DrawArrowHead(start, end, lineColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE * 1f, arrowPositionRatio: 0.5f); // TODO why reference map annotation tool? + DrawArrowHead(start, end, lineColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE, arrowPositionRatio: 0.5f); } } diff --git a/Assets/Scripts/Map/MapHolder.cs b/Assets/Scripts/Map/MapHolder.cs index 325b30ebb..12c5eb902 100644 --- a/Assets/Scripts/Map/MapHolder.cs +++ b/Assets/Scripts/Map/MapHolder.cs @@ -1,12 +1,10 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; -using System.Collections.Generic; using UnityEngine; namespace Simulator.Map @@ -15,5 +13,7 @@ public class MapHolder : MonoBehaviour { public Transform trafficLanesHolder; public Transform intersectionsHolder; + [HideInInspector] + public float MapWaypointSize = 0.5f; } } \ No newline at end of file diff --git a/Assets/Scripts/Map/MapIntersection.cs b/Assets/Scripts/Map/MapIntersection.cs index b14219068..55f8acb28 100644 --- a/Assets/Scripts/Map/MapIntersection.cs +++ b/Assets/Scripts/Map/MapIntersection.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using UnityEngine; -using Simulator.Controllable; using Simulator.Utilities; namespace Simulator.Map @@ -35,7 +34,6 @@ public class MapIntersection : MapData [System.NonSerialized] List signalGroup = new List(); - private MonoBehaviour FixedUpdateManager; public bool isStopSignIntersection = false; public void SetIntersectionData() @@ -268,7 +266,7 @@ public override void Draw() var start = transform.position; var end = start + transform.up * 6f; - AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.PROXIMITY * 0.5f, intersectionColor + selectedColor); + AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.WAYPOINT_SIZE, intersectionColor + selectedColor); Gizmos.color = intersectionColor + selectedColor; Gizmos.DrawLine(start, end); AnnotationGizmos.DrawArrowHead(start, end, intersectionColor + selectedColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE, arrowPositionRatio: 1f); diff --git a/Assets/Scripts/Map/MapJunction.cs b/Assets/Scripts/Map/MapJunction.cs index 915b8e7bf..379265103 100644 --- a/Assets/Scripts/Map/MapJunction.cs +++ b/Assets/Scripts/Map/MapJunction.cs @@ -1,15 +1,10 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using Simulator.Map; - namespace Simulator.Map { public class MapJunction : MapDataPoints, IMapType @@ -24,7 +19,7 @@ public override void Draw() { if (mapLocalPositions.Count < 2) return; - AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, junctionColor); + AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, junctionColor); AnnotationGizmos.DrawLines(transform, mapLocalPositions, junctionColor); if (MapAnnotationTool.SHOW_HELP) { diff --git a/Assets/Scripts/Map/MapLaneSection.cs b/Assets/Scripts/Map/MapLaneSection.cs index c6250831a..b24541e2f 100644 --- a/Assets/Scripts/Map/MapLaneSection.cs +++ b/Assets/Scripts/Map/MapLaneSection.cs @@ -1,5 +1,5 @@ /** - * Copyright (c) 2019-2020 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * @@ -170,7 +170,7 @@ public override void Draw() { var start = transform.position; var end = start + transform.up * 2f; - var size = new Vector3(MapAnnotationTool.PROXIMITY * 0.75f, MapAnnotationTool.PROXIMITY * 0.75f, MapAnnotationTool.PROXIMITY * 0.75f); + var size = new Vector3(MapAnnotationTool.WAYPOINT_SIZE, MapAnnotationTool.WAYPOINT_SIZE, MapAnnotationTool.WAYPOINT_SIZE); AnnotationGizmos.DrawCubeWaypoint(transform.position, size, laneColor + selectedColor); Gizmos.color = laneColor + selectedColor; Gizmos.DrawLine(start, end); diff --git a/Assets/Scripts/Map/MapLine.cs b/Assets/Scripts/Map/MapLine.cs index b32897b15..876cd82bc 100644 --- a/Assets/Scripts/Map/MapLine.cs +++ b/Assets/Scripts/Map/MapLine.cs @@ -1,14 +1,12 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; using System.Collections.Generic; using UnityEngine; -using Simulator.Map; namespace Simulator.Map { @@ -69,7 +67,7 @@ public override void Draw() UnityEditor.Handles.Label(transform.position, " " + lineType + " LINE"); #endif } - AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, typeColor + selectedColor); + AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, typeColor + selectedColor); AnnotationGizmos.DrawLines(transform, mapLocalPositions, typeColor + selectedColor); } } diff --git a/Assets/Scripts/Map/MapOrigin.cs b/Assets/Scripts/Map/MapOrigin.cs index 12052548b..493c7efc0 100644 --- a/Assets/Scripts/Map/MapOrigin.cs +++ b/Assets/Scripts/Map/MapOrigin.cs @@ -1,5 +1,5 @@ /** - * Copyright (c) 2019-2020 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * @@ -42,7 +42,7 @@ public partial class MapOrigin : MonoBehaviour public double OriginEasting; public double OriginNorthing; public int UTMZoneId; - public float AltitudeOffset; + public float AltitudeOffset = 0f; [HideInInspector] public string TimeZoneSerialized; @@ -58,7 +58,7 @@ public partial class MapOrigin : MonoBehaviour public bool IgnorePedBounds = false; [HideInInspector] public bool IgnorePedVisible = false; // TODO fix this disabled for now in SpawnManager - public int NPCSizeMask = 1; + 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; public int NPCMaxCount = 10; public int NPCSpawnBoundSize = 200; @@ -74,6 +74,10 @@ public static MapOrigin Find() { Debug.LogWarning("Map is missing MapOrigin component! Adding temporary MapOrigin. Please add to scene and set origin"); origin = new GameObject("MapOrigin").AddComponent(); + origin.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); + origin.OriginEasting = 592720; + origin.OriginNorthing = 4134479; + origin.UTMZoneId = 10; } return origin; diff --git a/Assets/Scripts/Map/MapParkingSpace.cs b/Assets/Scripts/Map/MapParkingSpace.cs index b3b845b8a..05ae2dacb 100644 --- a/Assets/Scripts/Map/MapParkingSpace.cs +++ b/Assets/Scripts/Map/MapParkingSpace.cs @@ -1,14 +1,10 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - namespace Simulator.Map { public class MapParkingSpace : MapDataPoints, IMapType @@ -23,7 +19,7 @@ public override void Draw() { if (mapLocalPositions.Count < 2) return; - AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, parkingSpaceColor + selectedColor); + AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, parkingSpaceColor + selectedColor); AnnotationGizmos.DrawLines(transform, mapLocalPositions, parkingSpaceColor + selectedColor); if (MapAnnotationTool.SHOW_HELP) { diff --git a/Assets/Scripts/Map/MapPedestrianLane.cs b/Assets/Scripts/Map/MapPedestrianLane.cs index 42d6b3611..d70b5e0d1 100644 --- a/Assets/Scripts/Map/MapPedestrianLane.cs +++ b/Assets/Scripts/Map/MapPedestrianLane.cs @@ -21,7 +21,7 @@ public override void Draw() { if (mapLocalPositions.Count < 2) return; - AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, pedestrianColor + selectedColor); + AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, pedestrianColor + selectedColor); AnnotationGizmos.DrawLines(transform, mapLocalPositions, pedestrianColor + selectedColor); AnnotationGizmos.DrawArrowHeads(transform, mapLocalPositions, pedestrianColor + selectedColor); if (MapAnnotationTool.SHOW_HELP) diff --git a/Assets/Scripts/Map/MapPole.cs b/Assets/Scripts/Map/MapPole.cs index 2169f6dbc..9f012e48c 100644 --- a/Assets/Scripts/Map/MapPole.cs +++ b/Assets/Scripts/Map/MapPole.cs @@ -1,14 +1,12 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; using System.Collections.Generic; using UnityEngine; -using Simulator.Map; namespace Simulator.Map { @@ -22,7 +20,7 @@ public override void Draw() var start = transform.position; var end = start + transform.up * 4f; - AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.PROXIMITY * 0.35f, poleColor + selectedColor); + AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.WAYPOINT_SIZE * 0.5f, poleColor + selectedColor); Gizmos.color = poleColor + selectedColor; Gizmos.DrawLine(start, end); AnnotationGizmos.DrawArrowHead(start, end, poleColor + selectedColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE, arrowPositionRatio: 1f); diff --git a/Assets/Scripts/Map/MapSign.cs b/Assets/Scripts/Map/MapSign.cs index a659916df..c8d462136 100644 --- a/Assets/Scripts/Map/MapSign.cs +++ b/Assets/Scripts/Map/MapSign.cs @@ -1,14 +1,11 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using Simulator.Map; namespace Simulator.Map { @@ -32,7 +29,7 @@ public override void Draw() var start = transform.position; var end = start + transform.up * 2f; - AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.PROXIMITY * 0.35f, stopSignColor + selectedColor); + AnnotationGizmos.DrawWaypoint(transform.position, MapAnnotationTool.WAYPOINT_SIZE * 0.5f, stopSignColor + selectedColor); Gizmos.color = stopSignColor + selectedColor; Gizmos.DrawLine(start, end); AnnotationGizmos.DrawArrowHead(start, end, stopSignColor + selectedColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE, arrowPositionRatio: 1f); diff --git a/Assets/Scripts/Map/MapSignal.cs b/Assets/Scripts/Map/MapSignal.cs index 10005a33e..1de59273d 100644 --- a/Assets/Scripts/Map/MapSignal.cs +++ b/Assets/Scripts/Map/MapSignal.cs @@ -316,7 +316,7 @@ public override void Draw() var signalColor = GetTypeColor(signalData[i]) + selectedColor; - AnnotationGizmos.DrawWaypoint(start, MapAnnotationTool.PROXIMITY * 0.15f, signalColor); + AnnotationGizmos.DrawWaypoint(start, MapAnnotationTool.WAYPOINT_SIZE * 0.25f, signalColor); Gizmos.color = signalColor; Gizmos.DrawLine(start, end); AnnotationGizmos.DrawArrowHead(start, end, signalColor, arrowHeadScale: MapAnnotationTool.ARROWSIZE, arrowPositionRatio: 1f); diff --git a/Assets/Scripts/Map/MapSpeedBump.cs b/Assets/Scripts/Map/MapSpeedBump.cs index 912b6f216..a8ebbfdfc 100644 --- a/Assets/Scripts/Map/MapSpeedBump.cs +++ b/Assets/Scripts/Map/MapSpeedBump.cs @@ -1,15 +1,10 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using Simulator.Map; - namespace Simulator.Map { public class MapSpeedBump : MapDataPoints, IMapType @@ -24,7 +19,7 @@ public override void Draw() { if (mapLocalPositions.Count < 2) return; - AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, speedBumpColor); + AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, speedBumpColor); AnnotationGizmos.DrawLines(transform, mapLocalPositions, speedBumpColor); if (MapAnnotationTool.SHOW_HELP) { diff --git a/Assets/Scripts/Map/MapTargetWaypoint.cs b/Assets/Scripts/Map/MapTargetWaypoint.cs index cea7afcd4..5388553ed 100644 --- a/Assets/Scripts/Map/MapTargetWaypoint.cs +++ b/Assets/Scripts/Map/MapTargetWaypoint.cs @@ -1,14 +1,12 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; using System.Collections.Generic; using UnityEngine; -using Simulator.Map; namespace Simulator.Map { @@ -46,7 +44,7 @@ private void Update() public override void Draw() { - AnnotationGizmos.DrawWaypoints(transform, new List() { Vector3.zero }, MapAnnotationTool.PROXIMITY * 0.75f, targetWaypointColor); + AnnotationGizmos.DrawWaypoints(transform, new List() { Vector3.zero }, MapAnnotationTool.WAYPOINT_SIZE, targetWaypointColor); if (MapAnnotationTool.SHOW_HELP) { #if UNITY_EDITOR diff --git a/Assets/Scripts/Map/MapTrafficLane.cs b/Assets/Scripts/Map/MapTrafficLane.cs index 7c311ecbc..e7225059b 100644 --- a/Assets/Scripts/Map/MapTrafficLane.cs +++ b/Assets/Scripts/Map/MapTrafficLane.cs @@ -64,7 +64,7 @@ public override void Draw() { if (mapLocalPositions.Count < 2) return; - AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.5f, laneColor + selectedColor); + AnnotationGizmos.DrawWaypoints(transform, mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE, laneColor + selectedColor); AnnotationGizmos.DrawLines(transform, mapLocalPositions, laneColor + selectedColor); AnnotationGizmos.DrawArrowHeads(transform, mapLocalPositions, laneColor + selectedColor); if (MapAnnotationTool.SHOW_HELP) @@ -81,7 +81,7 @@ public override void Draw() { if (yl != null) { - AnnotationGizmos.DrawWaypoints(yl.transform, yl.mapLocalPositions, MapAnnotationTool.PROXIMITY * 0.25f, new Color(1f, 1f, 0f, 0.5f)); + AnnotationGizmos.DrawWaypoints(yl.transform, yl.mapLocalPositions, MapAnnotationTool.WAYPOINT_SIZE * 0.25f, new Color(1f, 1f, 0f, 0.5f)); AnnotationGizmos.DrawLines(yl.transform, yl.mapLocalPositions, new Color(1f, 1f, 0f, 0.5f)); AnnotationGizmos.DrawArrowHeads(yl.transform, yl.mapLocalPositions, new Color(1f, 1f, 0f, 0.5f)); } diff --git a/Assets/Scripts/Map/MapWaypoint.cs b/Assets/Scripts/Map/MapWaypoint.cs index c20366e91..545282a42 100644 --- a/Assets/Scripts/Map/MapWaypoint.cs +++ b/Assets/Scripts/Map/MapWaypoint.cs @@ -1,14 +1,12 @@ /** - * Copyright (c) 2019 LG Electronics, Inc. + * Copyright (c) 2019-2021 LG Electronics, Inc. * * This software contains code licensed as described in LICENSE. * */ -using System.Collections; using System.Collections.Generic; using UnityEngine; -using Simulator.Map; namespace Simulator.Map { @@ -46,7 +44,7 @@ private void Update() public override void Draw() { - AnnotationGizmos.DrawWaypoints(transform, new List() { Vector3.zero }, MapAnnotationTool.PROXIMITY * 0.5f, tempWaypointColor + selectedColor); + AnnotationGizmos.DrawWaypoints(transform, new List() { Vector3.zero }, MapAnnotationTool.WAYPOINT_SIZE, tempWaypointColor + selectedColor); if (MapAnnotationTool.SHOW_HELP) { #if UNITY_EDITOR diff --git a/Assets/Scripts/ScenarioEditor/Managers/ScenarioManager.cs b/Assets/Scripts/ScenarioEditor/Managers/ScenarioManager.cs index 62d840e57..138cd070d 100644 --- a/Assets/Scripts/ScenarioEditor/Managers/ScenarioManager.cs +++ b/Assets/Scripts/ScenarioEditor/Managers/ScenarioManager.cs @@ -274,17 +274,44 @@ private async Task Initialize() scenarioEditorExtensions.Add(scenarioManagerType, scenarioManager); } } - await Task.WhenAll(tasks); - + + try + { + await Task.WhenAll(tasks); + } + catch (Exception ex) + { + Debug.LogError(ex.Message); + StopInitialization(); + return; + } + //Initialize map var mapManager = GetExtension(); mapManager.MapChanged += OnMapLoaded; - await mapManager.LoadMapAsync(); + try + { + await mapManager.LoadMapAsync(); + } + catch (Exception ex) + { + Debug.LogError(ex.Message); + StopInitialization(); + return; + } + inspector.Initialize(); loadingProcess.Update("Visual Scenario Editor has been loaded."); loadingProcess.NotifyCompletion(); } + private void StopInitialization() + { + isInitialized = true; + Deinitialize(); + Loader.ExitScenarioEditor(); + } + /// /// Deinitialization method /// @@ -431,4 +458,4 @@ public void NewElementActivated(ScenarioElement scenarioElement) NewScenarioElement?.Invoke(scenarioElement); } } -} \ No newline at end of file +}