From 13150ea553ea67752224426a730cc94f8c98a984 Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Wed, 19 Oct 2022 15:25:42 -0500 Subject: [PATCH] changed snap enable to still use default values if cache data doesnt exist --- Source/Editor/Viewport/MainEditorGizmoViewport.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Source/Editor/Viewport/MainEditorGizmoViewport.cs b/Source/Editor/Viewport/MainEditorGizmoViewport.cs index da9bd585d..80393302b 100644 --- a/Source/Editor/Viewport/MainEditorGizmoViewport.cs +++ b/Source/Editor/Viewport/MainEditorGizmoViewport.cs @@ -225,9 +225,18 @@ namespace FlaxEditor.Viewport // initialize snapping enabled from cached values string cachedSnapState; - TransformGizmo.TranslationSnapEnable = _editor.ProjectCache.TryGetCustomData("TranslateSnapState", out cachedSnapState) && Boolean.Parse(cachedSnapState); - TransformGizmo.RotationSnapEnabled = _editor.ProjectCache.TryGetCustomData("RotationSnapState", out cachedSnapState) && Boolean.Parse(cachedSnapState); - TransformGizmo.ScaleSnapEnabled = _editor.ProjectCache.TryGetCustomData("ScaleSnapState", out cachedSnapState) && Boolean.Parse(cachedSnapState); + if (_editor.ProjectCache.TryGetCustomData("TranslateSnapState", out cachedSnapState)) + { + TransformGizmo.TranslationSnapEnable = Boolean.Parse(cachedSnapState); + } + if (_editor.ProjectCache.TryGetCustomData("RotationSnapState", out cachedSnapState)) + { + TransformGizmo.RotationSnapEnabled = Boolean.Parse(cachedSnapState); + } + if (_editor.ProjectCache.TryGetCustomData("ScaleSnapState", out cachedSnapState)) + { + TransformGizmo.ScaleSnapEnabled = Boolean.Parse(cachedSnapState); + } // initialize snap value if there is one cached string cachedSnapValue;