diff options
Diffstat (limited to 'modules/mono')
7 files changed, 64 insertions, 12 deletions
diff --git a/modules/mono/class_db_api_json.cpp b/modules/mono/class_db_api_json.cpp index 3afde1e8d3..c4547b4323 100644 --- a/modules/mono/class_db_api_json.cpp +++ b/modules/mono/class_db_api_json.cpp @@ -124,7 +124,7 @@ void class_db_api_to_json(const String &p_output_file, ClassDB::APIType p_api) { List<StringName> snames; - for (const KeyValue<StringName, int> &F : t->constant_map) { + for (const KeyValue<StringName, int64_t> &F : t->constant_map) { snames.push_back(F.key); } diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 960d2fe27c..9d3d481068 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -954,7 +954,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) { } } - p_output.append(MEMBER_BEGIN "public const int "); + p_output.append(MEMBER_BEGIN "public const long "); p_output.append(iconstant.proxy_name); p_output.append(" = "); p_output.append(itos(iconstant.value)); @@ -992,6 +992,7 @@ void BindingsGenerator::_generate_global_constants(StringBuilder &p_output) { p_output.append("\n" INDENT1 "public enum "); p_output.append(enum_proxy_name); + p_output.append(" : long"); p_output.append("\n" INDENT1 OPEN_BLOCK); const ConstantInterface &last = ienum.constants.back()->get(); @@ -1417,7 +1418,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str } } - output.append(MEMBER_BEGIN "public const int "); + output.append(MEMBER_BEGIN "public const long "); output.append(iconstant.proxy_name); output.append(" = "); output.append(itos(iconstant.value)); @@ -1435,6 +1436,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str output.append(MEMBER_BEGIN "public enum "); output.append(ienum.cname.operator String()); + output.append(" : long"); output.append(MEMBER_BEGIN OPEN_BLOCK); const ConstantInterface &last = ienum.constants.back()->get(); @@ -3088,7 +3090,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { const List<StringName> &enum_constants = E.value; for (const StringName &constant_cname : enum_constants) { String constant_name = constant_cname.operator String(); - int *value = class_info->constant_map.getptr(constant_cname); + int64_t *value = class_info->constant_map.getptr(constant_cname); ERR_FAIL_NULL_V(value, false); constants.erase(constant_name); @@ -3123,7 +3125,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { } for (const String &constant_name : constants) { - int *value = class_info->constant_map.getptr(StringName(constant_name)); + int64_t *value = class_info->constant_map.getptr(StringName(constant_name)); ERR_FAIL_NULL_V(value, false); ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), *value); @@ -3666,7 +3668,7 @@ void BindingsGenerator::_populate_global_constants() { } } - int constant_value = CoreConstants::get_global_constant_value(i); + int64_t constant_value = CoreConstants::get_global_constant_value(i); StringName enum_name = CoreConstants::get_global_constant_enum(i); ConstantInterface iconstant(constant_name, snake_to_pascal_case(constant_name, true), constant_value); diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h index f0ba2b18e4..70c4f12146 100644 --- a/modules/mono/editor/bindings_generator.h +++ b/modules/mono/editor/bindings_generator.h @@ -45,12 +45,12 @@ class BindingsGenerator { struct ConstantInterface { String name; String proxy_name; - int value = 0; + int64_t value = 0; const DocData::ConstantDoc *const_doc; ConstantInterface() {} - ConstantInterface(const String &p_name, const String &p_proxy_name, int p_value) { + ConstantInterface(const String &p_name, const String &p_proxy_name, int64_t p_value) { name = p_name; proxy_name = p_proxy_name; value = p_value; diff --git a/modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs b/modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs new file mode 100644 index 0000000000..9e1b7ef580 --- /dev/null +++ b/modules/mono/editor/script_templates/EditorScenePostImport/basic_import_script.cs @@ -0,0 +1,16 @@ +// meta-description: Basic import script template + +#if TOOLS +using _BINDINGS_NAMESPACE_; +using System; + +[Tool] +public partial class _CLASS_ : _BASE_ +{ + public override Godot.Object _PostImport(Node scene) + { + // Modify the contents of the scene upon import. + return scene; // Return the modified root node when you're done. + } +} +#endif diff --git a/modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs b/modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs new file mode 100644 index 0000000000..bf2c9434e4 --- /dev/null +++ b/modules/mono/editor/script_templates/EditorScenePostImport/no_comments.cs @@ -0,0 +1,15 @@ +// meta-description: Basic import script template (no comments) + +#if TOOLS +using _BINDINGS_NAMESPACE_; +using System; + +[Tool] +public partial class _CLASS_ : _BASE_ +{ + public override Godot.Object _PostImport(Node scene) + { + return scene; + } +} +#endif diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs index ce213da6a7..2b820070d6 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Mathf.cs @@ -276,10 +276,14 @@ namespace Godot /// Returns a normalized value considering the given range. /// This is the opposite of <see cref="Lerp(real_t, real_t, real_t)"/>. /// </summary> - /// <param name="from">The interpolated value.</param> + /// <param name="from">The start value for interpolation.</param> /// <param name="to">The destination value for interpolation.</param> - /// <param name="weight">A value on the range of 0.0 to 1.0, representing the amount of interpolation.</param> - /// <returns>The resulting value of the inverse interpolation.</returns> + /// <param name="weight">The interpolated value.</param> + /// <returns> + /// The resulting value of the inverse interpolation. + /// The returned value will be between 0.0 and 1.0 if <paramref name="weight"/> is + /// between <paramref name="from"/> and <paramref name="to"/> (inclusive). + /// </returns> public static real_t InverseLerp(real_t from, real_t to, real_t weight) { return (weight - from) / (to - from); @@ -516,6 +520,21 @@ namespace Godot } /// <summary> + /// Maps a <paramref name="value"/> from [<paramref name="inFrom"/>, <paramref name="inTo"/>] + /// to [<paramref name="outFrom"/>, <paramref name="outTo"/>]. + /// </summary> + /// <param name="value">The value to map.</param> + /// <param name="inFrom">The start value for the input interpolation.</param> + /// <param name="inTo">The destination value for the input interpolation.</param> + /// <param name="outFrom">The start value for the output interpolation.</param> + /// <param name="outTo">The destination value for the output interpolation.</param> + /// <returns>The resulting mapped value mapped.</returns> + public static real_t RangeLerp(real_t value, real_t inFrom, real_t inTo, real_t outFrom, real_t outTo) + { + return Lerp(outFrom, outTo, InverseLerp(inFrom, inTo, value)); + } + + /// <summary> /// Rounds <paramref name="s"/> to the nearest whole number, /// with halfway cases rounded towards the nearest multiple of two. /// </summary> diff --git a/modules/mono/utils/string_utils.cpp b/modules/mono/utils/string_utils.cpp index e6975611d2..64b68b70af 100644 --- a/modules/mono/utils/string_utils.cpp +++ b/modules/mono/utils/string_utils.cpp @@ -145,7 +145,7 @@ bool is_csharp_keyword(const String &p_name) { p_name == "do" || p_name == "double" || p_name == "else" || p_name == "enum" || p_name == "event" || p_name == "explicit" || p_name == "extern" || p_name == "false" || p_name == "finally" || p_name == "fixed" || p_name == "float" || p_name == "for" || - p_name == "forech" || p_name == "goto" || p_name == "if" || p_name == "implicit" || + p_name == "foreach" || p_name == "goto" || p_name == "if" || p_name == "implicit" || p_name == "in" || p_name == "int" || p_name == "interface" || p_name == "internal" || p_name == "is" || p_name == "lock" || p_name == "long" || p_name == "namespace" || p_name == "new" || p_name == "null" || p_name == "object" || p_name == "operator" || |