Skip to content

Commit 7b8bcaa

Browse files
committed
ResX -> ResI
1 parent 55d5fc6 commit 7b8bcaa

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

Godot 4 Tests/TestScenes/Feature148.ResourceTree/ResourceTreeTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public static partial class RelativeResDir1;
3838
[ResourceTree("./Resources", ResG.DirPaths)]
3939
public static partial class RelativeResDir2;
4040

41-
[ResourceTree("Resources", resx: ResX.All, xtras: ["csv", "cfg", "txt", "zip"])]
41+
[ResourceTree("Resources", resi: ResI.All, xtras: ["csv", "cfg", "txt", "zip"])]
4242
public static partial class ResWithTypes;
4343

44-
[ResourceTree(resx: ResX.Scenes)]
44+
[ResourceTree(resi: ResI.Scenes)]
4545
public static partial class ResWithScenes;
4646

4747
//[ResourceTree("Invalid")]

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ var scene3 = Instantiate<Scene3>();
233233
* Advanced options available as attribute arguments:
234234
* source: relative or absolute path (use `/` as shortcut for `res://`)
235235
* resg: flags to configure generated output (see examples below)
236-
* resx: flags to configure extra input (see examples below)
236+
* resi: flags to configure extra input (see examples below)
237237
* xtras: scan for other file types (eg, txt, cfg, etc)
238238
* xclude: directories to exclude (addons is always excluded)
239239
#### Examples:
@@ -255,13 +255,13 @@ var scene3 = Instantiate<Scene3>();
255255
//[ResourceTree(resg: ResG.LoadRes | ResG.ResPaths)] // Generate nested type with Load method and ResPath property
256256
//[ResourceTree(resg: ResG.ResPaths | ResG.DirPaths)] // Just paths
257257
258-
//[ResourceTree(resx: ResX.Uid)] // Include uid files (as uid string)
259-
//[ResourceTree(resx: ResX.Scenes)] // Include tscn/scn files (as PackedScene)
260-
//[ResourceTree(resx: ResX.Scripts)] // Include cs/gd files (as CSharpScript/GdScript)
258+
//[ResourceTree(resi: ResI.Uid)] // Include uid files (as uid string)
259+
//[ResourceTree(resi: ResI.Scenes)] // Include tscn/scn files (as PackedScene)
260+
//[ResourceTree(resi: ResI.Scripts)] // Include cs/gd files (as CSharpScript/GdScript)
261261
262-
//[ResourceTree(resx: ResX.All)] // Include all of the above
263-
//[ResourceTree(resx: ResX.None)] // Include none of the above (default)
264-
//[ResourceTree(resx: ResX.Scenes | ResX.Scripts)] // Just scenes & scripts (or any combination)
262+
//[ResourceTree(resi: ResI.All)] // Include all of the above
263+
//[ResourceTree(resi: ResI.None)] // Include none of the above (default)
264+
//[ResourceTree(resi: ResI.Scenes | ResI.Scripts)] // Just scenes & scripts (or any combination)
265265
266266
//[ResourceTree(xtras: ["cfg", "txt"])] // Include file types not recognised as a Godot resource (these could match those added to export configs)
267267
//[ResourceTree(xclude: ["Tests"])] // Ignore specified folders

SourceGenerators/ResourceTreeExtensions/ResourceTreeAttribute.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
namespace Godot;
44

55
[AttributeUsage(AttributeTargets.Class)]
6-
public sealed class ResourceTreeAttribute(string source = null, ResG resg = ResG.LoadRes, ResX resx = ResX.None, string[] xtras = null, string[] xclude = null) : Attribute, IResourceTreeConfig
6+
public sealed class ResourceTreeAttribute(string source = null, ResG resg = ResG.LoadRes, ResI resi = ResI.None, string[] xtras = null, string[] xclude = null) : Attribute, IResourceTreeConfig
77
{
88
public string Source { get; } = source;
9-
public bool Uid { get; } = (resx & ResX.Uid) != 0;
10-
public bool Scenes { get; } = (resx & ResX.Scenes) != 0;
11-
public bool Scripts { get; } = (resx & ResX.Scripts) != 0;
9+
public bool Uid { get; } = (resi & ResI.Uid) != 0;
10+
public bool Scenes { get; } = (resi & ResI.Scenes) != 0;
11+
public bool Scripts { get; } = (resi & ResI.Scripts) != 0;
1212
public bool UseGdLoad { get; } = (resg & ResG.LoadRes) != 0;
1313
public bool UseResPaths { get; } = (resg & ResG.ResPaths) != 0;
1414
public bool ShowDirPaths { get; } = (resg & ResG.DirPaths) != 0;
1515
public HashSet<string> Xtras { get; } = [.. xtras ?? []];
1616
public HashSet<string> Xclude { get; } = [.. xclude ?? []];
1717

1818
public override string ToString() => $"ResourceTreeAttribute [Source: {Source}, {((IResourceTreeConfig)this).ToString()}]";
19-
string IResourceTreeConfig.ToString() => $"ResG: {resg}, ResX: {resx}, Xtras: {string.Join("|", Xtras)}, Xclude: {string.Join("|", Xclude)}";
19+
string IResourceTreeConfig.ToString() => $"ResG: {resg}, ResI: {resi}, Xtras: {string.Join("|", Xtras)}, Xclude: {string.Join("|", Xclude)}";
2020
}

SourceGenerators/ResourceTreeExtensions/ResourceTreeConfig.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ public enum ResG
99
All = LoadRes | ResPaths | DirPaths
1010
}
1111

12+
/// <summary>
13+
/// Specify which additional types of items to include.
14+
/// </summary>
1215
[Flags]
13-
public enum ResX
16+
public enum ResI
1417
{
1518
None,
1619
Uid = 1,

SourceGenerators/ResourceTreeExtensions/ResourceTreeSourceGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protected override (string GeneratedCode, DiagnosticDetail Error) GenerateCode(C
2828
Godot.ResourceTreeAttribute ReconstructAttribute() => new(
2929
(string)attribute.ConstructorArguments[0].Value,
3030
(ResG)attribute.ConstructorArguments[1].Value,
31-
(ResX)attribute.ConstructorArguments[2].Value,
31+
(ResI)attribute.ConstructorArguments[2].Value,
3232
attribute.ConstructorArguments[3].Values.Args<string>(),
3333
attribute.ConstructorArguments[4].Values.Args<string>());
3434
}

0 commit comments

Comments
 (0)