Merge pull request #64082 from KoBeWi/array3k

This commit is contained in:
Rémi Verschelde 2022-08-24 16:05:59 +02:00 committed by GitHub
commit 4698dc67b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
34 changed files with 182 additions and 170 deletions

View File

@ -70,7 +70,7 @@ void Translation::_set_messages(const Dictionary &p_messages) {
void Translation::set_locale(const String &p_locale) {
locale = TranslationServer::get_singleton()->standardize_locale(p_locale);
if (OS::get_singleton()->get_main_loop() && TranslationServer::get_singleton()->get_loaded_locales().has(this)) {
if (OS::get_singleton()->get_main_loop() && TranslationServer::get_singleton()->get_loaded_locales().has(get_locale())) {
OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_TRANSLATION_CHANGED);
}
}
@ -505,11 +505,11 @@ String TranslationServer::get_locale() const {
return locale;
}
Array TranslationServer::get_loaded_locales() const {
Array locales;
PackedStringArray TranslationServer::get_loaded_locales() const {
PackedStringArray locales;
for (const Ref<Translation> &E : translations) {
const Ref<Translation> &t = E;
ERR_FAIL_COND_V(t.is_null(), Array());
ERR_FAIL_COND_V(t.is_null(), PackedStringArray());
String l = t->get_locale();
locales.push_back(l);

View File

@ -145,7 +145,7 @@ public:
String get_locale_name(const String &p_locale) const;
Array get_loaded_locales() const;
PackedStringArray get_loaded_locales() const;
void add_translation(const Ref<Translation> &p_translation);
void remove_translation(const Ref<Translation> &p_translation);

View File

@ -1406,7 +1406,7 @@
</description>
</method>
<method name="instance_geometry_get_shader_uniform_list" qualifiers="const">
<return type="Array" />
<return type="Dictionary[]" />
<param index="0" name="instance" type="RID" />
<description>
</description>
@ -1581,7 +1581,7 @@
</description>
</method>
<method name="instances_cull_aabb" qualifiers="const">
<return type="Array" />
<return type="PackedInt64Array" />
<param index="0" name="aabb" type="AABB" />
<param index="1" name="scenario" type="RID" />
<description>
@ -1590,7 +1590,7 @@
</description>
</method>
<method name="instances_cull_convex" qualifiers="const">
<return type="Array" />
<return type="PackedInt64Array" />
<param index="0" name="convex" type="Array" />
<param index="1" name="scenario" type="RID" />
<description>
@ -1599,7 +1599,7 @@
</description>
</method>
<method name="instances_cull_ray" qualifiers="const">
<return type="Array" />
<return type="PackedInt64Array" />
<param index="0" name="from" type="Vector3" />
<param index="1" name="to" type="Vector3" />
<param index="2" name="scenario" type="RID" />

View File

@ -1162,7 +1162,7 @@
</description>
</method>
<method name="shaped_text_get_ellipsis_glyphs" qualifiers="const">
<return type="Array" />
<return type="Dictionary[]" />
<param index="0" name="shaped" type="RID" />
<description>
Returns array of the glyphs in the ellipsis.
@ -1183,7 +1183,7 @@
</description>
</method>
<method name="shaped_text_get_glyphs" qualifiers="const">
<return type="Array" />
<return type="Dictionary[]" />
<param index="0" name="shaped" type="RID" />
<description>
Returns an array of glyphs in the visual order.
@ -1463,7 +1463,7 @@
</description>
</method>
<method name="shaped_text_sort_logical">
<return type="Array" />
<return type="Dictionary[]" />
<param index="0" name="shaped" type="RID" />
<description>
Returns text glyphs in the logical order.

View File

@ -979,7 +979,7 @@
</description>
</method>
<method name="parse_structured_text" qualifiers="virtual const">
<return type="Array" />
<return type="Vector2i[]" />
<param index="0" name="parser_type" type="int" enum="TextServer.StructuredTextParser" />
<param index="1" name="args" type="Array" />
<param index="2" name="text" type="String" />

View File

@ -38,7 +38,7 @@
</description>
</method>
<method name="get_interfaces" qualifiers="const">
<return type="Array" />
<return type="Dictionary[]" />
<description>
Returns a list of available interfaces the index and name of each interface.
</description>

View File

@ -65,7 +65,7 @@
</description>
</method>
<method name="get_loaded_locales" qualifiers="const">
<return type="Array" />
<return type="PackedStringArray" />
<description>
Returns an array of all loaded locales of the project.
</description>

View File

@ -126,7 +126,7 @@
</description>
</method>
<method name="get_children">
<return type="Array" />
<return type="TreeItem[]" />
<description>
Returns an array of references to the item's children.
</description>

View File

@ -64,7 +64,7 @@
</description>
</method>
<method name="get_interfaces" qualifiers="const">
<return type="Array" />
<return type="Dictionary[]" />
<description>
Returns a list of available interfaces the ID and name of each interface.
</description>

View File

@ -118,7 +118,7 @@
</description>
</method>
<method name="get_peers">
<return type="Array" />
<return type="ENetPacketPeer[]" />
<description>
Returns the list of peers associated with this host.
[b]Note:[/b] This list might include some peers that are not fully connected or are still being disconnected.

View File

@ -34,6 +34,7 @@
#include "core/io/compression.h"
#include "core/io/ip.h"
#include "core/variant/typed_array.h"
void ENetConnection::broadcast(enet_uint8 p_channel, ENetPacket *p_packet) {
ERR_FAIL_COND_MSG(!host, "The ENetConnection instance isn't currently active.");
@ -263,9 +264,9 @@ void ENetConnection::get_peers(List<Ref<ENetPacketPeer>> &r_peers) {
}
}
Array ENetConnection::_get_peers() {
TypedArray<ENetPacketPeer> ENetConnection::_get_peers() {
ERR_FAIL_COND_V_MSG(!host, Array(), "The ENetConnection instance isn't currently active.");
Array out;
TypedArray<ENetPacketPeer> out;
for (const Ref<ENetPacketPeer> &I : peers) {
out.push_back(I);
}

View File

@ -38,6 +38,9 @@
#include <enet/enet.h>
template <typename T>
class TypedArray;
class ENetConnection : public RefCounted {
GDCLASS(ENetConnection, RefCounted);
@ -83,7 +86,7 @@ private:
Error _create(ENetAddress *p_address, int p_max_peers, int p_max_channels, int p_in_bandwidth, int p_out_bandwidth);
Array _service(int p_timeout = 0);
void _broadcast(int p_channel, PackedByteArray p_packet, int p_flags);
Array _get_peers();
TypedArray<ENetPacketPeer> _get_peers();
class Compressor {
private:

View File

@ -36,6 +36,7 @@
#include "core/object/object.h"
#include "core/templates/oa_hash_map.h"
#include "core/templates/vector.h"
#include "core/variant/typed_array.h"
#include "gdscript.h"
#ifdef DEBUG_ENABLED
@ -468,12 +469,12 @@ struct GDScriptUtilityFunctionsDefinitions {
static inline void get_stack(Variant *r_ret, const Variant **p_args, int p_arg_count, Callable::CallError &r_error) {
VALIDATE_ARG_COUNT(0);
if (Thread::get_caller_id() != Thread::get_main_id()) {
*r_ret = Array();
*r_ret = TypedArray<Dictionary>();
return;
}
ScriptLanguage *script = GDScriptLanguage::get_singleton();
Array ret;
TypedArray<Dictionary> ret;
for (int i = 0; i < script->debug_get_stack_level_count(); i++) {
Dictionary frame;
frame["source"] = script->debug_get_stack_level_source(i);

View File

@ -34,6 +34,9 @@
#include "core/string/string_name.h"
#include "core/variant/variant.h"
template <typename T>
class TypedArray;
class GDScriptUtilityFunctions {
public:
typedef void (*FunctionPtr)(Variant *r_ret, const Variant **p_args, int p_arg_count, Callable::CallError &r_error);

View File

@ -29,7 +29,7 @@
</description>
</method>
<method name="get_unique_names">
<return type="Array" />
<return type="String[]" />
<description>
</description>
</method>
@ -41,7 +41,7 @@
</method>
<method name="set_unique_names">
<return type="void" />
<param index="0" name="unique_names" type="Array" />
<param index="0" name="unique_names" type="String[]" />
<description>
</description>
</method>

View File

@ -8,7 +8,7 @@
</tutorials>
<methods>
<method name="get_inverse_binds">
<return type="Array" />
<return type="Transform3D[]" />
<description>
</description>
</method>
@ -24,7 +24,7 @@
</method>
<method name="set_inverse_binds">
<return type="void" />
<param index="0" name="inverse_binds" type="Array" />
<param index="0" name="inverse_binds" type="Transform3D[]" />
<description>
</description>
</method>

View File

@ -8,7 +8,7 @@
</tutorials>
<methods>
<method name="get_accessors">
<return type="Array" />
<return type="GLTFAccessor[]" />
<description>
</description>
</method>
@ -25,42 +25,42 @@
</description>
</method>
<method name="get_animations">
<return type="Array" />
<return type="GLTFAnimation[]" />
<description>
</description>
</method>
<method name="get_buffer_views">
<return type="Array" />
<return type="GLTFBufferView[]" />
<description>
</description>
</method>
<method name="get_cameras">
<return type="Array" />
<return type="GLTFCamera[]" />
<description>
</description>
</method>
<method name="get_images">
<return type="Array" />
<return type="Texture2D[]" />
<description>
</description>
</method>
<method name="get_lights">
<return type="Array" />
<return type="GLTFLight[]" />
<description>
</description>
</method>
<method name="get_materials">
<return type="Array" />
<return type="BaseMaterial3D[]" />
<description>
</description>
</method>
<method name="get_meshes">
<return type="Array" />
<return type="GLTFMesh[]" />
<description>
</description>
</method>
<method name="get_nodes">
<return type="Array" />
<return type="GLTFNode[]" />
<description>
</description>
</method>
@ -76,81 +76,81 @@
</description>
</method>
<method name="get_skeletons">
<return type="Array" />
<return type="GLTFSkeleton[]" />
<description>
</description>
</method>
<method name="get_skins">
<return type="Array" />
<return type="GLTFSkin[]" />
<description>
</description>
</method>
<method name="get_textures">
<return type="Array" />
<return type="GLTFTexture[]" />
<description>
</description>
</method>
<method name="get_unique_animation_names">
<return type="Array" />
<return type="String[]" />
<description>
</description>
</method>
<method name="get_unique_names">
<return type="Array" />
<return type="String[]" />
<description>
</description>
</method>
<method name="set_accessors">
<return type="void" />
<param index="0" name="accessors" type="Array" />
<param index="0" name="accessors" type="GLTFAccessor[]" />
<description>
</description>
</method>
<method name="set_animations">
<return type="void" />
<param index="0" name="animations" type="Array" />
<param index="0" name="animations" type="GLTFAnimation[]" />
<description>
</description>
</method>
<method name="set_buffer_views">
<return type="void" />
<param index="0" name="buffer_views" type="Array" />
<param index="0" name="buffer_views" type="GLTFBufferView[]" />
<description>
</description>
</method>
<method name="set_cameras">
<return type="void" />
<param index="0" name="cameras" type="Array" />
<param index="0" name="cameras" type="GLTFCamera[]" />
<description>
</description>
</method>
<method name="set_images">
<return type="void" />
<param index="0" name="images" type="Array" />
<param index="0" name="images" type="Texture2D[]" />
<description>
</description>
</method>
<method name="set_lights">
<return type="void" />
<param index="0" name="lights" type="Array" />
<param index="0" name="lights" type="GLTFLight[]" />
<description>
</description>
</method>
<method name="set_materials">
<return type="void" />
<param index="0" name="materials" type="Array" />
<param index="0" name="materials" type="BaseMaterial3D[]" />
<description>
</description>
</method>
<method name="set_meshes">
<return type="void" />
<param index="0" name="meshes" type="Array" />
<param index="0" name="meshes" type="GLTFMesh[]" />
<description>
</description>
</method>
<method name="set_nodes">
<return type="void" />
<param index="0" name="nodes" type="Array" />
<param index="0" name="nodes" type="GLTFNode[]" />
<description>
</description>
</method>
@ -162,31 +162,31 @@
</method>
<method name="set_skeletons">
<return type="void" />
<param index="0" name="skeletons" type="Array" />
<param index="0" name="skeletons" type="GLTFSkeleton[]" />
<description>
</description>
</method>
<method name="set_skins">
<return type="void" />
<param index="0" name="skins" type="Array" />
<param index="0" name="skins" type="GLTFSkin[]" />
<description>
</description>
</method>
<method name="set_textures">
<return type="void" />
<param index="0" name="textures" type="Array" />
<param index="0" name="textures" type="GLTFTexture[]" />
<description>
</description>
</method>
<method name="set_unique_animation_names">
<return type="void" />
<param index="0" name="unique_animation_names" type="Array" />
<param index="0" name="unique_animation_names" type="String[]" />
<description>
</description>
</method>
<method name="set_unique_names">
<return type="void" />
<param index="0" name="unique_names" type="Array" />
<param index="0" name="unique_names" type="String[]" />
<description>
</description>
</method>
@ -194,7 +194,7 @@
<members>
<member name="base_path" type="String" setter="set_base_path" getter="get_base_path" default="&quot;&quot;">
</member>
<member name="buffers" type="Array" setter="set_buffers" getter="get_buffers" default="[]">
<member name="buffers" type="PackedByteArray[]" setter="set_buffers" getter="get_buffers" default="[]">
</member>
<member name="create_animations" type="bool" setter="set_create_animations" getter="get_create_animations" default="true">
</member>
@ -206,7 +206,7 @@
</member>
<member name="minor_version" type="int" setter="set_minor_version" getter="get_minor_version" default="0">
</member>
<member name="root_nodes" type="Array" setter="set_root_nodes" getter="get_root_nodes" default="[]">
<member name="root_nodes" type="PackedInt32Array" setter="set_root_nodes" getter="get_root_nodes" default="PackedInt32Array()">
</member>
<member name="scene_name" type="String" setter="set_scene_name" getter="get_scene_name" default="&quot;&quot;">
</member>

View File

@ -152,51 +152,51 @@ void GLTFState::set_use_named_skin_binds(bool p_use_named_skin_binds) {
use_named_skin_binds = p_use_named_skin_binds;
}
Array GLTFState::get_nodes() {
TypedArray<GLTFNode> GLTFState::get_nodes() {
return GLTFTemplateConvert::to_array(nodes);
}
void GLTFState::set_nodes(Array p_nodes) {
void GLTFState::set_nodes(TypedArray<GLTFNode> p_nodes) {
GLTFTemplateConvert::set_from_array(nodes, p_nodes);
}
Array GLTFState::get_buffers() {
TypedArray<PackedByteArray> GLTFState::get_buffers() {
return GLTFTemplateConvert::to_array(buffers);
}
void GLTFState::set_buffers(Array p_buffers) {
void GLTFState::set_buffers(TypedArray<PackedByteArray> p_buffers) {
GLTFTemplateConvert::set_from_array(buffers, p_buffers);
}
Array GLTFState::get_buffer_views() {
TypedArray<GLTFBufferView> GLTFState::get_buffer_views() {
return GLTFTemplateConvert::to_array(buffer_views);
}
void GLTFState::set_buffer_views(Array p_buffer_views) {
void GLTFState::set_buffer_views(TypedArray<GLTFBufferView> p_buffer_views) {
GLTFTemplateConvert::set_from_array(buffer_views, p_buffer_views);
}
Array GLTFState::get_accessors() {
TypedArray<GLTFAccessor> GLTFState::get_accessors() {
return GLTFTemplateConvert::to_array(accessors);
}
void GLTFState::set_accessors(Array p_accessors) {
void GLTFState::set_accessors(TypedArray<GLTFAccessor> p_accessors) {
GLTFTemplateConvert::set_from_array(accessors, p_accessors);
}
Array GLTFState::get_meshes() {
TypedArray<GLTFMesh> GLTFState::get_meshes() {
return GLTFTemplateConvert::to_array(meshes);
}
void GLTFState::set_meshes(Array p_meshes) {
void GLTFState::set_meshes(TypedArray<GLTFMesh> p_meshes) {
GLTFTemplateConvert::set_from_array(meshes, p_meshes);
}
Array GLTFState::get_materials() {
TypedArray<BaseMaterial3D> GLTFState::get_materials() {
return GLTFTemplateConvert::to_array(materials);
}
void GLTFState::set_materials(Array p_materials) {
void GLTFState::set_materials(TypedArray<BaseMaterial3D> p_materials) {
GLTFTemplateConvert::set_from_array(materials, p_materials);
}
@ -208,75 +208,75 @@ void GLTFState::set_scene_name(String p_scene_name) {
scene_name = p_scene_name;
}
Array GLTFState::get_root_nodes() {
return GLTFTemplateConvert::to_array(root_nodes);
PackedInt32Array GLTFState::get_root_nodes() {
return root_nodes;
}
void GLTFState::set_root_nodes(Array p_root_nodes) {
GLTFTemplateConvert::set_from_array(root_nodes, p_root_nodes);
void GLTFState::set_root_nodes(PackedInt32Array p_root_nodes) {
root_nodes = p_root_nodes;
}
Array GLTFState::get_textures() {
TypedArray<GLTFTexture> GLTFState::get_textures() {
return GLTFTemplateConvert::to_array(textures);
}
void GLTFState::set_textures(Array p_textures) {
void GLTFState::set_textures(TypedArray<GLTFTexture> p_textures) {
GLTFTemplateConvert::set_from_array(textures, p_textures);
}
Array GLTFState::get_images() {
TypedArray<Texture2D> GLTFState::get_images() {
return GLTFTemplateConvert::to_array(images);
}
void GLTFState::set_images(Array p_images) {
void GLTFState::set_images(TypedArray<Texture2D> p_images) {
GLTFTemplateConvert::set_from_array(images, p_images);
}
Array GLTFState::get_skins() {
TypedArray<GLTFSkin> GLTFState::get_skins() {
return GLTFTemplateConvert::to_array(skins);
}
void GLTFState::set_skins(Array p_skins) {
void GLTFState::set_skins(TypedArray<GLTFSkin> p_skins) {
GLTFTemplateConvert::set_from_array(skins, p_skins);
}
Array GLTFState::get_cameras() {
TypedArray<GLTFCamera> GLTFState::get_cameras() {
return GLTFTemplateConvert::to_array(cameras);
}
void GLTFState::set_cameras(Array p_cameras) {
void GLTFState::set_cameras(TypedArray<GLTFCamera> p_cameras) {
GLTFTemplateConvert::set_from_array(cameras, p_cameras);
}
Array GLTFState::get_lights() {
TypedArray<GLTFLight> GLTFState::get_lights() {
return GLTFTemplateConvert::to_array(lights);
}
void GLTFState::set_lights(Array p_lights) {
void GLTFState::set_lights(TypedArray<GLTFLight> p_lights) {
GLTFTemplateConvert::set_from_array(lights, p_lights);
}
Array GLTFState::get_unique_names() {
TypedArray<String> GLTFState::get_unique_names() {
return GLTFTemplateConvert::to_array(unique_names);
}
void GLTFState::set_unique_names(Array p_unique_names) {
void GLTFState::set_unique_names(TypedArray<String> p_unique_names) {
GLTFTemplateConvert::set_from_array(unique_names, p_unique_names);
}
Array GLTFState::get_unique_animation_names() {
TypedArray<String> GLTFState::get_unique_animation_names() {
return GLTFTemplateConvert::to_array(unique_animation_names);
}
void GLTFState::set_unique_animation_names(Array p_unique_animation_names) {
void GLTFState::set_unique_animation_names(TypedArray<String> p_unique_animation_names) {
GLTFTemplateConvert::set_from_array(unique_animation_names, p_unique_animation_names);
}
Array GLTFState::get_skeletons() {
TypedArray<GLTFSkeleton> GLTFState::get_skeletons() {
return GLTFTemplateConvert::to_array(skeletons);
}
void GLTFState::set_skeletons(Array p_skeletons) {
void GLTFState::set_skeletons(TypedArray<GLTFSkeleton> p_skeletons) {
GLTFTemplateConvert::set_from_array(skeletons, p_skeletons);
}
@ -296,11 +296,11 @@ void GLTFState::set_create_animations(bool p_create_animations) {
create_animations = p_create_animations;
}
Array GLTFState::get_animations() {
TypedArray<GLTFAnimation> GLTFState::get_animations() {
return GLTFTemplateConvert::to_array(animations);
}
void GLTFState::set_animations(Array p_animations) {
void GLTFState::set_animations(TypedArray<GLTFAnimation> p_animations) {
GLTFTemplateConvert::set_from_array(animations, p_animations);
}

View File

@ -115,23 +115,23 @@ public:
bool get_discard_meshes_and_materials();
void set_discard_meshes_and_materials(bool p_discard_meshes_and_materials);
Array get_nodes();
void set_nodes(Array p_nodes);
TypedArray<GLTFNode> get_nodes();
void set_nodes(TypedArray<GLTFNode> p_nodes);
Array get_buffers();
void set_buffers(Array p_buffers);
TypedArray<PackedByteArray> get_buffers();
void set_buffers(TypedArray<PackedByteArray> p_buffers);
Array get_buffer_views();
void set_buffer_views(Array p_buffer_views);
TypedArray<GLTFBufferView> get_buffer_views();
void set_buffer_views(TypedArray<GLTFBufferView> p_buffer_views);
Array get_accessors();
void set_accessors(Array p_accessors);
TypedArray<GLTFAccessor> get_accessors();
void set_accessors(TypedArray<GLTFAccessor> p_accessors);
Array get_meshes();
void set_meshes(Array p_meshes);
TypedArray<GLTFMesh> get_meshes();
void set_meshes(TypedArray<GLTFMesh> p_meshes);
Array get_materials();
void set_materials(Array p_materials);
TypedArray<BaseMaterial3D> get_materials();
void set_materials(TypedArray<BaseMaterial3D> p_materials);
String get_scene_name();
void set_scene_name(String p_scene_name);
@ -139,32 +139,32 @@ public:
String get_base_path();
void set_base_path(String p_base_path);
Array get_root_nodes();
void set_root_nodes(Array p_root_nodes);
PackedInt32Array get_root_nodes();
void set_root_nodes(PackedInt32Array p_root_nodes);
Array get_textures();
void set_textures(Array p_textures);
TypedArray<GLTFTexture> get_textures();
void set_textures(TypedArray<GLTFTexture> p_textures);
Array get_images();
void set_images(Array p_images);
TypedArray<Texture2D> get_images();
void set_images(TypedArray<Texture2D> p_images);
Array get_skins();
void set_skins(Array p_skins);
TypedArray<GLTFSkin> get_skins();
void set_skins(TypedArray<GLTFSkin> p_skins);
Array get_cameras();
void set_cameras(Array p_cameras);
TypedArray<GLTFCamera> get_cameras();
void set_cameras(TypedArray<GLTFCamera> p_cameras);
Array get_lights();
void set_lights(Array p_lights);
TypedArray<GLTFLight> get_lights();
void set_lights(TypedArray<GLTFLight> p_lights);
Array get_unique_names();
void set_unique_names(Array p_unique_names);
TypedArray<String> get_unique_names();
void set_unique_names(TypedArray<String> p_unique_names);
Array get_unique_animation_names();
void set_unique_animation_names(Array p_unique_names);
TypedArray<String> get_unique_animation_names();
void set_unique_animation_names(TypedArray<String> p_unique_names);
Array get_skeletons();
void set_skeletons(Array p_skeletons);
TypedArray<GLTFSkeleton> get_skeletons();
void set_skeletons(TypedArray<GLTFSkeleton> p_skeletons);
Dictionary get_skeleton_to_node();
void set_skeleton_to_node(Dictionary p_skeleton_to_node);
@ -172,8 +172,8 @@ public:
bool get_create_animations();
void set_create_animations(bool p_create_animations);
Array get_animations();
void set_animations(Array p_animations);
TypedArray<GLTFAnimation> get_animations();
void set_animations(TypedArray<GLTFAnimation> p_animations);
Node *get_scene_node(GLTFNodeIndex idx);

View File

@ -46,8 +46,8 @@ static Array to_array(const Vector<T> &p_inp) {
}
template <class T>
static Array to_array(const HashSet<T> &p_inp) {
Array ret;
static TypedArray<T> to_array(const HashSet<T> &p_inp) {
TypedArray<T> ret;
typename HashSet<T>::Iterator elem = p_inp.begin();
while (elem) {
ret.push_back(*elem);
@ -65,7 +65,7 @@ static void set_from_array(Vector<T> &r_out, const Array &p_inp) {
}
template <class T>
static void set_from_array(HashSet<T> &r_out, const Array &p_inp) {
static void set_from_array(HashSet<T> &r_out, const TypedArray<T> &p_inp) {
r_out.clear();
for (int i = 0; i < p_inp.size(); i++) {
r_out.insert(p_inp[i]);

View File

@ -72,11 +72,11 @@ Skeleton3D *GLTFSkeleton::get_godot_skeleton() {
return godot_skeleton;
}
Array GLTFSkeleton::get_unique_names() {
TypedArray<String> GLTFSkeleton::get_unique_names() {
return GLTFTemplateConvert::to_array(unique_names);
}
void GLTFSkeleton::set_unique_names(Array p_unique_names) {
void GLTFSkeleton::set_unique_names(TypedArray<String> p_unique_names) {
GLTFTemplateConvert::set_from_array(unique_names, p_unique_names);
}

View File

@ -75,8 +75,8 @@ public:
// this->godot_skeleton = p_godot_skeleton;
// }
Array get_unique_names();
void set_unique_names(Array p_unique_names);
TypedArray<String> get_unique_names();
void set_unique_names(TypedArray<String> p_unique_names);
//RBMap<int32_t, GLTFNodeIndex> get_godot_bone_node() {
// return this->godot_bone_node;

View File

@ -31,6 +31,7 @@
#include "gltf_skin.h"
#include "../gltf_template_convert.h"
#include "core/variant/typed_array.h"
#include "scene/resources/skin.h"
void GLTFSkin::_bind_methods() {
@ -83,11 +84,11 @@ void GLTFSkin::set_joints_original(Vector<GLTFNodeIndex> p_joints_original) {
joints_original = p_joints_original;
}
Array GLTFSkin::get_inverse_binds() {
TypedArray<Transform3D> GLTFSkin::get_inverse_binds() {
return GLTFTemplateConvert::to_array(inverse_binds);
}
void GLTFSkin::set_inverse_binds(Array p_inverse_binds) {
void GLTFSkin::set_inverse_binds(TypedArray<Transform3D> p_inverse_binds) {
GLTFTemplateConvert::set_from_array(inverse_binds, p_inverse_binds);
}

View File

@ -34,6 +34,9 @@
#include "../gltf_defines.h"
#include "core/io/resource.h"
template <typename T>
class TypedArray;
class GLTFSkin : public Resource {
GDCLASS(GLTFSkin, Resource);
friend class GLTFDocument;
@ -82,8 +85,8 @@ public:
Vector<GLTFNodeIndex> get_joints_original();
void set_joints_original(Vector<GLTFNodeIndex> p_joints_original);
Array get_inverse_binds();
void set_inverse_binds(Array p_inverse_binds);
TypedArray<Transform3D> get_inverse_binds();
void set_inverse_binds(TypedArray<Transform3D> p_inverse_binds);
Vector<GLTFNodeIndex> get_joints();
void set_joints(Vector<GLTFNodeIndex> p_joints);

View File

@ -802,10 +802,10 @@ int TreeItem::get_child_count() {
return children_cache.size();
}
Array TreeItem::get_children() {
TypedArray<TreeItem> TreeItem::get_children() {
// Don't need to explicitly create children cache, because get_child_count creates it.
int size = get_child_count();
Array arr;
TypedArray<TreeItem> arr;
arr.resize(size);
for (int i = 0; i < size; i++) {
arr[i] = children_cache[i];

View File

@ -339,7 +339,7 @@ public:
TreeItem *get_child(int p_idx);
int get_visible_child_count();
int get_child_count();
Array get_children();
TypedArray<TreeItem> get_children();
int get_index();
#ifdef DEV_ENABLED

View File

@ -70,44 +70,44 @@ Array RenderingServer::_texture_debug_usage_bind() {
return arr;
}
static Array to_array(const Vector<ObjectID> &ids) {
Array a;
static PackedInt64Array to_int_array(const Vector<ObjectID> &ids) {
PackedInt64Array a;
a.resize(ids.size());
for (int i = 0; i < ids.size(); ++i) {
a[i] = ids[i];
a.write[i] = ids[i];
}
return a;
}
Array RenderingServer::_instances_cull_aabb_bind(const AABB &p_aabb, RID p_scenario) const {
PackedInt64Array RenderingServer::_instances_cull_aabb_bind(const AABB &p_aabb, RID p_scenario) const {
if (RSG::threaded) {
WARN_PRINT_ONCE("Using this function with a threaded renderer hurts performance, as it causes a server stall.");
}
Vector<ObjectID> ids = instances_cull_aabb(p_aabb, p_scenario);
return to_array(ids);
return to_int_array(ids);
}
Array RenderingServer::_instances_cull_ray_bind(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario) const {
PackedInt64Array RenderingServer::_instances_cull_ray_bind(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario) const {
if (RSG::threaded) {
WARN_PRINT_ONCE("Using this function with a threaded renderer hurts performance, as it causes a server stall.");
}
Vector<ObjectID> ids = instances_cull_ray(p_from, p_to, p_scenario);
return to_array(ids);
return to_int_array(ids);
}
Array RenderingServer::_instances_cull_convex_bind(const Array &p_convex, RID p_scenario) const {
PackedInt64Array RenderingServer::_instances_cull_convex_bind(const Array &p_convex, RID p_scenario) const {
if (RSG::threaded) {
WARN_PRINT_ONCE("Using this function with a threaded renderer hurts performance, as it causes a server stall.");
}
Vector<Plane> planes;
for (int i = 0; i < p_convex.size(); ++i) {
Variant v = p_convex[i];
ERR_FAIL_COND_V(v.get_type() != Variant::PLANE, Array());
ERR_FAIL_COND_V(v.get_type() != Variant::PLANE, PackedInt64Array());
planes.push_back(v);
}
Vector<ObjectID> ids = instances_cull_convex(planes, p_scenario);
return to_array(ids);
return to_int_array(ids);
}
RID RenderingServer::get_test_texture() {
@ -1626,7 +1626,7 @@ Dictionary RenderingServer::_mesh_get_surface(RID p_mesh, int p_idx) {
return d;
}
Array RenderingServer::_instance_geometry_get_shader_uniform_list(RID p_instance) const {
TypedArray<Dictionary> RenderingServer::_instance_geometry_get_shader_uniform_list(RID p_instance) const {
List<PropertyInfo> params;
instance_geometry_get_shader_uniform_list(p_instance, &params);
return convert_property_list(&params);

View File

@ -1216,9 +1216,9 @@ public:
virtual Vector<ObjectID> instances_cull_ray(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const = 0;
virtual Vector<ObjectID> instances_cull_convex(const Vector<Plane> &p_convex, RID p_scenario = RID()) const = 0;
Array _instances_cull_aabb_bind(const AABB &p_aabb, RID p_scenario = RID()) const;
Array _instances_cull_ray_bind(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const;
Array _instances_cull_convex_bind(const Array &p_convex, RID p_scenario = RID()) const;
PackedInt64Array _instances_cull_aabb_bind(const AABB &p_aabb, RID p_scenario = RID()) const;
PackedInt64Array _instances_cull_ray_bind(const Vector3 &p_from, const Vector3 &p_to, RID p_scenario = RID()) const;
PackedInt64Array _instances_cull_convex_bind(const Array &p_convex, RID p_scenario = RID()) const;
enum InstanceFlags {
INSTANCE_FLAG_USE_BAKED_LIGHT,
@ -1581,7 +1581,7 @@ private:
RID _mesh_create_from_surfaces(const TypedArray<Dictionary> &p_surfaces, int p_blend_shape_count);
void _mesh_add_surface(RID p_mesh, const Dictionary &p_surface);
Dictionary _mesh_get_surface(RID p_mesh, int p_idx);
Array _instance_geometry_get_shader_uniform_list(RID p_instance) const;
TypedArray<Dictionary> _instance_geometry_get_shader_uniform_list(RID p_instance) const;
TypedArray<Image> _bake_render_uv2(RID p_base, const TypedArray<RID> &p_material_overrides, const Size2i &p_image_size);
void _particles_set_trail_bind_poses(RID p_particles, const TypedArray<Transform3D> &p_bind_poses);
};

View File

@ -1534,12 +1534,12 @@ String TextServerExtension::string_to_lower(const String &p_string, const String
return p_string;
}
Array TextServerExtension::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
Array ret;
TypedArray<Vector2i> TextServerExtension::parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const {
TypedArray<Vector2i> ret;
if (GDVIRTUAL_CALL(parse_structured_text, p_parser_type, p_args, p_text, ret)) {
return ret;
}
return Array();
return TypedArray<Vector2i>();
}
PackedInt32Array TextServerExtension::string_get_word_breaks(const String &p_string, const String &p_language) const {

View File

@ -505,8 +505,8 @@ public:
GDVIRTUAL2RC(String, string_to_upper, const String &, const String &);
GDVIRTUAL2RC(String, string_to_lower, const String &, const String &);
Array parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const;
GDVIRTUAL3RC(Array, parse_structured_text, StructuredTextParser, const Array &, const String &);
TypedArray<Vector2i> parse_structured_text(StructuredTextParser p_parser_type, const Array &p_args, const String &p_text) const;
GDVIRTUAL3RC(TypedArray<Vector2i>, parse_structured_text, StructuredTextParser, const Array &, const String &);
virtual int is_confusable(const String &p_string, const PackedStringArray &p_dict) const override;
virtual bool spoof_check(const String &p_string) const override;

View File

@ -104,8 +104,8 @@ Ref<TextServer> TextServerManager::find_interface(const String &p_name) const {
return interfaces[idx];
}
Array TextServerManager::get_interfaces() const {
Array ret;
TypedArray<Dictionary> TextServerManager::get_interfaces() const {
TypedArray<Dictionary> ret;
for (int i = 0; i < interfaces.size(); i++) {
Dictionary iface_info;
@ -1663,8 +1663,8 @@ TypedArray<Vector2i> TextServer::parse_structured_text(StructuredTextParser p_pa
return ret;
}
Array TextServer::_shaped_text_get_glyphs_wrapper(const RID &p_shaped) const {
Array ret;
TypedArray<Dictionary> TextServer::_shaped_text_get_glyphs_wrapper(const RID &p_shaped) const {
TypedArray<Dictionary> ret;
const Glyph *glyphs = shaped_text_get_glyphs(p_shaped);
int gl_size = shaped_text_get_glyph_count(p_shaped);
@ -1688,7 +1688,7 @@ Array TextServer::_shaped_text_get_glyphs_wrapper(const RID &p_shaped) const {
return ret;
}
Array TextServer::_shaped_text_sort_logical_wrapper(const RID &p_shaped) {
TypedArray<Dictionary> TextServer::_shaped_text_sort_logical_wrapper(const RID &p_shaped) {
Array ret;
const Glyph *glyphs = shaped_text_sort_logical(p_shaped);
@ -1713,8 +1713,8 @@ Array TextServer::_shaped_text_sort_logical_wrapper(const RID &p_shaped) {
return ret;
}
Array TextServer::_shaped_text_get_ellipsis_glyphs_wrapper(const RID &p_shaped) const {
Array ret;
TypedArray<Dictionary> TextServer::_shaped_text_get_ellipsis_glyphs_wrapper(const RID &p_shaped) const {
TypedArray<Dictionary> ret;
const Glyph *glyphs = shaped_text_get_ellipsis_glyphs(p_shaped);
int gl_size = shaped_text_get_ellipsis_glyph_count(p_shaped);

View File

@ -414,9 +414,9 @@ public:
virtual bool shaped_text_is_ready(const RID &p_shaped) const = 0;
virtual const Glyph *shaped_text_get_glyphs(const RID &p_shaped) const = 0;
Array _shaped_text_get_glyphs_wrapper(const RID &p_shaped) const;
TypedArray<Dictionary> _shaped_text_get_glyphs_wrapper(const RID &p_shaped) const;
virtual const Glyph *shaped_text_sort_logical(const RID &p_shaped) = 0;
Array _shaped_text_sort_logical_wrapper(const RID &p_shaped);
TypedArray<Dictionary> _shaped_text_sort_logical_wrapper(const RID &p_shaped);
virtual int64_t shaped_text_get_glyph_count(const RID &p_shaped) const = 0;
virtual Vector2i shaped_text_get_range(const RID &p_shaped) const = 0;
@ -428,7 +428,7 @@ public:
virtual int64_t shaped_text_get_trim_pos(const RID &p_shaped) const = 0;
virtual int64_t shaped_text_get_ellipsis_pos(const RID &p_shaped) const = 0;
virtual const Glyph *shaped_text_get_ellipsis_glyphs(const RID &p_shaped) const = 0;
Array _shaped_text_get_ellipsis_glyphs_wrapper(const RID &p_shaped) const;
TypedArray<Dictionary> _shaped_text_get_ellipsis_glyphs_wrapper(const RID &p_shaped) const;
virtual int64_t shaped_text_get_ellipsis_glyph_count(const RID &p_shaped) const = 0;
virtual void shaped_text_overrun_trim_to_width(const RID &p_shaped, double p_width, BitField<TextServer::TextOverrunFlag> p_trim_flags) = 0;
@ -541,7 +541,7 @@ public:
int get_interface_count() const;
Ref<TextServer> get_interface(int p_index) const;
Ref<TextServer> find_interface(const String &p_name) const;
Array get_interfaces() const;
TypedArray<Dictionary> get_interfaces() const;
_FORCE_INLINE_ Ref<TextServer> get_primary_interface() const {
return primary_interface;

View File

@ -226,7 +226,7 @@ Ref<XRInterface> XRServer::find_interface(const String &p_name) const {
return interfaces[idx];
};
Array XRServer::get_interfaces() const {
TypedArray<Dictionary> XRServer::get_interfaces() const {
Array ret;
for (int i = 0; i < interfaces.size(); i++) {

View File

@ -157,7 +157,7 @@ public:
int get_interface_count() const;
Ref<XRInterface> get_interface(int p_index) const;
Ref<XRInterface> find_interface(const String &p_name) const;
Array get_interfaces() const;
TypedArray<Dictionary> get_interfaces() const;
/*
note, more then one interface can technically be active, especially on mobile, but only one interface is used for