diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-02 13:57:02 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-02 13:57:02 +0200 |
commit | 3a62c294c72f30f3186403fa57533b4226899e53 (patch) | |
tree | e9f9c9923194ffe513001cccdcf331e71b013947 /modules | |
parent | fe0b893dc7657e7543e62cd1793745c34f82ae66 (diff) | |
parent | 7adc8376ed79f016730845ea3a93f4015b95149e (diff) |
Merge pull request #65170 from KoBeWi/your_argument_is_TypedArray
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gltf/doc_classes/GLTFMesh.xml | 2 | ||||
-rw-r--r-- | modules/gltf/gltf_document.cpp | 2 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_mesh.cpp | 4 | ||||
-rw-r--r-- | modules/gltf/structures/gltf_mesh.h | 6 | ||||
-rw-r--r-- | modules/ogg/doc_classes/OggPacketSequence.xml | 4 | ||||
-rw-r--r-- | modules/ogg/ogg_packet_sequence.cpp | 16 | ||||
-rw-r--r-- | modules/ogg/ogg_packet_sequence.h | 8 | ||||
-rw-r--r-- | modules/regex/doc_classes/RegExMatch.xml | 2 | ||||
-rw-r--r-- | modules/regex/regex.cpp | 4 | ||||
-rw-r--r-- | modules/regex/regex.h | 2 | ||||
-rw-r--r-- | modules/text_server_adv/text_server_adv.cpp | 6 | ||||
-rw-r--r-- | modules/text_server_adv/text_server_adv.h | 6 | ||||
-rw-r--r-- | modules/text_server_fb/text_server_fb.cpp | 4 | ||||
-rw-r--r-- | modules/text_server_fb/text_server_fb.h | 4 |
14 files changed, 35 insertions, 35 deletions
diff --git a/modules/gltf/doc_classes/GLTFMesh.xml b/modules/gltf/doc_classes/GLTFMesh.xml index bac351cc20..4d2df872ea 100644 --- a/modules/gltf/doc_classes/GLTFMesh.xml +++ b/modules/gltf/doc_classes/GLTFMesh.xml @@ -9,7 +9,7 @@ <members> <member name="blend_weights" type="PackedFloat32Array" setter="set_blend_weights" getter="get_blend_weights" default="PackedFloat32Array()"> </member> - <member name="instance_materials" type="Array" setter="set_instance_materials" getter="get_instance_materials" default="[]"> + <member name="instance_materials" type="Material[]" setter="set_instance_materials" getter="get_instance_materials" default="[]"> </member> <member name="mesh" type="ImporterMesh" setter="set_mesh" getter="get_mesh"> </member> diff --git a/modules/gltf/gltf_document.cpp b/modules/gltf/gltf_document.cpp index bb83064446..61af58bda7 100644 --- a/modules/gltf/gltf_document.cpp +++ b/modules/gltf/gltf_document.cpp @@ -5007,7 +5007,7 @@ GLTFMeshIndex GLTFDocument::_convert_mesh_to_gltf(Ref<GLTFState> state, MeshInst Ref<GLTFMesh> gltf_mesh; gltf_mesh.instantiate(); - Array instance_materials; + TypedArray<Material> instance_materials; for (int32_t surface_i = 0; surface_i < current_mesh->get_surface_count(); surface_i++) { Ref<Material> mat = current_mesh->get_surface_material(surface_i); if (p_mesh_instance->get_surface_override_material(surface_i).is_valid()) { diff --git a/modules/gltf/structures/gltf_mesh.cpp b/modules/gltf/structures/gltf_mesh.cpp index 3add8304b1..3893f56626 100644 --- a/modules/gltf/structures/gltf_mesh.cpp +++ b/modules/gltf/structures/gltf_mesh.cpp @@ -53,11 +53,11 @@ void GLTFMesh::set_mesh(Ref<ImporterMesh> p_mesh) { mesh = p_mesh; } -Array GLTFMesh::get_instance_materials() { +TypedArray<Material> GLTFMesh::get_instance_materials() { return instance_materials; } -void GLTFMesh::set_instance_materials(Array p_instance_materials) { +void GLTFMesh::set_instance_materials(TypedArray<Material> p_instance_materials) { instance_materials = p_instance_materials; } diff --git a/modules/gltf/structures/gltf_mesh.h b/modules/gltf/structures/gltf_mesh.h index dc26120b48..2fa37fd727 100644 --- a/modules/gltf/structures/gltf_mesh.h +++ b/modules/gltf/structures/gltf_mesh.h @@ -42,7 +42,7 @@ class GLTFMesh : public Resource { private: Ref<ImporterMesh> mesh; Vector<float> blend_weights; - Array instance_materials; + TypedArray<Material> instance_materials; protected: static void _bind_methods(); @@ -52,8 +52,8 @@ public: void set_mesh(Ref<ImporterMesh> p_mesh); Vector<float> get_blend_weights(); void set_blend_weights(Vector<float> p_blend_weights); - Array get_instance_materials(); - void set_instance_materials(Array p_instance_materials); + TypedArray<Material> get_instance_materials(); + void set_instance_materials(TypedArray<Material> p_instance_materials); }; #endif // GLTF_MESH_H diff --git a/modules/ogg/doc_classes/OggPacketSequence.xml b/modules/ogg/doc_classes/OggPacketSequence.xml index d3bd4455d8..1148b38602 100644 --- a/modules/ogg/doc_classes/OggPacketSequence.xml +++ b/modules/ogg/doc_classes/OggPacketSequence.xml @@ -17,10 +17,10 @@ </method> </methods> <members> - <member name="granule_positions" type="Array" setter="set_packet_granule_positions" getter="get_packet_granule_positions" default="[]"> + <member name="granule_positions" type="PackedInt64Array" setter="set_packet_granule_positions" getter="get_packet_granule_positions" default="PackedInt64Array()"> Contains the granule positions for each page in this packet sequence. </member> - <member name="packet_data" type="Array" setter="set_packet_data" getter="get_packet_data" default="[]"> + <member name="packet_data" type="Array[]" setter="set_packet_data" getter="get_packet_data" default="[]"> Contains the raw packets that make up this OggPacketSequence. </member> <member name="sampling_rate" type="float" setter="set_sampling_rate" getter="get_sampling_rate" default="0.0"> diff --git a/modules/ogg/ogg_packet_sequence.cpp b/modules/ogg/ogg_packet_sequence.cpp index de8bf4a087..b9e48191e1 100644 --- a/modules/ogg/ogg_packet_sequence.cpp +++ b/modules/ogg/ogg_packet_sequence.cpp @@ -41,7 +41,7 @@ void OggPacketSequence::push_page(int64_t p_granule_pos, const Vector<PackedByte data_version++; } -void OggPacketSequence::set_packet_data(const Array &p_data) { +void OggPacketSequence::set_packet_data(const TypedArray<Array> &p_data) { data_version++; // Update the data version so old playbacks know that they can't rely on us anymore. page_data.clear(); for (int page_idx = 0; page_idx < p_data.size(); page_idx++) { @@ -54,8 +54,8 @@ void OggPacketSequence::set_packet_data(const Array &p_data) { } } -Array OggPacketSequence::get_packet_data() const { - Array ret; +TypedArray<Array> OggPacketSequence::get_packet_data() const { + TypedArray<Array> ret; for (const Vector<PackedByteArray> &page : page_data) { Array page_variant; for (const PackedByteArray &packet : page) { @@ -66,7 +66,7 @@ Array OggPacketSequence::get_packet_data() const { return ret; } -void OggPacketSequence::set_packet_granule_positions(const Array &p_granule_positions) { +void OggPacketSequence::set_packet_granule_positions(const PackedInt64Array &p_granule_positions) { data_version++; // Update the data version so old playbacks know that they can't rely on us anymore. page_granule_positions.clear(); for (int page_idx = 0; page_idx < p_granule_positions.size(); page_idx++) { @@ -75,8 +75,8 @@ void OggPacketSequence::set_packet_granule_positions(const Array &p_granule_posi } } -Array OggPacketSequence::get_packet_granule_positions() const { - Array ret; +PackedInt64Array OggPacketSequence::get_packet_granule_positions() const { + PackedInt64Array ret; for (int64_t granule_pos : page_granule_positions) { ret.push_back(granule_pos); } @@ -127,8 +127,8 @@ void OggPacketSequence::_bind_methods() { ClassDB::bind_method(D_METHOD("get_length"), &OggPacketSequence::get_length); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "packet_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_packet_data", "get_packet_data"); - ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "granule_positions", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_packet_granule_positions", "get_packet_granule_positions"); + ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "packet_data", PROPERTY_HINT_ARRAY_TYPE, "PackedByteArray", PROPERTY_USAGE_NO_EDITOR), "set_packet_data", "get_packet_data"); + ADD_PROPERTY(PropertyInfo(Variant::PACKED_INT64_ARRAY, "granule_positions", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_packet_granule_positions", "get_packet_granule_positions"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "sampling_rate", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR), "set_sampling_rate", "get_sampling_rate"); } diff --git a/modules/ogg/ogg_packet_sequence.h b/modules/ogg/ogg_packet_sequence.h index efd3b64a39..c275f0c639 100644 --- a/modules/ogg/ogg_packet_sequence.h +++ b/modules/ogg/ogg_packet_sequence.h @@ -67,11 +67,11 @@ public: // This should be called for each page, even for pages that no packets ended on. void push_page(int64_t p_granule_pos, const Vector<PackedByteArray> &p_data); - void set_packet_data(const Array &p_data); - Array get_packet_data() const; + void set_packet_data(const TypedArray<Array> &p_data); + TypedArray<Array> get_packet_data() const; - void set_packet_granule_positions(const Array &p_granule_positions); - Array get_packet_granule_positions() const; + void set_packet_granule_positions(const PackedInt64Array &p_granule_positions); + PackedInt64Array get_packet_granule_positions() const; // Sets a sampling rate associated with this object. OggPacketSequence doesn't understand codecs, // so this value is naively stored as a convenience. diff --git a/modules/regex/doc_classes/RegExMatch.xml b/modules/regex/doc_classes/RegExMatch.xml index 5bcf070e82..31e2207d84 100644 --- a/modules/regex/doc_classes/RegExMatch.xml +++ b/modules/regex/doc_classes/RegExMatch.xml @@ -44,7 +44,7 @@ <member name="names" type="Dictionary" setter="" getter="get_names" default="{}"> A dictionary of named groups and its corresponding group number. Only groups that were matched are included. If multiple groups have the same name, that name would refer to the first matching one. </member> - <member name="strings" type="Array" setter="" getter="get_strings" default="[]"> + <member name="strings" type="PackedStringArray" setter="" getter="get_strings" default="PackedStringArray()"> An [Array] of the match and its capturing groups. </member> <member name="subject" type="String" setter="" getter="get_subject" default=""""> diff --git a/modules/regex/regex.cpp b/modules/regex/regex.cpp index b2e6ea1004..c808211d68 100644 --- a/modules/regex/regex.cpp +++ b/modules/regex/regex.cpp @@ -82,8 +82,8 @@ Dictionary RegExMatch::get_names() const { return result; } -Array RegExMatch::get_strings() const { - Array result; +PackedStringArray RegExMatch::get_strings() const { + PackedStringArray result; int size = data.size(); diff --git a/modules/regex/regex.h b/modules/regex/regex.h index 6920d2634d..ac518f16df 100644 --- a/modules/regex/regex.h +++ b/modules/regex/regex.h @@ -63,7 +63,7 @@ public: int get_group_count() const; Dictionary get_names() const; - Array get_strings() const; + PackedStringArray get_strings() const; String get_string(const Variant &p_name) const; int get_start(const Variant &p_name) const; int get_end(const Variant &p_name) const; diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index abef48e2a1..7aebeafe70 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -3823,7 +3823,7 @@ Variant TextServerAdvanced::shaped_get_span_meta(const RID &p_shaped, int64_t p_ return sd->spans[p_index].meta; } -void TextServerAdvanced::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { +void TextServerAdvanced::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); ERR_FAIL_INDEX(p_index, sd->spans.size()); @@ -3844,7 +3844,7 @@ void TextServerAdvanced::shaped_set_span_update_font(const RID &p_shaped, int64_ } } -bool TextServerAdvanced::shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { +bool TextServerAdvanced::shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { ShapedTextDataAdvanced *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); ERR_FAIL_COND_V(p_size <= 0, false); @@ -5048,7 +5048,7 @@ _FORCE_INLINE_ void TextServerAdvanced::_add_featuers(const Dictionary &p_source } } -void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_end, hb_script_t p_script, hb_direction_t p_direction, Array p_fonts, int64_t p_span, int64_t p_fb_index) { +void TextServerAdvanced::_shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_end, hb_script_t p_script, hb_direction_t p_direction, TypedArray<RID> p_fonts, int64_t p_span, int64_t p_fb_index) { int fs = p_sd->spans[p_span].font_size; if (p_fb_index >= p_fonts.size()) { // Add fallback glyphs. diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h index 02abc31c55..1db95d153b 100644 --- a/modules/text_server_adv/text_server_adv.h +++ b/modules/text_server_adv/text_server_adv.h @@ -407,7 +407,7 @@ class TextServerAdvanced : public TextServerExtension { int64_t _convert_pos(const ShapedTextDataAdvanced *p_sd, int64_t p_pos) const; int64_t _convert_pos_inv(const ShapedTextDataAdvanced *p_sd, int64_t p_pos) const; bool _shape_substr(ShapedTextDataAdvanced *p_new_sd, const ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_length) const; - void _shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_end, hb_script_t p_script, hb_direction_t p_direction, Array p_fonts, int64_t p_span, int64_t p_fb_index); + void _shape_run(ShapedTextDataAdvanced *p_sd, int64_t p_start, int64_t p_end, hb_script_t p_script, hb_direction_t p_direction, TypedArray<RID> p_fonts, int64_t p_span, int64_t p_fb_index); Glyph _shape_single_glyph(ShapedTextDataAdvanced *p_sd, char32_t p_char, hb_script_t p_script, hb_direction_t p_direction, const RID &p_font, int64_t p_font_size); _FORCE_INLINE_ void _add_featuers(const Dictionary &p_source, Vector<hb_feature_t> &r_ftrs); @@ -656,13 +656,13 @@ public: virtual void shaped_text_set_spacing(const RID &p_shaped, SpacingType p_spacing, int64_t p_value) override; virtual int64_t shaped_text_get_spacing(const RID &p_shaped, SpacingType p_spacing) const override; - virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; + virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int64_t p_length = 1) override; virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override; virtual int64_t shaped_get_span_count(const RID &p_shaped) const override; virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const override; - virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary()) override; + virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary()) override; virtual RID shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const override; virtual RID shaped_text_get_parent(const RID &p_shaped) const override; diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index 359bb056a8..4d599dbcb5 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -2792,7 +2792,7 @@ Variant TextServerFallback::shaped_get_span_meta(const RID &p_shaped, int64_t p_ return sd->spans[p_index].meta; } -void TextServerFallback::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { +void TextServerFallback::shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND(!sd); ERR_FAIL_INDEX(p_index, sd->spans.size()); @@ -2816,7 +2816,7 @@ void TextServerFallback::shaped_set_span_update_font(const RID &p_shaped, int64_ sd->valid = false; } -bool TextServerFallback::shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { +bool TextServerFallback::shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features, const String &p_language, const Variant &p_meta) { ShapedTextDataFallback *sd = shaped_owner.get_or_null(p_shaped); ERR_FAIL_COND_V(!sd, false); diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h index 940c57a354..cbb2fb03f2 100644 --- a/modules/text_server_fb/text_server_fb.h +++ b/modules/text_server_fb/text_server_fb.h @@ -535,13 +535,13 @@ public: virtual void shaped_text_set_spacing(const RID &p_shaped, SpacingType p_spacing, int64_t p_value) override; virtual int64_t shaped_text_get_spacing(const RID &p_shaped, SpacingType p_spacing) const override; - virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; + virtual bool shaped_text_add_string(const RID &p_shaped, const String &p_text, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary(), const String &p_language = "", const Variant &p_meta = Variant()) override; virtual bool shaped_text_add_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER, int64_t p_length = 1) override; virtual bool shaped_text_resize_object(const RID &p_shaped, const Variant &p_key, const Size2 &p_size, InlineAlignment p_inline_align = INLINE_ALIGNMENT_CENTER) override; virtual int64_t shaped_get_span_count(const RID &p_shaped) const override; virtual Variant shaped_get_span_meta(const RID &p_shaped, int64_t p_index) const override; - virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const Array &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary()) override; + virtual void shaped_set_span_update_font(const RID &p_shaped, int64_t p_index, const TypedArray<RID> &p_fonts, int64_t p_size, const Dictionary &p_opentype_features = Dictionary()) override; virtual RID shaped_text_substr(const RID &p_shaped, int64_t p_start, int64_t p_length) const override; virtual RID shaped_text_get_parent(const RID &p_shaped) const override; |