From 1abdffe7a029daf634f57132cb5ab5d82a7ccfc9 Mon Sep 17 00:00:00 2001 From: kobewi Date: Fri, 5 Aug 2022 20:35:08 +0200 Subject: [PATCH] Replace Array return types with TypedArray 2 --- core/core_bind.cpp | 33 ++++++++++--------- core/core_bind.h | 22 ++++++------- core/input/input_map.cpp | 9 ++--- core/input/input_map.h | 7 ++-- core/io/ip.cpp | 17 +++++----- core/io/ip.h | 9 +++-- core/object/object.cpp | 30 ++++++++++------- core/object/object.h | 15 +++++---- core/object/script_language.cpp | 13 ++++---- core/object/script_language.h | 8 +++-- doc/classes/Geometry2D.xml | 16 ++++----- doc/classes/Geometry3D.xml | 6 ++-- doc/classes/GraphEdit.xml | 2 +- doc/classes/IP.xml | 6 ++-- doc/classes/InputMap.xml | 4 +-- doc/classes/Mesh.xml | 4 +-- doc/classes/NavigationServer2D.xml | 6 ++-- doc/classes/NavigationServer3D.xml | 6 ++-- doc/classes/Node.xml | 2 +- doc/classes/Node3D.xml | 2 +- doc/classes/Object.xml | 12 +++---- doc/classes/Performance.xml | 2 +- doc/classes/PhysicsDirectSpaceState2D.xml | 8 ++--- doc/classes/PhysicsDirectSpaceState3D.xml | 8 ++--- doc/classes/RDUniform.xml | 2 +- doc/classes/RenderingServer.xml | 2 +- doc/classes/RigidDynamicBody3D.xml | 2 +- doc/classes/SceneTree.xml | 4 +-- doc/classes/Script.xml | 6 ++-- doc/classes/ScriptEditor.xml | 4 +-- doc/classes/Shape2D.xml | 4 +-- doc/classes/SoftDynamicBody3D.xml | 2 +- doc/classes/VisualShader.xml | 2 +- editor/plugins/script_editor_plugin.cpp | 8 ++--- editor/plugins/script_editor_plugin.h | 4 +-- main/performance.cpp | 7 ++-- main/performance.h | 5 ++- modules/gridmap/doc_classes/GridMap.xml | 4 +-- modules/gridmap/grid_map.cpp | 12 +++---- modules/gridmap/grid_map.h | 4 +-- .../navigation/godot_navigation_server.cpp | 12 +++---- modules/navigation/godot_navigation_server.h | 6 ++-- scene/2d/physics_body_2d.cpp | 2 +- scene/3d/node_3d.cpp | 4 +-- scene/3d/node_3d.h | 2 +- scene/3d/physics_body_3d.cpp | 6 ++-- scene/3d/physics_body_3d.h | 2 +- scene/3d/soft_dynamic_body_3d.cpp | 4 +-- scene/3d/soft_dynamic_body_3d.h | 3 +- scene/gui/graph_edit.cpp | 4 +-- scene/gui/graph_edit.h | 2 +- scene/main/node.cpp | 4 +-- scene/main/node.h | 2 +- scene/main/scene_tree.cpp | 8 ++--- scene/main/scene_tree.h | 4 +-- scene/resources/immediate_mesh.cpp | 4 +-- scene/resources/immediate_mesh.h | 2 +- scene/resources/mesh.cpp | 10 +++--- scene/resources/mesh.h | 8 ++--- scene/resources/primitive_meshes.cpp | 4 +-- scene/resources/primitive_meshes.h | 2 +- scene/resources/shape_2d.cpp | 20 +++++------ scene/resources/shape_2d.h | 4 +-- scene/resources/visual_shader.cpp | 4 +-- scene/resources/visual_shader.h | 2 +- servers/navigation_server_2d.cpp | 6 ++-- servers/navigation_server_2d.h | 6 ++-- servers/navigation_server_3d.h | 6 ++-- servers/physics_server_2d.cpp | 31 ++++++++--------- servers/physics_server_2d.h | 10 +++--- servers/physics_server_3d.cpp | 33 ++++++++++--------- servers/physics_server_3d.h | 10 +++--- servers/rendering/rendering_device_binds.h | 6 ++-- servers/rendering_server.cpp | 7 ++-- servers/rendering_server.h | 5 ++- 75 files changed, 301 insertions(+), 263 deletions(-) diff --git a/core/core_bind.cpp b/core/core_bind.cpp index 7a9a2c4337e..6ce94fa1f32 100644 --- a/core/core_bind.cpp +++ b/core/core_bind.cpp @@ -819,7 +819,7 @@ Vector Geometry2D::convex_hull(const Vector &p_points) { return ::Geometry2D::convex_hull(p_points); } -Array Geometry2D::merge_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b) { +TypedArray Geometry2D::merge_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b) { Vector> polys = ::Geometry2D::merge_polygons(p_polygon_a, p_polygon_b); Array ret; @@ -830,10 +830,10 @@ Array Geometry2D::merge_polygons(const Vector &p_polygon_a, const Vecto return ret; } -Array Geometry2D::clip_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b) { +TypedArray Geometry2D::clip_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b) { Vector> polys = ::Geometry2D::clip_polygons(p_polygon_a, p_polygon_b); - Array ret; + TypedArray ret; for (int i = 0; i < polys.size(); ++i) { ret.push_back(polys[i]); @@ -841,7 +841,7 @@ Array Geometry2D::clip_polygons(const Vector &p_polygon_a, const Vector return ret; } -Array Geometry2D::intersect_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b) { +TypedArray Geometry2D::intersect_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b) { Vector> polys = ::Geometry2D::intersect_polygons(p_polygon_a, p_polygon_b); Array ret; @@ -852,7 +852,7 @@ Array Geometry2D::intersect_polygons(const Vector &p_polygon_a, const V return ret; } -Array Geometry2D::exclude_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b) { +TypedArray Geometry2D::exclude_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b) { Vector> polys = ::Geometry2D::exclude_polygons(p_polygon_a, p_polygon_b); Array ret; @@ -863,7 +863,7 @@ Array Geometry2D::exclude_polygons(const Vector &p_polygon_a, const Vec return ret; } -Array Geometry2D::clip_polyline_with_polygon(const Vector &p_polyline, const Vector &p_polygon) { +TypedArray Geometry2D::clip_polyline_with_polygon(const Vector &p_polyline, const Vector &p_polygon) { Vector> polys = ::Geometry2D::clip_polyline_with_polygon(p_polyline, p_polygon); Array ret; @@ -874,7 +874,7 @@ Array Geometry2D::clip_polyline_with_polygon(const Vector &p_polyline, return ret; } -Array Geometry2D::intersect_polyline_with_polygon(const Vector &p_polyline, const Vector &p_polygon) { +TypedArray Geometry2D::intersect_polyline_with_polygon(const Vector &p_polyline, const Vector &p_polygon) { Vector> polys = ::Geometry2D::intersect_polyline_with_polygon(p_polyline, p_polygon); Array ret; @@ -885,7 +885,7 @@ Array Geometry2D::intersect_polyline_with_polygon(const Vector &p_polyl return ret; } -Array Geometry2D::offset_polygon(const Vector &p_polygon, real_t p_delta, PolyJoinType p_join_type) { +TypedArray Geometry2D::offset_polygon(const Vector &p_polygon, real_t p_delta, PolyJoinType p_join_type) { Vector> polys = ::Geometry2D::offset_polygon(p_polygon, p_delta, ::Geometry2D::PolyJoinType(p_join_type)); Array ret; @@ -896,7 +896,7 @@ Array Geometry2D::offset_polygon(const Vector &p_polygon, real_t p_delt return ret; } -Array Geometry2D::offset_polyline(const Vector &p_polygon, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type) { +TypedArray Geometry2D::offset_polyline(const Vector &p_polygon, real_t p_delta, PolyJoinType p_join_type, PolyEndType p_end_type) { Vector> polys = ::Geometry2D::offset_polyline(p_polygon, p_delta, ::Geometry2D::PolyJoinType(p_join_type), ::Geometry2D::PolyEndType(p_end_type)); Array ret; @@ -989,16 +989,19 @@ Geometry3D *Geometry3D::get_singleton() { return singleton; } -Vector Geometry3D::build_box_planes(const Vector3 &p_extents) { - return ::Geometry3D::build_box_planes(p_extents); +TypedArray Geometry3D::build_box_planes(const Vector3 &p_extents) { + Variant ret = ::Geometry3D::build_box_planes(p_extents); + return ret; } -Vector Geometry3D::build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis) { - return ::Geometry3D::build_cylinder_planes(p_radius, p_height, p_sides, p_axis); +TypedArray Geometry3D::build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis) { + Variant ret = ::Geometry3D::build_cylinder_planes(p_radius, p_height, p_sides, p_axis); + return ret; } -Vector Geometry3D::build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis) { - return ::Geometry3D::build_capsule_planes(p_radius, p_height, p_sides, p_lats, p_axis); +TypedArray Geometry3D::build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis) { + Variant ret = ::Geometry3D::build_capsule_planes(p_radius, p_height, p_sides, p_lats, p_axis); + return ret; } Vector Geometry3D::get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2) { diff --git a/core/core_bind.h b/core/core_bind.h index f7ba4f31cff..3624bdf1789 100644 --- a/core/core_bind.h +++ b/core/core_bind.h @@ -303,14 +303,14 @@ public: OPERATION_XOR }; // 2D polygon boolean operations. - Array merge_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // Union (add). - Array clip_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // Difference (subtract). - Array intersect_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // Common area (multiply). - Array exclude_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // All but common area (xor). + TypedArray merge_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // Union (add). + TypedArray clip_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // Difference (subtract). + TypedArray intersect_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // Common area (multiply). + TypedArray exclude_polygons(const Vector &p_polygon_a, const Vector &p_polygon_b); // All but common area (xor). // 2D polyline vs polygon operations. - Array clip_polyline_with_polygon(const Vector &p_polyline, const Vector &p_polygon); // Cut. - Array intersect_polyline_with_polygon(const Vector &p_polyline, const Vector &p_polygon); // Chop. + TypedArray clip_polyline_with_polygon(const Vector &p_polyline, const Vector &p_polygon); // Cut. + TypedArray intersect_polyline_with_polygon(const Vector &p_polyline, const Vector &p_polygon); // Chop. // 2D offset polygons/polylines. enum PolyJoinType { @@ -325,8 +325,8 @@ public: END_SQUARE, END_ROUND }; - Array offset_polygon(const Vector &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE); - Array offset_polyline(const Vector &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE, PolyEndType p_end_type = END_SQUARE); + TypedArray offset_polygon(const Vector &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE); + TypedArray offset_polyline(const Vector &p_polygon, real_t p_delta, PolyJoinType p_join_type = JOIN_SQUARE, PolyEndType p_end_type = END_SQUARE); Dictionary make_atlas(const Vector &p_rects); @@ -343,9 +343,9 @@ protected: public: static Geometry3D *get_singleton(); - Vector build_box_planes(const Vector3 &p_extents); - Vector build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z); - Vector build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z); + TypedArray build_box_planes(const Vector3 &p_extents); + TypedArray build_cylinder_planes(float p_radius, float p_height, int p_sides, Vector3::Axis p_axis = Vector3::AXIS_Z); + TypedArray build_capsule_planes(float p_radius, float p_height, int p_sides, int p_lats, Vector3::Axis p_axis = Vector3::AXIS_Z); Vector get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2); Vector3 get_closest_point_to_segment(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b); Vector3 get_closest_point_to_segment_uncapped(const Vector3 &p_point, const Vector3 &p_a, const Vector3 &p_b); diff --git a/core/input/input_map.cpp b/core/input/input_map.cpp index 942c5248df0..702e257fb42 100644 --- a/core/input/input_map.cpp +++ b/core/input/input_map.cpp @@ -34,6 +34,7 @@ #include "core/input/input.h" #include "core/os/keyboard.h" #include "core/os/os.h" +#include "core/variant/typed_array.h" InputMap *InputMap::singleton = nullptr; @@ -99,8 +100,8 @@ void InputMap::erase_action(const StringName &p_action) { input_map.erase(p_action); } -Array InputMap::_get_actions() { - Array ret; +TypedArray InputMap::_get_actions() { + TypedArray ret; List actions = get_actions(); if (actions.is_empty()) { return ret; @@ -190,8 +191,8 @@ void InputMap::action_erase_events(const StringName &p_action) { input_map[p_action].inputs.clear(); } -Array InputMap::_action_get_events(const StringName &p_action) { - Array ret; +TypedArray InputMap::_action_get_events(const StringName &p_action) { + TypedArray ret; const List> *al = action_get_events(p_action); if (al) { for (const List>::Element *E = al->front(); E; E = E->next()) { diff --git a/core/input/input_map.h b/core/input/input_map.h index 2400a4a3f7e..414a06b2f13 100644 --- a/core/input/input_map.h +++ b/core/input/input_map.h @@ -36,6 +36,9 @@ #include "core/object/object.h" #include "core/templates/hash_map.h" +template +class TypedArray; + class InputMap : public Object { GDCLASS(InputMap, Object); @@ -60,8 +63,8 @@ private: List>::Element *_find_event(Action &p_action, const Ref &p_event, bool p_exact_match = false, bool *r_pressed = nullptr, float *r_strength = nullptr, float *r_raw_strength = nullptr) const; - Array _action_get_events(const StringName &p_action); - Array _get_actions(); + TypedArray _action_get_events(const StringName &p_action); + TypedArray _get_actions(); protected: static void _bind_methods(); diff --git a/core/io/ip.cpp b/core/io/ip.cpp index 25e3bef5fc7..a4d8dc3d5bc 100644 --- a/core/io/ip.cpp +++ b/core/io/ip.cpp @@ -33,6 +33,7 @@ #include "core/os/semaphore.h" #include "core/os/thread.h" #include "core/templates/hash_map.h" +#include "core/variant/typed_array.h" VARIANT_ENUM_CAST(IP::ResolverStatus); @@ -124,11 +125,11 @@ struct _IP_ResolverPrivate { }; IPAddress IP::resolve_hostname(const String &p_hostname, IP::Type p_type) { - const Array addresses = resolve_hostname_addresses(p_hostname, p_type); - return addresses.size() ? addresses[0].operator IPAddress() : IPAddress(); + const PackedStringArray addresses = resolve_hostname_addresses(p_hostname, p_type); + return addresses.size() ? (IPAddress)addresses[0] : IPAddress(); } -Array IP::resolve_hostname_addresses(const String &p_hostname, Type p_type) { +PackedStringArray IP::resolve_hostname_addresses(const String &p_hostname, Type p_type) { List res; String key = _IP_ResolverPrivate::get_cache_key(p_hostname, p_type); @@ -148,7 +149,7 @@ Array IP::resolve_hostname_addresses(const String &p_hostname, Type p_type) { } resolver->mutex.unlock(); - Array result; + PackedStringArray result; for (int i = 0; i < res.size(); ++i) { result.push_back(String(res[i])); } @@ -254,8 +255,8 @@ void IP::clear_cache(const String &p_hostname) { } } -Array IP::_get_local_addresses() const { - Array addresses; +PackedStringArray IP::_get_local_addresses() const { + PackedStringArray addresses; List ip_addresses; get_local_addresses(&ip_addresses); for (const IPAddress &E : ip_addresses) { @@ -265,8 +266,8 @@ Array IP::_get_local_addresses() const { return addresses; } -Array IP::_get_local_interfaces() const { - Array results; +TypedArray IP::_get_local_interfaces() const { + TypedArray results; HashMap interfaces; get_local_interfaces(&interfaces); for (KeyValue &E : interfaces) { diff --git a/core/io/ip.h b/core/io/ip.h index 4d83515e2b0..f2d93a454d1 100644 --- a/core/io/ip.h +++ b/core/io/ip.h @@ -34,6 +34,9 @@ #include "core/io/ip_address.h" #include "core/os/os.h" +template +class TypedArray; + struct _IP_ResolverPrivate; class IP : public Object { @@ -68,8 +71,8 @@ protected: static IP *singleton; static void _bind_methods(); - Array _get_local_addresses() const; - Array _get_local_interfaces() const; + PackedStringArray _get_local_addresses() const; + TypedArray _get_local_interfaces() const; static IP *(*_create)(); @@ -82,7 +85,7 @@ public: }; IPAddress resolve_hostname(const String &p_hostname, Type p_type = TYPE_ANY); - Array resolve_hostname_addresses(const String &p_hostname, Type p_type = TYPE_ANY); + PackedStringArray resolve_hostname_addresses(const String &p_hostname, Type p_type = TYPE_ANY); // async resolver hostname ResolverID resolve_hostname_queue_item(const String &p_hostname, Type p_type = TYPE_ANY); ResolverStatus get_resolve_item_status(ResolverID p_id) const; diff --git a/core/object/object.cpp b/core/object/object.cpp index 5203685c7f3..7dd18c38cee 100644 --- a/core/object/object.cpp +++ b/core/object/object.cpp @@ -38,6 +38,7 @@ #include "core/os/os.h" #include "core/string/print_string.h" #include "core/string/translation.h" +#include "core/variant/typed_array.h" #ifdef DEBUG_ENABLED @@ -102,8 +103,8 @@ PropertyInfo PropertyInfo::from_dict(const Dictionary &p_dict) { return pi; } -Array convert_property_list(const List *p_list) { - Array va; +TypedArray convert_property_list(const List *p_list) { + TypedArray va; for (const List::Element *E = p_list->front(); E; E = E->next()) { va.push_back(Dictionary(E->get())); } @@ -912,16 +913,16 @@ void Object::remove_meta(const StringName &p_name) { set_meta(p_name, Variant()); } -Array Object::_get_property_list_bind() const { +TypedArray Object::_get_property_list_bind() const { List lpi; get_property_list(&lpi); return convert_property_list(&lpi); } -Array Object::_get_method_list_bind() const { +TypedArray Object::_get_method_list_bind() const { List ml; get_method_list(&ml); - Array ret; + TypedArray ret; for (List::Element *E = ml.front(); E; E = E->next()) { Dictionary d = E->get(); @@ -1109,11 +1110,11 @@ void Object::_add_user_signal(const String &p_name, const Array &p_args) { add_user_signal(mi); } -Array Object::_get_signal_list() const { +TypedArray Object::_get_signal_list() const { List signal_list; get_signal_list(&signal_list); - Array ret; + TypedArray ret; for (const MethodInfo &E : signal_list) { ret.push_back(Dictionary(E)); } @@ -1121,11 +1122,11 @@ Array Object::_get_signal_list() const { return ret; } -Array Object::_get_signal_connection_list(const StringName &p_signal) const { +TypedArray Object::_get_signal_connection_list(const StringName &p_signal) const { List conns; get_all_signal_connections(&conns); - Array ret; + TypedArray ret; for (const Connection &c : conns) { if (c.signal.get_name() == p_signal) { @@ -1136,8 +1137,8 @@ Array Object::_get_signal_connection_list(const StringName &p_signal) const { return ret; } -Array Object::_get_incoming_connections() const { - Array ret; +TypedArray Object::_get_incoming_connections() const { + TypedArray ret; int connections_amount = connections.size(); for (int idx_conn = 0; idx_conn < connections_amount; idx_conn++) { ret.push_back(connections[idx_conn]); @@ -1553,7 +1554,12 @@ void Object::_bind_methods() { miget.return_val.usage |= PROPERTY_USAGE_NIL_IS_VARIANT; BIND_OBJ_CORE_METHOD(miget); - BIND_OBJ_CORE_METHOD(MethodInfo(Variant::ARRAY, "_get_property_list")); + MethodInfo plget("_get_property_list"); + plget.return_val.type = Variant::ARRAY; + plget.return_val.hint = PROPERTY_HINT_ARRAY_TYPE; + plget.return_val.hint_string = "Dictionary"; + BIND_OBJ_CORE_METHOD(plget); + BIND_OBJ_CORE_METHOD(MethodInfo(Variant::BOOL, "_property_can_revert", PropertyInfo(Variant::STRING_NAME, "property"))); MethodInfo mipgr("_property_get_revert", PropertyInfo(Variant::STRING_NAME, "property")); mipgr.return_val.name = "Variant"; diff --git a/core/object/object.h b/core/object/object.h index 093b1046646..47681c0223d 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -45,6 +45,9 @@ #include "core/variant/callable_bind.h" #include "core/variant/variant.h" +template +class TypedArray; + enum PropertyHint { PROPERTY_HINT_NONE, ///< no hint provided. PROPERTY_HINT_RANGE, ///< hint_text = "min,max[,step][,or_greater][,or_lesser][,no_slider][,radians][,degrees][,exp][,suffix:] range. @@ -207,7 +210,7 @@ struct PropertyInfo { } }; -Array convert_property_list(const List *p_list); +TypedArray convert_property_list(const List *p_list); enum MethodFlags { METHOD_FLAG_NORMAL = 1, @@ -597,9 +600,9 @@ private: void _add_user_signal(const String &p_name, const Array &p_args = Array()); bool _has_user_signal(const StringName &p_name) const; Error _emit_signal(const Variant **p_args, int p_argcount, Callable::CallError &r_error); - Array _get_signal_list() const; - Array _get_signal_connection_list(const StringName &p_signal) const; - Array _get_incoming_connections() const; + TypedArray _get_signal_list() const; + TypedArray _get_signal_connection_list(const StringName &p_signal) const; + TypedArray _get_incoming_connections() const; void _set_bind(const StringName &p_set, const Variant &p_value); Variant _get_bind(const StringName &p_name) const; void _set_indexed_bind(const NodePath &p_name, const Variant &p_value); @@ -698,8 +701,8 @@ protected: } Vector _get_meta_list_bind() const; - Array _get_property_list_bind() const; - Array _get_method_list_bind() const; + TypedArray _get_property_list_bind() const; + TypedArray _get_method_list_bind() const; void _clear_internal_resource_paths(const Variant &p_var); diff --git a/core/object/script_language.cpp b/core/object/script_language.cpp index b06c2e88966..e56d2e80b90 100644 --- a/core/object/script_language.cpp +++ b/core/object/script_language.cpp @@ -34,6 +34,7 @@ #include "core/core_string_names.h" #include "core/debugger/engine_debugger.h" #include "core/debugger/script_debugger.h" +#include "core/variant/typed_array.h" #include @@ -61,8 +62,8 @@ Variant Script::_get_property_default_value(const StringName &p_property) { return ret; } -Array Script::_get_script_property_list() { - Array ret; +TypedArray Script::_get_script_property_list() { + TypedArray ret; List list; get_script_property_list(&list); for (const PropertyInfo &E : list) { @@ -71,8 +72,8 @@ Array Script::_get_script_property_list() { return ret; } -Array Script::_get_script_method_list() { - Array ret; +TypedArray Script::_get_script_method_list() { + TypedArray ret; List list; get_script_method_list(&list); for (const MethodInfo &E : list) { @@ -81,8 +82,8 @@ Array Script::_get_script_method_list() { return ret; } -Array Script::_get_script_signal_list() { - Array ret; +TypedArray Script::_get_script_signal_list() { + TypedArray ret; List list; get_script_signal_list(&list); for (const MethodInfo &E : list) { diff --git a/core/object/script_language.h b/core/object/script_language.h index bfdedbe4a5a..12a21150bc6 100644 --- a/core/object/script_language.h +++ b/core/object/script_language.h @@ -37,6 +37,8 @@ #include "core/templates/rb_map.h" class ScriptLanguage; +template +class TypedArray; typedef void (*ScriptEditRequestFunction)(const String &p_path); @@ -108,9 +110,9 @@ protected: virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder) {} Variant _get_property_default_value(const StringName &p_property); - Array _get_script_property_list(); - Array _get_script_method_list(); - Array _get_script_signal_list(); + TypedArray _get_script_property_list(); + TypedArray _get_script_method_list(); + TypedArray _get_script_signal_list(); Dictionary _get_script_constant_map(); public: diff --git a/doc/classes/Geometry2D.xml b/doc/classes/Geometry2D.xml index 80d19e22c5a..392ca2cabba 100644 --- a/doc/classes/Geometry2D.xml +++ b/doc/classes/Geometry2D.xml @@ -10,7 +10,7 @@ - + @@ -19,7 +19,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -71,7 +71,7 @@ - + @@ -80,7 +80,7 @@ - + @@ -130,7 +130,7 @@ - + @@ -139,7 +139,7 @@ - + @@ -166,7 +166,7 @@ - + diff --git a/doc/classes/Geometry3D.xml b/doc/classes/Geometry3D.xml index c841842d147..d37b0b7b814 100644 --- a/doc/classes/Geometry3D.xml +++ b/doc/classes/Geometry3D.xml @@ -10,14 +10,14 @@ - + Returns an array with 6 [Plane]s that describe the sides of a box centered at the origin. The box size is defined by [param extents], which represents one (positive) corner of the box (i.e. half its actual size). - + @@ -28,7 +28,7 @@ - + diff --git a/doc/classes/GraphEdit.xml b/doc/classes/GraphEdit.xml index 9f9d1a7ed65..e5aa78971e5 100644 --- a/doc/classes/GraphEdit.xml +++ b/doc/classes/GraphEdit.xml @@ -149,7 +149,7 @@ - + Returns an Array containing the list of connections. A connection consists in a structure of the form [code]{ from_port: 0, from: "GraphNode name 0", to_port: 1, to: "GraphNode name 1" }[/code]. diff --git a/doc/classes/IP.xml b/doc/classes/IP.xml index e476a86a490..1e5e6da5139 100644 --- a/doc/classes/IP.xml +++ b/doc/classes/IP.xml @@ -24,13 +24,13 @@ - + Returns all the user's current IPv4 and IPv6 addresses as an array. - + Returns all network adapters as an array. Each adapter is a dictionary of the form: @@ -74,7 +74,7 @@ - + diff --git a/doc/classes/InputMap.xml b/doc/classes/InputMap.xml index d60abd79759..1d7d54f6810 100644 --- a/doc/classes/InputMap.xml +++ b/doc/classes/InputMap.xml @@ -41,7 +41,7 @@ - + Returns an array of [InputEvent]s associated with a given action. @@ -91,7 +91,7 @@ - + Returns an array of all actions in the [InputMap]. diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml index 8e98efa6fc3..d3d5a7bfaae 100644 --- a/doc/classes/Mesh.xml +++ b/doc/classes/Mesh.xml @@ -60,7 +60,7 @@ - + @@ -153,7 +153,7 @@ - + Returns the blend shape arrays for the requested surface. diff --git a/doc/classes/NavigationServer2D.xml b/doc/classes/NavigationServer2D.xml index e4e9a7fea9c..2067a237dc7 100644 --- a/doc/classes/NavigationServer2D.xml +++ b/doc/classes/NavigationServer2D.xml @@ -128,7 +128,7 @@ - + Returns all created navigation map [RID]s on the NavigationServer. This returns both 2D and 3D created navigation maps as there is technically no distinction between them. @@ -150,7 +150,7 @@ - + Returns all navigation agents [RID]s that are currently assigned to the requested navigation [param map]. @@ -198,7 +198,7 @@ - + Returns all navigation regions [RID]s that are currently assigned to the requested navigation [param map]. diff --git a/doc/classes/NavigationServer3D.xml b/doc/classes/NavigationServer3D.xml index 7c6b828aa90..92da5cca21e 100644 --- a/doc/classes/NavigationServer3D.xml +++ b/doc/classes/NavigationServer3D.xml @@ -128,7 +128,7 @@ - + Returns all created navigation map [RID]s on the NavigationServer. This returns both 2D and 3D created navigation maps as there is technically no distinction between them. @@ -150,7 +150,7 @@ - + Returns all navigation agents [RID]s that are currently assigned to the requested navigation [param map]. @@ -216,7 +216,7 @@ - + Returns all navigation regions [RID]s that are currently assigned to the requested navigation [param map]. diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index d38a724d399..429a9abf51b 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -262,7 +262,7 @@ - + Returns an array listing the groups that the node is a member of. [b]Note:[/b] For performance reasons, the order of node groups is [i]not[/i] guaranteed. The order of node groups should not be relied upon as it can vary across project runs. diff --git a/doc/classes/Node3D.xml b/doc/classes/Node3D.xml index e9f1f995a59..53b93beb402 100644 --- a/doc/classes/Node3D.xml +++ b/doc/classes/Node3D.xml @@ -39,7 +39,7 @@ - + Returns all the gizmos attached to this [code]Node3D[/code]. diff --git a/doc/classes/Object.xml b/doc/classes/Object.xml index 2e03ac52911..5f9b6f72060 100644 --- a/doc/classes/Object.xml +++ b/doc/classes/Object.xml @@ -43,7 +43,7 @@ - + Virtual method which can be overridden to customize the return value of [method get_property_list]. Returns the object's property list as an [Array] of dictionaries. @@ -353,7 +353,7 @@ - + Returns an [Array] of dictionaries with information about signals that are connected to the object. Each [Dictionary] contains three String entries: @@ -394,13 +394,13 @@ - + Returns the object's methods and their signatures as an [Array]. - + Returns the object's property list as an [Array] of dictionaries. Each property's [Dictionary] contain at least [code]name: String[/code] and [code]type: int[/code] (see [enum Variant.Type]) entries. Optionally, it can also include [code]hint: int[/code] (see [enum PropertyHint]), [code]hint_string: String[/code], and [code]usage: int[/code] (see [enum PropertyUsageFlags]). @@ -413,14 +413,14 @@ - + Returns an [Array] of connections for the given [param signal]. - + Returns the list of signals as an [Array] of dictionaries. diff --git a/doc/classes/Performance.xml b/doc/classes/Performance.xml index ddb290f007e..92fa1040afd 100644 --- a/doc/classes/Performance.xml +++ b/doc/classes/Performance.xml @@ -79,7 +79,7 @@ - + Returns the names of active custom monitors in an [Array]. diff --git a/doc/classes/PhysicsDirectSpaceState2D.xml b/doc/classes/PhysicsDirectSpaceState2D.xml index 6290ea315ff..d4cb073d15d 100644 --- a/doc/classes/PhysicsDirectSpaceState2D.xml +++ b/doc/classes/PhysicsDirectSpaceState2D.xml @@ -12,7 +12,7 @@ - + Checks how far a [Shape2D] can move without colliding. All the parameters for the query, including the shape and the motion, are supplied through a [PhysicsShapeQueryParameters2D] object. @@ -21,7 +21,7 @@ - + @@ -44,7 +44,7 @@ - + @@ -72,7 +72,7 @@ - + diff --git a/doc/classes/PhysicsDirectSpaceState3D.xml b/doc/classes/PhysicsDirectSpaceState3D.xml index 619891df90f..cc1cf8a3238 100644 --- a/doc/classes/PhysicsDirectSpaceState3D.xml +++ b/doc/classes/PhysicsDirectSpaceState3D.xml @@ -12,7 +12,7 @@ - + Checks how far a [Shape3D] can move without colliding. All the parameters for the query, including the shape, are supplied through a [PhysicsShapeQueryParameters3D] object. @@ -21,7 +21,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -73,7 +73,7 @@ - + diff --git a/doc/classes/RDUniform.xml b/doc/classes/RDUniform.xml index d1440240008..e4b7883f027 100644 --- a/doc/classes/RDUniform.xml +++ b/doc/classes/RDUniform.xml @@ -19,7 +19,7 @@ - + diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml index 62351ea9ec5..15d7fa4d4bd 100644 --- a/doc/classes/RenderingServer.xml +++ b/doc/classes/RenderingServer.xml @@ -1959,7 +1959,7 @@ - + diff --git a/doc/classes/RigidDynamicBody3D.xml b/doc/classes/RigidDynamicBody3D.xml index 83f24be4183..70721342501 100644 --- a/doc/classes/RigidDynamicBody3D.xml +++ b/doc/classes/RigidDynamicBody3D.xml @@ -98,7 +98,7 @@ - + Returns a list of the bodies colliding with this one. Requires [member contact_monitor] to be set to [code]true[/code] and [member contacts_reported] to be set high enough to detect all the collisions. [b]Note:[/b] The result of this test is not immediate after moving objects. For performance, list of collisions is updated once per frame and before the physics step. Consider using signals instead. diff --git a/doc/classes/SceneTree.xml b/doc/classes/SceneTree.xml index 0b358bd06f4..417703ff01b 100644 --- a/doc/classes/SceneTree.xml +++ b/doc/classes/SceneTree.xml @@ -113,14 +113,14 @@ - + Returns a list of all nodes assigned to the given group. - + Returns an array of currently existing [Tween]s in the [SceneTree] (both running and paused). diff --git a/doc/classes/Script.xml b/doc/classes/Script.xml index 8202f9f5361..40ec8ed4295 100644 --- a/doc/classes/Script.xml +++ b/doc/classes/Script.xml @@ -44,19 +44,19 @@ - + Returns the list of methods in this [Script]. - + Returns the list of properties in this [Script]. - + Returns the list of user signals defined in this [Script]. diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml index 9118f38a3e6..becaff975e4 100644 --- a/doc/classes/ScriptEditor.xml +++ b/doc/classes/ScriptEditor.xml @@ -22,13 +22,13 @@ - + Returns an array with all [ScriptEditorBase] objects which are currently open in editor. - + Returns an array with all [Script] objects which are currently open in editor. diff --git a/doc/classes/Shape2D.xml b/doc/classes/Shape2D.xml index 4d7031ab868..34ca2287955 100644 --- a/doc/classes/Shape2D.xml +++ b/doc/classes/Shape2D.xml @@ -21,7 +21,7 @@ - + @@ -45,7 +45,7 @@ - + diff --git a/doc/classes/SoftDynamicBody3D.xml b/doc/classes/SoftDynamicBody3D.xml index 87492704d73..7f0a1d94d0a 100644 --- a/doc/classes/SoftDynamicBody3D.xml +++ b/doc/classes/SoftDynamicBody3D.xml @@ -19,7 +19,7 @@ - + Returns an array of nodes that were added as collision exceptions for this body. diff --git a/doc/classes/VisualShader.xml b/doc/classes/VisualShader.xml index 558b1086b72..ecfb9000b29 100644 --- a/doc/classes/VisualShader.xml +++ b/doc/classes/VisualShader.xml @@ -81,7 +81,7 @@ - + Returns the list of connected nodes with the specified type. diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index e8c3cb8d604..de1776c0eac 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1156,8 +1156,8 @@ Ref