1
1
/**
2
- * Copyright (c) 2019-2020 LG Electronics, Inc.
2
+ * Copyright (c) 2019-2021 LG Electronics, Inc.
3
3
*
4
4
* This software contains code licensed as described in LICENSE.
5
5
*
16
16
using UnityEngine . SceneManagement ;
17
17
using System . Text . RegularExpressions ;
18
18
using Simulator . Editor ;
19
+ using UnityEditor . SceneManagement ;
19
20
20
21
public class MapAnnotations : EditorWindow
21
22
{
@@ -84,6 +85,8 @@ private enum SignType { STOP, YIELD };
84
85
private Vector2 scrollPos ;
85
86
private int ExtraLinesCnt ;
86
87
88
+ private Scene CurrentActiveScene ;
89
+
87
90
[ MenuItem ( "Simulator/Annotate HD Map #&m" , false , 100 ) ]
88
91
public static void Open ( )
89
92
{
@@ -231,6 +234,7 @@ private void OnEnable()
231
234
if ( targetWaypointGO != null )
232
235
DestroyImmediate ( targetWaypointGO ) ;
233
236
mapHolder = FindObjectOfType < MapHolder > ( ) ;
237
+ CurrentActiveScene = EditorSceneManager . GetActiveScene ( ) ;
234
238
}
235
239
236
240
private void OnSelectionChange ( )
@@ -271,6 +275,13 @@ private void OnDisable()
271
275
272
276
private void Update ( )
273
277
{
278
+ if ( CurrentActiveScene != EditorSceneManager . GetActiveScene ( ) )
279
+ {
280
+ CurrentActiveScene = EditorSceneManager . GetActiveScene ( ) ;
281
+ mapHolder = FindObjectOfType < MapHolder > ( ) ;
282
+ OnSelectionChange ( ) ;
283
+ }
284
+
274
285
switch ( MapAnnotationTool . createMode )
275
286
{
276
287
case MapAnnotationTool . CreateMode . NONE :
@@ -368,6 +379,28 @@ private void OnGUI()
368
379
GUILayout . EndHorizontal ( ) ;
369
380
GUILayout . Space ( 20 ) ;
370
381
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
+
371
404
EditorGUILayout . LabelField ( "Create Modes" , titleLabelStyle , GUILayout . ExpandWidth ( true ) ) ;
372
405
if ( ! EditorGUIUtility . isProSkin )
373
406
GUI . backgroundColor = nonProColor ;
@@ -981,6 +1014,8 @@ private void CreateMapHolder()
981
1014
{
982
1015
MapAnnotations tool = ( MapAnnotations ) GetWindow ( typeof ( MapAnnotations ) ) ;
983
1016
1017
+ MapOrigin . Find ( ) ;
1018
+
984
1019
var tempGO = new GameObject ( "Map" + SceneManager . GetActiveScene ( ) . name ) ;
985
1020
tempGO . transform . position = Vector3 . zero ;
986
1021
tempGO . transform . rotation = Quaternion . identity ;
@@ -994,7 +1029,7 @@ private void CreateMapHolder()
994
1029
Undo . RegisterCreatedObjectUndo ( tempGO , nameof ( tempGO ) ) ;
995
1030
996
1031
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 ) ;
998
1033
}
999
1034
1000
1035
private void CreateIntersectionHolder ( )
0 commit comments