1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-04 17:04:49 +00:00

Merge pull request #64742 from zaevi/csharp_add_grouping_attributes

C#: Add grouping attributes for properties.
This commit is contained in:
Ignacio Roldán Etcheverry
2022-08-24 20:09:47 +02:00
committed by GitHub
6 changed files with 127 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
using System;
namespace Godot
{
/// <summary>
/// Define a new category for the following exported properties. This helps to organize properties in the Inspector dock.
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public sealed class ExportCategoryAttribute : Attribute
{
private string name;
/// <summary>
/// Define a new category for the following exported properties.
/// </summary>
/// <param name="name">The name of the category.</param>
public ExportCategoryAttribute(string name)
{
this.name = name;
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
namespace Godot
{
/// <summary>
/// Define a new group for the following exported properties. This helps to organize properties in the Inspector dock.
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public sealed class ExportGroupAttribute : Attribute
{
private string name;
private string prefix;
/// <summary>
/// Define a new group for the following exported properties.
/// </summary>
/// <param name="name">The name of the group.</param>
/// <param name="prefix">If provided, the group would make group to only consider properties that have this prefix.</param>
public ExportGroupAttribute(string name, string prefix = "")
{
this.name = name;
this.prefix = prefix;
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
namespace Godot
{
/// <summary>
/// Define a new subgroup for the following exported properties. This helps to organize properties in the Inspector dock.
/// </summary>
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
public sealed class ExportSubgroupAttribute : Attribute
{
private string name;
private string prefix;
/// <summary>
/// Define a new subgroup for the following exported properties. This helps to organize properties in the Inspector dock.
/// </summary>
/// <param name="name">The name of the subgroup.</param>
/// <param name="prefix">If provided, the subgroup would make group to only consider properties that have this prefix.</param>
public ExportSubgroupAttribute(string name, string prefix = "")
{
this.name = name;
this.prefix = prefix;
}
}
}

View File

@@ -53,6 +53,9 @@
<Compile Include="Core\Array.cs" />
<Compile Include="Core\Attributes\AssemblyHasScriptsAttribute.cs" />
<Compile Include="Core\Attributes\ExportAttribute.cs" />
<Compile Include="Core\Attributes\ExportCategoryAttribute.cs" />
<Compile Include="Core\Attributes\ExportGroupAttribute.cs" />
<Compile Include="Core\Attributes\ExportSubgroupAttribute.cs" />
<Compile Include="Core\Attributes\RPCAttribute.cs" />
<Compile Include="Core\Attributes\ScriptPathAttribute.cs" />
<Compile Include="Core\Attributes\SignalAttribute.cs" />