public void SaveSettingsToPrefs() { MapperSettingsFile saveFile = new MapperSettingsFile(); saveFile.version = VERSION; saveFile.useGps = useGps; saveFile.captureRgb = captureRgb; saveFile.checkConnectivity = checkConnectivity; saveFile.showPointClouds = showPointClouds; saveFile.useServerLocalizer = useServerLocalizer; saveFile.listOnlyNearbyMaps = listOnlyNearbyMaps; saveFile.transformRootToOrigin = transformRootToOrigin; saveFile.downsampleWhenLocalizing = downsampleWhenLocalizing; saveFile.renderPointsAs3D = renderPointsAs3D; saveFile.pointSize = pointSize; saveFile.resolution = resolution; saveFile.localizer = localizer; saveFile.mapDetailLevel = mapDetailLevel; saveFile.serverLocalizationWithIds = serverLocalizationWithIds; saveFile.useDifferentARSpaces = useDifferentARSpaces; saveFile.preservePoses = preservePoses; saveFile.windowSize = windowSize; string jsonstring = JsonUtility.ToJson(saveFile, true); string dataPath = Path.Combine(Application.persistentDataPath, m_Filename); //Debug.Log(dataPath); File.WriteAllText(dataPath, jsonstring); }
public void SaveSettingsToPrefs() { MapperSettingsFile saveFile = new MapperSettingsFile(); saveFile.version = VERSION; saveFile.useGps = useGps; saveFile.captureRgb = captureRgb; saveFile.showPointClouds = showPointClouds; saveFile.useServerLocalizer = useServerLocalizer; saveFile.listOnlyNearbyMaps = listOnlyNearbyMaps; saveFile.downsampleWhenLocalizing = downsampleWhenLocalizing; saveFile.resolution = resolution; saveFile.localizer = localizer; saveFile.mapDetailLevel = mapDetailLevel; saveFile.serverLocalizationWithIds = serverLocalizationWithIds; saveFile.preservePoses = preservePoses; saveFile.windowSize = windowSize; saveFile.param1 = param1; saveFile.param2 = param2; saveFile.param3 = param3; saveFile.param4 = param4; string jsonstring = JsonUtility.ToJson(saveFile, true); string dataPath = Path.Combine(Application.persistentDataPath, m_Filename); //Debug.Log(dataPath); File.WriteAllText(dataPath, jsonstring); }
private void LoadSettingsFromPrefs() { string dataPath = Path.Combine(Application.persistentDataPath, m_Filename); try { MapperSettingsFile loadFile = JsonUtility.FromJson <MapperSettingsFile>(File.ReadAllText(dataPath)); // set defaults for old file versions if (loadFile.version < 2) { ResetDeveloperSettings(); return; } m_GpsCaptureToggle.isOn = loadFile.useGps; useGps = loadFile.useGps; m_RgbCaptureToggle.SetIsOnWithoutNotify(loadFile.captureRgb); captureRgb = loadFile.captureRgb; m_ShowPointCloudsToggle.SetIsOnWithoutNotify(loadFile.showPointClouds); showPointClouds = loadFile.showPointClouds; m_OnServerLocalizationToggle.SetIsOnWithoutNotify(loadFile.useServerLocalizer); useServerLocalizer = loadFile.useServerLocalizer; m_ListOnlyNearbyMapsToggle.SetIsOnWithoutNotify(loadFile.listOnlyNearbyMaps); listOnlyNearbyMaps = loadFile.listOnlyNearbyMaps; m_DownsampleWhenLocalizingToggle.SetIsOnWithoutNotify(loadFile.downsampleWhenLocalizing); downsampleWhenLocalizing = loadFile.downsampleWhenLocalizing; localizer = loadFile.localizer; m_LocalizerDropdown.value = localizer; //m_ResolutionDropdown.value = loadFile.resolution; //resolution = loadFile.resolution; m_MapDetailLevelInput.SetTextWithoutNotify(loadFile.mapDetailLevel.ToString()); mapDetailLevel = loadFile.mapDetailLevel; m_ServerLocalizationWithIdsToggle.SetIsOnWithoutNotify(loadFile.serverLocalizationWithIds); serverLocalizationWithIds = loadFile.serverLocalizationWithIds; m_PreservePosesToggle.SetIsOnWithoutNotify(loadFile.preservePoses); preservePoses = loadFile.preservePoses; m_WindowSizeInput.SetTextWithoutNotify(loadFile.windowSize.ToString()); windowSize = loadFile.windowSize; m_Param1Input.SetTextWithoutNotify(loadFile.param1.ToString()); param1 = loadFile.param1; m_Param2Input.SetTextWithoutNotify(loadFile.param2.ToString()); param2 = loadFile.param2; m_Param3Input.SetTextWithoutNotify(loadFile.param3.ToString()); param3 = loadFile.param3; m_Param4Input.SetTextWithoutNotify(loadFile.param4.ToString()); param4 = loadFile.param4; } catch (FileNotFoundException e) { Debug.Log(e.Message + "\nsettings.json file not found"); } SaveSettingsToPrefs(); }
private void LoadSettingsFromPrefs() { string dataPath = Path.Combine(Application.persistentDataPath, m_Filename); try { MapperSettingsFile loadFile = JsonUtility.FromJson <MapperSettingsFile>(File.ReadAllText(dataPath)); // set defaults for old file versions if (loadFile.version < VERSION) { ResetDeveloperSettings(); return; } m_GpsCaptureToggle.isOn = loadFile.useGps; useGps = loadFile.useGps; m_RgbCaptureToggle.SetIsOnWithoutNotify(loadFile.captureRgb); captureRgb = loadFile.captureRgb; m_CheckConnectivityToggle.SetIsOnWithoutNotify(loadFile.checkConnectivity); checkConnectivity = loadFile.checkConnectivity; m_ShowPointCloudsToggle.SetIsOnWithoutNotify(loadFile.showPointClouds); showPointClouds = loadFile.showPointClouds; m_RenderPointsAs3DToggle.SetIsOnWithoutNotify(loadFile.renderPointsAs3D); renderPointsAs3D = loadFile.renderPointsAs3D; Immersal.AR.ARMap.renderAs3dPoints = renderPointsAs3D; m_PointSizeSlider.SetValueWithoutNotify(loadFile.pointSize); pointSize = loadFile.pointSize; Immersal.AR.ARMap.pointSize = pointSize; m_OnServerLocalizationToggle.SetIsOnWithoutNotify(loadFile.useServerLocalizer); useServerLocalizer = loadFile.useServerLocalizer; m_ListOnlyNearbyMapsToggle.SetIsOnWithoutNotify(loadFile.listOnlyNearbyMaps); listOnlyNearbyMaps = loadFile.listOnlyNearbyMaps; m_TransformRootToOrigin.SetIsOnWithoutNotify(loadFile.transformRootToOrigin); transformRootToOrigin = loadFile.transformRootToOrigin; m_DownsampleWhenLocalizingToggle.SetIsOnWithoutNotify(loadFile.downsampleWhenLocalizing); downsampleWhenLocalizing = loadFile.downsampleWhenLocalizing; m_MapDetailLevelInput.SetTextWithoutNotify(loadFile.mapDetailLevel.ToString()); mapDetailLevel = loadFile.mapDetailLevel; m_ServerLocalizationWithIdsToggle.SetIsOnWithoutNotify(loadFile.serverLocalizationWithIds); serverLocalizationWithIds = loadFile.serverLocalizationWithIds; m_UseDifferentARSpacesToggle.SetIsOnWithoutNotify(loadFile.useDifferentARSpaces); useDifferentARSpaces = loadFile.useDifferentARSpaces; m_PreservePosesToggle.SetIsOnWithoutNotify(loadFile.preservePoses); preservePoses = loadFile.preservePoses; m_WindowSizeInput.SetTextWithoutNotify(loadFile.windowSize.ToString()); windowSize = loadFile.windowSize; } catch (FileNotFoundException e) { Debug.Log(e.Message + "\nsettings.json file not found"); } SaveSettingsToPrefs(); }