Skip to content

Commit

Permalink
Revert "refactor: readonly on several fields/properties that are neve…
Browse files Browse the repository at this point in the history
…r reassigned (typical for collections)"

This reverts commit aca944c.
  • Loading branch information
brmassa committed Sep 19, 2024
1 parent 100488f commit 0791469
Show file tree
Hide file tree
Showing 57 changed files with 216 additions and 216 deletions.
4 changes: 2 additions & 2 deletions Prowl.Editor/Assets/AssetDatabase.Packages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public static partial class AssetDatabase
/// Key: Package ID
/// Value: Package Version
/// </summary>
public static readonly Dictionary<string, string> DesiredPackages = [];
public static Dictionary<string, string> DesiredPackages = [];

public static readonly List<IPackageSearchMetadata> Packages = [];
public static List<IPackageSearchMetadata> Packages = [];

#region Public Methods

Expand Down
12 changes: 6 additions & 6 deletions Prowl.Editor/Assets/AssetDirectoryCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ public class AssetDirectoryCache(DirectoryInfo root)
{
public class DirNode(DirectoryInfo directory, DirNode? parent)
{
public readonly DirectoryInfo Directory = directory;
public readonly DirNode? Parent = parent;
public readonly List<DirNode> SubDirectories = [];
public readonly List<FileNode> Files = [];
public DirectoryInfo Directory = directory;
public DirNode? Parent = parent;
public List<DirNode> SubDirectories = [];
public List<FileNode> Files = [];
}

public class FileNode
{
public readonly FileInfo File;
public FileInfo File;
public Guid AssetID;
public readonly AssetDatabase.SubAssetCache[] SubAssets;
public AssetDatabase.SubAssetCache[] SubAssets;

public FileNode(FileInfo file)
{
Expand Down
8 changes: 4 additions & 4 deletions Prowl.Editor/Assets/ImporterAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public ImporterAttribute(string fileIcon, Type generalType, params string[] exte
GeneralType = generalType;
}

public static readonly Dictionary<string, Type> extToGeneralType = new(StringComparer.OrdinalIgnoreCase);
public static readonly Dictionary<string, Type> extToImporter = new(StringComparer.OrdinalIgnoreCase);
public static readonly Dictionary<string, string> extToIcon = new(StringComparer.OrdinalIgnoreCase);
public static Dictionary<string, Type> extToGeneralType = new(StringComparer.OrdinalIgnoreCase);
public static Dictionary<string, Type> extToImporter = new(StringComparer.OrdinalIgnoreCase);
public static Dictionary<string, string> extToIcon = new(StringComparer.OrdinalIgnoreCase);

[OnAssemblyLoad]
public static void GenerateLookUp()
Expand Down Expand Up @@ -96,7 +96,7 @@ public CustomEditorAttribute(Type type)
Type = type;
}

public static readonly Dictionary<Type, Type> typeToEditor = new();
public static Dictionary<Type, Type> typeToEditor = new();

[OnAssemblyLoad]
public static void GenerateLookUp()
Expand Down
2 changes: 1 addition & 1 deletion Prowl.Editor/Assets/Importers/FontImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Prowl.Editor.Assets;
[Importer("FileIcon.png", typeof(Font), ".ttf")]
public class FontImporter : ScriptedImporter
{
public readonly List<Font.CharacterRange> characterRanges = [Font.CharacterRange.BasicLatin];
public List<Font.CharacterRange> characterRanges = [Font.CharacterRange.BasicLatin];
public float fontSize = 20;
public int width = 1024;
public int height = 1024;
Expand Down
2 changes: 1 addition & 1 deletion Prowl.Editor/Assets/Importers/TextureImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class TextureImporter : ScriptedImporter

public FilterType textureMinFilter = FilterType.Linear;
public FilterType textureMagFilter = FilterType.Linear;
public readonly FilterType textureMipFilter = FilterType.Linear;
public FilterType textureMipFilter = FilterType.Linear;

public override void Import(SerializedAsset ctx, FileInfo assetPath)
{
Expand Down
6 changes: 3 additions & 3 deletions Prowl.Editor/Build/Desktop_Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ public enum Target

Universal
}
public readonly Target target = Target.win_x64;
public Target target = Target.win_x64;

public enum Configuration
{
Debug,
Release
}
public readonly Configuration configuration = Configuration.Release;
public Configuration configuration = Configuration.Release;

public enum AssetPacking
{
[Text("All Assets")] All,
[Text("Used Assets")] Used
}
public readonly AssetPacking assetPacking = AssetPacking.Used;
public AssetPacking assetPacking = AssetPacking.Used;


protected override void Build(AssetRef<Scene>[] scenes, DirectoryInfo output)
Expand Down
2 changes: 1 addition & 1 deletion Prowl.Editor/Editor/Docking/DockContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace Prowl.Editor.Docking;

public class DockContainer
{
public readonly DockNode Root = new();
public DockNode Root = new();
private Vector2 PaddedMins => new(0, 0);

public void Update(Rect root)
Expand Down
4 changes: 2 additions & 2 deletions Prowl.Editor/Editor/NodeEditor/NodeEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class NodeEditorAttribute(Type type) : Attribute
{
public Type Type { get; private set; } = type;

public static readonly Dictionary<Type, Type> nodeEditors = [];
public static Dictionary<Type, Type> nodeEditors = [];

[OnAssemblyLoad]
public static void GenerateLookUp()
Expand Down Expand Up @@ -576,7 +576,7 @@ public class NodeEditor
private RenderTexture RenderTarget;

internal NodePort? draggingPort;
internal readonly List<Vector2> reroutePoints = [];
internal List<Vector2> reroutePoints = [];

internal Vector2? dragSelectionStart;
internal Rect dragSelection;
Expand Down
4 changes: 2 additions & 2 deletions Prowl.Editor/Editor/Preferences/AssetPipelinePreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Prowl.Editor.Preferences;
public class AssetPipelinePreferences : ScriptableSingleton<AssetPipelinePreferences>
{
[Text("Asset Browser:")]
public readonly bool HideExtensions = true;
public readonly float ThumbnailSize = 0.0f;
public bool HideExtensions = true;
public float ThumbnailSize = 0.0f;
[Text("Pipeline:")]
public bool AutoImport = true;
}
32 changes: 16 additions & 16 deletions Prowl.Editor/Editor/Preferences/GeneralPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ namespace Prowl.Editor.Preferences;
public class GeneralPreferences : ScriptableSingleton<GeneralPreferences>
{
[Text("General:")]
public readonly bool LockFPS = false;
public bool LockFPS = false;
[ShowIf("LockFPS")]
public readonly int TargetFPS = 0;
public int TargetFPS = 0;
[ShowIf("LockFPS", true)]
public readonly bool VSync = true;
public bool VSync = true;

[Text("Debugging:")]
public bool ShowDebugLogs = true;
Expand All @@ -23,8 +23,8 @@ public class GeneralPreferences : ScriptableSingleton<GeneralPreferences>
public bool ShowDebugSuccess = true;

[Text("Game View:")]
public readonly bool AutoFocusGameView = true;
public readonly bool AutoRefreshGameView = true;
public bool AutoFocusGameView = true;
public bool AutoRefreshGameView = true;
public GameWindow.Resolutions Resolution = GameWindow.Resolutions.fit;
[HideInInspector]
public int CurrentWidth = 1280;
Expand All @@ -37,18 +37,18 @@ public class GeneralPreferences : ScriptableSingleton<GeneralPreferences>
public class EditorPreferences : ScriptableSingleton<EditorPreferences>
{
[Text("UI:")]
public readonly bool AntiAliasing = true;
public bool AntiAliasing = true;

[Text("File Editor:")]
public readonly string fileEditor = ""; // code
public readonly string fileEditorArgs = ""; // "${ProjectDirectory}" -g "${File}":${Line}:${Character}
public string fileEditor = ""; // code
public string fileEditorArgs = ""; // "${ProjectDirectory}" -g "${File}":${Line}:${Character}
}

[FilePath("EditorStyle.pref", FilePathAttribute.Location.EditorPreference)]
public class EditorStylePrefs : ScriptableSingleton<EditorStylePrefs>
{
[Text("Colors:")]
public readonly double Disabled = 0.7;
public double Disabled = 0.7;
public Color LesserText = new(110, 110, 120);
public Color Background = new(15, 15, 18);
public Color WindowBGOne = new(31, 33, 40);
Expand All @@ -68,17 +68,17 @@ public class EditorStylePrefs : ScriptableSingleton<EditorStylePrefs>
public double DockSpacing = 4;

[Text("Rounding:")]
public readonly double WindowRoundness = 4;
public readonly double TabRoundness = 4;
public readonly double AssetRoundness = 4;
public readonly double ButtonRoundness = 4;
public double WindowRoundness = 4;
public double TabRoundness = 4;
public double AssetRoundness = 4;
public double ButtonRoundness = 4;

public enum NoodlePath { Straight, Curvy, Angled, ShaderLab }
public enum NoodleStroke { Basic, Dashed }
[Text("Node Editor:")]
public readonly NoodlePath NoodlePathType = NoodlePath.Curvy;
public readonly NoodleStroke NoodleStrokeType = NoodleStroke.Basic;
public readonly double NoodleStrokeWidth = 4;
public NoodlePath NoodlePathType = NoodlePath.Curvy;
public NoodleStroke NoodleStrokeType = NoodleStroke.Basic;
public double NoodleStrokeWidth = 4;

// Base Colors
public static Color Black => new(0, 0, 0, 255);
Expand Down
8 changes: 4 additions & 4 deletions Prowl.Editor/Editor/Preferences/PackageManagerPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ public class PackageManagerPreferences : ScriptableSingleton<PackageManagerPrefe
{
public struct PackageSource(string name, string source, bool isEnabled)
{
public readonly string Name = name;
public readonly string Source = source;
public readonly bool IsEnabled = isEnabled;
public string Name = name;
public string Source = source;
public bool IsEnabled = isEnabled;
}

public readonly List<PackageSource> Sources = [new("Nuget", "https://api.nuget.org/v3/index.json", true)];
public List<PackageSource> Sources = [new("Nuget", "https://api.nuget.org/v3/index.json", true)];

public bool IncludePrerelease = true; // True for the time being untill we have a stable 1.0 release
}
24 changes: 12 additions & 12 deletions Prowl.Editor/Editor/Preferences/SceneViewPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,27 @@ namespace Prowl.Editor.Preferences;
public class SceneViewPreferences : ScriptableSingleton<SceneViewPreferences>
{
[Text("Controls:")]
public readonly float LookSensitivity = 1f;
public readonly float PanSensitivity = 1f;
public readonly float ZoomSensitivity = 1f;
public float LookSensitivity = 1f;
public float PanSensitivity = 1f;
public float ZoomSensitivity = 1f;

public readonly bool InvertLook = false;
public bool InvertLook = false;

public readonly double SnapDistance = 0.5f;
public readonly double SnapAngle = 10f;
public double SnapDistance = 0.5f;
public double SnapAngle = 10f;

[Space, Text("Rendering:")]
public SceneViewWindow.GridType GridType = SceneViewWindow.GridType.XZ;
public readonly bool ShowFPS = true;
public bool ShowFPS = true;

[Space]
public readonly float NearClip = 0.02f;
public readonly float FarClip = 10000f;
public float NearClip = 0.02f;
public float FarClip = 10000f;
public float RenderResolution = 1f;

[Text("Grid:")]
public readonly float LineWidth = 0.02f;
public readonly float PrimaryGridSize = 1f;
public readonly float SecondaryGridSize = 5f;
public float LineWidth = 0.02f;
public float PrimaryGridSize = 1f;
public float SecondaryGridSize = 5f;
public Color GridColor = new Color(1.0f, 1.0f, 1.0f, 0.5f);
}
2 changes: 1 addition & 1 deletion Prowl.Editor/Editor/Widgets/FileDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ internal void UpdateCache()

public class FileDialog : EditorWindow
{
public readonly FileDialogContext Dialog;
public FileDialogContext Dialog;

private FileDialogSortBy _sortBy = FileDialogSortBy.None;

Expand Down
2 changes: 1 addition & 1 deletion Prowl.Editor/EditorGuiManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static class EditorGuiManager

public static WeakReference? FocusedWindow;

public static readonly List<EditorWindow> Windows = [];
public static List<EditorWindow> Windows = [];

static readonly List<EditorWindow> WindowsToRemove = [];

Expand Down
20 changes: 10 additions & 10 deletions Prowl.Editor/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ public class Project
{
#region Public Properties

public readonly DirectoryInfo ProjectDirectory;
public DirectoryInfo ProjectDirectory;
public bool Exists => ProjectDirectory.Exists;
public string Name => ProjectDirectory.Name;
public string ProjectPath => ProjectDirectory.FullName;

public readonly DirectoryInfo AssetDirectory;
public readonly DirectoryInfo LibraryDirectory;
public readonly DirectoryInfo DefaultsDirectory;
public readonly DirectoryInfo PackagesDirectory;
public readonly DirectoryInfo TempDirectory;
public DirectoryInfo AssetDirectory;
public DirectoryInfo LibraryDirectory;
public DirectoryInfo DefaultsDirectory;
public DirectoryInfo PackagesDirectory;
public DirectoryInfo TempDirectory;

public readonly FileInfo Assembly_Proj;
public readonly FileInfo Assembly_DLL;
public FileInfo Assembly_Proj;
public FileInfo Assembly_DLL;

public readonly FileInfo Editor_Assembly_Proj;
public readonly FileInfo Editor_Assembly_DLL;
public FileInfo Editor_Assembly_Proj;
public FileInfo Editor_Assembly_DLL;

public static event Action OnProjectChanged;

Expand Down
2 changes: 1 addition & 1 deletion Prowl.Editor/Utilities/ShaderCompiler/FileIncluder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Prowl.Editor.Utilities;

public class FileIncluder
{
public readonly string SourceFile;
public string SourceFile;
public string SourceFilePath => Path.Join(_searchDirectories[0].FullName, SourceFile);

private readonly string _relativeDirectory;
Expand Down
4 changes: 2 additions & 2 deletions Prowl.Editor/Utilities/ShaderCompiler/ShaderParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -848,8 +848,8 @@ public class ParsedPass

public struct EntryPoint(ShaderStages stages, string name)
{
public readonly ShaderStages Stage = stages;
public readonly string Name = name;
public ShaderStages Stage = stages;
public string Name = name;
}


Expand Down
16 changes: 8 additions & 8 deletions Prowl.Runtime/Components/Animation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace Prowl.Runtime;
public class Animation : MonoBehaviour
{

public readonly List<AssetRef<AnimationClip>> Clips = [];
public List<AssetRef<AnimationClip>> Clips = [];
public AssetRef<AnimationClip> DefaultClip;
public readonly bool PlayAutomatically = true;
public readonly double Speed = 1.0;
public bool PlayAutomatically = true;
public double Speed = 1.0;

private readonly List<AnimationState> _states = new List<AnimationState>();
private readonly Dictionary<string, AnimationState> _stateDictionary = new Dictionary<string, AnimationState>();
Expand Down Expand Up @@ -208,8 +208,8 @@ public void RemoveClip(string stateName)

public class AnimationState
{
public readonly string Name;
public readonly AnimationClip Clip;
public string Name;
public AnimationClip Clip;
public bool Enabled;
public double Length => Clip.Duration;
public double NormalizedTime => Time / Length;
Expand All @@ -219,17 +219,17 @@ public class AnimationState
public double MoveWeightSpeed = 1.0;
public double TargetWeight = 1.0;

public readonly AnimationWrapMode Wrap = AnimationWrapMode.Loop;
public AnimationWrapMode Wrap = AnimationWrapMode.Loop;

public readonly HashSet<string> MixingTransforms = new HashSet<string>();
public HashSet<string> MixingTransforms = new HashSet<string>();

public enum BlendMode
{
Blend,
Additive,
}

public readonly BlendMode Blend = BlendMode.Blend;
public BlendMode Blend = BlendMode.Blend;

public AnimationState(string name, AnimationClip clip)
{
Expand Down
Loading

0 comments on commit 0791469

Please sign in to comment.