Commit Graph

177 Commits (cb1569345a6f17da08241e645ab03cb2e1b78d2f)

Author SHA1 Message Date
Mitchell Davis 455bb2a4ed Fixed typo in array.xml (countrary to contrary) Godot Engine Issue #91521 and Docs issue # 11452 2025-11-12 22:13:06 +07:00
John 7e3dcf3ac0 Correct Array `remove_at` class reference
`remove_at` can take negative positions as relative to the end of the array.
The note is no longer needed and contradictory to the first paragraph.
2025-10-19 11:54:58 +07:00
Rémi Verschelde cf6da2a12e
i18n: Sync translations with Weblate
(cherry picked from commit d488e962df)
2025-09-30 13:32:35 +07:00
Thaddeus Crews 4fcd85551c
Merge pull request #107071 from Calinou/doc-typed-dictionary-array
Document typed dictionaries and arrays in the class reference
2025-09-18 12:42:30 +07:00
Pedro J. Estébanez 7dc37bdc9c Enhance bindings of deep resource duplication 2025-06-20 18:40:41 +07:00
Hugo Locurcio b6dcb111d2
Document typed dictionaries and arrays in the class reference 2025-06-13 01:53:17 +07:00
kobewi 13f642d959
Replace XML codeblock spaces with tabs 2025-06-06 14:35:38 +07:00
Thaddeus Crews e41af67e29
Merge pull request #107020 from Aioshiro/typo-array-slice
Fix extra parenthesis in `Array.slice` description
2025-06-02 18:51:22 +07:00
Thaddeus Crews d7d6bc77ed
Merge pull request #106369 from Calinou/doc-array-get
Improve documentation for `Array.get()` and `Packed*Array.get()` methods
2025-06-02 18:51:20 +07:00
Aioshiro 8fc060b8b3 Fix extra parenthesis in `Array.slice` description 2025-06-01 17:05:30 +07:00
Pedro J. Estébanez 6841b45552 Add tests for resource duplication 2025-05-26 17:05:04 +07:00
Pedro J. Estébanez 342266cfd9 Overhaul `Variant::duplicate()` for resources
This in the scope of a duplication triggered via any type in the `Variant` realm. that is, the following: `Variant` itself, `Array` and `Dictionary`. That includes invoking `duplicate()` from scripts.

A `duplicate_deep(deep_subresources_mode)` method is added to `Variant`, `Array` and `Dictionary` (for compatibility reasons, simply adding an extra parameter was not possible). The default value for it is `RESOURCE_DEEP_DUPLICATE_NONE`, which is like calling `duplicate(true)`.

Remarks:
- The results of copying resources via those `Variant` types are exactly the same as if the copy were initiated from the `Resource` type at C++.
- In order to keep some separation between `Variant` and the higher-level animal which is `Resource`, `Variant` still contains the original code for that, so it's self-sufficient unless there's a `Resource` involved. Once the deep copy finds a `Resource` that has to be copied according to the duplication parameters, the algorithm invokes the `Resource` duplication machinery. When the stack is unwind back to a nesting level `Variant` can handle, `Variant` duplication logic keeps functioning.

While that is good from a responsibility separation standpoint, that would have a caveat: `Variant` would not be aware of the mapping between original and duplicate subresources and so wouldn't be able to keep preventing multiple duplicates.

To avoid that, this commit also introduces a wormwhole, a sharing mechanism by which `Variant` and `Resource` can collaborate in managing the lifetime of the original-to-duplicates map. The user-visible benefit is that the overduplicate prevention works as broadly as the whole `Variant` entity being copied, including all nesting levels, regardless how disconnected the data members containing resources may be across al the nesting levels. In other words, despite the aforementioned division of duties between `Variant` and `Resource` duplication logic, the duplicates map is shared among them. It's created when first finding a `Resource` and, however how deep the copy was working at that point, the map kept alive unitl the stack is unwind to the root user call, until the first step of the recursion.

