286 Commits

Author SHA1 Message Date
Rémi Verschelde
1a64b6b5b6
Merge pull request #106913 from Ivorforce/string-resize-uninitialized
Rename `String::resize` to `resize_uninitialized`
2025-06-12 22:48:45 +02:00
OsakiTsukiko
805ad87340
Add PackedByteArray conversion to PackedVector2Array, PackedVector3Array, PackedVector4Array and PackedColorArray 2025-06-12 17:05:57 +02:00
Danil Alexeev
f864d0ce11
GDScript: Re-add ord() function 2025-06-11 21:01:13 +03:00
Lukas Tenbrink
b13a0e1834 Rename String::resize to resize_uninitialized, to better communicate to callers that new characters must be initialized. 2025-06-11 18:13:02 +02:00
Zi Ye
b957cf73ef Optimized and exposed Basis::scaled_local. 2025-06-05 13:06:46 -05:00
Rémi Verschelde
61639d9574
Merge pull request #106996 from Ivorforce/no-oa-hashmap
Core: Remove `OAHashMap`, in favour of `AHashMap`
2025-06-05 13:12:34 +02:00
Aaron Franke
5777a88b76
Support 64-bit sizes in Compression 2025-06-03 00:03:01 -07:00
Lukas Tenbrink
963c20565b Remove OAHashMap, in favour of AHashMap.
The two types had (mostly) the same decisions, but `AHashMap` is a faster implementation, and is more consistent with `HashMap`.
2025-05-31 15:50:10 +02:00
Thaddeus Crews
0f67c3e992
Merge pull request #104522 from Ivorforce/localvector-force-trivial-resize
Core: Add `resize_initialized` and `resize_uninitialized` to `Vector` and `LocalVector`
2025-05-27 09:39:27 -05:00
Thaddeus Crews
63dff62948
Merge pull request #100673 from RandomShaper/res_duplicate
Overhaul resource duplication
2025-05-27 09:39:25 -05:00
Lukas Tenbrink
4cb8a0c77e Add resize_initialized and resize_uninitialized to Vector. These functions serve as replacements for resize, to make sure the caller understands whether elements need to be initialized 'by hand' after the call. 2025-05-26 18:35:41 +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
Aaron Franke
15de1d6c35
Use Grisu2 algorithm in String::num_scientific to fix serializing 2025-05-22 09:13:16 -07:00
Thaddeus Crews
d237e31a89
Style: Remove redundant DEBUG_METHODS_ENABLED
• Replaced with functionally identical and far more ubiquitous `DEBUG_ENABLED`
2025-05-15 13:09:41 -05:00
Thaddeus Crews
051712dfb8
Merge pull request #103264 from mhilbrunner/docs-path-join
Rename "file" param for str.path_join() to "path"
2025-05-07 12:48:29 -05:00
Thaddeus Crews
ad40939b6f
Core: Replace C math headers with C++ equivalents
- Minor restructuring to ensure `math_funcs.h` is the central point for math functions
2025-04-16 15:49:02 -05:00
Thaddeus Crews
717df3ee88
Merge pull request #105249 from Repiteo/core/math-defs-namespace
Core: Use `Math` namespace for constants
2025-04-11 09:51:04 -05:00
Thaddeus Crews
31bb3be5a6
Merge pull request #105145 from bruvzg/swap_pba
Add bswap methods to the `PackedByteArray` bindings.
2025-04-10 16:53:46 -05:00
Thaddeus Crews
94282d88f9
Core: Use Math namespace for constants 2025-04-10 16:29:30 -05:00
Priahoud
bf963e767e Add Options, Functions and Settings to convert Node-Names and Strings to kebab-case
- refactored and renamed String::_camelcase_to_underscore to String:_separate_compound_words
- refactored String::to_snake_case to work with the refactored String::_separate_compound_words
- created char_utils::is_hyphen to catch all hyphen variants in kebab-case conversion
- created String::to_kebab_case using the new String::_separate_compound_words
- created corresponding Documentation in String and StringName
- simplified both switch statements in EditorNode and ProjectDialog
- added new kebab-casing Option for Node Names in ProjectSettings
- added missing camelCase Options to Scene- and Node-Names in ProjectSettings
- simplified Mono RuntimeInterop Functions
- hooked up the ConnectionsDialog
- created additional Unit Tests
2025-04-10 21:22:21 +02:00
A Thousand Ships
889410dcda
Add String::replace_char(s) methods for performance and convenience 2025-04-10 13:08:45 +02:00
Pāvels Nadtočajevs
7c4d45ba3b
Add bswap methods to the PackedByteArray bindings. 2025-04-09 18:51:50 +03:00
Pāvels Nadtočajevs
9abe2e5294
Add uri_file_decode to handle + in file names. 2025-04-07 23:49:17 +03:00
Thaddeus Crews
780cf03051
Merge pull request #104556 from Ivorforce/string-extend-instead-of-parse
Use `append_` instead of `parse_` for `String` methods.
2025-03-29 10:16:33 -05:00
bruvzg
48bfe13e4f
Add methods to decode/encode multibyte encodings. 2025-03-28 17:32:34 +02:00
Lukas Tenbrink
ffa6ef220b Use append_ instead of parse_ for String methods. 2025-03-27 17:51:02 +01:00
Lukas Tenbrink
a23f630781 Remove String clipping constructors.
Callers should instead call constructors with explicit encoding names, with known length `Span`.
2025-03-15 12:34:44 +01:00
Thaddeus Crews
dae32f8ec6
Merge pull request #92737 from AThousandShips/packed_erase
[Core] Expose `Packed*Array::erase`
2025-03-10 10:01:06 -05:00
A Thousand Ships
331a43a9d8
Add String::remove_char(s) methods for performance and convenience 2025-03-10 13:19:28 +01:00
Pāvels Nadtočajevs
f9c7d348c3 Add bound checks to Array/Packed*Array variant call get and set methods. 2025-02-27 17:54:40 +02:00
Max Hilbrunner
3275116304 Rename "file" param for str.path_join() to "path" 2025-02-25 15:58:33 +01:00
Pāvels Nadtočajevs
1bc86c2626 Fix PackedStringArray.to_byte_array() to return UTF-8 encoded data instead of pointers. 2025-02-07 10:19:32 +02:00
A Thousand Ships
46b6acdabb
[Core] Expose Packed*Array::erase 2025-02-03 19:25:09 +01:00
kobewi
4e48b19e1f Add Color.from_rgba8 and deprecate Color8 2024-12-27 11:26:59 +01:00
Danil Alexeev
03b05cf9ac
Core: Fix built-in enum constant bindings 2024-11-22 14:03:21 +03:00
Danil Alexeev
e379cc76e5
Core: Fix Callable.get_bound_arguments{,_count}() return incorrect data 2024-11-04 22:41:56 +03: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
A Thousand Ships
203d3be200
[Core] Add way to check if a signal has any connections
Added to `Object` and `Signal`
2024-09-20 16:39:09 +02: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 +02:00
Slashscreen
89491f4403 Add callable support for find and rfind Array methods 2024-09-13 00:01:53 -07:00
Thaddeus Crews
9853a69144
Implement typed dictionaries 2024-09-04 10:27:26 -05:00
Haoyu Qiu
8bf4ecc026 Add String.is_valid_unicode_identifier()
- Adds `is_valid_unicode_identifier()`
- Adds `is_valid_ascii_identifier()`
- Deprecates `is_valid_identifier()`
- Renames `validate_identifier()` to `validate_ascii_identifier()`
2024-08-27 11:34:08 +08:00
Aaron Franke
7db24a9ad5
Simplify and fix Rect2/AABB get_support function 2024-08-19 23:55:31 -07: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
bruvzg
d8e1ab085a
[Windows] Fix 32-bit MinGW LTO build. 2024-06-04 13:46:03 +03:00
kobewi
413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
A Thousand Ships
b4c6cc7d82
[Core] Add case-insensitive String::containsn 2024-05-08 12:48:01 +02:00
Wilson E. Alvarez
d4154dbc55
Add const char * overloads to String class
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2024-05-07 10:53:00 -04: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 +02:00