From 59ab229b63fee5335bd35b88fd8c7a2ad2012b15 Mon Sep 17 00:00:00 2001 From: Andy Baker Date: Mon, 23 Dec 2024 00:28:19 +0000 Subject: [PATCH] Post-merge fixes (WIP) --- Assets/Scripts/API/ApiMethods.Tools.cs | 2 +- .../Scripts/Commands/CreatePathKnotCommand.cs | 12 -------- .../Commands/MovePositionKnotCommand.cs | 2 +- Assets/Scripts/Layers/LayerUI_Manager.cs | 8 ++--- Assets/Scripts/Save/SketchWriter.cs | 30 ++++++++++++++----- Assets/Scripts/Sharing/OAuth2Identity.cs | 2 +- 6 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Assets/Scripts/API/ApiMethods.Tools.cs b/Assets/Scripts/API/ApiMethods.Tools.cs index 41507938ad..257cf80e79 100644 --- a/Assets/Scripts/API/ApiMethods.Tools.cs +++ b/Assets/Scripts/API/ApiMethods.Tools.cs @@ -140,7 +140,7 @@ public static void ActivatePinTool() SketchSurfacePanel.m_Instance.EnableSpecificTool(BaseTool.ToolType.PinTool); } - [ApiEndpoint("tool.camerapath", "Activates the MovementPath Tool")] + [ApiEndpoint("tool.camerapath", "Activates the CameraPath Tool")] public static void ActivateCameraPathTool() { SketchSurfacePanel.m_Instance.EnableSpecificTool(BaseTool.ToolType.CameraPathTool); diff --git a/Assets/Scripts/Commands/CreatePathKnotCommand.cs b/Assets/Scripts/Commands/CreatePathKnotCommand.cs index 77c4e5b321..ed220eea06 100644 --- a/Assets/Scripts/Commands/CreatePathKnotCommand.cs +++ b/Assets/Scripts/Commands/CreatePathKnotCommand.cs @@ -54,27 +54,20 @@ protected override void OnRedo() // The scale of path widgets is arbitrary. However, the scale should be one at knot creation // time so newly added knots have appropriate mesh scales. m_Widget.transform.localScale = Vector3.one; - - Debug.Log("PATH SWITCH "); if (m_CreatedKnot == null) { switch (m_KnotType) { case CameraPathKnot.Type.Position: - Debug.Log("1 "); m_CreatedKnot = m_Widget.Path.CreatePositionKnot(m_SpawnXf.translation); - Debug.Log(m_CreatedKnot); break; case CameraPathKnot.Type.Rotation: - Debug.Log("2 "); m_CreatedKnot = m_Widget.Path.CreateRotationKnot(m_PathT, m_SpawnXf.rotation); break; case CameraPathKnot.Type.Speed: - Debug.Log("3 "); m_CreatedKnot = m_Widget.Path.CreateSpeedKnot(m_PathT); break; case CameraPathKnot.Type.Fov: - Debug.Log("4 "); m_CreatedKnot = m_Widget.Path.CreateFovKnot(m_PathT); break; default: @@ -90,11 +83,6 @@ protected override void OnRedo() // If we're inserting a point and it's at the head, take on the characteristics of // the head knot. This will cause InsertPositionKnot to register the path as looping, // which is what we want. - - - Debug.Log("PATH IS NULL "); - Debug.Log(m_Widget); - Debug.Log(m_CreatedKnot); if (m_Widget.Path.IsPositionNearHead(m_CreatedKnot.transform.position) && knotIndex == m_Widget.Path.NumPositionKnots) { diff --git a/Assets/Scripts/Commands/MovePositionKnotCommand.cs b/Assets/Scripts/Commands/MovePositionKnotCommand.cs index 15627349d9..da081b2289 100644 --- a/Assets/Scripts/Commands/MovePositionKnotCommand.cs +++ b/Assets/Scripts/Commands/MovePositionKnotCommand.cs @@ -37,7 +37,7 @@ public MovePositionKnotCommand(CameraPath path, KnotDescriptor knotDesc, if (Knot == null) { - throw new ArgumentException("MovePositionKnotCommand requires MovementPathPositionKnot"); + throw new ArgumentException("MovePositionKnotCommand requires CameraPathPositionKnot"); } m_StartXf_CS = TrTransform.FromLocalTransform(Knot.transform); } diff --git a/Assets/Scripts/Layers/LayerUI_Manager.cs b/Assets/Scripts/Layers/LayerUI_Manager.cs index d7664f3417..2963ceb109 100644 --- a/Assets/Scripts/Layers/LayerUI_Manager.cs +++ b/Assets/Scripts/Layers/LayerUI_Manager.cs @@ -36,8 +36,8 @@ public class LayerUI_Manager : MonoBehaviour private bool m_RefreshNavButtons; private int WidgetsPerPage => m_Widgets.Count; - private int LastPageIndex => (m_Canvases.Count + WidgetsPerPage - 1) / WidgetsPerPage - 1; - private int CurrentPageIndex => m_StartingCanvasIndex / WidgetsPerPage; + private int LastPageIndex => (m_Canvases.Count + WidgetsPerPage - 1) / (WidgetsPerPage > 1 ? WidgetsPerPage - 1 : 1); + private int CurrentPageIndex => m_StartingCanvasIndex / (WidgetsPerPage > 0 ? WidgetsPerPage : 1); private void Start() { @@ -85,8 +85,8 @@ private void LateUpdate() if (m_RefreshNavButtons) { // Can't do this in RefreshUI because the it doesn't take effect if the button is being interacted with - m_PreviousPageButton.SetButtonAvailable(CurrentPageIndex > 0); - m_NextPageButton.SetButtonAvailable(CurrentPageIndex < LastPageIndex); + m_PreviousPageButton?.SetButtonAvailable(CurrentPageIndex > 0); + m_NextPageButton?.SetButtonAvailable(CurrentPageIndex < LastPageIndex); m_RefreshNavButtons = false; } } diff --git a/Assets/Scripts/Save/SketchWriter.cs b/Assets/Scripts/Save/SketchWriter.cs index 6ae49b12c9..a820c6289a 100644 --- a/Assets/Scripts/Save/SketchWriter.cs +++ b/Assets/Scripts/Save/SketchWriter.cs @@ -322,7 +322,8 @@ public static void WriteMemory(Stream stream, IList s StrokeExtension strokeExtensionMask = StrokeExtension.Flags | StrokeExtension.Seed; if (stroke.m_BrushScale != 1) { strokeExtensionMask |= StrokeExtension.Scale; } if (stroke.m_Group != SketchGroupTag.None) { strokeExtensionMask |= StrokeExtension.Group; } - strokeExtensionMask |= StrokeExtension.Layer; + strokeExtensionMask |= StrokeExtension.Track; + strokeExtensionMask |= StrokeExtension.Frame; writer.UInt32((uint)strokeExtensionMask); uint controlPointExtensionMask = @@ -343,9 +344,13 @@ public static void WriteMemory(Stream stream, IList s { writer.Int32(stroke.m_Seed); } - if ((uint)(strokeExtensionMask & StrokeExtension.Layer) != 0) + if ((uint)(strokeExtensionMask & StrokeExtension.Track) != 0) { - writer.UInt32(copy.layerIndex); + writer.UInt32(copy.trackIndex); + } + if ((uint)(strokeExtensionMask & StrokeExtension.Frame) != 0) + { + writer.UInt32(copy.frameIndex); } // Control points @@ -689,6 +694,8 @@ public static List GetStrokes( } // Process stroke extension fields... + UInt32 trackIndex = 0; + UInt32 frameIndex = 0; for (var fields = strokeExtensionMask; fields != 0; fields &= (fields - 1)) { uint bit = (fields & ~(fields - 1)); @@ -709,14 +716,19 @@ public static List GetStrokes( stroke.Group = App.GroupManager.GetGroupFromId(groupId); break; } - case StrokeExtension.Layer: - UInt32 layerIndex = reader.UInt32(); + case StrokeExtension.Track: + trackIndex = reader.UInt32(); if (squashLayers) { - layerIndex = 0; + trackIndex = 0; + } + break; + case StrokeExtension.Frame: + frameIndex = reader.UInt32(); + if (squashLayers) + { + frameIndex = 0; } - var canvas = App.Scene.GetOrCreateLayer((int)layerIndex); - stroke.m_IntendedCanvas = canvas; break; case StrokeExtension.Seed: stroke.m_Seed = reader.Int32(); @@ -737,6 +749,8 @@ public static List GetStrokes( } } } + var canvas = App.Scene.GetOrCreateLayer((int)trackIndex, (int)frameIndex); + stroke.m_IntendedCanvas = canvas; // Process control points... int nControlPoints = reader.Int32(); diff --git a/Assets/Scripts/Sharing/OAuth2Identity.cs b/Assets/Scripts/Sharing/OAuth2Identity.cs index a9e66905c9..cfea48f6fb 100644 --- a/Assets/Scripts/Sharing/OAuth2Identity.cs +++ b/Assets/Scripts/Sharing/OAuth2Identity.cs @@ -103,7 +103,7 @@ private static void LogOutAll() public bool IsGoogle => m_Service == SecretsConfig.Service.Google; public UserCredential UserCredential => m_CredentialRequest?.UserCredential; - private SecretsConfig.ServiceAuthData ServiceAuthData => App.Config.Secrets[m_Service]; + private SecretsConfig.ServiceAuthData ServiceAuthData => App.Config.Secrets?[m_Service]; public string ClientId => ServiceAuthData?.ClientId; private string ClientSecret => ServiceAuthData?.ClientSecret;