Skip to content

Commit

Permalink
Post-merge fixes (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
andybak committed Dec 23, 2024
1 parent 5e9c4f5 commit 59ab229
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Assets/Scripts/API/ApiMethods.Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 0 additions & 12 deletions Assets/Scripts/Commands/CreatePathKnotCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Commands/MovePositionKnotCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions Assets/Scripts/Layers/LayerUI_Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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;
}
}
Expand Down
30 changes: 22 additions & 8 deletions Assets/Scripts/Save/SketchWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ public static void WriteMemory(Stream stream, IList<AdjustedMemoryBrushStroke> 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 =
Expand All @@ -343,9 +344,13 @@ public static void WriteMemory(Stream stream, IList<AdjustedMemoryBrushStroke> 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
Expand Down Expand Up @@ -689,6 +694,8 @@ public static List<Stroke> 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));
Expand All @@ -709,14 +716,19 @@ public static List<Stroke> 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();
Expand All @@ -737,6 +749,8 @@ public static List<Stroke> GetStrokes(
}
}
}
var canvas = App.Scene.GetOrCreateLayer((int)trackIndex, (int)frameIndex);
stroke.m_IntendedCanvas = canvas;

// Process control points...
int nControlPoints = reader.Int32();
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Sharing/OAuth2Identity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 59ab229

Please sign in to comment.