diff options
Diffstat (limited to 'modules/mono')
9 files changed, 138 insertions, 138 deletions
diff --git a/modules/mono/editor/script_templates/CharacterBody2D/basic_movement.cs b/modules/mono/editor/script_templates/CharacterBody2D/basic_movement.cs index c34f1a17f3..1f5ea7532d 100644 --- a/modules/mono/editor/script_templates/CharacterBody2D/basic_movement.cs +++ b/modules/mono/editor/script_templates/CharacterBody2D/basic_movement.cs @@ -8,7 +8,7 @@ public partial class _CLASS_ : _BASE_ public const float Speed = 300.0f; public const float JumpVelocity = -400.0f; - // Get the gravity from the project settings to be synced with RigidDynamicBody nodes. + // Get the gravity from the project settings to be synced with RigidBody nodes. public float gravity = ProjectSettings.GetSetting("physics/2d/default_gravity").AsSingle(); public override void _PhysicsProcess(float delta) diff --git a/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs b/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs index 069908c426..4e978b7549 100644 --- a/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs +++ b/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs @@ -8,7 +8,7 @@ public partial class _CLASS_ : _BASE_ public const float Speed = 5.0f; public const float JumpVelocity = 4.5f; - // Get the gravity from the project settings to be synced with RigidDynamicBody nodes. + // Get the gravity from the project settings to be synced with RigidBody nodes. public float gravity = ProjectSettings.GetSetting("physics/3d/default_gravity").AsSingle(); public override void _PhysicsProcess(float delta) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs index bacf7c89e6..5bce66ea87 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs @@ -10,136 +10,136 @@ 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> { - { "ALICE_BLUE", new Color(0xF0F8FFFF) }, - { "ANTIQUE_WHITE", new Color(0xFAEBD7FF) }, + { "ALICEBLUE", new Color(0xF0F8FFFF) }, + { "ANTIQUEWHITE", 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) }, + { "BLANCHEDALMOND", new Color(0xFFEBCDFF) }, { "BLUE", new Color(0x0000FFFF) }, - { "BLUE_VIOLET", new Color(0x8A2BE2FF) }, + { "BLUEVIOLET", new Color(0x8A2BE2FF) }, { "BROWN", new Color(0xA52A2AFF) }, { "BURLYWOOD", new Color(0xDEB887FF) }, - { "CADET_BLUE", new Color(0x5F9EA0FF) }, + { "CADETBLUE", new Color(0x5F9EA0FF) }, { "CHARTREUSE", new Color(0x7FFF00FF) }, { "CHOCOLATE", new Color(0xD2691EFF) }, { "CORAL", new Color(0xFF7F50FF) }, - { "CORNFLOWER_BLUE", new Color(0x6495EDFF) }, + { "CORNFLOWERBLUE", 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) }, + { "DARKBLUE", new Color(0x00008BFF) }, + { "DARKCYAN", new Color(0x008B8BFF) }, + { "DARKGOLDENROD", new Color(0xB8860BFF) }, + { "DARKGRAY", new Color(0xA9A9A9FF) }, + { "DARKGREEN", new Color(0x006400FF) }, + { "DARKKHAKI", new Color(0xBDB76BFF) }, + { "DARKMAGENTA", new Color(0x8B008BFF) }, + { "DARKOLIVEGREEN", new Color(0x556B2FFF) }, + { "DARKORANGE", new Color(0xFF8C00FF) }, + { "DARKORCHID", new Color(0x9932CCFF) }, + { "DARKRED", new Color(0x8B0000FF) }, + { "DARKSALMON", new Color(0xE9967AFF) }, + { "DARKSEAGREEN", new Color(0x8FBC8FFF) }, + { "DARKSLATEBLUE", new Color(0x483D8BFF) }, + { "DARKSLATEGRAY", new Color(0x2F4F4FFF) }, + { "DARKTURQUOISE", new Color(0x00CED1FF) }, + { "DARKVIOLET", new Color(0x9400D3FF) }, + { "DEEPPINK", new Color(0xFF1493FF) }, + { "DEEPSKYBLUE", new Color(0x00BFFFFF) }, + { "DIMGRAY", new Color(0x696969FF) }, + { "DODGERBLUE", new Color(0x1E90FFFF) }, { "FIREBRICK", new Color(0xB22222FF) }, - { "FLORAL_WHITE", new Color(0xFFFAF0FF) }, - { "FOREST_GREEN", new Color(0x228B22FF) }, + { "FLORALWHITE", new Color(0xFFFAF0FF) }, + { "FORESTGREEN", new Color(0x228B22FF) }, { "FUCHSIA", new Color(0xFF00FFFF) }, { "GAINSBORO", new Color(0xDCDCDCFF) }, - { "GHOST_WHITE", new Color(0xF8F8FFFF) }, + { "GHOSTWHITE", new Color(0xF8F8FFFF) }, { "GOLD", new Color(0xFFD700FF) }, { "GOLDENROD", new Color(0xDAA520FF) }, { "GRAY", new Color(0xBEBEBEFF) }, { "GREEN", new Color(0x00FF00FF) }, - { "GREEN_YELLOW", new Color(0xADFF2FFF) }, + { "GREENYELLOW", new Color(0xADFF2FFF) }, { "HONEYDEW", new Color(0xF0FFF0FF) }, - { "HOT_PINK", new Color(0xFF69B4FF) }, - { "INDIAN_RED", new Color(0xCD5C5CFF) }, + { "HOTPINK", new Color(0xFF69B4FF) }, + { "INDIANRED", 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) }, + { "LAVENDERBLUSH", new Color(0xFFF0F5FF) }, + { "LAWNGREEN", new Color(0x7CFC00FF) }, + { "LEMONCHIFFON", new Color(0xFFFACDFF) }, + { "LIGHTBLUE", new Color(0xADD8E6FF) }, + { "LIGHTCORAL", new Color(0xF08080FF) }, + { "LIGHTCYAN", new Color(0xE0FFFFFF) }, + { "LIGHTGOLDENROD", new Color(0xFAFAD2FF) }, + { "LIGHTGRAY", new Color(0xD3D3D3FF) }, + { "LIGHTGREEN", new Color(0x90EE90FF) }, + { "LIGHTPINK", new Color(0xFFB6C1FF) }, + { "LIGHTSALMON", new Color(0xFFA07AFF) }, + { "LIGHTSEAGREEN", new Color(0x20B2AAFF) }, + { "LIGHTSKYBLUE", new Color(0x87CEFAFF) }, + { "LIGHTSLATEGRAY", new Color(0x778899FF) }, + { "LIGHTSTEELBLUE", new Color(0xB0C4DEFF) }, + { "LIGHTYELLOW", new Color(0xFFFFE0FF) }, { "LIME", new Color(0x00FF00FF) }, - { "LIME_GREEN", new Color(0x32CD32FF) }, + { "LIMEGREEN", 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) }, + { "MEDIUMAQUAMARINE", new Color(0x66CDAAFF) }, + { "MEDIUMBLUE", new Color(0x0000CDFF) }, + { "MEDIUMORCHID", new Color(0xBA55D3FF) }, + { "MEDIUMPURPLE", new Color(0x9370DBFF) }, + { "MEDIUMSEAGREEN", new Color(0x3CB371FF) }, + { "MEDIUMSLATEBLUE", new Color(0x7B68EEFF) }, + { "MEDIUMSPRINGGREEN", new Color(0x00FA9AFF) }, + { "MEDIUMTURQUOISE", new Color(0x48D1CCFF) }, + { "MEDIUMVIOLETRED", new Color(0xC71585FF) }, + { "MIDNIGHTBLUE", new Color(0x191970FF) }, + { "MINTCREAM", new Color(0xF5FFFAFF) }, + { "MISTYROSE", new Color(0xFFE4E1FF) }, { "MOCCASIN", new Color(0xFFE4B5FF) }, - { "NAVAJO_WHITE", new Color(0xFFDEADFF) }, - { "NAVY_BLUE", new Color(0x000080FF) }, - { "OLD_LACE", new Color(0xFDF5E6FF) }, + { "NAVAJOWHITE", new Color(0xFFDEADFF) }, + { "NAVYBLUE", new Color(0x000080FF) }, + { "OLDLACE", new Color(0xFDF5E6FF) }, { "OLIVE", new Color(0x808000FF) }, - { "OLIVE_DRAB", new Color(0x6B8E23FF) }, + { "OLIVEDRAB", new Color(0x6B8E23FF) }, { "ORANGE", new Color(0xFFA500FF) }, - { "ORANGE_RED", new Color(0xFF4500FF) }, + { "ORANGERED", 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) }, + { "PALEGOLDENROD", new Color(0xEEE8AAFF) }, + { "PALEGREEN", new Color(0x98FB98FF) }, + { "PALETURQUOISE", new Color(0xAFEEEEFF) }, + { "PALEVIOLETRED", new Color(0xDB7093FF) }, + { "PAPAYAWHIP", new Color(0xFFEFD5FF) }, + { "PEACHPUFF", new Color(0xFFDAB9FF) }, { "PERU", new Color(0xCD853FFF) }, { "PINK", new Color(0xFFC0CBFF) }, { "PLUM", new Color(0xDDA0DDFF) }, - { "POWDER_BLUE", new Color(0xB0E0E6FF) }, + { "POWDERBLUE", new Color(0xB0E0E6FF) }, { "PURPLE", new Color(0xA020F0FF) }, - { "REBECCA_PURPLE", new Color(0x663399FF) }, + { "REBECCAPURPLE", new Color(0x663399FF) }, { "RED", new Color(0xFF0000FF) }, - { "ROSY_BROWN", new Color(0xBC8F8FFF) }, - { "ROYAL_BLUE", new Color(0x4169E1FF) }, - { "SADDLE_BROWN", new Color(0x8B4513FF) }, + { "ROSYBROWN", new Color(0xBC8F8FFF) }, + { "ROYALBLUE", new Color(0x4169E1FF) }, + { "SADDLEBROWN", new Color(0x8B4513FF) }, { "SALMON", new Color(0xFA8072FF) }, - { "SANDY_BROWN", new Color(0xF4A460FF) }, - { "SEA_GREEN", new Color(0x2E8B57FF) }, + { "SANDYBROWN", new Color(0xF4A460FF) }, + { "SEAGREEN", 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) }, + { "SKYBLUE", new Color(0x87CEEBFF) }, + { "SLATEBLUE", new Color(0x6A5ACDFF) }, + { "SLATEGRAY", new Color(0x708090FF) }, { "SNOW", new Color(0xFFFAFAFF) }, - { "SPRING_GREEN", new Color(0x00FF7FFF) }, - { "STEEL_BLUE", new Color(0x4682B4FF) }, + { "SPRINGGREEN", new Color(0x00FF7FFF) }, + { "STEELBLUE", new Color(0x4682B4FF) }, { "TAN", new Color(0xD2B48CFF) }, { "TEAL", new Color(0x008080FF) }, { "THISTLE", new Color(0xD8BFD8FF) }, @@ -147,15 +147,15 @@ namespace Godot { "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) }, + { "WEBGRAY", new Color(0x808080FF) }, + { "WEBGREEN", new Color(0x008000FF) }, + { "WEBMAROON", new Color(0x800000FF) }, + { "WEBPURPLE", new Color(0x800080FF) }, { "WHEAT", new Color(0xF5DEB3FF) }, { "WHITE", new Color(0xFFFFFFFF) }, - { "WHITE_SMOKE", new Color(0xF5F5F5FF) }, + { "WHITESMOKE", new Color(0xF5F5F5FF) }, { "YELLOW", new Color(0xFFFF00FF) }, - { "YELLOW_GREEN", new Color(0x9ACD32FF) }, + { "YELLOWGREEN", 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/DelegateUtils.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs index 266038a0af..3c75d18943 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs @@ -181,9 +181,9 @@ namespace Godot if (variantType == Variant.Type.Nil) return false; - static byte[] Var2Bytes(in godot_variant var) + static byte[] VarToBytes(in godot_variant var) { - NativeFuncs.godotsharp_var2bytes(var, false.ToGodotBool(), out var varBytes); + NativeFuncs.godotsharp_var_to_bytes(var, false.ToGodotBool(), out var varBytes); using (varBytes) return Marshaling.ConvertNativePackedByteArrayToSystemArray(varBytes); } @@ -192,7 +192,7 @@ namespace Godot var fieldValue = field.GetValue(target); using var fieldValueVariant = Marshaling.ConvertManagedObjectToVariant(fieldValue); - byte[] valueBuffer = Var2Bytes(fieldValueVariant); + byte[] valueBuffer = VarToBytes(fieldValueVariant); writer.Write(valueBuffer.Length); writer.Write(valueBuffer); } @@ -448,7 +448,7 @@ namespace Godot FieldInfo? fieldInfo = targetType.GetField(name, BindingFlags.Instance | BindingFlags.Public); - fieldInfo?.SetValue(recreatedTarget, GD.Bytes2Var(valueBuffer)); + fieldInfo?.SetValue(recreatedTarget, GD.BytesToVar(valueBuffer)); } @delegate = Delegate.CreateDelegate(delegateType, recreatedTarget, methodInfo, diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs index 9e7da7757a..e4b79e7ec4 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs @@ -21,10 +21,10 @@ namespace Godot /// <param name="bytes">Byte array that will be decoded to a <c>Variant</c>.</param> /// <param name="allowObjects">If objects should be decoded.</param> /// <returns>The decoded <c>Variant</c>.</returns> - public static Variant Bytes2Var(Span<byte> bytes, bool allowObjects = false) + public static Variant BytesToVar(Span<byte> bytes, bool allowObjects = false) { using var varBytes = Marshaling.ConvertSystemArrayToNativePackedByteArray(bytes); - NativeFuncs.godotsharp_bytes2var(varBytes, allowObjects.ToGodotBool(), out godot_variant ret); + NativeFuncs.godotsharp_bytes_to_var(varBytes, allowObjects.ToGodotBool(), out godot_variant ret); return Variant.CreateTakingOwnershipOfDisposableValue(ret); } @@ -52,10 +52,10 @@ namespace Godot /// <summary> /// Converts from decibels to linear energy (audio). /// </summary> - /// <seealso cref="Linear2Db(real_t)"/> + /// <seealso cref="LinearToDb(real_t)"/> /// <param name="db">Decibels to convert.</param> /// <returns>Audio volume as linear energy.</returns> - public static real_t Db2Linear(real_t db) + public static real_t DbToLinear(real_t db) { return (real_t)Math.Exp(db * 0.11512925464970228420089957273422); } @@ -115,18 +115,18 @@ namespace Godot /// Converts from linear energy to decibels (audio). /// This can be used to implement volume sliders that behave as expected (since volume isn't linear). /// </summary> - /// <seealso cref="Db2Linear(real_t)"/> + /// <seealso cref="DbToLinear(real_t)"/> /// <example> /// <code> /// // "slider" refers to a node that inherits Range such as HSlider or VSlider. /// // Its range must be configured to go from 0 to 1. /// // Change the bus name if you'd like to change the volume of a specific bus only. - /// AudioServer.SetBusVolumeDb(AudioServer.GetBusIndex("Master"), GD.Linear2Db(slider.value)); + /// AudioServer.SetBusVolumeDb(AudioServer.GetBusIndex("Master"), GD.LinearToDb(slider.value)); /// </code> /// </example> /// <param name="linear">The linear energy to convert.</param> /// <returns>Audio as decibels.</returns> - public static real_t Linear2Db(real_t linear) + public static real_t LinearToDb(real_t linear) { return (real_t)(Math.Log(linear) * 8.6858896380650365530225783783321); } @@ -518,21 +518,21 @@ namespace Godot } /// <summary> - /// Converts a formatted string that was returned by <see cref="Var2Str(Variant)"/> to the original value. + /// Converts a formatted string that was returned by <see cref="VarToStr(Variant)"/> to the original value. /// </summary> /// <example> /// <code> /// string a = "{\"a\": 1, \"b\": 2 }"; - /// var b = (Godot.Collections.Dictionary)GD.Str2Var(a); + /// var b = (Godot.Collections.Dictionary)GD.StrToVar(a); /// GD.Print(b["a"]); // Prints 1 /// </code> /// </example> /// <param name="str">String that will be converted to Variant.</param> /// <returns>The decoded <c>Variant</c>.</returns> - public static Variant Str2Var(string str) + public static Variant StrToVar(string str) { using var godotStr = Marshaling.ConvertStringToNative(str); - NativeFuncs.godotsharp_str2var(godotStr, out godot_variant ret); + NativeFuncs.godotsharp_str_to_var(godotStr, out godot_variant ret); return Variant.CreateTakingOwnershipOfDisposableValue(ret); } @@ -540,26 +540,26 @@ namespace Godot /// Encodes a <c>Variant</c> value to a byte array. /// If <paramref name="fullObjects"/> is <see langword="true"/> encoding objects is allowed /// (and can potentially include code). - /// Deserialization can be done with <see cref="Bytes2Var(Span{byte}, bool)"/>. + /// Deserialization can be done with <see cref="BytesToVar(Span{byte}, bool)"/>. /// </summary> /// <param name="var">Variant that will be encoded.</param> /// <param name="fullObjects">If objects should be serialized.</param> /// <returns>The <c>Variant</c> encoded as an array of bytes.</returns> - public static byte[] Var2Bytes(Variant var, bool fullObjects = false) + public static byte[] VarToBytes(Variant var, bool fullObjects = false) { - NativeFuncs.godotsharp_var2bytes((godot_variant)var.NativeVar, fullObjects.ToGodotBool(), out var varBytes); + NativeFuncs.godotsharp_var_to_bytes((godot_variant)var.NativeVar, fullObjects.ToGodotBool(), out var varBytes); using (varBytes) return Marshaling.ConvertNativePackedByteArrayToSystemArray(varBytes); } /// <summary> /// Converts a <c>Variant</c> <paramref name="var"/> to a formatted string that - /// can later be parsed using <see cref="Str2Var(string)"/>. + /// can later be parsed using <see cref="StrToVar(string)"/>. /// </summary> /// <example> /// <code> /// var a = new Godot.Collections.Dictionary { ["a"] = 1, ["b"] = 2 }; - /// GD.Print(GD.Var2Str(a)); + /// GD.Print(GD.VarToStr(a)); /// // Prints /// // { /// // "a": 1, @@ -569,9 +569,9 @@ namespace Godot /// </example> /// <param name="var">Variant that will be converted to string.</param> /// <returns>The <c>Variant</c> encoded as a string.</returns> - public static string Var2Str(Variant var) + public static string VarToStr(Variant var) { - NativeFuncs.godotsharp_var2str((godot_variant)var.NativeVar, out godot_string ret); + NativeFuncs.godotsharp_var_to_str((godot_variant)var.NativeVar, out godot_string ret); using (ret) return Marshaling.ConvertStringToManaged(ret); } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs index 41a0dd871c..00e775e6ad 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs @@ -35,9 +35,9 @@ namespace Godot public const real_t NaN = real_t.NaN; // 0.0174532924f and 0.0174532925199433 - private const real_t _deg2RadConst = (real_t)0.0174532925199432957692369077M; + private const real_t _degToRadConst = (real_t)0.0174532925199432957692369077M; // 57.29578f and 57.2957795130823 - private const real_t _rad2DegConst = (real_t)57.295779513082320876798154814M; + private const real_t _radToDegConst = (real_t)57.295779513082320876798154814M; /// <summary> /// Returns the absolute value of <paramref name="s"/> (i.e. positive value). @@ -219,9 +219,9 @@ namespace Godot /// </summary> /// <param name="deg">An angle expressed in degrees.</param> /// <returns>The same angle expressed in radians.</returns> - public static real_t Deg2Rad(real_t deg) + public static real_t DegToRad(real_t deg) { - return deg * _deg2RadConst; + return deg * _degToRadConst; } /// <summary> @@ -531,9 +531,9 @@ namespace Godot /// </summary> /// <param name="rad">An angle expressed in radians.</param> /// <returns>The same angle expressed in degrees.</returns> - public static real_t Rad2Deg(real_t rad) + public static real_t RadToDeg(real_t rad) { - return rad * _rad2DegConst; + return rad * _radToDegConst; } /// <summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs index 6d2534e6f7..48c1b48c59 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/NativeFuncs.cs @@ -461,7 +461,7 @@ namespace Godot.NativeInterop // GD, etc - internal static partial void godotsharp_bytes2var(in godot_packed_byte_array p_bytes, + internal static partial void godotsharp_bytes_to_var(in godot_packed_byte_array p_bytes, godot_bool p_allow_objects, out godot_variant r_ret); @@ -504,12 +504,12 @@ namespace Godot.NativeInterop internal static partial void godotsharp_str(in godot_array p_what, out godot_string r_ret); - internal static partial void godotsharp_str2var(in godot_string p_str, out godot_variant r_ret); + internal static partial void godotsharp_str_to_var(in godot_string p_str, out godot_variant r_ret); - internal static partial void godotsharp_var2bytes(in godot_variant p_what, godot_bool p_full_objects, + internal static partial void godotsharp_var_to_bytes(in godot_variant p_what, godot_bool p_full_objects, out godot_packed_byte_array r_bytes); - internal static partial void godotsharp_var2str(in godot_variant p_var, out godot_string r_ret); + internal static partial void godotsharp_var_to_str(in godot_variant p_var, out godot_string r_ret); internal static partial void godotsharp_pusherror(in godot_string p_str); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs index 5da1f3b560..9d08e7120a 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Projection.cs @@ -226,7 +226,7 @@ namespace Godot { fovyDegrees = GetFovy(fovyDegrees, (real_t)1.0 / aspect); } - real_t radians = Mathf.Deg2Rad(fovyDegrees / (real_t)2.0); + real_t radians = Mathf.DegToRad(fovyDegrees / (real_t)2.0); real_t deltaZ = zFar - zNear; real_t sine = Mathf.Sin(radians); @@ -256,7 +256,7 @@ namespace Godot fovyDegrees = GetFovy(fovyDegrees, (real_t)1.0 / aspect); } - real_t ymax = zNear * Mathf.Tan(Mathf.Deg2Rad(fovyDegrees / (real_t)2.0)); + real_t ymax = zNear * Mathf.Tan(Mathf.DegToRad(fovyDegrees / (real_t)2.0)); real_t xmax = ymax * aspect; real_t frustumshift = (intraocularDist / (real_t)2.0) * zNear / convergenceDist; real_t left; @@ -313,18 +313,18 @@ namespace Godot Plane rightPlane = new Plane(x.w - x.x, y.w - y.x, z.w - z.x, -w.w + w.x).Normalized(); if (z.x == 0 && z.y == 0) { - return Mathf.Rad2Deg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.x))) * (real_t)2.0; + return Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.x))) * (real_t)2.0; } else { Plane leftPlane = new Plane(x.w + x.x, y.w + y.x, z.w + z.x, w.w + w.x).Normalized(); - return Mathf.Rad2Deg(Mathf.Acos(Mathf.Abs(leftPlane.Normal.x))) + Mathf.Rad2Deg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.x))); + return Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(leftPlane.Normal.x))) + Mathf.RadToDeg(Mathf.Acos(Mathf.Abs(rightPlane.Normal.x))); } } public static real_t GetFovy(real_t fovx, real_t aspect) { - return Mathf.Rad2Deg(Mathf.Atan(aspect * Mathf.Tan(Mathf.Deg2Rad(fovx) * (real_t)0.5)) * (real_t)2.0); + return Mathf.RadToDeg(Mathf.Atan(aspect * Mathf.Tan(Mathf.DegToRad(fovx) * (real_t)0.5)) * (real_t)2.0); } public real_t GetLodMultiplier() diff --git a/modules/mono/glue/runtime_interop.cpp b/modules/mono/glue/runtime_interop.cpp index 13d4395a64..0d68cb54b9 100644 --- a/modules/mono/glue/runtime_interop.cpp +++ b/modules/mono/glue/runtime_interop.cpp @@ -1233,13 +1233,13 @@ void godotsharp_pushwarning(const godot_string *p_str) { WARN_PRINT(*reinterpret_cast<const String *>(p_str)); } -void godotsharp_var2str(const godot_variant *p_var, godot_string *r_ret) { +void godotsharp_var_to_str(const godot_variant *p_var, godot_string *r_ret) { const Variant &var = *reinterpret_cast<const Variant *>(p_var); String &vars = *memnew_placement(r_ret, String); VariantWriter::write_to_string(var, vars); } -void godotsharp_str2var(const godot_string *p_str, godot_variant *r_ret) { +void godotsharp_str_to_var(const godot_string *p_str, godot_variant *r_ret) { Variant ret; VariantParser::StreamString ss; @@ -1256,7 +1256,7 @@ void godotsharp_str2var(const godot_string *p_str, godot_variant *r_ret) { memnew_placement(r_ret, Variant(ret)); } -void godotsharp_var2bytes(const godot_variant *p_var, bool p_full_objects, godot_packed_array *r_bytes) { +void godotsharp_var_to_bytes(const godot_variant *p_var, bool p_full_objects, godot_packed_array *r_bytes) { const Variant &var = *reinterpret_cast<const Variant *>(p_var); PackedByteArray &bytes = *memnew_placement(r_bytes, PackedByteArray); @@ -1268,7 +1268,7 @@ void godotsharp_var2bytes(const godot_variant *p_var, bool p_full_objects, godot encode_variant(var, bytes.ptrw(), len, p_full_objects); } -void godotsharp_bytes2var(const godot_packed_array *p_bytes, bool p_allow_objects, godot_variant *r_ret) { +void godotsharp_bytes_to_var(const godot_packed_array *p_bytes, bool p_allow_objects, godot_variant *r_ret) { const PackedByteArray *bytes = reinterpret_cast<const PackedByteArray *>(p_bytes); Variant ret; Error err = decode_variant(ret, bytes->ptr(), bytes->size(), nullptr, p_allow_objects); @@ -1479,7 +1479,7 @@ static const void *unmanaged_callbacks[]{ (void *)godotsharp_node_path_get_subname, (void *)godotsharp_node_path_get_subname_count, (void *)godotsharp_node_path_is_absolute, - (void *)godotsharp_bytes2var, + (void *)godotsharp_bytes_to_var, (void *)godotsharp_convert, (void *)godotsharp_hash, (void *)godotsharp_instance_from_id, @@ -1499,9 +1499,9 @@ static const void *unmanaged_callbacks[]{ (void *)godotsharp_seed, (void *)godotsharp_weakref, (void *)godotsharp_str, - (void *)godotsharp_str2var, - (void *)godotsharp_var2bytes, - (void *)godotsharp_var2str, + (void *)godotsharp_str_to_var, + (void *)godotsharp_var_to_bytes, + (void *)godotsharp_var_to_str, (void *)godotsharp_pusherror, (void *)godotsharp_pushwarning, (void *)godotsharp_object_to_string, |