Fix project cache in editor to use invariant culture when converting numbers
This commit is contained in:
@@ -38,15 +38,15 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
_gizmoMode = new ClothPaintingGizmoMode();
|
||||
|
||||
var projectCache = Editor.Instance.ProjectCache;
|
||||
if (projectCache.TryGetCustomData("ClothGizmoPaintValue", out var cachedPaintValue))
|
||||
if (projectCache.TryGetCustomData("ClothGizmoPaintValue", out string cachedPaintValue))
|
||||
_gizmoMode.PaintValue = JsonSerializer.Deserialize<float>(cachedPaintValue);
|
||||
if (projectCache.TryGetCustomData("ClothGizmoContinuousPaint", out var cachedContinuousPaint))
|
||||
if (projectCache.TryGetCustomData("ClothGizmoContinuousPaint", out string cachedContinuousPaint))
|
||||
_gizmoMode.ContinuousPaint = JsonSerializer.Deserialize<bool>(cachedContinuousPaint);
|
||||
if (projectCache.TryGetCustomData("ClothGizmoBrushFalloff", out var cachedBrushFalloff))
|
||||
if (projectCache.TryGetCustomData("ClothGizmoBrushFalloff", out string cachedBrushFalloff))
|
||||
_gizmoMode.BrushFalloff = JsonSerializer.Deserialize<float>(cachedBrushFalloff);
|
||||
if (projectCache.TryGetCustomData("ClothGizmoBrushSize", out var cachedBrushSize))
|
||||
if (projectCache.TryGetCustomData("ClothGizmoBrushSize", out string cachedBrushSize))
|
||||
_gizmoMode.BrushSize = JsonSerializer.Deserialize<float>(cachedBrushSize);
|
||||
if (projectCache.TryGetCustomData("ClothGizmoBrushStrength", out var cachedBrushStrength))
|
||||
if (projectCache.TryGetCustomData("ClothGizmoBrushStrength", out string cachedBrushStrength))
|
||||
_gizmoMode.BrushStrength = JsonSerializer.Deserialize<float>(cachedBrushStrength);
|
||||
|
||||
gizmos.AddMode(_gizmoMode);
|
||||
|
||||
@@ -330,7 +330,7 @@ namespace FlaxEditor
|
||||
}
|
||||
case GeneralOptions.StartupSceneModes.LastOpened:
|
||||
{
|
||||
if (ProjectCache.TryGetCustomData(ProjectDataLastScene, out var lastSceneIdName))
|
||||
if (ProjectCache.TryGetCustomData(ProjectDataLastScene, out string lastSceneIdName))
|
||||
{
|
||||
var lastScenes = JsonSerializer.Deserialize<Guid[]>(lastSceneIdName);
|
||||
foreach (var scene in lastScenes)
|
||||
@@ -442,7 +442,7 @@ namespace FlaxEditor
|
||||
}
|
||||
case GeneralOptions.StartupSceneModes.LastOpened:
|
||||
{
|
||||
if (ProjectCache.TryGetCustomData(ProjectDataLastScene, out var lastSceneIdName))
|
||||
if (ProjectCache.TryGetCustomData(ProjectDataLastScene, out string lastSceneIdName))
|
||||
{
|
||||
var lastScenes = JsonSerializer.Deserialize<Guid[]>(lastSceneIdName);
|
||||
foreach (var sceneId in lastScenes)
|
||||
@@ -459,7 +459,7 @@ namespace FlaxEditor
|
||||
}
|
||||
|
||||
// Restore view
|
||||
if (ProjectCache.TryGetCustomData(ProjectDataLastSceneSpawn, out var lastSceneSpawnName))
|
||||
if (ProjectCache.TryGetCustomData(ProjectDataLastSceneSpawn, out string lastSceneSpawnName))
|
||||
Windows.EditWin.Viewport.ViewRay = JsonSerializer.Deserialize<Ray>(lastSceneSpawnName);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -119,10 +119,8 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
_onClosed = pickerClosed;
|
||||
|
||||
// Get saved colors if they exist
|
||||
if (Editor.Instance.ProjectCache.TryGetCustomData("ColorPickerSavedColors", out var savedColors))
|
||||
{
|
||||
if (Editor.Instance.ProjectCache.TryGetCustomData("ColorPickerSavedColors", out string savedColors))
|
||||
_savedColors = JsonSerializer.Deserialize<List<Color>>(savedColors);
|
||||
}
|
||||
|
||||
// Selector
|
||||
_cSelector = new ColorSelectorWithSliders(180, 18)
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using FlaxEngine;
|
||||
|
||||
namespace FlaxEditor.Modules
|
||||
@@ -119,6 +121,30 @@ namespace FlaxEditor.Modules
|
||||
return _customData.TryGetValue(key, out value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get the custom data by the key.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the <paramref name="value" /> parameter. This parameter is passed uninitialized.</param>
|
||||
/// <returns>The custom data.</returns>
|
||||
public bool TryGetCustomData(string key, out bool value)
|
||||
{
|
||||
value = false;
|
||||
return _customData.TryGetValue(key, out var valueStr) && bool.TryParse(valueStr, out value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get the custom data by the key.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the <paramref name="value" /> parameter. This parameter is passed uninitialized.</param>
|
||||
/// <returns>The custom data.</returns>
|
||||
public bool TryGetCustomData(string key, out float value)
|
||||
{
|
||||
value = 0.0f;
|
||||
return _customData.TryGetValue(key, out var valueStr) && float.TryParse(valueStr, out value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the custom data.
|
||||
/// </summary>
|
||||
@@ -130,6 +156,28 @@ namespace FlaxEditor.Modules
|
||||
_isDirty = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the custom data.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetCustomData(string key, bool value)
|
||||
{
|
||||
SetCustomData(key, value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the custom data.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetCustomData(string key, float value)
|
||||
{
|
||||
SetCustomData(key, value.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the custom data.
|
||||
/// </summary>
|
||||
|
||||
@@ -511,11 +511,11 @@ namespace FlaxEditor.Modules
|
||||
{
|
||||
var bounds = node["Bounds"];
|
||||
var isMaximizedText = bounds.GetAttribute("IsMaximized");
|
||||
if (!string.IsNullOrEmpty(isMaximizedText))
|
||||
isMaximized = bool.Parse(isMaximizedText);
|
||||
if (!string.IsNullOrEmpty(isMaximizedText) && bool.TryParse(isMaximizedText, out var tmpBool))
|
||||
isMaximized = tmpBool;
|
||||
var isMinimizedText = bounds.GetAttribute("IsMinimized");
|
||||
if (!string.IsNullOrEmpty(isMinimizedText))
|
||||
isMinimized = bool.Parse(isMinimizedText);
|
||||
if (!string.IsNullOrEmpty(isMinimizedText) && bool.TryParse(isMinimizedText, out tmpBool))
|
||||
isMinimized = tmpBool;
|
||||
float x = float.Parse(bounds.GetAttribute("X"), CultureInfo.InvariantCulture);
|
||||
float y = float.Parse(bounds.GetAttribute("Y"), CultureInfo.InvariantCulture);
|
||||
float width = float.Parse(bounds.GetAttribute("Width"), CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -137,19 +137,19 @@ namespace FlaxEditor.Viewport
|
||||
if (useProjectCache)
|
||||
{
|
||||
// Initialize snapping enabled from cached values
|
||||
if (editor.ProjectCache.TryGetCustomData("TranslateSnapState", out var cachedState))
|
||||
transformGizmo.TranslationSnapEnable = bool.Parse(cachedState);
|
||||
if (editor.ProjectCache.TryGetCustomData("RotationSnapState", out cachedState))
|
||||
transformGizmo.RotationSnapEnabled = bool.Parse(cachedState);
|
||||
if (editor.ProjectCache.TryGetCustomData("ScaleSnapState", out cachedState))
|
||||
transformGizmo.ScaleSnapEnabled = bool.Parse(cachedState);
|
||||
if (editor.ProjectCache.TryGetCustomData("TranslateSnapValue", out cachedState))
|
||||
transformGizmo.TranslationSnapValue = float.Parse(cachedState);
|
||||
if (editor.ProjectCache.TryGetCustomData("RotationSnapValue", out cachedState))
|
||||
transformGizmo.RotationSnapValue = float.Parse(cachedState);
|
||||
if (editor.ProjectCache.TryGetCustomData("ScaleSnapValue", out cachedState))
|
||||
transformGizmo.ScaleSnapValue = float.Parse(cachedState);
|
||||
if (editor.ProjectCache.TryGetCustomData("TransformSpaceState", out cachedState) && Enum.TryParse(cachedState, out TransformGizmoBase.TransformSpace space))
|
||||
if (editor.ProjectCache.TryGetCustomData("TranslateSnapState", out bool cachedBool))
|
||||
transformGizmo.TranslationSnapEnable = cachedBool;
|
||||
if (editor.ProjectCache.TryGetCustomData("RotationSnapState", out cachedBool))
|
||||
transformGizmo.RotationSnapEnabled = cachedBool;
|
||||
if (editor.ProjectCache.TryGetCustomData("ScaleSnapState", out cachedBool))
|
||||
transformGizmo.ScaleSnapEnabled = cachedBool;
|
||||
if (editor.ProjectCache.TryGetCustomData("TranslateSnapValue", out float cachedFloat))
|
||||
transformGizmo.TranslationSnapValue = cachedFloat;
|
||||
if (editor.ProjectCache.TryGetCustomData("RotationSnapValue", out cachedFloat))
|
||||
transformGizmo.RotationSnapValue = cachedFloat;
|
||||
if (editor.ProjectCache.TryGetCustomData("ScaleSnapValue", out cachedFloat))
|
||||
transformGizmo.ScaleSnapValue = cachedFloat;
|
||||
if (editor.ProjectCache.TryGetCustomData("TransformSpaceState", out string cachedText) && Enum.TryParse(cachedText, out TransformGizmoBase.TransformSpace space))
|
||||
transformGizmo.ActiveTransformSpace = space;
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
transformGizmo.ScaleSnapEnabled = !transformGizmo.ScaleSnapEnabled;
|
||||
if (useProjectCache)
|
||||
editor.ProjectCache.SetCustomData("ScaleSnapState", transformGizmo.ScaleSnapEnabled.ToString());
|
||||
editor.ProjectCache.SetCustomData("ScaleSnapState", transformGizmo.ScaleSnapEnabled);
|
||||
};
|
||||
var scaleSnappingCM = new ContextMenu();
|
||||
var scaleSnapping = new ViewportWidgetButton(transformGizmo.ScaleSnapValue.ToString(), SpriteHandle.Invalid, scaleSnappingCM)
|
||||
@@ -200,7 +200,7 @@ namespace FlaxEditor.Viewport
|
||||
transformGizmo.ScaleSnapValue = v;
|
||||
scaleSnapping.Text = v.ToString();
|
||||
if (useProjectCache)
|
||||
editor.ProjectCache.SetCustomData("ScaleSnapValue", transformGizmo.ScaleSnapValue.ToString("N"));
|
||||
editor.ProjectCache.SetCustomData("ScaleSnapValue", transformGizmo.ScaleSnapValue);
|
||||
};
|
||||
scaleSnappingCM.VisibleChanged += control =>
|
||||
{
|
||||
@@ -231,7 +231,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
transformGizmo.RotationSnapEnabled = !transformGizmo.RotationSnapEnabled;
|
||||
if (useProjectCache)
|
||||
editor.ProjectCache.SetCustomData("RotationSnapState", transformGizmo.RotationSnapEnabled.ToString());
|
||||
editor.ProjectCache.SetCustomData("RotationSnapState", transformGizmo.RotationSnapEnabled);
|
||||
};
|
||||
var rotateSnappingCM = new ContextMenu();
|
||||
var rotateSnapping = new ViewportWidgetButton(transformGizmo.RotationSnapValue.ToString(), SpriteHandle.Invalid, rotateSnappingCM)
|
||||
@@ -250,7 +250,7 @@ namespace FlaxEditor.Viewport
|
||||
transformGizmo.RotationSnapValue = v;
|
||||
rotateSnapping.Text = v.ToString();
|
||||
if (useProjectCache)
|
||||
editor.ProjectCache.SetCustomData("RotationSnapValue", transformGizmo.RotationSnapValue.ToString("N"));
|
||||
editor.ProjectCache.SetCustomData("RotationSnapValue", transformGizmo.RotationSnapValue);
|
||||
};
|
||||
rotateSnappingCM.VisibleChanged += control =>
|
||||
{
|
||||
@@ -281,7 +281,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
transformGizmo.TranslationSnapEnable = !transformGizmo.TranslationSnapEnable;
|
||||
if (useProjectCache)
|
||||
editor.ProjectCache.SetCustomData("TranslateSnapState", transformGizmo.TranslationSnapEnable.ToString());
|
||||
editor.ProjectCache.SetCustomData("TranslateSnapState", transformGizmo.TranslationSnapEnable);
|
||||
};
|
||||
var translateSnappingCM = new ContextMenu();
|
||||
var translateSnapping = new ViewportWidgetButton(transformGizmo.TranslationSnapValue.ToString(), SpriteHandle.Invalid, translateSnappingCM)
|
||||
@@ -307,7 +307,7 @@ namespace FlaxEditor.Viewport
|
||||
else
|
||||
translateSnapping.Text = v.ToString();
|
||||
if (useProjectCache)
|
||||
editor.ProjectCache.SetCustomData("TranslateSnapValue", transformGizmo.TranslationSnapValue.ToString("N"));
|
||||
editor.ProjectCache.SetCustomData("TranslateSnapValue", transformGizmo.TranslationSnapValue);
|
||||
};
|
||||
translateSnappingCM.VisibleChanged += control =>
|
||||
{
|
||||
|
||||
@@ -540,30 +540,30 @@ namespace FlaxEditor.Viewport
|
||||
}
|
||||
|
||||
// Initialize camera values from cache
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraMovementSpeedValue", out var cachedState))
|
||||
MovementSpeed = float.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraMinMovementSpeedValue", out cachedState))
|
||||
_minMovementSpeed = float.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraMaxMovementSpeedValue", out cachedState))
|
||||
_maxMovementSpeed = float.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("UseCameraEasingState", out cachedState))
|
||||
_useCameraEasing = bool.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraPanningSpeedValue", out cachedState))
|
||||
_panningSpeed = float.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraInvertPanningState", out cachedState))
|
||||
_invertPanning = bool.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraRelativePanningState", out cachedState))
|
||||
_relativePanning = bool.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraOrthographicState", out cachedState))
|
||||
_isOrtho = bool.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraOrthographicSizeValue", out cachedState))
|
||||
_orthoSize = float.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraFieldOfViewValue", out cachedState))
|
||||
_fieldOfView = float.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraNearPlaneValue", out cachedState))
|
||||
_nearPlane = float.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraFarPlaneValue", out cachedState))
|
||||
_farPlane = float.Parse(cachedState);
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraMovementSpeedValue", out float cachedFloat))
|
||||
MovementSpeed = cachedFloat;
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraMinMovementSpeedValue", out cachedFloat))
|
||||
_minMovementSpeed = cachedFloat;
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraMaxMovementSpeedValue", out cachedFloat))
|
||||
_maxMovementSpeed = cachedFloat;
|
||||
if (_editor.ProjectCache.TryGetCustomData("UseCameraEasingState", out bool cachedBool))
|
||||
_useCameraEasing = cachedBool;
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraPanningSpeedValue", out cachedFloat))
|
||||
_panningSpeed = cachedFloat;
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraInvertPanningState", out cachedBool))
|
||||
_invertPanning = cachedBool;
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraRelativePanningState", out cachedBool))
|
||||
_relativePanning = cachedBool;
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraOrthographicState", out cachedBool))
|
||||
_isOrtho = cachedBool;
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraOrthographicSizeValue", out cachedFloat))
|
||||
_orthoSize = cachedFloat;
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraFieldOfViewValue", out cachedFloat))
|
||||
_fieldOfView = cachedFloat;
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraNearPlaneValue", out cachedFloat))
|
||||
_nearPlane = cachedFloat;
|
||||
if (_editor.ProjectCache.TryGetCustomData("CameraFarPlaneValue", out cachedFloat))
|
||||
_farPlane = cachedFloat;
|
||||
|
||||
OnCameraMovementProgressChanged();
|
||||
|
||||
@@ -1041,7 +1041,7 @@ namespace FlaxEditor.Viewport
|
||||
MovementSpeed = value;
|
||||
|
||||
OnCameraMovementProgressChanged();
|
||||
_editor.ProjectCache.SetCustomData("CameraMovementSpeedValue", _movementSpeed.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraMovementSpeedValue", _movementSpeed);
|
||||
}
|
||||
|
||||
private void OnMinMovementSpeedChanged(FloatValueBox control)
|
||||
@@ -1053,7 +1053,7 @@ namespace FlaxEditor.Viewport
|
||||
MovementSpeed = value;
|
||||
|
||||
OnCameraMovementProgressChanged();
|
||||
_editor.ProjectCache.SetCustomData("CameraMinMovementSpeedValue", _minMovementSpeed.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraMinMovementSpeedValue", _minMovementSpeed);
|
||||
}
|
||||
|
||||
private void OnMaxMovementSpeedChanged(FloatValueBox control)
|
||||
@@ -1065,7 +1065,7 @@ namespace FlaxEditor.Viewport
|
||||
MovementSpeed = value;
|
||||
|
||||
OnCameraMovementProgressChanged();
|
||||
_editor.ProjectCache.SetCustomData("CameraMaxMovementSpeedValue", _maxMovementSpeed.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraMaxMovementSpeedValue", _maxMovementSpeed);
|
||||
}
|
||||
|
||||
private void OnCameraEasingToggled(Control control)
|
||||
@@ -1073,25 +1073,25 @@ namespace FlaxEditor.Viewport
|
||||
_useCameraEasing = !_useCameraEasing;
|
||||
|
||||
OnCameraMovementProgressChanged();
|
||||
_editor.ProjectCache.SetCustomData("UseCameraEasingState", _useCameraEasing.ToString());
|
||||
_editor.ProjectCache.SetCustomData("UseCameraEasingState", _useCameraEasing);
|
||||
}
|
||||
|
||||
private void OnPanningSpeedChanged(FloatValueBox control)
|
||||
{
|
||||
_panningSpeed = control.Value;
|
||||
_editor.ProjectCache.SetCustomData("CameraPanningSpeedValue", _panningSpeed.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraPanningSpeedValue", _panningSpeed);
|
||||
}
|
||||
|
||||
private void OnRelativePanningToggled(Control control)
|
||||
{
|
||||
_relativePanning = !_relativePanning;
|
||||
_editor.ProjectCache.SetCustomData("CameraRelativePanningState", _relativePanning.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraRelativePanningState", _relativePanning);
|
||||
}
|
||||
|
||||
private void OnInvertPanningToggled(Control control)
|
||||
{
|
||||
_invertPanning = !_invertPanning;
|
||||
_editor.ProjectCache.SetCustomData("CameraInvertPanningState", _invertPanning.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraInvertPanningState", _invertPanning);
|
||||
}
|
||||
|
||||
|
||||
@@ -1104,7 +1104,7 @@ namespace FlaxEditor.Viewport
|
||||
private void OnFieldOfViewChanged(FloatValueBox control)
|
||||
{
|
||||
_fieldOfView = control.Value;
|
||||
_editor.ProjectCache.SetCustomData("CameraFieldOfViewValue", _fieldOfView.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraFieldOfViewValue", _fieldOfView);
|
||||
}
|
||||
|
||||
private void OnOrthographicModeToggled(Control control)
|
||||
@@ -1120,25 +1120,25 @@ namespace FlaxEditor.Viewport
|
||||
OrientViewport(ref orient);
|
||||
}
|
||||
|
||||
_editor.ProjectCache.SetCustomData("CameraOrthographicState", _isOrtho.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraOrthographicState", _isOrtho);
|
||||
}
|
||||
|
||||
private void OnOrthographicSizeChanged(FloatValueBox control)
|
||||
{
|
||||
_orthoSize = control.Value;
|
||||
_editor.ProjectCache.SetCustomData("CameraOrthographicSizeValue", _orthoSize.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraOrthographicSizeValue", _orthoSize);
|
||||
}
|
||||
|
||||
private void OnNearPlaneChanged(FloatValueBox control)
|
||||
{
|
||||
_nearPlane = control.Value;
|
||||
_editor.ProjectCache.SetCustomData("CameraNearPlaneValue", _nearPlane.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraNearPlaneValue", _nearPlane);
|
||||
}
|
||||
|
||||
private void OnFarPlaneChanged(FloatValueBox control)
|
||||
{
|
||||
_farPlane = control.Value;
|
||||
_editor.ProjectCache.SetCustomData("CameraFarPlaneValue", _farPlane.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraFarPlaneValue", _farPlane);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1217,7 +1217,7 @@ namespace FlaxEditor.Viewport
|
||||
|
||||
var speed = Mathf.Lerp(_minMovementSpeed, _maxMovementSpeed, progress);
|
||||
MovementSpeed = (float)Math.Round(speed, 3);
|
||||
_editor.ProjectCache.SetCustomData("CameraMovementSpeedValue", _movementSpeed.ToString());
|
||||
_editor.ProjectCache.SetCustomData("CameraMovementSpeedValue", _movementSpeed);
|
||||
}
|
||||
|
||||
private void OnEditorOptionsChanged(EditorOptions options)
|
||||
|
||||
@@ -1027,7 +1027,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
try
|
||||
{
|
||||
// Try to restore the cached breakpoints from the last session
|
||||
if (Editor.ProjectCache.TryGetCustomData(_asset.ScriptTypeName + ".Breakpoints", out var breakpointsData))
|
||||
if (Editor.ProjectCache.TryGetCustomData(_asset.ScriptTypeName + ".Breakpoints", out string breakpointsData))
|
||||
{
|
||||
var data = JsonSerializer.Deserialize<BreakpointData[]>(breakpointsData);
|
||||
if (data != null)
|
||||
|
||||
@@ -1068,7 +1068,7 @@ namespace FlaxEditor.Windows
|
||||
PerformLayout();
|
||||
|
||||
// Load last viewed folder
|
||||
if (Editor.ProjectCache.TryGetCustomData(ProjectDataLastViewedFolder, out var lastViewedFolder))
|
||||
if (Editor.ProjectCache.TryGetCustomData(ProjectDataLastViewedFolder, out string lastViewedFolder))
|
||||
{
|
||||
if (Editor.ContentDatabase.Find(lastViewedFolder) is ContentFolder folder)
|
||||
_tree.Select(folder.Node);
|
||||
|
||||
@@ -329,9 +329,8 @@ namespace FlaxEditor.Windows
|
||||
toolstrip.AddButton("Clear", Clear).LinkTooltip("Clears all log entries");
|
||||
_clearOnPlayButton = (ToolStripButton)toolstrip.AddButton("Clear on Play").SetAutoCheck(true).SetChecked(true).LinkTooltip("Clears all log entries on enter playmode");
|
||||
bool collapse = true;
|
||||
if (Editor.ProjectCache.TryGetCustomData("DebugLogCollapse", out var collapseString))
|
||||
if (bool.TryParse(collapseString, out var setCollapse))
|
||||
collapse = setCollapse;
|
||||
if (Editor.ProjectCache.TryGetCustomData("DebugLogCollapse", out bool setCollapse))
|
||||
collapse = setCollapse;
|
||||
_collapseLogsButton = (ToolStripButton)toolstrip.AddButton("Collapse", () => Editor.ProjectCache.SetCustomData("DebugLogCollapse", _collapseLogsButton.Checked.ToString())).SetAutoCheck(true).SetChecked(collapse).LinkTooltip("Collapses similar logs.");
|
||||
_pauseOnErrorButton = (ToolStripButton)toolstrip.AddButton("Pause on Error").SetAutoCheck(true).LinkTooltip("Performs auto pause on error");
|
||||
toolstrip.AddSeparator();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using FlaxEditor.CustomEditors;
|
||||
using FlaxEngine;
|
||||
@@ -177,7 +176,7 @@ namespace FlaxEditor.Windows
|
||||
/// <inheritdoc />
|
||||
public override void OnInit()
|
||||
{
|
||||
if (Editor.ProjectCache.TryGetCustomData(_optionsName, out var options) && !string.IsNullOrEmpty(options))
|
||||
if (Editor.ProjectCache.TryGetCustomData(_optionsName, out string options) && !string.IsNullOrEmpty(options))
|
||||
{
|
||||
// Load cached settings
|
||||
JsonSerializer.Deserialize(_viewModel, options);
|
||||
|
||||
Reference in New Issue
Block a user