diff options
Diffstat (limited to 'modules/mono/glue/GodotSharp')
23 files changed, 279 insertions, 295 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs index 81991c6626..f2984bd1fb 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Array.cs @@ -483,7 +483,7 @@ namespace Godot.Collections /// <typeparam name="T">The type of the array.</typeparam> [SuppressMessage("ReSharper", "RedundantExtendsListEntry")] [SuppressMessage("Naming", "CA1710", MessageId = "Identifiers should have correct suffix")] - public sealed class Array<T> : + public sealed class Array<[MustBeVariant] T> : IList<T>, IReadOnlyList<T>, ICollection<T>, diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportCategoryAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportCategoryAttribute.cs new file mode 100644 index 0000000000..101e56f8d3 --- /dev/null +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportCategoryAttribute.cs @@ -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; + } + } +} diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportGroupAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportGroupAttribute.cs new file mode 100644 index 0000000000..3bd532cec1 --- /dev/null +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportGroupAttribute.cs @@ -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; + } + } +} diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportSubgroupAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportSubgroupAttribute.cs new file mode 100644 index 0000000000..2ae6eb0b68 --- /dev/null +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportSubgroupAttribute.cs @@ -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; + } + } +} diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/MustBeVariantAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/MustBeVariantAttribute.cs new file mode 100644 index 0000000000..23088378d1 --- /dev/null +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/MustBeVariantAttribute.cs @@ -0,0 +1,11 @@ +using System; + +namespace Godot +{ + /// <summary> + /// Attribute that restricts generic type parameters to be only types + /// that can be marshaled from/to a <see cref="Variant"/>. + /// </summary> + [AttributeUsage(AttributeTargets.GenericParameter)] + public class MustBeVariantAttribute : Attribute { } +} diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs index 07a214f543..38e68a89d5 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/SignalAttribute.cs @@ -2,6 +2,6 @@ using System; namespace Godot { - [AttributeUsage(AttributeTargets.Delegate | AttributeTargets.Event)] + [AttributeUsage(AttributeTargets.Delegate)] public class SignalAttribute : Attribute { } } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/GodotSerializationInfo.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/GodotSerializationInfo.cs index 8f26967dcd..6d20f95007 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/GodotSerializationInfo.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/GodotSerializationInfo.cs @@ -4,7 +4,7 @@ using Godot.NativeInterop; namespace Godot.Bridge; -public class GodotSerializationInfo : IDisposable +public sealed class GodotSerializationInfo : IDisposable { private readonly Collections.Dictionary _properties; private readonly Collections.Dictionary _signalEvents; diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs index 68c821b447..bacf7c89e6 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs @@ -10,152 +10,152 @@ namespace Godot { // Color names and values are derived from core/math/color_names.inc internal static readonly Dictionary<string, Color> namedColors = new Dictionary<string, Color> { - {"ALICEBLUE", new Color(0.94f, 0.97f, 1.00f)}, - {"ANTIQUEWHITE", new Color(0.98f, 0.92f, 0.84f)}, - {"AQUA", new Color(0.00f, 1.00f, 1.00f)}, - {"AQUAMARINE", new Color(0.50f, 1.00f, 0.83f)}, - {"AZURE", new Color(0.94f, 1.00f, 1.00f)}, - {"BEIGE", new Color(0.96f, 0.96f, 0.86f)}, - {"BISQUE", new Color(1.00f, 0.89f, 0.77f)}, - {"BLACK", new Color(0.00f, 0.00f, 0.00f)}, - {"BLANCHEDALMOND", new Color(1.00f, 0.92f, 0.80f)}, - {"BLUE", new Color(0.00f, 0.00f, 1.00f)}, - {"BLUEVIOLET", new Color(0.54f, 0.17f, 0.89f)}, - {"BROWN", new Color(0.65f, 0.16f, 0.16f)}, - {"BURLYWOOD", new Color(0.87f, 0.72f, 0.53f)}, - {"CADETBLUE", new Color(0.37f, 0.62f, 0.63f)}, - {"CHARTREUSE", new Color(0.50f, 1.00f, 0.00f)}, - {"CHOCOLATE", new Color(0.82f, 0.41f, 0.12f)}, - {"CORAL", new Color(1.00f, 0.50f, 0.31f)}, - {"CORNFLOWERBLUE", new Color(0.39f, 0.58f, 0.93f)}, - {"CORNSILK", new Color(1.00f, 0.97f, 0.86f)}, - {"CRIMSON", new Color(0.86f, 0.08f, 0.24f)}, - {"CYAN", new Color(0.00f, 1.00f, 1.00f)}, - {"DARKBLUE", new Color(0.00f, 0.00f, 0.55f)}, - {"DARKCYAN", new Color(0.00f, 0.55f, 0.55f)}, - {"DARKGOLDENROD", new Color(0.72f, 0.53f, 0.04f)}, - {"DARKGRAY", new Color(0.66f, 0.66f, 0.66f)}, - {"DARKGREEN", new Color(0.00f, 0.39f, 0.00f)}, - {"DARKKHAKI", new Color(0.74f, 0.72f, 0.42f)}, - {"DARKMAGENTA", new Color(0.55f, 0.00f, 0.55f)}, - {"DARKOLIVEGREEN", new Color(0.33f, 0.42f, 0.18f)}, - {"DARKORANGE", new Color(1.00f, 0.55f, 0.00f)}, - {"DARKORCHID", new Color(0.60f, 0.20f, 0.80f)}, - {"DARKRED", new Color(0.55f, 0.00f, 0.00f)}, - {"DARKSALMON", new Color(0.91f, 0.59f, 0.48f)}, - {"DARKSEAGREEN", new Color(0.56f, 0.74f, 0.56f)}, - {"DARKSLATEBLUE", new Color(0.28f, 0.24f, 0.55f)}, - {"DARKSLATEGRAY", new Color(0.18f, 0.31f, 0.31f)}, - {"DARKTURQUOISE", new Color(0.00f, 0.81f, 0.82f)}, - {"DARKVIOLET", new Color(0.58f, 0.00f, 0.83f)}, - {"DEEPPINK", new Color(1.00f, 0.08f, 0.58f)}, - {"DEEPSKYBLUE", new Color(0.00f, 0.75f, 1.00f)}, - {"DIMGRAY", new Color(0.41f, 0.41f, 0.41f)}, - {"DODGERBLUE", new Color(0.12f, 0.56f, 1.00f)}, - {"FIREBRICK", new Color(0.70f, 0.13f, 0.13f)}, - {"FLORALWHITE", new Color(1.00f, 0.98f, 0.94f)}, - {"FORESTGREEN", new Color(0.13f, 0.55f, 0.13f)}, - {"FUCHSIA", new Color(1.00f, 0.00f, 1.00f)}, - {"GAINSBORO", new Color(0.86f, 0.86f, 0.86f)}, - {"GHOSTWHITE", new Color(0.97f, 0.97f, 1.00f)}, - {"GOLD", new Color(1.00f, 0.84f, 0.00f)}, - {"GOLDENROD", new Color(0.85f, 0.65f, 0.13f)}, - {"GRAY", new Color(0.75f, 0.75f, 0.75f)}, - {"GREEN", new Color(0.00f, 1.00f, 0.00f)}, - {"GREENYELLOW", new Color(0.68f, 1.00f, 0.18f)}, - {"HONEYDEW", new Color(0.94f, 1.00f, 0.94f)}, - {"HOTPINK", new Color(1.00f, 0.41f, 0.71f)}, - {"INDIANRED", new Color(0.80f, 0.36f, 0.36f)}, - {"INDIGO", new Color(0.29f, 0.00f, 0.51f)}, - {"IVORY", new Color(1.00f, 1.00f, 0.94f)}, - {"KHAKI", new Color(0.94f, 0.90f, 0.55f)}, - {"LAVENDER", new Color(0.90f, 0.90f, 0.98f)}, - {"LAVENDERBLUSH", new Color(1.00f, 0.94f, 0.96f)}, - {"LAWNGREEN", new Color(0.49f, 0.99f, 0.00f)}, - {"LEMONCHIFFON", new Color(1.00f, 0.98f, 0.80f)}, - {"LIGHTBLUE", new Color(0.68f, 0.85f, 0.90f)}, - {"LIGHTCORAL", new Color(0.94f, 0.50f, 0.50f)}, - {"LIGHTCYAN", new Color(0.88f, 1.00f, 1.00f)}, - {"LIGHTGOLDENROD", new Color(0.98f, 0.98f, 0.82f)}, - {"LIGHTGRAY", new Color(0.83f, 0.83f, 0.83f)}, - {"LIGHTGREEN", new Color(0.56f, 0.93f, 0.56f)}, - {"LIGHTPINK", new Color(1.00f, 0.71f, 0.76f)}, - {"LIGHTSALMON", new Color(1.00f, 0.63f, 0.48f)}, - {"LIGHTSEAGREEN", new Color(0.13f, 0.70f, 0.67f)}, - {"LIGHTSKYBLUE", new Color(0.53f, 0.81f, 0.98f)}, - {"LIGHTSLATEGRAY", new Color(0.47f, 0.53f, 0.60f)}, - {"LIGHTSTEELBLUE", new Color(0.69f, 0.77f, 0.87f)}, - {"LIGHTYELLOW", new Color(1.00f, 1.00f, 0.88f)}, - {"LIME", new Color(0.00f, 1.00f, 0.00f)}, - {"LIMEGREEN", new Color(0.20f, 0.80f, 0.20f)}, - {"LINEN", new Color(0.98f, 0.94f, 0.90f)}, - {"MAGENTA", new Color(1.00f, 0.00f, 1.00f)}, - {"MAROON", new Color(0.69f, 0.19f, 0.38f)}, - {"MEDIUMAQUAMARINE", new Color(0.40f, 0.80f, 0.67f)}, - {"MEDIUMBLUE", new Color(0.00f, 0.00f, 0.80f)}, - {"MEDIUMORCHID", new Color(0.73f, 0.33f, 0.83f)}, - {"MEDIUMPURPLE", new Color(0.58f, 0.44f, 0.86f)}, - {"MEDIUMSEAGREEN", new Color(0.24f, 0.70f, 0.44f)}, - {"MEDIUMSLATEBLUE", new Color(0.48f, 0.41f, 0.93f)}, - {"MEDIUMSPRINGGREEN", new Color(0.00f, 0.98f, 0.60f)}, - {"MEDIUMTURQUOISE", new Color(0.28f, 0.82f, 0.80f)}, - {"MEDIUMVIOLETRED", new Color(0.78f, 0.08f, 0.52f)}, - {"MIDNIGHTBLUE", new Color(0.10f, 0.10f, 0.44f)}, - {"MINTCREAM", new Color(0.96f, 1.00f, 0.98f)}, - {"MISTYROSE", new Color(1.00f, 0.89f, 0.88f)}, - {"MOCCASIN", new Color(1.00f, 0.89f, 0.71f)}, - {"NAVAJOWHITE", new Color(1.00f, 0.87f, 0.68f)}, - {"NAVYBLUE", new Color(0.00f, 0.00f, 0.50f)}, - {"OLDLACE", new Color(0.99f, 0.96f, 0.90f)}, - {"OLIVE", new Color(0.50f, 0.50f, 0.00f)}, - {"OLIVEDRAB", new Color(0.42f, 0.56f, 0.14f)}, - {"ORANGE", new Color(1.00f, 0.65f, 0.00f)}, - {"ORANGERED", new Color(1.00f, 0.27f, 0.00f)}, - {"ORCHID", new Color(0.85f, 0.44f, 0.84f)}, - {"PALEGOLDENROD", new Color(0.93f, 0.91f, 0.67f)}, - {"PALEGREEN", new Color(0.60f, 0.98f, 0.60f)}, - {"PALETURQUOISE", new Color(0.69f, 0.93f, 0.93f)}, - {"PALEVIOLETRED", new Color(0.86f, 0.44f, 0.58f)}, - {"PAPAYAWHIP", new Color(1.00f, 0.94f, 0.84f)}, - {"PEACHPUFF", new Color(1.00f, 0.85f, 0.73f)}, - {"PERU", new Color(0.80f, 0.52f, 0.25f)}, - {"PINK", new Color(1.00f, 0.75f, 0.80f)}, - {"PLUM", new Color(0.87f, 0.63f, 0.87f)}, - {"POWDERBLUE", new Color(0.69f, 0.88f, 0.90f)}, - {"PURPLE", new Color(0.63f, 0.13f, 0.94f)}, - {"REBECCAPURPLE", new Color(0.40f, 0.20f, 0.60f)}, - {"RED", new Color(1.00f, 0.00f, 0.00f)}, - {"ROSYBROWN", new Color(0.74f, 0.56f, 0.56f)}, - {"ROYALBLUE", new Color(0.25f, 0.41f, 0.88f)}, - {"SADDLEBROWN", new Color(0.55f, 0.27f, 0.07f)}, - {"SALMON", new Color(0.98f, 0.50f, 0.45f)}, - {"SANDYBROWN", new Color(0.96f, 0.64f, 0.38f)}, - {"SEAGREEN", new Color(0.18f, 0.55f, 0.34f)}, - {"SEASHELL", new Color(1.00f, 0.96f, 0.93f)}, - {"SIENNA", new Color(0.63f, 0.32f, 0.18f)}, - {"SILVER", new Color(0.75f, 0.75f, 0.75f)}, - {"SKYBLUE", new Color(0.53f, 0.81f, 0.92f)}, - {"SLATEBLUE", new Color(0.42f, 0.35f, 0.80f)}, - {"SLATEGRAY", new Color(0.44f, 0.50f, 0.56f)}, - {"SNOW", new Color(1.00f, 0.98f, 0.98f)}, - {"SPRINGGREEN", new Color(0.00f, 1.00f, 0.50f)}, - {"STEELBLUE", new Color(0.27f, 0.51f, 0.71f)}, - {"TAN", new Color(0.82f, 0.71f, 0.55f)}, - {"TEAL", new Color(0.00f, 0.50f, 0.50f)}, - {"THISTLE", new Color(0.85f, 0.75f, 0.85f)}, - {"TOMATO", new Color(1.00f, 0.39f, 0.28f)}, - {"TRANSPARENT", new Color(1.00f, 1.00f, 1.00f, 0.00f)}, - {"TURQUOISE", new Color(0.25f, 0.88f, 0.82f)}, - {"VIOLET", new Color(0.93f, 0.51f, 0.93f)}, - {"WEBGRAY", new Color(0.50f, 0.50f, 0.50f)}, - {"WEBGREEN", new Color(0.00f, 0.50f, 0.00f)}, - {"WEBMAROON", new Color(0.50f, 0.00f, 0.00f)}, - {"WEBPURPLE", new Color(0.50f, 0.00f, 0.50f)}, - {"WHEAT", new Color(0.96f, 0.87f, 0.70f)}, - {"WHITE", new Color(1.00f, 1.00f, 1.00f)}, - {"WHITESMOKE", new Color(0.96f, 0.96f, 0.96f)}, - {"YELLOW", new Color(1.00f, 1.00f, 0.00f)}, - {"YELLOWGREEN", new Color(0.60f, 0.80f, 0.20f)}, + { "ALICE_BLUE", new Color(0xF0F8FFFF) }, + { "ANTIQUE_WHITE", new Color(0xFAEBD7FF) }, + { "AQUA", new Color(0x00FFFFFF) }, + { "AQUAMARINE", new Color(0x7FFFD4FF) }, + { "AZURE", new Color(0xF0FFFFFF) }, + { "BEIGE", new Color(0xF5F5DCFF) }, + { "BISQUE", new Color(0xFFE4C4FF) }, + { "BLACK", new Color(0x000000FF) }, + { "BLANCHED_ALMOND", new Color(0xFFEBCDFF) }, + { "BLUE", new Color(0x0000FFFF) }, + { "BLUE_VIOLET", new Color(0x8A2BE2FF) }, + { "BROWN", new Color(0xA52A2AFF) }, + { "BURLYWOOD", new Color(0xDEB887FF) }, + { "CADET_BLUE", new Color(0x5F9EA0FF) }, + { "CHARTREUSE", new Color(0x7FFF00FF) }, + { "CHOCOLATE", new Color(0xD2691EFF) }, + { "CORAL", new Color(0xFF7F50FF) }, + { "CORNFLOWER_BLUE", new Color(0x6495EDFF) }, + { "CORNSILK", new Color(0xFFF8DCFF) }, + { "CRIMSON", new Color(0xDC143CFF) }, + { "CYAN", new Color(0x00FFFFFF) }, + { "DARK_BLUE", new Color(0x00008BFF) }, + { "DARK_CYAN", new Color(0x008B8BFF) }, + { "DARK_GOLDENROD", new Color(0xB8860BFF) }, + { "DARK_GRAY", new Color(0xA9A9A9FF) }, + { "DARK_GREEN", new Color(0x006400FF) }, + { "DARK_KHAKI", new Color(0xBDB76BFF) }, + { "DARK_MAGENTA", new Color(0x8B008BFF) }, + { "DARK_OLIVE_GREEN", new Color(0x556B2FFF) }, + { "DARK_ORANGE", new Color(0xFF8C00FF) }, + { "DARK_ORCHID", new Color(0x9932CCFF) }, + { "DARK_RED", new Color(0x8B0000FF) }, + { "DARK_SALMON", new Color(0xE9967AFF) }, + { "DARK_SEA_GREEN", new Color(0x8FBC8FFF) }, + { "DARK_SLATE_BLUE", new Color(0x483D8BFF) }, + { "DARK_SLATE_GRAY", new Color(0x2F4F4FFF) }, + { "DARK_TURQUOISE", new Color(0x00CED1FF) }, + { "DARK_VIOLET", new Color(0x9400D3FF) }, + { "DEEP_PINK", new Color(0xFF1493FF) }, + { "DEEP_SKY_BLUE", new Color(0x00BFFFFF) }, + { "DIM_GRAY", new Color(0x696969FF) }, + { "DODGER_BLUE", new Color(0x1E90FFFF) }, + { "FIREBRICK", new Color(0xB22222FF) }, + { "FLORAL_WHITE", new Color(0xFFFAF0FF) }, + { "FOREST_GREEN", new Color(0x228B22FF) }, + { "FUCHSIA", new Color(0xFF00FFFF) }, + { "GAINSBORO", new Color(0xDCDCDCFF) }, + { "GHOST_WHITE", new Color(0xF8F8FFFF) }, + { "GOLD", new Color(0xFFD700FF) }, + { "GOLDENROD", new Color(0xDAA520FF) }, + { "GRAY", new Color(0xBEBEBEFF) }, + { "GREEN", new Color(0x00FF00FF) }, + { "GREEN_YELLOW", new Color(0xADFF2FFF) }, + { "HONEYDEW", new Color(0xF0FFF0FF) }, + { "HOT_PINK", new Color(0xFF69B4FF) }, + { "INDIAN_RED", new Color(0xCD5C5CFF) }, + { "INDIGO", new Color(0x4B0082FF) }, + { "IVORY", new Color(0xFFFFF0FF) }, + { "KHAKI", new Color(0xF0E68CFF) }, + { "LAVENDER", new Color(0xE6E6FAFF) }, + { "LAVENDER_BLUSH", new Color(0xFFF0F5FF) }, + { "LAWN_GREEN", new Color(0x7CFC00FF) }, + { "LEMON_CHIFFON", new Color(0xFFFACDFF) }, + { "LIGHT_BLUE", new Color(0xADD8E6FF) }, + { "LIGHT_CORAL", new Color(0xF08080FF) }, + { "LIGHT_CYAN", new Color(0xE0FFFFFF) }, + { "LIGHT_GOLDENROD", new Color(0xFAFAD2FF) }, + { "LIGHT_GRAY", new Color(0xD3D3D3FF) }, + { "LIGHT_GREEN", new Color(0x90EE90FF) }, + { "LIGHT_PINK", new Color(0xFFB6C1FF) }, + { "LIGHT_SALMON", new Color(0xFFA07AFF) }, + { "LIGHT_SEA_GREEN", new Color(0x20B2AAFF) }, + { "LIGHT_SKY_BLUE", new Color(0x87CEFAFF) }, + { "LIGHT_SLATE_GRAY", new Color(0x778899FF) }, + { "LIGHT_STEEL_BLUE", new Color(0xB0C4DEFF) }, + { "LIGHT_YELLOW", new Color(0xFFFFE0FF) }, + { "LIME", new Color(0x00FF00FF) }, + { "LIME_GREEN", new Color(0x32CD32FF) }, + { "LINEN", new Color(0xFAF0E6FF) }, + { "MAGENTA", new Color(0xFF00FFFF) }, + { "MAROON", new Color(0xB03060FF) }, + { "MEDIUM_AQUAMARINE", new Color(0x66CDAAFF) }, + { "MEDIUM_BLUE", new Color(0x0000CDFF) }, + { "MEDIUM_ORCHID", new Color(0xBA55D3FF) }, + { "MEDIUM_PURPLE", new Color(0x9370DBFF) }, + { "MEDIUM_SEA_GREEN", new Color(0x3CB371FF) }, + { "MEDIUM_SLATE_BLUE", new Color(0x7B68EEFF) }, + { "MEDIUM_SPRING_GREEN", new Color(0x00FA9AFF) }, + { "MEDIUM_TURQUOISE", new Color(0x48D1CCFF) }, + { "MEDIUM_VIOLET_RED", new Color(0xC71585FF) }, + { "MIDNIGHT_BLUE", new Color(0x191970FF) }, + { "MINT_CREAM", new Color(0xF5FFFAFF) }, + { "MISTY_ROSE", new Color(0xFFE4E1FF) }, + { "MOCCASIN", new Color(0xFFE4B5FF) }, + { "NAVAJO_WHITE", new Color(0xFFDEADFF) }, + { "NAVY_BLUE", new Color(0x000080FF) }, + { "OLD_LACE", new Color(0xFDF5E6FF) }, + { "OLIVE", new Color(0x808000FF) }, + { "OLIVE_DRAB", new Color(0x6B8E23FF) }, + { "ORANGE", new Color(0xFFA500FF) }, + { "ORANGE_RED", new Color(0xFF4500FF) }, + { "ORCHID", new Color(0xDA70D6FF) }, + { "PALE_GOLDENROD", new Color(0xEEE8AAFF) }, + { "PALE_GREEN", new Color(0x98FB98FF) }, + { "PALE_TURQUOISE", new Color(0xAFEEEEFF) }, + { "PALE_VIOLET_RED", new Color(0xDB7093FF) }, + { "PAPAYA_WHIP", new Color(0xFFEFD5FF) }, + { "PEACH_PUFF", new Color(0xFFDAB9FF) }, + { "PERU", new Color(0xCD853FFF) }, + { "PINK", new Color(0xFFC0CBFF) }, + { "PLUM", new Color(0xDDA0DDFF) }, + { "POWDER_BLUE", new Color(0xB0E0E6FF) }, + { "PURPLE", new Color(0xA020F0FF) }, + { "REBECCA_PURPLE", new Color(0x663399FF) }, + { "RED", new Color(0xFF0000FF) }, + { "ROSY_BROWN", new Color(0xBC8F8FFF) }, + { "ROYAL_BLUE", new Color(0x4169E1FF) }, + { "SADDLE_BROWN", new Color(0x8B4513FF) }, + { "SALMON", new Color(0xFA8072FF) }, + { "SANDY_BROWN", new Color(0xF4A460FF) }, + { "SEA_GREEN", new Color(0x2E8B57FF) }, + { "SEASHELL", new Color(0xFFF5EEFF) }, + { "SIENNA", new Color(0xA0522DFF) }, + { "SILVER", new Color(0xC0C0C0FF) }, + { "SKY_BLUE", new Color(0x87CEEBFF) }, + { "SLATE_BLUE", new Color(0x6A5ACDFF) }, + { "SLATE_GRAY", new Color(0x708090FF) }, + { "SNOW", new Color(0xFFFAFAFF) }, + { "SPRING_GREEN", new Color(0x00FF7FFF) }, + { "STEEL_BLUE", new Color(0x4682B4FF) }, + { "TAN", new Color(0xD2B48CFF) }, + { "TEAL", new Color(0x008080FF) }, + { "THISTLE", new Color(0xD8BFD8FF) }, + { "TOMATO", new Color(0xFF6347FF) }, + { "TRANSPARENT", new Color(0xFFFFFF00) }, + { "TURQUOISE", new Color(0x40E0D0FF) }, + { "VIOLET", new Color(0xEE82EEFF) }, + { "WEB_GRAY", new Color(0x808080FF) }, + { "WEB_GREEN", new Color(0x008000FF) }, + { "WEB_MAROON", new Color(0x800000FF) }, + { "WEB_PURPLE", new Color(0x800080FF) }, + { "WHEAT", new Color(0xF5DEB3FF) }, + { "WHITE", new Color(0xFFFFFFFF) }, + { "WHITE_SMOKE", new Color(0xF5F5F5FF) }, + { "YELLOW", new Color(0xFFFF00FF) }, + { "YELLOW_GREEN", new Color(0x9ACD32FF) }, }; #pragma warning disable CS1591 // Disable warning: "Missing XML comment for publicly visible type or member" diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs index fa8c94ed18..95ad097192 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs @@ -352,7 +352,7 @@ namespace Godot.Collections /// </summary> /// <typeparam name="TKey">The type of the dictionary's keys.</typeparam> /// <typeparam name="TValue">The type of the dictionary's values.</typeparam> - public class Dictionary<TKey, TValue> : + public class Dictionary<[MustBeVariant] TKey, [MustBeVariant] TValue> : IDictionary<TKey, TValue>, IReadOnlyDictionary<TKey, TValue> { diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs index 1dc21b6303..df0e839866 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Extensions/NodeExtensions.cs @@ -93,8 +93,12 @@ namespace Godot /// Negative indices access the children from the last one. /// To access a child node via its name, use <see cref="GetNode"/>. /// </summary> - /// <seealso cref="GetChildOrNull{T}(int)"/> + /// <seealso cref="GetChildOrNull{T}(int, bool)"/> /// <param name="idx">Child index.</param> + /// <param name="includeInternal"> + /// If <see langword="false"/>, internal children are skipped (see <c>internal</c> + /// parameter in <see cref="AddChild(Node, bool, InternalMode)"/>). + /// </param> /// <exception cref="InvalidCastException"> /// Thrown when the given the fetched node can't be casted to the given type <typeparamref name="T"/>. /// </exception> @@ -102,9 +106,9 @@ namespace Godot /// <returns> /// The child <see cref="Node"/> at the given index <paramref name="idx"/>. /// </returns> - public T GetChild<T>(int idx) where T : class + public T GetChild<T>(int idx, bool includeInternal = false) where T : class { - return (T)(object)GetChild(idx); + return (T)(object)GetChild(idx, includeInternal); } /// <summary> @@ -113,15 +117,20 @@ namespace Godot /// Negative indices access the children from the last one. /// To access a child node via its name, use <see cref="GetNode"/>. /// </summary> - /// <seealso cref="GetChild{T}(int)"/> + /// <seealso cref="GetChild{T}(int, bool)"/> /// <param name="idx">Child index.</param> + /// <param name="includeInternal"> + /// If <see langword="false"/>, internal children are skipped (see <c>internal</c> + /// parameter in <see cref="AddChild(Node, bool, InternalMode)"/>). + /// </param> /// <typeparam name="T">The type to cast to. Should be a descendant of <see cref="Node"/>.</typeparam> /// <returns> /// The child <see cref="Node"/> at the given index <paramref name="idx"/>, or <see langword="null"/> if not found. /// </returns> - public T GetChildOrNull<T>(int idx) where T : class + public T GetChildOrNull<T>(int idx, bool includeInternal = false) where T : class { - return GetChild(idx) as T; + int count = GetChildCount(includeInternal); + return idx >= -count && idx < count ? GetChild(idx, includeInternal) as T : null; } /// <summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs index 9348cc1d00..9e7da7757a 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs @@ -189,8 +189,6 @@ namespace Godot /// Pushes an error message to Godot's built-in debugger and to the OS terminal. /// /// Note: Errors printed this way will not pause project execution. - /// To print an error message and pause project execution in debug builds, - /// use [code]assert(false, "test error")[/code] instead. /// </summary> /// <example> /// <code> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs index 08beff8104..41a0dd871c 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs @@ -754,9 +754,10 @@ namespace Godot } /// <summary> - /// Returns the [code]value[/code] wrapped between [code]0[/code] and the [code]length[/code]. - /// If the limit is reached, the next value the function returned is decreased to the [code]0[/code] side or increased to the [code]length[/code] side (like a triangle wave). - /// If [code]length[/code] is less than zero, it becomes positive. + /// Returns the <paramref name="value"/> wrapped between <c>0</c> and the <paramref name="length"/>. + /// If the limit is reached, the next value the function returned is decreased to the <c>0</c> side + /// or increased to the <paramref name="length"/> side (like a triangle wave). + /// If <paramref name="length"/> is less than zero, it becomes positive. /// </summary> /// <param name="value">The value to pingpong.</param> /// <param name="length">The maximum value of the function.</param> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs index 91b3c42b07..5da1f3b560 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs @@ -39,22 +39,22 @@ namespace Godot } /// <summary> - /// The projections's X column. Also accessible by using the index position <c>[0]</c>. + /// The projection's X column. Also accessible by using the index position <c>[0]</c>. /// </summary> public Vector4 x; /// <summary> - /// The projections's Y column. Also accessible by using the index position <c>[1]</c>. + /// The projection's Y column. Also accessible by using the index position <c>[1]</c>. /// </summary> public Vector4 y; /// <summary> - /// The projections's Z column. Also accessible by using the index position <c>[2]</c>. + /// The projection's Z column. Also accessible by using the index position <c>[2]</c>. /// </summary> public Vector4 z; /// <summary> - /// The projections's W column. Also accessible by using the index position <c>[3]</c>. + /// The projection's W column. Also accessible by using the index position <c>[3]</c>. /// </summary> public Vector4 w; @@ -74,18 +74,6 @@ namespace Godot } /// <summary> - /// Constructs a new <see cref="Projection"/> from an existing <see cref="Projection"/>. - /// </summary> - /// <param name="proj">The existing <see cref="Projection"/>.</param> - public Projection(Projection proj) - { - x = proj.x; - y = proj.y; - z = proj.z; - w = proj.w; - } - - /// <summary> /// Constructs a new <see cref="Projection"/> from a <see cref="Transform3D"/>. /// </summary> /// <param name="transform">The <see cref="Transform3D"/>.</param> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs index aae900ac46..999500ca13 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Quaternion.cs @@ -340,15 +340,6 @@ namespace Godot } /// <summary> - /// Constructs a <see cref="Quaternion"/> from the given <see cref="Quaternion"/>. - /// </summary> - /// <param name="q">The existing quaternion.</param> - public Quaternion(Quaternion q) - { - this = q; - } - - /// <summary> /// Constructs a <see cref="Quaternion"/> from the given <see cref="Basis"/>. /// </summary> /// <param name="basis">The <see cref="Basis"/> to construct from.</param> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringName.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringName.cs index 10739c02a7..b9ee0bc278 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/StringName.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/StringName.cs @@ -59,9 +59,9 @@ namespace Godot } /// <summary> - /// Constructs a <see cref="StringName"/> from the given <paramref name="path"/> string. + /// Constructs a <see cref="StringName"/> from the given <paramref name="name"/> string. /// </summary> - /// <param name="path">String to construct the <see cref="StringName"/> from.</param> + /// <param name="name">String to construct the <see cref="StringName"/> from.</param> public StringName(string name) { if (!string.IsNullOrEmpty(name)) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs index c4f9b0f044..03ee12884b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2.cs @@ -639,16 +639,6 @@ namespace Godot } /// <summary> - /// Constructs a new <see cref="Vector2"/> from an existing <see cref="Vector2"/>. - /// </summary> - /// <param name="v">The existing <see cref="Vector2"/>.</param> - public Vector2(Vector2 v) - { - x = v.x; - y = v.y; - } - - /// <summary> /// Creates a unit Vector2 rotated to the given angle. This is equivalent to doing /// <c>Vector2(Mathf.Cos(angle), Mathf.Sin(angle))</c> or <c>Vector2.Right.Rotated(angle)</c>. /// </summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs index 1a983195b9..666616edec 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2i.cs @@ -350,27 +350,6 @@ namespace Godot } /// <summary> - /// Constructs a new <see cref="Vector2i"/> from an existing <see cref="Vector2i"/>. - /// </summary> - /// <param name="vi">The existing <see cref="Vector2i"/>.</param> - public Vector2i(Vector2i vi) - { - this.x = vi.x; - this.y = vi.y; - } - - /// <summary> - /// Constructs a new <see cref="Vector2i"/> from an existing <see cref="Vector2"/> - /// by rounding the components via <see cref="Mathf.RoundToInt(real_t)"/>. - /// </summary> - /// <param name="v">The <see cref="Vector2"/> to convert.</param> - public Vector2i(Vector2 v) - { - this.x = Mathf.RoundToInt(v.x); - this.y = Mathf.RoundToInt(v.y); - } - - /// <summary> /// Adds each component of the <see cref="Vector2i"/> /// with the components of the given <see cref="Vector2i"/>. /// </summary> @@ -674,7 +653,10 @@ namespace Godot /// <param name="value">The vector to convert.</param> public static explicit operator Vector2i(Vector2 value) { - return new Vector2i(value); + return new Vector2i( + Mathf.RoundToInt(value.x), + Mathf.RoundToInt(value.y) + ); } /// <summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs index d445e6976c..cdba06c089 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3.cs @@ -692,17 +692,6 @@ namespace Godot } /// <summary> - /// Constructs a new <see cref="Vector3"/> from an existing <see cref="Vector3"/>. - /// </summary> - /// <param name="v">The existing <see cref="Vector3"/>.</param> - public Vector3(Vector3 v) - { - x = v.x; - y = v.y; - z = v.z; - } - - /// <summary> /// Adds each component of the <see cref="Vector3"/> /// with the components of the given <see cref="Vector3"/>. /// </summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs index 60b1818fb9..2947ef94a7 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3i.cs @@ -330,29 +330,6 @@ namespace Godot } /// <summary> - /// Constructs a new <see cref="Vector3i"/> from an existing <see cref="Vector3i"/>. - /// </summary> - /// <param name="vi">The existing <see cref="Vector3i"/>.</param> - public Vector3i(Vector3i vi) - { - this.x = vi.x; - this.y = vi.y; - this.z = vi.z; - } - - /// <summary> - /// Constructs a new <see cref="Vector3i"/> from an existing <see cref="Vector3"/> - /// by rounding the components via <see cref="Mathf.RoundToInt(real_t)"/>. - /// </summary> - /// <param name="v">The <see cref="Vector3"/> to convert.</param> - public Vector3i(Vector3 v) - { - this.x = Mathf.RoundToInt(v.x); - this.y = Mathf.RoundToInt(v.y); - this.z = Mathf.RoundToInt(v.z); - } - - /// <summary> /// Adds each component of the <see cref="Vector3i"/> /// with the components of the given <see cref="Vector3i"/>. /// </summary> @@ -684,7 +661,11 @@ namespace Godot /// <param name="value">The vector to convert.</param> public static explicit operator Vector3i(Vector3 value) { - return new Vector3i(value); + return new Vector3i( + Mathf.RoundToInt(value.x), + Mathf.RoundToInt(value.y), + Mathf.RoundToInt(value.z) + ); } /// <summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs index f4628fded0..705da04692 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4.cs @@ -477,18 +477,6 @@ namespace Godot } /// <summary> - /// Constructs a new <see cref="Vector4"/> from an existing <see cref="Vector4"/>. - /// </summary> - /// <param name="v">The existing <see cref="Vector4"/>.</param> - public Vector4(Vector4 v) - { - x = v.x; - y = v.y; - z = v.z; - w = v.w; - } - - /// <summary> /// Adds each component of the <see cref="Vector4"/> /// with the components of the given <see cref="Vector4"/>. /// </summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs index 55e0891bb2..73134b0baf 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4i.cs @@ -258,31 +258,6 @@ namespace Godot } /// <summary> - /// Constructs a new <see cref="Vector4i"/> from an existing <see cref="Vector4i"/>. - /// </summary> - /// <param name="vi">The existing <see cref="Vector4i"/>.</param> - public Vector4i(Vector4i vi) - { - this.x = vi.x; - this.y = vi.y; - this.z = vi.z; - this.w = vi.w; - } - - /// <summary> - /// Constructs a new <see cref="Vector4i"/> from an existing <see cref="Vector4"/> - /// by rounding the components via <see cref="Mathf.RoundToInt(real_t)"/>. - /// </summary> - /// <param name="v">The <see cref="Vector4"/> to convert.</param> - public Vector4i(Vector4 v) - { - this.x = Mathf.RoundToInt(v.x); - this.y = Mathf.RoundToInt(v.y); - this.z = Mathf.RoundToInt(v.z); - this.w = Mathf.RoundToInt(v.w); - } - - /// <summary> /// Adds each component of the <see cref="Vector4i"/> /// with the components of the given <see cref="Vector4i"/>. /// </summary> @@ -638,7 +613,12 @@ namespace Godot /// <param name="value">The vector to convert.</param> public static explicit operator Vector4i(Vector4 value) { - return new Vector4i(value); + return new Vector4i( + Mathf.RoundToInt(value.x), + Mathf.RoundToInt(value.y), + Mathf.RoundToInt(value.z), + Mathf.RoundToInt(value.w) + ); } /// <summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj index 111920ecf6..aae7a5ebfa 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj +++ b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj @@ -53,6 +53,10 @@ <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\MustBeVariantAttribute.cs" /> <Compile Include="Core\Attributes\RPCAttribute.cs" /> <Compile Include="Core\Attributes\ScriptPathAttribute.cs" /> <Compile Include="Core\Attributes\SignalAttribute.cs" /> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Variant.cs b/modules/mono/glue/GodotSharp/GodotSharp/Variant.cs index eb8b061120..85ef258922 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Variant.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Variant.cs @@ -14,7 +14,7 @@ public partial struct Variant : IDisposable private object? _obj; private Disposer? _disposer; - private class Disposer : IDisposable + private sealed class Disposer : IDisposable { private godot_variant.movable _native; @@ -37,7 +37,7 @@ public partial struct Variant : IDisposable GC.SuppressFinalize(this); } - public void Dispose(bool disposing) + private void Dispose(bool disposing) { _native.DangerousSelfRef.Dispose(); |