Thanks to that common map of duplicates, this commit is able to fix the issue that `Resource::duplicate_for_local_scene()` used to ignore overridden duplicate logic.
2025-05-26 10:06:40 +07:00
Hugo Locurcio 59a75babf8
Improve documentation for `Array.get()` and `Packed*Array.get()` methods 2025-05-20 23:47:04 +07:00
Rarysson Guilherme fe39ffeb7d Add negative index to `Array.remove_at` and `Array.insert` 2025-04-08 14:55:39 +07:00
Max Chacon 44d10c576e
Improve documentation for return value of `Packed*Array.resize`
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-03-20 16:21:01 +07:00
Micky ca4b29b18d Standardize all "Prints" comments in documentation 2024-12-23 21:26:00 +07:00
Raul Santos 072ff85f82
[.NET] Use collection expressions in docs
As of C# 12 we can now use collection expressions to reduce some boilerplate when initializing collections.
2024-12-21 02:28:59 +07:00
Micky 0c2296fb1b Fix C# boolean "Prints" comments in documentation 2024-11-11 21:19:34 +07:00
Aaron Franke cc9f2b58a0
Bind Array get and set functions 2024-09-26 13:00:17 +07:00
Rémi Verschelde 6bf8a3e3f8
Merge pull request #95449 from SlashScreen/array_functions
Add callable support for `find` and `rfind` `Array` methods
2024-09-20 16:06:13 +07:00
Daylily-Zeleen c6f7c89149 Fix description of `Array.sort_custom()` 2024-09-15 15:52:50 +07:00
Slashscreen 89491f4403 Add callable support for `find` and `rfind` `Array` methods 2024-09-13 00:01:53 +07:00
Rémi Verschelde 4a798ad85d
Merge pull request #95749 from Mickeon/documentation-example-pruning
Remove empty `[b]Example:[/b]` lines from the class reference
2024-08-26 23:29:00 +07:00
aaronp64 39ca8b4e23 Fix Array.sort_custom example code
Array.sort_custom descending sort example was comparing index 0, but had expected result based on comparing index 1.  Updated to use index 1 consistently.
2024-08-26 10:38:23 +07:00
Tallivm b516742358 Fix typo in Array code example 2024-08-24 20:44:01 +07:00
Micky 4ce5856384 Remove empty `[b]Example:[/b]` lines from the class reference 2024-08-19 01:00:52 +07:00
Eduardo Assis 5ada090d74 Fix typo in Array's sort() method description 2024-07-27 16:13:42 +07:00
Micky 31a9c634d5 Overhaul Array Documentation 2024-07-05 13:48:56 +07:00
K. S. Ernest (iFire) Lee f9b488508c
Add PackedVector4Array Variant type
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-05-03 00:58:27 +07:00
Rémi Verschelde a27d9639f2
Merge pull request #79075 from dalexeev/doc-typed-arrays
Update typed arrays documentation
2024-04-08 11:17:38 +07:00
Rémi Verschelde ea961d3981
Merge pull request #78257 from Calinou/doc-packed-arrays-vs-typed-arrays
Document the upsides and downsides of packed arrays versus typed arrays
2024-04-08 11:17:31 +07:00
A Thousand Ships 06df4abcd3
[Doc] Clarify `bsearch(_custom)` behavior
* Added an example for the effect of `before`
* Clarified the arguments to the custom callable can be either order
2024-03-09 13:09:29 +07:00
RedMser 5911a12db1 Update class reference to include some keywords
More should be added in future PRs, wherever there is demand.
2024-02-09 18:13:23 +07:00
Micky 61bdbdd9ee Replace some "uncommon" words in class reference 2024-01-15 18:51:52 +07:00
Hugo Locurcio ab8c9b678f
Document the upsides and downsides of packed arrays versus typed arrays 2023-11-15 23:30:47 +07:00
MewPurPur 80b636069a Add performance note to Array.resize() 2023-11-10 00:41:39 +07:00
Yuri Sizov e538843930 Merge pull request #80936 from curious-broccoli/fix-array-doc
Clarify Array class methods that return error
2023-08-25 14:59:00 +07:00
curious-broccoli d8e7ce58ee Clarify Array class methods that return error
related to #47406
2023-08-24 14:11:56 +07:00
David Turner 30d4d1c6d1 Document pick_random for empty arrays 2023-08-18 17:01:23 +07:00
Ninni Pipping 7752a0d8d1 Fix range error for `Array.slice` 2023-07-07 23:19:42 +07:00
Rémi Verschelde 81064cc239
Doctool: Remove version attribute from XML header
We don't use that info for anything, and it generates unnecessary diffs
every time we bump the minor version (and CI failures if we forget to
sync some files from opt-in modules (mono, text_server_fb).
2023-07-06 10:08:21 +07:00
Rémi Verschelde 346f1ab86b
Bump version to 4.2-dev
Keep on waitin'
2023-07-05 22:07:03 +07:00
Danil Alexeev b33c3fa092
Update typed arrays documentation 2023-07-05 20:30:15 +07:00
Peter Anderson bdffb74f06
Update Array's `remove_at()` description to cover removing the last element 2023-06-19 23:14:46 +07:00
VolTer 04562662d3 Overhaul the top sections of the class reference (Core classes) 2023-05-19 07:04:48 +07:00
Ninni Pipping 96ab31a711 Document how to make custom min/max for Array 2023-04-10 16:41:11 +07:00
George Marques d2b1d6e69b
Remove outdated note about const in Dictionary and Array docs 2023-03-08 12:13:17 +07:00
Rémi Verschelde 1c1524a651
Bump version to 4.1-dev
Can't stop, won't stop, they said, huh?
2023-03-01 01:44:37 +07:00
Rémi Verschelde bbff9fd7a4
Merge pull request #71786 from raulsntos/dotnet/array
Sync C# Array with Core
2023-02-04 00:24:06 +07:00
Dmitrii Maganov 5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +07:00