Skip to content

Commit

Permalink
Rename Sketch and SketchSet to ISketch and ISketchSet because they ar…
Browse files Browse the repository at this point in the history
…e both interfaces.
  • Loading branch information
TimAidley committed Mar 1, 2023
1 parent 8de07f4 commit ea24e65
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Assets/Scripts/GUI/LoadSketchButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -51,7 +51,7 @@ public int SketchIndex
}
}

public SketchSet SketchSet
public ISketchSet SketchSet
{
get { return m_SketchSet; }
set
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/GUI/SketchbookPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<BaseButton> m_IconScriptsOnFirstPage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using UnityEngine;
namespace TiltBrush
{
public class ResourceCollectionSketchSet : SketchSet
public class ResourceCollectionSketchSet : ISketchSet
{
private IResourceCollection m_Collection;
private Task m_Init;
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/ResourceSystem/ResourceSketch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace TiltBrush
{
public class ResourceSketch : Sketch
public class ResourceSketch : ISketch
{
private ResourceFileInfo m_FileInfo;
public ResourceSketch(ResourceFileInfo fileInfo)
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Save/FileSketchSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
namespace TiltBrush
{

public class FileSketchSet : SketchSet
public class FileSketchSet : ISketchSet
{
static int ICON_LOAD_PER_FRAME = 3;

Expand All @@ -47,7 +47,7 @@ public static byte[] ReadThumbnailAsync(SceneFileInfo fileinfo)
}
}

private class FileSketch : Sketch, IComparable<FileSketch>
private class FileSketch : ISketch, IComparable<FileSketch>
{
private DiskSceneFileInfo m_FileInfo;
private Texture2D m_Icon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -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; }

Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions Assets/Scripts/Save/SketchCatalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand All @@ -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()),
Expand Down Expand Up @@ -102,15 +102,15 @@ public static bool InitFeaturedSketchesPath()

void Start()
{
foreach (SketchSet s in m_Sets)
foreach (ISketchSet s in m_Sets)
{
s.Init();
}
}

void Update()
{
foreach (SketchSet s in m_Sets)
foreach (ISketchSet s in m_Sets)
{
s.Update();
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Sharing/GoogleDriveSketchSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Sharing/PolySketchSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions Assets/Scripts/SketchControlsScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3861,7 +3861,7 @@ IEnumerator<Null> LoadAndExportList(List<string> filenames)
// This coroutine must be run to completion or disposed.
IEnumerator<Null> 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);
Expand Down Expand Up @@ -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)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit ea24e65

Please sign in to comment.