1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00
Commit Graph

106 Commits

Author SHA1 Message Date
AdvanceControl
c24d6afd64 Docs: Fix example in Dictionary.set description 2025-10-04 11:11:54 +08: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 -05:00
Rémi Verschelde
a0f9f5d90a Merge pull request #107770 from RandomShaper/fix_res_dupe_bindings
Enhance bindings of deep resource duplication
2025-06-21 11:14:19 +02:00
Pedro J. Estébanez
7dc37bdc9c Enhance bindings of deep resource duplication 2025-06-20 18:40:41 +02:00
Hugo Locurcio
b6dcb111d2 Document typed dictionaries and arrays in the class reference 2025-06-13 01:53:17 +02:00
ProgrammerOnCoffee
11af23a7a7 Enforce GDScript and C# dictionary spacing style guidelines in code samples
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Micky <66727710+Mickeon@users.noreply.github.com>
2025-06-10 13:32:57 -04:00
kobewi
13f642d959 Replace XML codeblock spaces with tabs 2025-06-06 14:35:38 +02:00
Pedro J. Estébanez
6841b45552 Add tests for resource duplication 2025-05-26 17:05:04 +02: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 +02:00
Micky
e935fb1ee2 Fix miscellaneous oddities around the class reference (part 4) 2025-04-10 17:56:58 +02:00
Micky
0c2296fb1b Fix C# boolean "Prints" comments in documentation 2024-11-11 21:19:34 +01:00
Aaron Franke
a7f6ec0e4c Add a sort method to Dictionary and HashMap 2024-10-02 14:26:33 -07:00
Aaron Franke
cc9f2b58a0 Bind Array get and set functions 2024-09-26 13:00:17 -07:00
Thaddeus Crews
9853a69144 Implement typed dictionaries 2024-09-04 10:27:26 -05:00
Haoyu Qiu
7cf9ed5f65 Fix several typos in the documentation 2024-08-02 08:42:20 +08:00
bruvzg
e651421905 [TextServer, GDExtension] Fix building text servers as GDExtension, expose new/changed low-level methods to GDExtension API. 2024-06-12 19:30:19 +03:00
skyace65
c83718624f Update links to outdated asset library demos
Update links to outdated asset library demos

Co-authored-by: Max Hilbrunner <m.hilbrunner@gmail.com>
2024-04-07 16:59:43 +02:00
kobewi
eb0a624902 Allow returning Dictionary after merging 2024-03-06 14:49:35 +01:00
Aaron Franke
437586bf31 Add a get_or_add method to Dictionary 2023-12-06 11:43:58 -06:00
Hugo Locurcio
0396e12a47 Add an example for Dictionary.merge(), mention lack of recursion 2023-10-31 10:16:11 +01:00
Septian
2857b91385 Fix many typos in documentation 2023-07-19 19:56:06 +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 +02:00
Rémi Verschelde
346f1ab86b Bump version to 4.2-dev
Keep on waitin'
2023-07-05 22:07:03 +02:00
Raul Santos
6723b4e8c3 C#: Fix dictionary key lookup documentation
The method to check if a key exists in the dictionary is called `ContainsKey`.
2023-06-02 11:13:03 +02:00
VolTer
04562662d3 Overhaul the top sections of the class reference (Core classes) 2023-05-19 07:04:48 +02:00
George Marques
d2b1d6e69b Remove outdated note about const in Dictionary and Array docs 2023-03-08 12:13:17 -03: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 +01:00
Raul Santos
7eb8325180 Fix C# examples in documentation
- Fix documentation after C# renames.
- Add missing `partial` in C# class declarations.
- Change `delta` parameter type to `double` in C#.
- Ensure parameters match base declaration.
- Use `$` string interpolation in C#.
- Fix invalid or outdated C# code.
- Changed some examples to follow our style guide more closely.
2023-01-31 19:04:07 +01:00
Dmitrii Maganov
5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02:00
Rémi Verschelde
312011fade Fix various typos with codespell
And include #72377.

Co-authored-by: Wiktor Kocielski <withaust@gmail.com>
2023-01-30 14:22:47 +01:00
Dmitrii Maganov
abe6d67232 GDScript: Fix test for read-only state of constants 2023-01-27 05:28:08 +02:00
Danil Alexeev
b004f8180e GDScript: Allow constant expressions in annotations 2023-01-25 18:43:56 +03:00
Rémi Verschelde
346efd29e0 Fix typos with codespell 2022-12-15 12:24:08 +01:00
Micky
b77f93516e Overhaul Dictionary Documentation 2022-12-05 17:17:53 +01:00
Rémi Verschelde
f7c611ab71 Style: Misc docs and comment style and language fixes
- Removed empty paragraphs in XML.
- Consistently use bold style for "Example:", on a new line.
- Fix usage of `[code]` when hyperlinks could be used (`[member]`, `[constant]`).
- Fix invalid usage of backticks for inline code in BBCode.
- Fix some American/British English spelling inconsistencies.
- Other minor fixes spotted along the way, including typo fixes with codespell.
- Don't specify `@GlobalScope` for `enum` and `constant`.
2022-11-02 19:01:18 +01:00
kobewi
1b7aee3c8d Fill random docs 2022-10-07 20:10:18 +02:00
volokh0x
ff23defaf8 Fix typos in Dictionary.xml 2022-09-06 13:38:40 +03:00
kobewi
cc424bcb18 Add Dictionary.find_key() 2022-08-16 13:48:59 +02:00
Andy Maloney
d32803fdd6 [doc] Use "param" instead of "code" to refer to parameters (7) 2022-08-12 13:19:48 -04:00
Yuri Sizov
c5d7115038 Rename the argument tag to param in XML documentation 2022-08-08 22:34:31 +03:00
Rémi Verschelde
83421cd06f Merge pull request #59883 from KoBeWi/merge_this 2022-06-06 23:38:29 +02:00
kobewi
a0915e6dee Add Dictionary.merge() 2022-05-31 21:05:56 +02:00
dtesniere
55b63eceaa Fix class name : change "string" to "String"
Change case of "s" letter : "string" does not compile but "String" does (for gdScript)
2022-05-29 00:40:56 +02:00
Yuri Roubinsky
32f2c47356 Remove generating of null comparison operators from documentation 2022-03-14 22:35:23 +03:00
Hugo Locurcio
b68dd2e189 Add an XML schema for documentation
This makes it easier to spot syntax errors when editing the
class reference. The schema is referenced locally so validation
can still work offline.

Each class XML's schema conformance is also checked on GitHub Actions.
2022-02-15 00:03:31 +01:00
Hugo Locurcio
08541fe11d Clarify identical hash() return values due to collisions 2022-02-12 22:21:37 +01:00
Rémi Verschelde
6c1bd4d227 Replace Godot docs URL with $DOCS_URL in XML class reference 2021-11-15 13:02:21 +01:00
Aaron Franke
6772ebcea0 Move the docs for constructors and operators out of methods section 2021-10-29 12:34:57 -05:00
Rémi Verschelde
862994a8ef doc: Update links to latest documentation after content reorganization 2021-10-06 13:48:48 +02:00
Max Hilbrunner
770bd61767 Merge pull request #53076 from zacryol/dict-typo-fix
Fix typo with example variable name in Dictionary docs
2021-09-30 20:19:05 +02:00