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 | |
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')
25 files changed, 296 insertions, 270 deletions
diff --git a/modules/assimp/editor_scene_importer_assimp.cpp b/modules/assimp/editor_scene_importer_assimp.cpp index 01d49e7995..1881d0db33 100644 --- a/modules/assimp/editor_scene_importer_assimp.cpp +++ b/modules/assimp/editor_scene_importer_assimp.cpp @@ -1275,7 +1275,7 @@ EditorSceneImporterAssimp::_generate_mesh_from_surface_indices(ImportState &stat for (size_t l = 0; l < num_vertices; l++) { AssimpUtils::calc_tangent_from_mesh(ai_mesh, j, l, l, w); } - PackedRealArray new_tangents = array_copy[VisualServer::ARRAY_TANGENT].duplicate(true); + PackedFloat32Array new_tangents = array_copy[VisualServer::ARRAY_TANGENT].duplicate(true); ERR_CONTINUE(new_tangents.size() != tangents.size() * 4); for (int32_t l = 0; l < tangents.size(); l++) { new_tangents.ptrw()[l + 0] = tangents[l].r; diff --git a/modules/bullet/shape_bullet.cpp b/modules/bullet/shape_bullet.cpp index 6315964efd..6780f89d9e 100644 --- a/modules/bullet/shape_bullet.cpp +++ b/modules/bullet/shape_bullet.cpp @@ -474,7 +474,7 @@ void HeightMapShapeBullet::set_data(const Variant &p_data) { Vector<real_t> l_heights; Variant l_heights_v = d["heights"]; - if (l_heights_v.get_type() == Variant::PACKED_REAL_ARRAY) { + if (l_heights_v.get_type() == Variant::PACKED_FLOAT32_ARRAY) { // Ready-to-use heights can be passed l_heights = l_heights_v; @@ -505,7 +505,7 @@ void HeightMapShapeBullet::set_data(const Variant &p_data) { } } else { - ERR_FAIL_MSG("Expected PackedRealArray or float Image."); + ERR_FAIL_MSG("Expected PackedFloat32Array or float Image."); } ERR_FAIL_COND(l_width <= 0); diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp index 7e7f383ea6..d017afd792 100644 --- a/modules/csg/csg_shape.cpp +++ b/modules/csg/csg_shape.cpp @@ -621,7 +621,7 @@ void CSGShape::_bind_methods() { ClassDB::bind_method(D_METHOD("get_meshes"), &CSGShape::get_meshes); ADD_PROPERTY(PropertyInfo(Variant::INT, "operation", PROPERTY_HINT_ENUM, "Union,Intersection,Subtraction"), "set_operation", "get_operation"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "snap", PROPERTY_HINT_RANGE, "0.0001,1,0.001"), "set_snap", "get_snap"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "snap", PROPERTY_HINT_RANGE, "0.0001,1,0.001"), "set_snap", "get_snap"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "calculate_tangents"), "set_calculate_tangents", "is_calculating_tangents"); ADD_GROUP("Collision", "collision_"); @@ -1049,7 +1049,7 @@ void CSGSphere::_bind_methods() { ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGSphere::set_material); ClassDB::bind_method(D_METHOD("get_material"), &CSGSphere::get_material); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_radius", "get_radius"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_RANGE, "0.001,100.0,0.001"), "set_radius", "get_radius"); ADD_PROPERTY(PropertyInfo(Variant::INT, "radial_segments", PROPERTY_HINT_RANGE, "1,100,1"), "set_radial_segments", "get_radial_segments"); ADD_PROPERTY(PropertyInfo(Variant::INT, "rings", PROPERTY_HINT_RANGE, "1,100,1"), "set_rings", "get_rings"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces"); @@ -1236,9 +1236,9 @@ void CSGBox::_bind_methods() { ClassDB::bind_method(D_METHOD("set_material", "material"), &CSGBox::set_material); ClassDB::bind_method(D_METHOD("get_material"), &CSGBox::get_material); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "width", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_width", "get_width"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_height", "get_height"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "depth", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_depth", "get_depth"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "width", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_width", "get_width"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_height", "get_height"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "depth", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_depth", "get_depth"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "material", PROPERTY_HINT_RESOURCE_TYPE, "StandardMaterial3D,ShaderMaterial"), "set_material", "get_material"); } @@ -1451,8 +1451,8 @@ void CSGCylinder::_bind_methods() { ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGCylinder::set_smooth_faces); ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGCylinder::get_smooth_faces); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_radius", "get_radius"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "height", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_height", "get_height"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_radius", "get_radius"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "height", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_height", "get_height"); ADD_PROPERTY(PropertyInfo(Variant::INT, "sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_sides", "get_sides"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cone"), "set_cone", "is_cone"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces"); @@ -1678,8 +1678,8 @@ void CSGTorus::_bind_methods() { ClassDB::bind_method(D_METHOD("set_smooth_faces", "smooth_faces"), &CSGTorus::set_smooth_faces); ClassDB::bind_method(D_METHOD("get_smooth_faces"), &CSGTorus::get_smooth_faces); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "inner_radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_inner_radius", "get_inner_radius"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "outer_radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_outer_radius", "get_outer_radius"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "inner_radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_inner_radius", "get_inner_radius"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "outer_radius", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_outer_radius", "get_outer_radius"); ADD_PROPERTY(PropertyInfo(Variant::INT, "sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_sides", "get_sides"); ADD_PROPERTY(PropertyInfo(Variant::INT, "ring_sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_ring_sides", "get_ring_sides"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_faces"), "set_smooth_faces", "get_smooth_faces"); @@ -2314,11 +2314,11 @@ void CSGPolygon::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::PACKED_VECTOR2_ARRAY, "polygon"), "set_polygon", "get_polygon"); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Depth,Spin,Path"), "set_mode", "get_mode"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "depth", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_depth", "get_depth"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "spin_degrees", PROPERTY_HINT_RANGE, "1,360,0.1"), "set_spin_degrees", "get_spin_degrees"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "depth", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_depth", "get_depth"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "spin_degrees", PROPERTY_HINT_RANGE, "1,360,0.1"), "set_spin_degrees", "get_spin_degrees"); ADD_PROPERTY(PropertyInfo(Variant::INT, "spin_sides", PROPERTY_HINT_RANGE, "3,64,1"), "set_spin_sides", "get_spin_sides"); ADD_PROPERTY(PropertyInfo(Variant::NODE_PATH, "path_node", PROPERTY_HINT_NODE_PATH_VALID_TYPES, "Path"), "set_path_node", "get_path_node"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "path_interval", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_path_interval", "get_path_interval"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "path_interval", PROPERTY_HINT_EXP_RANGE, "0.001,1000.0,0.001,or_greater"), "set_path_interval", "get_path_interval"); ADD_PROPERTY(PropertyInfo(Variant::INT, "path_rotation", PROPERTY_HINT_ENUM, "Polygon,Path,PathFollow"), "set_path_rotation", "get_path_rotation"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "path_local"), "set_path_local", "is_path_local"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "path_continuous_u"), "set_path_continuous_u", "is_path_continuous_u"); diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp index 1d8ba6087f..f0fc44ae8a 100644 --- a/modules/gdnative/gdnative/variant.cpp +++ b/modules/gdnative/gdnative/variant.cpp @@ -209,13 +209,13 @@ void GDAPI godot_variant_new_packed_byte_array(godot_variant *r_dest, const godo void GDAPI godot_variant_new_packed_int_array(godot_variant *r_dest, const godot_packed_int_array *p_pia) { Variant *dest = (Variant *)r_dest; - PackedIntArray *pia = (PackedIntArray *)p_pia; + PackedInt32Array *pia = (PackedInt32Array *)p_pia; memnew_placement_custom(dest, Variant, Variant(*pia)); } void GDAPI godot_variant_new_packed_real_array(godot_variant *r_dest, const godot_packed_real_array *p_pra) { Variant *dest = (Variant *)r_dest; - PackedRealArray *pra = (PackedRealArray *)p_pra; + PackedFloat32Array *pra = (PackedFloat32Array *)p_pra; memnew_placement_custom(dest, Variant, Variant(*pra)); } @@ -402,8 +402,8 @@ godot_packed_byte_array GDAPI godot_variant_as_packed_byte_array(const godot_var godot_packed_int_array GDAPI godot_variant_as_packed_int_array(const godot_variant *p_self) { godot_packed_int_array raw_dest; const Variant *self = (const Variant *)p_self; - PackedIntArray *dest = (PackedIntArray *)&raw_dest; - memnew_placement(dest, PackedIntArray(self->operator PackedIntArray())); // operator = is overloaded by PackedIntArray + PackedInt32Array *dest = (PackedInt32Array *)&raw_dest; + memnew_placement(dest, PackedInt32Array(self->operator PackedInt32Array())); // operator = is overloaded by PackedInt32Array *dest = *self; return raw_dest; } @@ -411,8 +411,8 @@ godot_packed_int_array GDAPI godot_variant_as_packed_int_array(const godot_varia godot_packed_real_array GDAPI godot_variant_as_packed_real_array(const godot_variant *p_self) { godot_packed_real_array raw_dest; const Variant *self = (const Variant *)p_self; - PackedRealArray *dest = (PackedRealArray *)&raw_dest; - memnew_placement(dest, PackedRealArray(self->operator PackedRealArray())); // operator = is overloaded by PackedRealArray + PackedFloat32Array *dest = (PackedFloat32Array *)&raw_dest; + memnew_placement(dest, PackedFloat32Array(self->operator PackedFloat32Array())); // operator = is overloaded by PackedFloat32Array *dest = *self; return raw_dest; } diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h index 315fb7ada2..c610377f54 100644 --- a/modules/gdnative/include/gdnative/pool_arrays.h +++ b/modules/gdnative/include/gdnative/pool_arrays.h @@ -48,7 +48,7 @@ typedef struct { } godot_packed_byte_array; #endif -/////// PackedIntArray +/////// PackedInt32Array #define GODOT_PACKED_INT_ARRAY_SIZE sizeof(void *) @@ -59,7 +59,7 @@ typedef struct { } godot_packed_int_array; #endif -/////// PackedRealArray +/////// PackedFloat32Array #define GODOT_PACKED_REAL_ARRAY_SIZE sizeof(void *) diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index bc3f66719f..85265a1fe5 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -1124,7 +1124,7 @@ static bool _guess_expression_type(GDScriptCompletionContext &p_context, const G v2 = 1; v2_use_value = false; } - if (vop == Variant::OP_DIVIDE && v2.get_type() == Variant::REAL) { + if (vop == Variant::OP_DIVIDE && v2.get_type() == Variant::FLOAT) { v2 = 1.0; v2_use_value = false; } @@ -2173,7 +2173,7 @@ static void _find_identifiers(const GDScriptCompletionContext &p_context, bool p static const char *_type_names[Variant::VARIANT_MAX] = { "null", "bool", "int", "float", "String", "Vector2", "Rect2", "Vector3", "Transform2D", "Plane", "Quat", "AABB", "Basis", "Transform", - "Color", "NodePath", "RID", "Object", "Dictionary", "Array", "PackedByteArray", "PackedIntArray", "PackedRealArray", "PackedStringArray", + "Color", "NodePath", "RID", "Object", "Callable", "Signal", "Dictionary", "Array", "PackedByteArray", "PackedInt32Array", "PackedInt64Array", "PackedFloat32Array", "PackedFloat64Array", "PackedStringArray", "PackedVector2Array", "PackedVector3Array", "PackedColorArray" }; diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index 426b5b58cb..aaa308f40f 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -162,7 +162,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ if (!p_args[m_arg]->is_num()) { \ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \ r_error.argument = m_arg; \ - r_error.expected = Variant::REAL; \ + r_error.expected = Variant::FLOAT; \ r_ret = Variant(); \ return; \ } @@ -272,7 +272,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ int64_t i = *p_args[0]; r_ret = ABS(i); - } else if (p_args[0]->get_type() == Variant::REAL) { + } else if (p_args[0]->get_type() == Variant::FLOAT) { double r = *p_args[0]; r_ret = Math::abs(r); @@ -280,7 +280,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::REAL; + r_error.expected = Variant::FLOAT; r_ret = Variant(); } } break; @@ -290,7 +290,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ int64_t i = *p_args[0]; r_ret = i < 0 ? -1 : (i > 0 ? +1 : 0); - } else if (p_args[0]->get_type() == Variant::REAL) { + } else if (p_args[0]->get_type() == Variant::FLOAT) { real_t r = *p_args[0]; r_ret = r < 0.0 ? -1.0 : (r > 0.0 ? +1.0 : 0.0); @@ -298,7 +298,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::REAL; + r_error.expected = Variant::FLOAT; r_ret = Variant(); } } break; @@ -360,7 +360,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ VALIDATE_ARG_COUNT(3); VALIDATE_ARG_NUM(2); const double t = (double)*p_args[2]; - switch (p_args[0]->get_type() == p_args[1]->get_type() ? p_args[0]->get_type() : Variant::REAL) { + switch (p_args[0]->get_type() == p_args[1]->get_type() ? p_args[0]->get_type() : Variant::FLOAT) { case Variant::VECTOR2: { r_ret = ((Vector2)*p_args[0]).linear_interpolate((Vector2)*p_args[1], t); } break; @@ -1359,7 +1359,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ case INSTANCE_FROM_ID: { VALIDATE_ARG_COUNT(1); - if (p_args[0]->get_type() != Variant::INT && p_args[0]->get_type() != Variant::REAL) { + if (p_args[0]->get_type() != Variant::INT && p_args[0]->get_type() != Variant::FLOAT) { r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; r_error.expected = Variant::INT; @@ -1395,14 +1395,24 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ Vector<uint8_t> d = *p_args[0]; r_ret = d.size(); } break; - case Variant::PACKED_INT_ARRAY: { + case Variant::PACKED_INT32_ARRAY: { - Vector<int> d = *p_args[0]; + Vector<int32_t> d = *p_args[0]; r_ret = d.size(); } break; - case Variant::PACKED_REAL_ARRAY: { + case Variant::PACKED_INT64_ARRAY: { - Vector<real_t> d = *p_args[0]; + Vector<int64_t> d = *p_args[0]; + r_ret = d.size(); + } break; + case Variant::PACKED_FLOAT32_ARRAY: { + + Vector<float> d = *p_args[0]; + r_ret = d.size(); + } break; + case Variant::PACKED_FLOAT64_ARRAY: { + + Vector<double> d = *p_args[0]; r_ret = d.size(); } break; case Variant::PACKED_STRING_ARRAY: { @@ -1530,69 +1540,69 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) { switch (p_func) { case MATH_SIN: { - MethodInfo mi("sin", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("sin", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_COS: { - MethodInfo mi("cos", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("cos", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_TAN: { - MethodInfo mi("tan", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("tan", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_SINH: { - MethodInfo mi("sinh", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("sinh", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_COSH: { - MethodInfo mi("cosh", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("cosh", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_TANH: { - MethodInfo mi("tanh", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("tanh", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_ASIN: { - MethodInfo mi("asin", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("asin", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_ACOS: { - MethodInfo mi("acos", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("acos", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_ATAN: { - MethodInfo mi("atan", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("atan", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_ATAN2: { - MethodInfo mi("atan2", PropertyInfo(Variant::REAL, "y"), PropertyInfo(Variant::REAL, "x")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("atan2", PropertyInfo(Variant::FLOAT, "y"), PropertyInfo(Variant::FLOAT, "x")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_SQRT: { - MethodInfo mi("sqrt", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("sqrt", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_FMOD: { - MethodInfo mi("fmod", PropertyInfo(Variant::REAL, "a"), PropertyInfo(Variant::REAL, "b")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("fmod", PropertyInfo(Variant::FLOAT, "a"), PropertyInfo(Variant::FLOAT, "b")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_FPOSMOD: { - MethodInfo mi("fposmod", PropertyInfo(Variant::REAL, "a"), PropertyInfo(Variant::REAL, "b")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("fposmod", PropertyInfo(Variant::FLOAT, "a"), PropertyInfo(Variant::FLOAT, "b")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_POSMOD: { @@ -1601,114 +1611,114 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) { return mi; } break; case MATH_FLOOR: { - MethodInfo mi("floor", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("floor", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_CEIL: { - MethodInfo mi("ceil", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("ceil", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_ROUND: { - MethodInfo mi("round", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("round", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_ABS: { - MethodInfo mi("abs", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("abs", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_SIGN: { - MethodInfo mi("sign", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("sign", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_POW: { - MethodInfo mi("pow", PropertyInfo(Variant::REAL, "base"), PropertyInfo(Variant::REAL, "exp")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("pow", PropertyInfo(Variant::FLOAT, "base"), PropertyInfo(Variant::FLOAT, "exp")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_LOG: { - MethodInfo mi("log", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("log", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_EXP: { - MethodInfo mi("exp", PropertyInfo(Variant::REAL, "s")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("exp", PropertyInfo(Variant::FLOAT, "s")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_ISNAN: { - MethodInfo mi("is_nan", PropertyInfo(Variant::REAL, "s")); + MethodInfo mi("is_nan", PropertyInfo(Variant::FLOAT, "s")); mi.return_val.type = Variant::BOOL; return mi; } break; case MATH_ISINF: { - MethodInfo mi("is_inf", PropertyInfo(Variant::REAL, "s")); + MethodInfo mi("is_inf", PropertyInfo(Variant::FLOAT, "s")); mi.return_val.type = Variant::BOOL; return mi; } break; case MATH_ISEQUALAPPROX: { - MethodInfo mi("is_equal_approx", PropertyInfo(Variant::REAL, "a"), PropertyInfo(Variant::REAL, "b")); + MethodInfo mi("is_equal_approx", PropertyInfo(Variant::FLOAT, "a"), PropertyInfo(Variant::FLOAT, "b")); mi.return_val.type = Variant::BOOL; return mi; } break; case MATH_ISZEROAPPROX: { - MethodInfo mi("is_zero_approx", PropertyInfo(Variant::REAL, "s")); + MethodInfo mi("is_zero_approx", PropertyInfo(Variant::FLOAT, "s")); mi.return_val.type = Variant::BOOL; return mi; } break; case MATH_EASE: { - MethodInfo mi("ease", PropertyInfo(Variant::REAL, "s"), PropertyInfo(Variant::REAL, "curve")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("ease", PropertyInfo(Variant::FLOAT, "s"), PropertyInfo(Variant::FLOAT, "curve")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_STEP_DECIMALS: { - MethodInfo mi("step_decimals", PropertyInfo(Variant::REAL, "step")); + MethodInfo mi("step_decimals", PropertyInfo(Variant::FLOAT, "step")); mi.return_val.type = Variant::INT; return mi; } break; case MATH_STEPIFY: { - MethodInfo mi("stepify", PropertyInfo(Variant::REAL, "s"), PropertyInfo(Variant::REAL, "step")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("stepify", PropertyInfo(Variant::FLOAT, "s"), PropertyInfo(Variant::FLOAT, "step")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_LERP: { - MethodInfo mi("lerp", PropertyInfo(Variant::NIL, "from"), PropertyInfo(Variant::NIL, "to"), PropertyInfo(Variant::REAL, "weight")); + MethodInfo mi("lerp", PropertyInfo(Variant::NIL, "from"), PropertyInfo(Variant::NIL, "to"), PropertyInfo(Variant::FLOAT, "weight")); mi.return_val.type = Variant::NIL; mi.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; return mi; } break; case MATH_LERP_ANGLE: { - MethodInfo mi("lerp_angle", PropertyInfo(Variant::REAL, "from"), PropertyInfo(Variant::REAL, "to"), PropertyInfo(Variant::REAL, "weight")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("lerp_angle", PropertyInfo(Variant::FLOAT, "from"), PropertyInfo(Variant::FLOAT, "to"), PropertyInfo(Variant::FLOAT, "weight")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_INVERSE_LERP: { - MethodInfo mi("inverse_lerp", PropertyInfo(Variant::REAL, "from"), PropertyInfo(Variant::REAL, "to"), PropertyInfo(Variant::REAL, "weight")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("inverse_lerp", PropertyInfo(Variant::FLOAT, "from"), PropertyInfo(Variant::FLOAT, "to"), PropertyInfo(Variant::FLOAT, "weight")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_RANGE_LERP: { - MethodInfo mi("range_lerp", PropertyInfo(Variant::REAL, "value"), PropertyInfo(Variant::REAL, "istart"), PropertyInfo(Variant::REAL, "istop"), PropertyInfo(Variant::REAL, "ostart"), PropertyInfo(Variant::REAL, "ostop")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("range_lerp", PropertyInfo(Variant::FLOAT, "value"), PropertyInfo(Variant::FLOAT, "istart"), PropertyInfo(Variant::FLOAT, "istop"), PropertyInfo(Variant::FLOAT, "ostart"), PropertyInfo(Variant::FLOAT, "ostop")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_SMOOTHSTEP: { - MethodInfo mi("smoothstep", PropertyInfo(Variant::REAL, "from"), PropertyInfo(Variant::REAL, "to"), PropertyInfo(Variant::REAL, "weight")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("smoothstep", PropertyInfo(Variant::FLOAT, "from"), PropertyInfo(Variant::FLOAT, "to"), PropertyInfo(Variant::FLOAT, "weight")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_MOVE_TOWARD: { - MethodInfo mi("move_toward", PropertyInfo(Variant::REAL, "from"), PropertyInfo(Variant::REAL, "to"), PropertyInfo(Variant::REAL, "delta")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("move_toward", PropertyInfo(Variant::FLOAT, "from"), PropertyInfo(Variant::FLOAT, "to"), PropertyInfo(Variant::FLOAT, "delta")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_DECTIME: { - MethodInfo mi("dectime", PropertyInfo(Variant::REAL, "value"), PropertyInfo(Variant::REAL, "amount"), PropertyInfo(Variant::REAL, "step")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("dectime", PropertyInfo(Variant::FLOAT, "value"), PropertyInfo(Variant::FLOAT, "amount"), PropertyInfo(Variant::FLOAT, "step")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_RANDOMIZE: { @@ -1723,12 +1733,12 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) { } break; case MATH_RANDF: { MethodInfo mi("randf"); - mi.return_val.type = Variant::REAL; + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_RANDOM: { - MethodInfo mi("rand_range", PropertyInfo(Variant::REAL, "from"), PropertyInfo(Variant::REAL, "to")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("rand_range", PropertyInfo(Variant::FLOAT, "from"), PropertyInfo(Variant::FLOAT, "to")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_SEED: { @@ -1742,32 +1752,32 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) { return mi; } break; case MATH_DEG2RAD: { - MethodInfo mi("deg2rad", PropertyInfo(Variant::REAL, "deg")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("deg2rad", PropertyInfo(Variant::FLOAT, "deg")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_RAD2DEG: { - MethodInfo mi("rad2deg", PropertyInfo(Variant::REAL, "rad")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("rad2deg", PropertyInfo(Variant::FLOAT, "rad")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_LINEAR2DB: { - MethodInfo mi("linear2db", PropertyInfo(Variant::REAL, "nrg")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("linear2db", PropertyInfo(Variant::FLOAT, "nrg")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_DB2LINEAR: { - MethodInfo mi("db2linear", PropertyInfo(Variant::REAL, "db")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("db2linear", PropertyInfo(Variant::FLOAT, "db")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case MATH_POLAR2CARTESIAN: { - MethodInfo mi("polar2cartesian", PropertyInfo(Variant::REAL, "r"), PropertyInfo(Variant::REAL, "th")); + MethodInfo mi("polar2cartesian", PropertyInfo(Variant::FLOAT, "r"), PropertyInfo(Variant::FLOAT, "th")); mi.return_val.type = Variant::VECTOR2; return mi; } break; case MATH_CARTESIAN2POLAR: { - MethodInfo mi("cartesian2polar", PropertyInfo(Variant::REAL, "x"), PropertyInfo(Variant::REAL, "y")); + MethodInfo mi("cartesian2polar", PropertyInfo(Variant::FLOAT, "x"), PropertyInfo(Variant::FLOAT, "y")); mi.return_val.type = Variant::VECTOR2; return mi; } break; @@ -1777,24 +1787,24 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) { return mi; } break; case MATH_WRAPF: { - MethodInfo mi("wrapf", PropertyInfo(Variant::REAL, "value"), PropertyInfo(Variant::REAL, "min"), PropertyInfo(Variant::REAL, "max")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("wrapf", PropertyInfo(Variant::FLOAT, "value"), PropertyInfo(Variant::FLOAT, "min"), PropertyInfo(Variant::FLOAT, "max")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case LOGIC_MAX: { - MethodInfo mi("max", PropertyInfo(Variant::REAL, "a"), PropertyInfo(Variant::REAL, "b")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("max", PropertyInfo(Variant::FLOAT, "a"), PropertyInfo(Variant::FLOAT, "b")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case LOGIC_MIN: { - MethodInfo mi("min", PropertyInfo(Variant::REAL, "a"), PropertyInfo(Variant::REAL, "b")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("min", PropertyInfo(Variant::FLOAT, "a"), PropertyInfo(Variant::FLOAT, "b")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case LOGIC_CLAMP: { - MethodInfo mi("clamp", PropertyInfo(Variant::REAL, "value"), PropertyInfo(Variant::REAL, "min"), PropertyInfo(Variant::REAL, "max")); - mi.return_val.type = Variant::REAL; + MethodInfo mi("clamp", PropertyInfo(Variant::FLOAT, "value"), PropertyInfo(Variant::FLOAT, "min"), PropertyInfo(Variant::FLOAT, "max")); + mi.return_val.type = Variant::FLOAT; return mi; } break; case LOGIC_NEAREST_PO2: { @@ -2012,7 +2022,7 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) { } break; case COLORN: { - MethodInfo mi("ColorN", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::REAL, "alpha")); + MethodInfo mi("ColorN", PropertyInfo(Variant::STRING, "name"), PropertyInfo(Variant::FLOAT, "alpha")); mi.default_arguments.push_back(1.0f); mi.return_val.type = Variant::COLOR; return mi; diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp index 842ce6c1c1..0382944efd 100644 --- a/modules/gdscript/gdscript_parser.cpp +++ b/modules/gdscript/gdscript_parser.cpp @@ -3108,7 +3108,7 @@ void GDScriptParser::_parse_block(BlockNode *p_block, bool p_static) { args.push_back(op->arguments[i]); if (constant && op->arguments[i]->type == Node::TYPE_CONSTANT) { ConstantNode *c = static_cast<ConstantNode *>(op->arguments[i]); - if (c->value.get_type() == Variant::REAL || c->value.get_type() == Variant::INT) { + if (c->value.get_type() == Variant::FLOAT || c->value.get_type() == Variant::INT) { constants.push_back(c->value); constant = true; } @@ -4222,7 +4222,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) { [[fallthrough]]; } - case Variant::REAL: { + case Variant::FLOAT: { if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "EASE") { current_export.hint = PROPERTY_HINT_EXP_EASING; @@ -5955,10 +5955,10 @@ GDScriptParser::DataType GDScriptParser::_get_operation_type(const Variant::Oper } // Avoid division by zero - if (a_type == Variant::INT || a_type == Variant::REAL) { + if (a_type == Variant::INT || a_type == Variant::FLOAT) { Variant::evaluate(Variant::OP_ADD, a, 1, a, r_valid); } - if (b_type == Variant::INT || b_type == Variant::REAL) { + if (b_type == Variant::INT || b_type == Variant::FLOAT) { Variant::evaluate(Variant::OP_ADD, b, 1, b, r_valid); } if (a_type == Variant::STRING && b_type != Variant::ARRAY) { @@ -6598,14 +6598,16 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { // Expect int or real as index case Variant::PACKED_BYTE_ARRAY: case Variant::PACKED_COLOR_ARRAY: - case Variant::PACKED_INT_ARRAY: - case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_INT32_ARRAY: + case Variant::PACKED_INT64_ARRAY: + case Variant::PACKED_FLOAT32_ARRAY: + case Variant::PACKED_FLOAT64_ARRAY: case Variant::PACKED_STRING_ARRAY: case Variant::PACKED_VECTOR2_ARRAY: case Variant::PACKED_VECTOR3_ARRAY: case Variant::ARRAY: case Variant::STRING: { - error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::REAL; + error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::FLOAT; } break; // Expect String only case Variant::RECT2: @@ -6621,7 +6623,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { case Variant::TRANSFORM2D: case Variant::BASIS: case Variant::TRANSFORM: { - error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::REAL && + error = index_type.builtin_type != Variant::INT && index_type.builtin_type != Variant::FLOAT && index_type.builtin_type != Variant::STRING; } break; // Expect String or int @@ -6648,8 +6650,10 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { case Variant::DICTIONARY: case Variant::PACKED_BYTE_ARRAY: case Variant::PACKED_COLOR_ARRAY: - case Variant::PACKED_INT_ARRAY: - case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_INT32_ARRAY: + case Variant::PACKED_INT64_ARRAY: + case Variant::PACKED_FLOAT32_ARRAY: + case Variant::PACKED_FLOAT64_ARRAY: case Variant::PACKED_STRING_ARRAY: case Variant::PACKED_VECTOR2_ARRAY: case Variant::PACKED_VECTOR3_ARRAY: { @@ -6691,7 +6695,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { case Variant::NIL: case Variant::BOOL: case Variant::INT: - case Variant::REAL: + case Variant::FLOAT: case Variant::NODE_PATH: case Variant::_RID: { _set_error("Can't index on a value of type \"" + base_type.to_string() + "\".", op->line); @@ -6699,15 +6703,17 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) { } break; // Return int case Variant::PACKED_BYTE_ARRAY: - case Variant::PACKED_INT_ARRAY: { + case Variant::PACKED_INT32_ARRAY: + case Variant::PACKED_INT64_ARRAY: { result.builtin_type = Variant::INT; } break; // Return real - case Variant::PACKED_REAL_ARRAY: + case Variant::PACKED_FLOAT32_ARRAY: + case Variant::PACKED_FLOAT64_ARRAY: case Variant::VECTOR2: case Variant::VECTOR3: case Variant::QUAT: { - result.builtin_type = Variant::REAL; + result.builtin_type = Variant::FLOAT; } break; // Return color case Variant::PACKED_COLOR_ARRAY: { @@ -7002,7 +7008,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat break; } else { #ifdef DEBUG_ENABLED - if (arg_type.kind == DataType::BUILTIN && arg_type.builtin_type == Variant::INT && par_types[i].kind == DataType::BUILTIN && par_types[i].builtin_type == Variant::REAL) { + if (arg_type.kind == DataType::BUILTIN && arg_type.builtin_type == Variant::INT && par_types[i].kind == DataType::BUILTIN && par_types[i].builtin_type == Variant::FLOAT) { _add_warning(GDScriptWarning::NARROWING_CONVERSION, p_call->line, Variant::get_type_name(tn->vtype)); } if (par_types[i].may_yield && p_call->arguments[i + 1]->type == Node::TYPE_OPERATOR) { @@ -7245,7 +7251,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat _mark_line_as_unsafe(p_call->line); } } else { - if (arg_type.kind == DataType::BUILTIN && arg_type.builtin_type == Variant::INT && par_type.kind == DataType::BUILTIN && par_type.builtin_type == Variant::REAL) { + if (arg_type.kind == DataType::BUILTIN && arg_type.builtin_type == Variant::INT && par_type.kind == DataType::BUILTIN && par_type.builtin_type == Variant::FLOAT) { _add_warning(GDScriptWarning::NARROWING_CONVERSION, p_call->line, callee_name); } } @@ -8103,7 +8109,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) { lv->assign = convert_call; lv->assign_op->arguments.write[1] = convert_call; #ifdef DEBUG_ENABLED - if (lv->datatype.builtin_type == Variant::INT && assign_type.builtin_type == Variant::REAL) { + if (lv->datatype.builtin_type == Variant::INT && assign_type.builtin_type == Variant::FLOAT) { _add_warning(GDScriptWarning::NARROWING_CONVERSION, lv->line); } #endif // DEBUG_ENABLED @@ -8240,7 +8246,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) { type_match = true; // Since we are converting, the type is matching } #ifdef DEBUG_ENABLED - if (lh_type.builtin_type == Variant::INT && rh_type.builtin_type == Variant::REAL) { + if (lh_type.builtin_type == Variant::INT && rh_type.builtin_type == Variant::FLOAT) { _add_warning(GDScriptWarning::NARROWING_CONVERSION, op->line); } #endif // DEBUG_ENABLED diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index 818033025e..9064998d32 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -146,7 +146,7 @@ static const _bit _type_list[] = { //types { Variant::BOOL, "bool" }, { Variant::INT, "int" }, - { Variant::REAL, "float" }, + { Variant::FLOAT, "float" }, { Variant::STRING, "String" }, { Variant::VECTOR2, "Vector2" }, { Variant::VECTOR2I, "Vector2i" }, @@ -170,8 +170,10 @@ static const _bit _type_list[] = { { Variant::SIGNAL, "Signal" }, { Variant::ARRAY, "Array" }, { Variant::PACKED_BYTE_ARRAY, "PackedByteArray" }, - { Variant::PACKED_INT_ARRAY, "PackedIntArray" }, - { Variant::PACKED_REAL_ARRAY, "PackedRealArray" }, + { Variant::PACKED_INT32_ARRAY, "PackedInt32Array" }, + { Variant::PACKED_INT64_ARRAY, "PackedInt64Array" }, + { Variant::PACKED_FLOAT32_ARRAY, "PackedFloat32Array" }, + { Variant::PACKED_FLOAT64_ARRAY, "PackedFloat64Array" }, { Variant::PACKED_STRING_ARRAY, "PackedStringArray" }, { Variant::PACKED_VECTOR2_ARRAY, "PackedVector2Array" }, { Variant::PACKED_VECTOR3_ARRAY, "PackedVector3Array" }, diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index ba0449c046..84075f76fd 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -874,7 +874,7 @@ void GridMap::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cell_center_x"), "set_center_x", "get_center_x"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cell_center_y"), "set_center_y", "get_center_y"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "cell_center_z"), "set_center_z", "get_center_z"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_scale"), "set_cell_scale", "get_cell_scale"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "cell_scale"), "set_cell_scale", "get_cell_scale"); ADD_GROUP("Collision", "collision_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_layer", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_layer", "get_collision_layer"); ADD_PROPERTY(PropertyInfo(Variant::INT, "collision_mask", PROPERTY_HINT_LAYERS_3D_PHYSICS), "set_collision_mask", "get_collision_mask"); diff --git a/modules/mobile_vr/mobile_vr_interface.cpp b/modules/mobile_vr/mobile_vr_interface.cpp index afa8766bce..2f1d95cd42 100644 --- a/modules/mobile_vr/mobile_vr_interface.cpp +++ b/modules/mobile_vr/mobile_vr_interface.cpp @@ -221,13 +221,13 @@ void MobileVRInterface::_bind_methods() { ClassDB::bind_method(D_METHOD("set_k2", "k"), &MobileVRInterface::set_k2); ClassDB::bind_method(D_METHOD("get_k2"), &MobileVRInterface::get_k2); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "eye_height", PROPERTY_HINT_RANGE, "0.0,3.0,0.1"), "set_eye_height", "get_eye_height"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "iod", PROPERTY_HINT_RANGE, "4.0,10.0,0.1"), "set_iod", "get_iod"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "display_width", PROPERTY_HINT_RANGE, "5.0,25.0,0.1"), "set_display_width", "get_display_width"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "display_to_lens", PROPERTY_HINT_RANGE, "5.0,25.0,0.1"), "set_display_to_lens", "get_display_to_lens"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "oversample", PROPERTY_HINT_RANGE, "1.0,2.0,0.1"), "set_oversample", "get_oversample"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "k1", PROPERTY_HINT_RANGE, "0.1,10.0,0.0001"), "set_k1", "get_k1"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "k2", PROPERTY_HINT_RANGE, "0.1,10.0,0.0001"), "set_k2", "get_k2"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "eye_height", PROPERTY_HINT_RANGE, "0.0,3.0,0.1"), "set_eye_height", "get_eye_height"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "iod", PROPERTY_HINT_RANGE, "4.0,10.0,0.1"), "set_iod", "get_iod"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "display_width", PROPERTY_HINT_RANGE, "5.0,25.0,0.1"), "set_display_width", "get_display_width"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "display_to_lens", PROPERTY_HINT_RANGE, "5.0,25.0,0.1"), "set_display_to_lens", "get_display_to_lens"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "oversample", PROPERTY_HINT_RANGE, "1.0,2.0,0.1"), "set_oversample", "get_oversample"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "k1", PROPERTY_HINT_RANGE, "0.1,10.0,0.0001"), "set_k1", "get_k1"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "k2", PROPERTY_HINT_RANGE, "0.1,10.0,0.0001"), "set_k2", "get_k2"); } void MobileVRInterface::set_eye_height(const real_t p_eye_height) { diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 2b3b6aa98a..5c1c098e3e 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -411,7 +411,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { if (p_var_type_name == Variant::get_type_name(Variant::OBJECT)) return "Godot.Object"; - if (p_var_type_name == Variant::get_type_name(Variant::REAL)) { + if (p_var_type_name == Variant::get_type_name(Variant::FLOAT)) { #ifdef REAL_T_IS_DOUBLE return "double"; #else @@ -430,9 +430,9 @@ static String variant_type_to_managed_name(const String &p_var_type_name) { if (p_var_type_name == Variant::get_type_name(Variant::PACKED_BYTE_ARRAY)) return "byte[]"; - if (p_var_type_name == Variant::get_type_name(Variant::PACKED_INT_ARRAY)) + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_INT32_ARRAY)) return "int[]"; - if (p_var_type_name == Variant::get_type_name(Variant::PACKED_REAL_ARRAY)) { + if (p_var_type_name == Variant::get_type_name(Variant::PACKED_FLOAT32_ARRAY)) { #ifdef REAL_T_IS_DOUBLE return "double[]"; #else 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); diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp index 21d78483ee..03b56c9949 100644 --- a/modules/mono/mono_gd/gd_mono_field.cpp +++ b/modules/mono/mono_gd/gd_mono_field.cpp @@ -252,12 +252,12 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ } if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) { - SET_FROM_ARRAY(PackedIntArray); + SET_FROM_ARRAY(PackedInt32Array); break; } if (array_type->eklass == REAL_T_MONOCLASS) { - SET_FROM_ARRAY(PackedRealArray); + SET_FROM_ARRAY(PackedFloat32Array); break; } @@ -370,7 +370,7 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ int32_t val = p_value.operator signed int(); mono_field_set_value(p_object, mono_field, &val); } break; - case Variant::REAL: { + case Variant::FLOAT: { #ifdef REAL_T_IS_DOUBLE double val = p_value.operator double(); mono_field_set_value(p_object, mono_field, &val); @@ -437,11 +437,11 @@ void GDMonoField::set_value_from_variant(MonoObject *p_object, const Variant &p_ case Variant::PACKED_BYTE_ARRAY: { SET_FROM_ARRAY(PackedByteArray); } break; - case Variant::PACKED_INT_ARRAY: { - SET_FROM_ARRAY(PackedIntArray); + case Variant::PACKED_INT32_ARRAY: { + SET_FROM_ARRAY(PackedInt32Array); } break; - case Variant::PACKED_REAL_ARRAY: { - SET_FROM_ARRAY(PackedRealArray); + case Variant::PACKED_FLOAT32_ARRAY: { + SET_FROM_ARRAY(PackedFloat32Array); } break; case Variant::PACKED_STRING_ARRAY: { SET_FROM_ARRAY(PackedStringArray); diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp index 63890f6066..695be64d6e 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.cpp +++ b/modules/mono/mono_gd/gd_mono_marshal.cpp @@ -60,9 +60,9 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { return Variant::INT; case MONO_TYPE_R4: - return Variant::REAL; + return Variant::FLOAT; case MONO_TYPE_R8: - return Variant::REAL; + return Variant::FLOAT; case MONO_TYPE_STRING: { return Variant::STRING; @@ -116,10 +116,10 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) { return Variant::PACKED_BYTE_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return Variant::PACKED_INT_ARRAY; + return Variant::PACKED_INT32_ARRAY; if (array_type->eklass == REAL_T_MONOCLASS) - return Variant::PACKED_REAL_ARRAY; + return Variant::PACKED_FLOAT32_ARRAY; if (array_type->eklass == CACHED_CLASS_RAW(String)) return Variant::PACKED_STRING_ARRAY; @@ -494,10 +494,10 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty return (MonoObject *)PackedByteArray_to_mono_array(p_var->operator PackedByteArray()); if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return (MonoObject *)PackedIntArray_to_mono_array(p_var->operator PackedIntArray()); + return (MonoObject *)PackedInt32Array_to_mono_array(p_var->operator PackedInt32Array()); if (array_type->eklass == REAL_T_MONOCLASS) - return (MonoObject *)PackedRealArray_to_mono_array(p_var->operator PackedRealArray()); + return (MonoObject *)PackedFloat32Array_to_mono_array(p_var->operator PackedFloat32Array()); if (array_type->eklass == CACHED_CLASS_RAW(String)) return (MonoObject *)PackedStringArray_to_mono_array(p_var->operator PackedStringArray()); @@ -577,7 +577,7 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty int32_t val = p_var->operator signed int(); return BOX_INT32(val); } - case Variant::REAL: { + case Variant::FLOAT: { #ifdef REAL_T_IS_DOUBLE double val = p_var->operator double(); return BOX_DOUBLE(val); @@ -640,10 +640,10 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty return GDMonoUtils::create_managed_from(p_var->operator Array(), CACHED_CLASS(Array)); case Variant::PACKED_BYTE_ARRAY: return (MonoObject *)PackedByteArray_to_mono_array(p_var->operator PackedByteArray()); - case Variant::PACKED_INT_ARRAY: - return (MonoObject *)PackedIntArray_to_mono_array(p_var->operator PackedIntArray()); - case Variant::PACKED_REAL_ARRAY: - return (MonoObject *)PackedRealArray_to_mono_array(p_var->operator PackedRealArray()); + case Variant::PACKED_INT32_ARRAY: + return (MonoObject *)PackedInt32Array_to_mono_array(p_var->operator PackedInt32Array()); + case Variant::PACKED_FLOAT32_ARRAY: + return (MonoObject *)PackedFloat32Array_to_mono_array(p_var->operator PackedFloat32Array()); case Variant::PACKED_STRING_ARRAY: return (MonoObject *)PackedStringArray_to_mono_array(p_var->operator PackedStringArray()); case Variant::PACKED_VECTOR2_ARRAY: @@ -788,10 +788,10 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type return mono_array_to_PackedByteArray((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(int32_t)) - return mono_array_to_PackedIntArray((MonoArray *)p_obj); + return mono_array_to_PackedInt32Array((MonoArray *)p_obj); if (array_type->eklass == REAL_T_MONOCLASS) - return mono_array_to_PackedRealArray((MonoArray *)p_obj); + return mono_array_to_PackedFloat32Array((MonoArray *)p_obj); if (array_type->eklass == CACHED_CLASS_RAW(String)) return mono_array_to_PackedStringArray((MonoArray *)p_obj); @@ -987,7 +987,7 @@ Array mono_array_to_Array(MonoArray *p_array) { // TODO: Use memcpy where possible -MonoArray *PackedIntArray_to_mono_array(const PackedIntArray &p_array) { +MonoArray *PackedInt32Array_to_mono_array(const PackedInt32Array &p_array) { const int *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), CACHED_CLASS_RAW(int32_t), p_array.size()); @@ -999,8 +999,8 @@ MonoArray *PackedIntArray_to_mono_array(const PackedIntArray &p_array) { return ret; } -PackedIntArray mono_array_to_PackedIntArray(MonoArray *p_array) { - PackedIntArray ret; +PackedInt32Array mono_array_to_PackedInt32Array(MonoArray *p_array) { + PackedInt32Array ret; if (!p_array) return ret; int length = mono_array_length(p_array); @@ -1041,7 +1041,7 @@ PackedByteArray mono_array_to_PackedByteArray(MonoArray *p_array) { return ret; } -MonoArray *PackedRealArray_to_mono_array(const PackedRealArray &p_array) { +MonoArray *PackedFloat32Array_to_mono_array(const PackedFloat32Array &p_array) { const real_t *r = p_array.ptr(); MonoArray *ret = mono_array_new(mono_domain_get(), REAL_T_MONOCLASS, p_array.size()); @@ -1053,8 +1053,8 @@ MonoArray *PackedRealArray_to_mono_array(const PackedRealArray &p_array) { return ret; } -PackedRealArray mono_array_to_PackedRealArray(MonoArray *p_array) { - PackedRealArray ret; +PackedFloat32Array mono_array_to_PackedFloat32Array(MonoArray *p_array) { + PackedFloat32Array ret; if (!p_array) return ret; int length = mono_array_length(p_array); diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h index d3527109ff..5db59522ce 100644 --- a/modules/mono/mono_gd/gd_mono_marshal.h +++ b/modules/mono/mono_gd/gd_mono_marshal.h @@ -127,20 +127,20 @@ String mono_object_to_variant_string(MonoObject *p_obj, MonoException **r_exc); MonoArray *Array_to_mono_array(const Array &p_array); Array mono_array_to_Array(MonoArray *p_array); -// PackedIntArray +// PackedInt32Array -MonoArray *PackedIntArray_to_mono_array(const PackedIntArray &p_array); -PackedIntArray mono_array_to_PackedIntArray(MonoArray *p_array); +MonoArray *PackedInt32Array_to_mono_array(const PackedInt32Array &p_array); +PackedInt32Array mono_array_to_PackedInt32Array(MonoArray *p_array); // PackedByteArray MonoArray *PackedByteArray_to_mono_array(const PackedByteArray &p_array); PackedByteArray mono_array_to_PackedByteArray(MonoArray *p_array); -// PackedRealArray +// PackedFloat32Array -MonoArray *PackedRealArray_to_mono_array(const PackedRealArray &p_array); -PackedRealArray mono_array_to_PackedRealArray(MonoArray *p_array); +MonoArray *PackedFloat32Array_to_mono_array(const PackedFloat32Array &p_array); +PackedFloat32Array mono_array_to_PackedFloat32Array(MonoArray *p_array); // PackedStringArray diff --git a/modules/opensimplex/noise_texture.cpp b/modules/opensimplex/noise_texture.cpp index 35f0fb7ac0..d60099e676 100644 --- a/modules/opensimplex/noise_texture.cpp +++ b/modules/opensimplex/noise_texture.cpp @@ -84,7 +84,7 @@ void NoiseTexture::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "height", PROPERTY_HINT_RANGE, "1,2048,1,or_greater"), "set_height", "get_height"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "seamless"), "set_seamless", "get_seamless"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "as_normalmap"), "set_as_normalmap", "is_normalmap"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "bump_strength", PROPERTY_HINT_RANGE, "0,32,0.1,or_greater"), "set_bump_strength", "get_bump_strength"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bump_strength", PROPERTY_HINT_RANGE, "0,32,0.1,or_greater"), "set_bump_strength", "get_bump_strength"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "noise", PROPERTY_HINT_RESOURCE_TYPE, "OpenSimplexNoise"), "set_noise", "get_noise"); } diff --git a/modules/opensimplex/open_simplex_noise.cpp b/modules/opensimplex/open_simplex_noise.cpp index bd2dbd74a8..238faa4130 100644 --- a/modules/opensimplex/open_simplex_noise.cpp +++ b/modules/opensimplex/open_simplex_noise.cpp @@ -186,9 +186,9 @@ void OpenSimplexNoise::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "seed"), "set_seed", "get_seed"); ADD_PROPERTY(PropertyInfo(Variant::INT, "octaves", PROPERTY_HINT_RANGE, vformat("1,%d,1", MAX_OCTAVES)), "set_octaves", "get_octaves"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "period", PROPERTY_HINT_RANGE, "0.1,256.0,0.1"), "set_period", "get_period"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "persistence", PROPERTY_HINT_RANGE, "0.0,1.0,0.001"), "set_persistence", "get_persistence"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "lacunarity", PROPERTY_HINT_RANGE, "0.1,4.0,0.01"), "set_lacunarity", "get_lacunarity"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "period", PROPERTY_HINT_RANGE, "0.1,256.0,0.1"), "set_period", "get_period"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "persistence", PROPERTY_HINT_RANGE, "0.0,1.0,0.001"), "set_persistence", "get_persistence"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "lacunarity", PROPERTY_HINT_RANGE, "0.1,4.0,0.01"), "set_lacunarity", "get_lacunarity"); } float OpenSimplexNoise::get_noise_1d(float x) { diff --git a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp index 6224db90e7..054ed088df 100644 --- a/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp +++ b/modules/stb_vorbis/audio_stream_ogg_vorbis.cpp @@ -267,7 +267,7 @@ void AudioStreamOGGVorbis::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::PACKED_BYTE_ARRAY, "data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_data", "get_data"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "loop"), "set_loop", "has_loop"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "loop_offset"), "set_loop_offset", "get_loop_offset"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "loop_offset"), "set_loop_offset", "get_loop_offset"); } AudioStreamOGGVorbis::AudioStreamOGGVorbis() { diff --git a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp index ec89f2ac76..13d96541e3 100644 --- a/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp +++ b/modules/stb_vorbis/resource_importer_ogg_vorbis.cpp @@ -73,7 +73,7 @@ String ResourceImporterOGGVorbis::get_preset_name(int p_idx) const { void ResourceImporterOGGVorbis::get_import_options(List<ImportOption> *r_options, int p_preset) const { r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "loop"), true)); - r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "loop_offset"), 0)); + r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "loop_offset"), 0)); } Error ResourceImporterOGGVorbis::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) { diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp index 3fd2b474bb..07f152efd4 100644 --- a/modules/visual_script/visual_script_builtin_funcs.cpp +++ b/modules/visual_script/visual_script_builtin_funcs.cpp @@ -277,22 +277,22 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const case MATH_EXP: case MATH_ISNAN: case MATH_ISINF: { - return PropertyInfo(Variant::REAL, "s"); + return PropertyInfo(Variant::FLOAT, "s"); } break; case MATH_ATAN2: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "y"); + return PropertyInfo(Variant::FLOAT, "y"); else - return PropertyInfo(Variant::REAL, "x"); + return PropertyInfo(Variant::FLOAT, "x"); } break; case MATH_FMOD: case MATH_FPOSMOD: case LOGIC_MAX: case LOGIC_MIN: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "a"); + return PropertyInfo(Variant::FLOAT, "a"); else - return PropertyInfo(Variant::REAL, "b"); + return PropertyInfo(Variant::FLOAT, "b"); } break; case MATH_POSMOD: { if (p_idx == 0) @@ -302,63 +302,63 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const } break; case MATH_POW: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "base"); + return PropertyInfo(Variant::FLOAT, "base"); else - return PropertyInfo(Variant::REAL, "exp"); + return PropertyInfo(Variant::FLOAT, "exp"); } break; case MATH_EASE: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "s"); + return PropertyInfo(Variant::FLOAT, "s"); else - return PropertyInfo(Variant::REAL, "curve"); + return PropertyInfo(Variant::FLOAT, "curve"); } break; case MATH_STEP_DECIMALS: { - return PropertyInfo(Variant::REAL, "step"); + return PropertyInfo(Variant::FLOAT, "step"); } break; case MATH_STEPIFY: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "s"); + return PropertyInfo(Variant::FLOAT, "s"); else - return PropertyInfo(Variant::REAL, "steps"); + return PropertyInfo(Variant::FLOAT, "steps"); } break; case MATH_LERP: case MATH_LERP_ANGLE: case MATH_INVERSE_LERP: case MATH_SMOOTHSTEP: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "from"); + return PropertyInfo(Variant::FLOAT, "from"); else if (p_idx == 1) - return PropertyInfo(Variant::REAL, "to"); + return PropertyInfo(Variant::FLOAT, "to"); else - return PropertyInfo(Variant::REAL, "weight"); + return PropertyInfo(Variant::FLOAT, "weight"); } break; case MATH_RANGE_LERP: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "value"); + return PropertyInfo(Variant::FLOAT, "value"); else if (p_idx == 1) - return PropertyInfo(Variant::REAL, "istart"); + return PropertyInfo(Variant::FLOAT, "istart"); else if (p_idx == 2) - return PropertyInfo(Variant::REAL, "istop"); + return PropertyInfo(Variant::FLOAT, "istop"); else if (p_idx == 3) - return PropertyInfo(Variant::REAL, "ostart"); + return PropertyInfo(Variant::FLOAT, "ostart"); else - return PropertyInfo(Variant::REAL, "ostop"); + return PropertyInfo(Variant::FLOAT, "ostop"); } break; case MATH_MOVE_TOWARD: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "from"); + return PropertyInfo(Variant::FLOAT, "from"); else if (p_idx == 1) - return PropertyInfo(Variant::REAL, "to"); + return PropertyInfo(Variant::FLOAT, "to"); else - return PropertyInfo(Variant::REAL, "delta"); + return PropertyInfo(Variant::FLOAT, "delta"); } break; case MATH_DECTIME: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "value"); + return PropertyInfo(Variant::FLOAT, "value"); else if (p_idx == 1) - return PropertyInfo(Variant::REAL, "amount"); + return PropertyInfo(Variant::FLOAT, "amount"); else - return PropertyInfo(Variant::REAL, "step"); + return PropertyInfo(Variant::FLOAT, "step"); } break; case MATH_RANDOMIZE: case MATH_RAND: @@ -367,37 +367,37 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const } break; case MATH_RANDOM: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "from"); + return PropertyInfo(Variant::FLOAT, "from"); else - return PropertyInfo(Variant::REAL, "to"); + return PropertyInfo(Variant::FLOAT, "to"); } break; case MATH_SEED: case MATH_RANDSEED: { return PropertyInfo(Variant::INT, "seed"); } break; case MATH_DEG2RAD: { - return PropertyInfo(Variant::REAL, "deg"); + return PropertyInfo(Variant::FLOAT, "deg"); } break; case MATH_RAD2DEG: { - return PropertyInfo(Variant::REAL, "rad"); + return PropertyInfo(Variant::FLOAT, "rad"); } break; case MATH_LINEAR2DB: { - return PropertyInfo(Variant::REAL, "nrg"); + return PropertyInfo(Variant::FLOAT, "nrg"); } break; case MATH_DB2LINEAR: { - return PropertyInfo(Variant::REAL, "db"); + return PropertyInfo(Variant::FLOAT, "db"); } break; case MATH_POLAR2CARTESIAN: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "r"); + return PropertyInfo(Variant::FLOAT, "r"); else - return PropertyInfo(Variant::REAL, "th"); + return PropertyInfo(Variant::FLOAT, "th"); } break; case MATH_CARTESIAN2POLAR: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "x"); + return PropertyInfo(Variant::FLOAT, "x"); else - return PropertyInfo(Variant::REAL, "y"); + return PropertyInfo(Variant::FLOAT, "y"); } break; case MATH_WRAP: { if (p_idx == 0) @@ -410,11 +410,11 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const case MATH_WRAPF: case LOGIC_CLAMP: { if (p_idx == 0) - return PropertyInfo(Variant::REAL, "value"); + return PropertyInfo(Variant::FLOAT, "value"); else if (p_idx == 1) - return PropertyInfo(Variant::REAL, "min"); + return PropertyInfo(Variant::FLOAT, "min"); else - return PropertyInfo(Variant::REAL, "max"); + return PropertyInfo(Variant::FLOAT, "max"); } break; case LOGIC_NEAREST_PO2: { return PropertyInfo(Variant::INT, "value"); @@ -475,7 +475,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_input_value_port_info(int p_idx) const if (p_idx == 0) return PropertyInfo(Variant::STRING, "name"); else - return PropertyInfo(Variant::REAL, "alpha"); + return PropertyInfo(Variant::FLOAT, "alpha"); } break; case FUNC_MAX: { } @@ -504,7 +504,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons case MATH_FPOSMOD: case MATH_FLOOR: case MATH_CEIL: { - t = Variant::REAL; + t = Variant::FLOAT; } break; case MATH_POSMOD: case MATH_ROUND: { @@ -519,14 +519,14 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons case MATH_POW: case MATH_LOG: case MATH_EXP: { - t = Variant::REAL; + t = Variant::FLOAT; } break; case MATH_ISNAN: case MATH_ISINF: { t = Variant::BOOL; } break; case MATH_EASE: { - t = Variant::REAL; + t = Variant::FLOAT; } break; case MATH_STEP_DECIMALS: { t = Variant::INT; @@ -539,7 +539,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons case MATH_SMOOTHSTEP: case MATH_MOVE_TOWARD: case MATH_DECTIME: { - t = Variant::REAL; + t = Variant::FLOAT; } break; case MATH_RANDOMIZE: { @@ -551,7 +551,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons } break; case MATH_RANDF: case MATH_RANDOM: { - t = Variant::REAL; + t = Variant::FLOAT; } break; case MATH_SEED: { @@ -568,7 +568,7 @@ PropertyInfo VisualScriptBuiltinFunc::get_output_value_port_info(int p_idx) cons case MATH_LINEAR2DB: case MATH_WRAPF: case MATH_DB2LINEAR: { - t = Variant::REAL; + t = Variant::FLOAT; } break; case MATH_POLAR2CARTESIAN: case MATH_CARTESIAN2POLAR: { @@ -679,7 +679,7 @@ VisualScriptBuiltinFunc::BuiltinFunc VisualScriptBuiltinFunc::get_func() { if (!p_inputs[m_arg]->is_num()) { \ r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; \ r_error.argument = m_arg; \ - r_error.expected = Variant::REAL; \ + r_error.expected = Variant::FLOAT; \ return; \ } @@ -781,7 +781,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in int64_t i = *p_inputs[0]; *r_return = ABS(i); - } else if (p_inputs[0]->get_type() == Variant::REAL) { + } else if (p_inputs[0]->get_type() == Variant::FLOAT) { real_t r = *p_inputs[0]; *r_return = Math::abs(r); @@ -789,7 +789,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::REAL; + r_error.expected = Variant::FLOAT; } } break; case VisualScriptBuiltinFunc::MATH_SIGN: { @@ -798,7 +798,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in int64_t i = *p_inputs[0]; *r_return = i < 0 ? -1 : (i > 0 ? +1 : 0); - } else if (p_inputs[0]->get_type() == Variant::REAL) { + } else if (p_inputs[0]->get_type() == Variant::FLOAT) { real_t r = *p_inputs[0]; *r_return = r < 0.0 ? -1.0 : (r > 0.0 ? +1.0 : 0.0); @@ -806,7 +806,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT; r_error.argument = 0; - r_error.expected = Variant::REAL; + r_error.expected = Variant::FLOAT; } } break; case VisualScriptBuiltinFunc::MATH_POW: { diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 787f0b7f40..8d58cb9c4d 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -346,7 +346,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::BOOL: color = Color(0.55, 0.65, 0.94); break; case Variant::INT: color = Color(0.49, 0.78, 0.94); break; - case Variant::REAL: color = Color(0.38, 0.85, 0.96); break; + case Variant::FLOAT: color = Color(0.38, 0.85, 0.96); break; case Variant::STRING: color = Color(0.42, 0.65, 0.93); break; case Variant::VECTOR2: color = Color(0.74, 0.57, 0.95); break; @@ -367,8 +367,10 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::ARRAY: color = Color(0.88, 0.88, 0.88); break; case Variant::PACKED_BYTE_ARRAY: color = Color(0.67, 0.96, 0.78); break; - case Variant::PACKED_INT_ARRAY: color = Color(0.69, 0.86, 0.96); break; - case Variant::PACKED_REAL_ARRAY: color = Color(0.59, 0.91, 0.97); break; + case Variant::PACKED_INT32_ARRAY: color = Color(0.69, 0.86, 0.96); break; + case Variant::PACKED_FLOAT32_ARRAY: color = Color(0.59, 0.91, 0.97); break; + case Variant::PACKED_INT64_ARRAY: color = Color(0.69, 0.86, 0.96); break; + case Variant::PACKED_FLOAT64_ARRAY: color = Color(0.59, 0.91, 0.97); break; case Variant::PACKED_STRING_ARRAY: color = Color(0.62, 0.77, 0.95); break; case Variant::PACKED_VECTOR2_ARRAY: color = Color(0.82, 0.7, 0.96); break; case Variant::PACKED_VECTOR3_ARRAY: color = Color(0.87, 0.61, 0.95); break; @@ -383,7 +385,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::BOOL: color = Color(0.43, 0.56, 0.92); break; case Variant::INT: color = Color(0.31, 0.7, 0.91); break; - case Variant::REAL: color = Color(0.15, 0.8, 0.94); break; + case Variant::FLOAT: color = Color(0.15, 0.8, 0.94); break; case Variant::STRING: color = Color(0.27, 0.56, 0.91); break; case Variant::VECTOR2: color = Color(0.68, 0.46, 0.93); break; @@ -404,8 +406,10 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) { case Variant::ARRAY: color = Color(0.45, 0.45, 0.45); break; case Variant::PACKED_BYTE_ARRAY: color = Color(0.38, 0.92, 0.6); break; - case Variant::PACKED_INT_ARRAY: color = Color(0.38, 0.73, 0.92); break; - case Variant::PACKED_REAL_ARRAY: color = Color(0.25, 0.83, 0.95); break; + case Variant::PACKED_INT32_ARRAY: color = Color(0.38, 0.73, 0.92); break; + case Variant::PACKED_FLOAT32_ARRAY: color = Color(0.25, 0.83, 0.95); break; + case Variant::PACKED_INT64_ARRAY: color = Color(0.38, 0.73, 0.92); break; + case Variant::PACKED_FLOAT64_ARRAY: color = Color(0.25, 0.83, 0.95); break; case Variant::PACKED_STRING_ARRAY: color = Color(0.38, 0.62, 0.92); break; case Variant::PACKED_VECTOR2_ARRAY: color = Color(0.62, 0.36, 0.92); break; case Variant::PACKED_VECTOR3_ARRAY: color = Color(0.79, 0.35, 0.92); break; @@ -521,8 +525,8 @@ void VisualScriptEditor::_update_graph(int p_only_id) { Control::get_icon("Dictionary", "EditorIcons"), Control::get_icon("Array", "EditorIcons"), Control::get_icon("PackedByteArray", "EditorIcons"), - Control::get_icon("PackedIntArray", "EditorIcons"), - Control::get_icon("PackedRealArray", "EditorIcons"), + Control::get_icon("PackedInt32Array", "EditorIcons"), + Control::get_icon("PackedFloat32Array", "EditorIcons"), Control::get_icon("PackedStringArray", "EditorIcons"), Control::get_icon("PackedVector2Array", "EditorIcons"), Control::get_icon("PackedVector3Array", "EditorIcons"), @@ -977,8 +981,8 @@ void VisualScriptEditor::_update_members() { Control::get_icon("Dictionary", "EditorIcons"), Control::get_icon("Array", "EditorIcons"), Control::get_icon("PackedByteArray", "EditorIcons"), - Control::get_icon("PackedIntArray", "EditorIcons"), - Control::get_icon("PackedRealArray", "EditorIcons"), + Control::get_icon("PackedInt32Array", "EditorIcons"), + Control::get_icon("PackedFloat32Array", "EditorIcons"), Control::get_icon("PackedStringArray", "EditorIcons"), Control::get_icon("PackedVector2Array", "EditorIcons"), Control::get_icon("PackedVector3Array", "EditorIcons"), @@ -2910,8 +2914,8 @@ void VisualScriptEditor::_graph_connected(const String &p_from, int p_from_slot, if (to_type != Variant::NIL && from_type != Variant::NIL && to_type != from_type) { // add a constructor node between the ports bool exceptions = false; // true if there are any exceptions - exceptions = exceptions || (to_type == Variant::INT && from_type == Variant::REAL); - exceptions = exceptions || (to_type == Variant::REAL && from_type == Variant::INT); + exceptions = exceptions || (to_type == Variant::INT && from_type == Variant::FLOAT); + exceptions = exceptions || (to_type == Variant::FLOAT && from_type == Variant::INT); if (Variant::can_convert(from_type, to_type) && !exceptions) { MethodInfo mi; mi.name = Variant::get_type_name(to_type); diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp index 1f1c3e2f52..4a9a6bdb1d 100644 --- a/modules/visual_script/visual_script_nodes.cpp +++ b/modules/visual_script/visual_script_nodes.cpp @@ -2259,7 +2259,7 @@ PropertyInfo VisualScriptMathConstant::get_input_value_port_info(int p_idx) cons PropertyInfo VisualScriptMathConstant::get_output_value_port_info(int p_idx) const { - return PropertyInfo(Variant::REAL, const_name[constant]); + return PropertyInfo(Variant::FLOAT, const_name[constant]); } String VisualScriptMathConstant::get_caption() const { diff --git a/modules/visual_script/visual_script_property_selector.cpp b/modules/visual_script/visual_script_property_selector.cpp index 51b77659c4..20bad364dc 100644 --- a/modules/visual_script/visual_script_property_selector.cpp +++ b/modules/visual_script/visual_script_property_selector.cpp @@ -120,8 +120,10 @@ void VisualScriptPropertySelector::_update_search() { Control::get_icon("Dictionary", "EditorIcons"), Control::get_icon("Array", "EditorIcons"), Control::get_icon("PackedByteArray", "EditorIcons"), - Control::get_icon("PackedIntArray", "EditorIcons"), - Control::get_icon("PackedRealArray", "EditorIcons"), + Control::get_icon("PackedInt32Array", "EditorIcons"), + Control::get_icon("PackedFloat32Array", "EditorIcons"), + Control::get_icon("PackedInt64Array", "EditorIcons"), + Control::get_icon("PackedFloat64Array", "EditorIcons"), Control::get_icon("PackedStringArray", "EditorIcons"), Control::get_icon("PackedVector2Array", "EditorIcons"), Control::get_icon("PackedVector3Array", "EditorIcons"), @@ -279,7 +281,7 @@ void VisualScriptPropertySelector::_update_search() { if (type == Variant::BOOL) { get_visual_node_names("operators/logic/", Set<String>(), found, root, search_box); } - if (type == Variant::BOOL || type == Variant::INT || type == Variant::REAL || type == Variant::VECTOR2 || type == Variant::VECTOR3) { + if (type == Variant::BOOL || type == Variant::INT || type == Variant::FLOAT || type == Variant::VECTOR2 || type == Variant::VECTOR3) { get_visual_node_names("operators/math/", Set<String>(), found, root, search_box); } } diff --git a/modules/visual_script/visual_script_yield_nodes.cpp b/modules/visual_script/visual_script_yield_nodes.cpp index 40d2ec88c5..858074742e 100644 --- a/modules/visual_script/visual_script_yield_nodes.cpp +++ b/modules/visual_script/visual_script_yield_nodes.cpp @@ -188,7 +188,7 @@ void VisualScriptYield::_bind_methods() { ClassDB::bind_method(D_METHOD("get_wait_time"), &VisualScriptYield::get_wait_time); ADD_PROPERTY(PropertyInfo(Variant::INT, "mode", PROPERTY_HINT_ENUM, "Frame,Physics Frame,Time", PROPERTY_USAGE_NOEDITOR), "set_yield_mode", "get_yield_mode"); - ADD_PROPERTY(PropertyInfo(Variant::REAL, "wait_time"), "set_wait_time", "get_wait_time"); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "wait_time"), "set_wait_time", "get_wait_time"); BIND_ENUM_CONSTANT(YIELD_FRAME); BIND_ENUM_CONSTANT(YIELD_PHYSICS_FRAME); |