File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Assets/HoloToolkit/SpatialMapping/Scripts/RemoteMapping Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,12 @@ public class FileSurfaceObserver : SpatialMappingSource
1111 [ Tooltip ( "The file name to use when saving and loading meshes." ) ]
1212 public string MeshFileName = "roombackup" ;
1313
14+ [ Tooltip ( "Key to press in editor to load a spatial mapping mesh from a .room file." ) ]
15+ public KeyCode LoadFileKey = KeyCode . L ;
16+
17+ [ Tooltip ( "Key to press in editor to save a spatial mapping mesh to file." ) ]
18+ public KeyCode SaveFileKey = KeyCode . S ;
19+
1420 /// <summary>
1521 /// Loads the SpatialMapping mesh from the specified file.
1622 /// </summary>
@@ -59,5 +65,25 @@ public void Load(string fileName)
5965 Debug . Log ( "Failed to load " + fileName ) ;
6066 }
6167 }
68+
69+ // Called every frame.
70+ private void Update ( )
71+ {
72+ // Keyboard commands for saving and loading a remotely generated mesh file.
73+ #if UNITY_EDITOR || UNITY_STANDALONE
74+ // S - saves the active mesh
75+ if ( Input . GetKeyUp ( KeyCode . S ) )
76+ {
77+ MeshSaver . Save ( MeshFileName , SpatialMappingManager . Instance . GetMeshes ( ) ) ;
78+ }
79+
80+ // L - loads the previously saved mesh into editor and sets it to be the spatial mapping source.
81+ if ( Input . GetKeyUp ( KeyCode . L ) )
82+ {
83+ SpatialMappingManager . Instance . SetSpatialMappingSource ( this ) ;
84+ Load ( MeshFileName ) ;
85+ }
86+ #endif
87+ }
6288 }
6389}
You can’t perform that action at this time.
0 commit comments