diff options
author | Juan Linietsky <juan@godotengine.org> | 2020-02-24 15:20:53 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2020-02-25 12:55:53 +0100 |
commit | 33b5c571995cce60a21784ac33fcf958640ed1e2 (patch) | |
tree | b6f087b46a88fe8e2bac093c521da829108714f5 /modules/mono/editor/bindings_generator.cpp | |
parent | c19488bd895f911f37bf2c03624d05ea8d0ec1ee (diff) |
Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.
Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.
For Variant, the float datatype is always 64 bits, and exposed as `float`.
We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.
Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
Diffstat (limited to 'modules/mono/editor/bindings_generator.cpp')
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 10595b4fcc..908c72c591 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -505,9 +505,9 @@ String BindingsGenerator::bbcode_to_xml(const String &p_bbcode, const TypeInterf xml_output.append("</c>"); } else if (tag == "PackedByteArray") { xml_output.append("<see cref=\"byte\"/>"); - } else if (tag == "PackedIntArray") { + } else if (tag == "PackedInt32Array") { xml_output.append("<see cref=\"int\"/>"); - } else if (tag == "PackedRealArray") { + } else if (tag == "PackedFloat32Array") { #ifdef REAL_T_IS_DOUBLE xml_output.append("<see cref=\"double\"/>"); #else @@ -2383,7 +2383,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { } else { if (return_info.type == Variant::INT) { imethod.return_type.cname = _get_int_type_name_from_meta(m ? m->get_argument_meta(-1) : GodotTypeInfo::METADATA_NONE); - } else if (return_info.type == Variant::REAL) { + } else if (return_info.type == Variant::FLOAT) { imethod.return_type.cname = _get_float_type_name_from_meta(m ? m->get_argument_meta(-1) : GodotTypeInfo::METADATA_NONE); } else { imethod.return_type.cname = Variant::get_type_name(return_info.type); @@ -2410,7 +2410,7 @@ bool BindingsGenerator::_populate_object_type_interfaces() { } else { if (arginfo.type == Variant::INT) { iarg.type.cname = _get_int_type_name_from_meta(m ? m->get_argument_meta(i) : GodotTypeInfo::METADATA_NONE); - } else if (arginfo.type == Variant::REAL) { + } else if (arginfo.type == Variant::FLOAT) { iarg.type.cname = _get_float_type_name_from_meta(m ? m->get_argument_meta(i) : GodotTypeInfo::METADATA_NONE); } else { iarg.type.cname = Variant::get_type_name(arginfo.type); @@ -2581,7 +2581,7 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar r_iarg.default_argument = "(%s)" + r_iarg.default_argument; } break; - case Variant::REAL: + case Variant::FLOAT: #ifndef REAL_T_IS_DOUBLE r_iarg.default_argument += "f"; #endif @@ -2629,8 +2629,10 @@ bool BindingsGenerator::_arg_default_value_from_variant(const Variant &p_val, Ar break; case Variant::ARRAY: case Variant::PACKED_BYTE_ARRAY: - case Variant::PACKED_INT_ARRAY: - case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_INT32_ARRAY: + case Variant::PACKED_FLOAT32_ARRAY: + case Variant::PACKED_INT64_ARRAY: + case Variant::PACKED_FLOAT64_ARRAY: case Variant::PACKED_STRING_ARRAY: case Variant::PACKED_VECTOR2_ARRAY: case Variant::PACKED_VECTOR3_ARRAY: @@ -2914,13 +2916,13 @@ void BindingsGenerator::_populate_builtin_type_interfaces() { #define INSERT_ARRAY(m_type, m_proxy_t) INSERT_ARRAY_FULL(m_type, m_type, m_proxy_t) - INSERT_ARRAY(PackedIntArray, int); + INSERT_ARRAY(PackedInt32Array, int); INSERT_ARRAY_FULL(PackedByteArray, PackedByteArray, byte); #ifdef REAL_T_IS_DOUBLE - INSERT_ARRAY(PackedRealArray, double); + INSERT_ARRAY(PackedFloat32Array, double); #else - INSERT_ARRAY(PackedRealArray, float); + INSERT_ARRAY(PackedFloat32Array, float); #endif INSERT_ARRAY(PackedStringArray, string); |