From ea24e656f58a6ca234ed5060665c7f3d01daafb9 Mon Sep 17 00:00:00 2001 From: Tim Aidley Date: Mon, 27 Feb 2023 20:26:06 -0800 Subject: [PATCH] Rename Sketch and SketchSet to ISketch and ISketchSet because they are both interfaces. --- Assets/Scripts/GUI/LoadSketchButton.cs | 4 ++-- Assets/Scripts/GUI/SketchbookPanel.cs | 2 +- .../ResourceSystem/ResourceCollectionSketchSet.cs | 2 +- Assets/Scripts/ResourceSystem/ResourceSketch.cs | 2 +- Assets/Scripts/Save/FileSketchSet.cs | 4 ++-- Assets/Scripts/Save/{SketchSet.cs => ISketchSet.cs} | 4 ++-- .../Save/{SketchSet.cs.meta => ISketchSet.cs.meta} | 0 Assets/Scripts/Save/SketchCatalog.cs | 10 +++++----- Assets/Scripts/Sharing/GoogleDriveSketchSet.cs | 2 +- Assets/Scripts/Sharing/PolySketchSet.cs | 4 ++-- Assets/Scripts/SketchControlsScript.cs | 12 ++++++------ 11 files changed, 23 insertions(+), 23 deletions(-) rename Assets/Scripts/Save/{SketchSet.cs => ISketchSet.cs} (97%) rename Assets/Scripts/Save/{SketchSet.cs.meta => ISketchSet.cs.meta} (100%) diff --git a/Assets/Scripts/GUI/LoadSketchButton.cs b/Assets/Scripts/GUI/LoadSketchButton.cs index b563cf144b..eb1b92f30b 100644 --- a/Assets/Scripts/GUI/LoadSketchButton.cs +++ b/Assets/Scripts/GUI/LoadSketchButton.cs @@ -38,7 +38,7 @@ public struct MenuButton private float m_DynamicUvTransitionSpeed = 12.0f; private float m_DynamicUvTransitionValue; private int m_SketchIndex; - private SketchSet m_SketchSet; + private ISketchSet m_SketchSet; private UIComponentManager m_UIComponentManager; public int SketchIndex @@ -51,7 +51,7 @@ public int SketchIndex } } - public SketchSet SketchSet + public ISketchSet SketchSet { get { return m_SketchSet; } set diff --git a/Assets/Scripts/GUI/SketchbookPanel.cs b/Assets/Scripts/GUI/SketchbookPanel.cs index 972f89dcbc..bda4b1dabe 100644 --- a/Assets/Scripts/GUI/SketchbookPanel.cs +++ b/Assets/Scripts/GUI/SketchbookPanel.cs @@ -73,7 +73,7 @@ public class SketchbookPanel : ModalPanel private bool m_AllIconTexturesAssigned; private bool m_AllSketchesAreAvailable; private SketchSetType m_CurrentSketchSet; - private SketchSet m_SketchSet; + private ISketchSet m_SketchSet; private OptionButton m_NewSketchButtonScript; private OptionButton m_PaintButtonScript; private List m_IconScriptsOnFirstPage; diff --git a/Assets/Scripts/ResourceSystem/ResourceCollectionSketchSet.cs b/Assets/Scripts/ResourceSystem/ResourceCollectionSketchSet.cs index d1a16b8907..b098498b8f 100644 --- a/Assets/Scripts/ResourceSystem/ResourceCollectionSketchSet.cs +++ b/Assets/Scripts/ResourceSystem/ResourceCollectionSketchSet.cs @@ -8,7 +8,7 @@ using UnityEngine; namespace TiltBrush { - public class ResourceCollectionSketchSet : SketchSet + public class ResourceCollectionSketchSet : ISketchSet { private IResourceCollection m_Collection; private Task m_Init; diff --git a/Assets/Scripts/ResourceSystem/ResourceSketch.cs b/Assets/Scripts/ResourceSystem/ResourceSketch.cs index f22cbda930..8e3ac050e0 100644 --- a/Assets/Scripts/ResourceSystem/ResourceSketch.cs +++ b/Assets/Scripts/ResourceSystem/ResourceSketch.cs @@ -7,7 +7,7 @@ namespace TiltBrush { - public class ResourceSketch : Sketch + public class ResourceSketch : ISketch { private ResourceFileInfo m_FileInfo; public ResourceSketch(ResourceFileInfo fileInfo) diff --git a/Assets/Scripts/Save/FileSketchSet.cs b/Assets/Scripts/Save/FileSketchSet.cs index 8ef39e2d65..929c3a48e2 100644 --- a/Assets/Scripts/Save/FileSketchSet.cs +++ b/Assets/Scripts/Save/FileSketchSet.cs @@ -23,7 +23,7 @@ namespace TiltBrush { - public class FileSketchSet : SketchSet + public class FileSketchSet : ISketchSet { static int ICON_LOAD_PER_FRAME = 3; @@ -47,7 +47,7 @@ public static byte[] ReadThumbnailAsync(SceneFileInfo fileinfo) } } - private class FileSketch : Sketch, IComparable + private class FileSketch : ISketch, IComparable { private DiskSceneFileInfo m_FileInfo; private Texture2D m_Icon; diff --git a/Assets/Scripts/Save/SketchSet.cs b/Assets/Scripts/Save/ISketchSet.cs similarity index 97% rename from Assets/Scripts/Save/SketchSet.cs rename to Assets/Scripts/Save/ISketchSet.cs index a074ce5b16..2a615c0b72 100644 --- a/Assets/Scripts/Save/SketchSet.cs +++ b/Assets/Scripts/Save/ISketchSet.cs @@ -20,7 +20,7 @@ namespace TiltBrush { // Not actually useful as only used internally in SketchSets. - public interface Sketch + public interface ISketch { SceneFileInfo SceneFileInfo { get; } string[] Authors { get; } @@ -31,7 +31,7 @@ public interface Sketch /// A collection of sketches from some source (user's local folder, showcase, cloud). /// Name, icon and author are available here, and sketches are accessed by getting the /// SceneFileInfo. - public interface SketchSet + public interface ISketchSet { SketchSetType Type { get; } diff --git a/Assets/Scripts/Save/SketchSet.cs.meta b/Assets/Scripts/Save/ISketchSet.cs.meta similarity index 100% rename from Assets/Scripts/Save/SketchSet.cs.meta rename to Assets/Scripts/Save/ISketchSet.cs.meta diff --git a/Assets/Scripts/Save/SketchCatalog.cs b/Assets/Scripts/Save/SketchCatalog.cs index 68f054cb15..c21b6f8ad1 100644 --- a/Assets/Scripts/Save/SketchCatalog.cs +++ b/Assets/Scripts/Save/SketchCatalog.cs @@ -38,9 +38,9 @@ public class SketchCatalog : MonoBehaviour // Obviously, if Poly as a database is deleted or moved, accessing these files will fail. public const string kDefaultShowcaseSketchesFolder = "DefaultShowcaseSketches"; - private SketchSet[] m_Sets; + private ISketchSet[] m_Sets; - public SketchSet GetSet(SketchSetType eType) + public ISketchSet GetSet(SketchSetType eType) { return m_Sets[(int)eType]; } @@ -65,7 +65,7 @@ void Awake() //var icosaCollection = new IcosaSketchCollection(App.HttpClient); var rssCollection = new RssSketchCollection(App.HttpClient, new Uri("https://timaidley.github.io/open-brush-feed/sketches.rss")); - m_Sets = new SketchSet[] + m_Sets = new ISketchSet[] { new FileSketchSet(), //new FileSketchSet(App.FeaturedSketchesPath()), @@ -102,7 +102,7 @@ public static bool InitFeaturedSketchesPath() void Start() { - foreach (SketchSet s in m_Sets) + foreach (ISketchSet s in m_Sets) { s.Init(); } @@ -110,7 +110,7 @@ void Start() void Update() { - foreach (SketchSet s in m_Sets) + foreach (ISketchSet s in m_Sets) { s.Update(); } diff --git a/Assets/Scripts/Sharing/GoogleDriveSketchSet.cs b/Assets/Scripts/Sharing/GoogleDriveSketchSet.cs index d40759da25..8f8e4c335c 100644 --- a/Assets/Scripts/Sharing/GoogleDriveSketchSet.cs +++ b/Assets/Scripts/Sharing/GoogleDriveSketchSet.cs @@ -28,7 +28,7 @@ namespace TiltBrush { /// A sketchset made up of the sketches stored on Google drive, excepting the ones that are copies /// of the sketches on the local device. - public class GoogleDriveSketchSet : SketchSet + public class GoogleDriveSketchSet : ISketchSet { public class GoogleDriveFileInfo : SceneFileInfo diff --git a/Assets/Scripts/Sharing/PolySketchSet.cs b/Assets/Scripts/Sharing/PolySketchSet.cs index 6de2358527..e6ba415075 100644 --- a/Assets/Scripts/Sharing/PolySketchSet.cs +++ b/Assets/Scripts/Sharing/PolySketchSet.cs @@ -26,14 +26,14 @@ namespace TiltBrush { // TODO: Specify tag for which sketches to query (curated, liked etc.) - public class PolySketchSet : SketchSet + public class PolySketchSet : ISketchSet { const int kDownloadBufferSize = 1024 * 1024; // 1MB // Downloading is handled by PolySketchSet which will set the local paths - private class PolySketch : Sketch + private class PolySketch : ISketch { // This value holds the count of sketches that were downloaded by the sketch set // before this one. It's used during our sort to retain order from Poly, while diff --git a/Assets/Scripts/SketchControlsScript.cs b/Assets/Scripts/SketchControlsScript.cs index 8cb356df2a..282e7d8791 100644 --- a/Assets/Scripts/SketchControlsScript.cs +++ b/Assets/Scripts/SketchControlsScript.cs @@ -3861,7 +3861,7 @@ IEnumerator LoadAndExportList(List filenames) // This coroutine must be run to completion or disposed. IEnumerator LoadAndExportAll() { - SketchSet sketchSet = SketchCatalog.m_Instance.GetSet(SketchSetType.User); + ISketchSet sketchSet = SketchCatalog.m_Instance.GetSet(SketchSetType.User); for (int i = 0; i < SketchCatalog.m_Instance.GetSet(SketchSetType.User).NumSketches; ++i) { SceneFileInfo rInfo = sketchSet.GetSketchSceneFileInfo(i); @@ -4238,7 +4238,7 @@ public void IssueGlobalCommand(GlobalCommands rEnum, int iParam1 = -1, // TODO Refactor with Load below var index = iParam1; var sketchSetType = (SketchSetType)iParam2; - SketchSet sketchSet = SketchCatalog.m_Instance.GetSet(sketchSetType); + ISketchSet sketchSet = SketchCatalog.m_Instance.GetSet(sketchSetType); SceneFileInfo rInfo = sketchSet.GetSketchSceneFileInfo(index); if (rInfo != null) { @@ -4254,7 +4254,7 @@ public void IssueGlobalCommand(GlobalCommands rEnum, int iParam1 = -1, { var index = iParam1; var sketchSetType = (SketchSetType)iParam2; - SketchSet sketchSet = SketchCatalog.m_Instance.GetSet(sketchSetType); + ISketchSet sketchSet = SketchCatalog.m_Instance.GetSet(sketchSetType); SceneFileInfo rInfo = sketchSet.GetSketchSceneFileInfo(index); if (rInfo != null) { @@ -4463,7 +4463,7 @@ public void IssueGlobalCommand(GlobalCommands rEnum, int iParam1 = -1, { var index = iParam1; var sketchSetType = (SketchSetType)iParam2; - SketchSet sketchSet = SketchCatalog.m_Instance.GetSet(sketchSetType); + ISketchSet sketchSet = SketchCatalog.m_Instance.GetSet(sketchSetType); SceneFileInfo rInfo = sketchSet.GetSketchSceneFileInfo(index); EatGazeObjectInput(); //launch external window and tell the user we did so @@ -4531,7 +4531,7 @@ public void IssueGlobalCommand(GlobalCommands rEnum, int iParam1 = -1, case GlobalCommands.DeleteSketch: { var sketchSetType = (SketchSetType)iParam2; - SketchSet sketchSet = SketchCatalog.m_Instance.GetSet(sketchSetType); + ISketchSet sketchSet = SketchCatalog.m_Instance.GetSet(sketchSetType); sketchSet.DeleteSketch(iParam1); DismissPopupOnCurrentGazeObject(false); break; @@ -4756,7 +4756,7 @@ public void IssueGlobalCommand(GlobalCommands rEnum, int iParam1 = -1, if (sketchBook != null) { // Get triangle count from cloud scene file info. - SketchSet sketchSet = SketchCatalog.m_Instance.GetSet(sketchSetType); + ISketchSet sketchSet = SketchCatalog.m_Instance.GetSet(sketchSetType); SceneFileInfo sfi = sketchSet.GetSketchSceneFileInfo(index); int tris = sfi.TriangleCount ?? -1;