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
Yufeng Ying
3bf400ffae
Move bisect to Span and deduplicate code.
...
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-05-14 18:19:09 +08:00
Thaddeus Crews
243c8932d3
Merge pull request #82497 from Repiteo/typed-array-consolidation
...
Typed array equality operator update
2025-05-13 16:22:15 -05:00
Thaddeus Crews
a2b49d0800
Merge pull request #93883 from TV4Fun/variant_join
...
Consolidate and simplify string joining code in `VariantUtilityFunctions`
2025-05-13 16:22:13 -05:00
Thaddeus Crews
172794337c
Merge pull request #99985 from allenwp/release-only-crash-99797
...
Print error message when index is out of range in `Variant::iter_get`
2025-05-13 16:22:11 -05:00
Thaddeus Crews
5b935881fc
Typed array equality operator logic updated
...
• Instead of calling to `_ref`, the same effect is achieved by calling to the base class assignment operator
• No longer need to be expose `_ref`; set back to private & remove reference from gdextension_interface
2025-05-13 14:41:16 -05:00
Allen Pestaluky
5657ecc542
Print error message when index is out of range in `Variant::iter_get` of `DEBUG_ENABLED` builds.
...
Mitigates #99797
2025-05-13 13:57:16 -04:00
Rémi Verschelde
620206b0ae
Merge pull request #106309 from aaronp64/string_chr_appends
...
Avoid single character `String` allocations when appending characters
2025-05-13 01:05:45 +02:00
Joel Croteau
981f1e9298
Rename `VariantUtilityFunctions::join()` to `join_string()`
2025-05-12 17:51:09 -05:00
Joel Croteau
8be7ad32e7
Consolidate and simplify string joining code in `VariantUtilityFunctions`
...
`variant_utility.cpp` has 8 different copies of the exact same loop to join
vararg strings together. This is bad coding process and makes the codebase
needlessly cluttered. Also, the loop itself has an i == 0 check that is
unnecessary since String is auto-initialized to be empty and String::operator+=
already checks if it is empty before appending. This is a non-functional change
that only reorganizes the code to be a bit more readable.
2025-05-12 17:47:14 -05:00
aaronp64
8fb3697916
Avoid single character String allocations when appending characters
...
Removed calls to String::chr() when appending characters to Strings in Expression, Resource, and VariantParser, to avoid creating temporary Strings for each character. Also updated the Resource case to resize String up front, since size is known.
2025-05-12 17:35:42 -04:00
mashumafi
b73346ef19
Avoid copy-on-write when reading vectors
2025-05-12 16:08:05 +02: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
aaronp64
d176ba045f
Array performance improvements to reduce copying/copy_on_write calls
...
- Avoid temporary copy of p_array in Array::append_array when types match
- Call ptrw() once before looping in methods that return new Arrays, to avoid copy_on_write call for each item (recursive_duplicate, slice, filter, map)
2025-05-06 13:19:50 -04:00
Thaddeus Crews
5fec9a9fdc
Merge pull request #100057 from aaronp64/container_validate_obj_perf
...
Improve `ContainerTypeValidate` performance for object types
2025-05-06 08:38:03 -05:00
Danil Alexeev
2b30f23595
GDScript: Fix `Callable` call error text
2025-05-02 18:30:35 +03:00
Thaddeus Crews
01fc9aee6c
Core: Modernize C headers with C++ equivalents
2025-05-02 08:23:01 -05:00
Thaddeus Crews
347e51e077
Merge pull request #105922 from aaronp64/dictionary_has_all
...
Avoid extra copy/validation of keys in `Dictionary::has_all`
2025-04-29 16:05:14 -05:00
aaronp64
e4bd611e19
Avoid extra copy/validation of keys in Dictionary::has_all
...
Updated Dictionary::has_all to check its HashMap directly for each validated key instead of going through Dictionary::has, to avoid additional copy/validation of each key.
2025-04-29 15:27:12 -04:00
Thaddeus Crews
3947cbe3b2
Merge pull request #104386 from Repiteo/core/cpp-math
...
Core: Replace C math headers with C++ equivalents
2025-04-27 19:21:22 -05:00
Thaddeus Crews
28089c40c1
Merge pull request #91006 from reduz/live-backtrace
...
Ability to print and log script backtraces
2025-04-24 17:18:52 -05:00
reduz
d1dcb40d56
Ability to print and log script backtraces
...
Co-authored-by: Mikael Hermansson <mikael@hermansson.io>
2025-04-24 18:54:41 +02: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
b8950a4662
Merge pull request #105392 from aaronp64/array_min_max
...
Optimize `Array` `min`/`max` methods
2025-04-15 12:28:40 -05:00
Thaddeus Crews
e5ccaa79e2
Merge pull request #105334 from WindyDarian/insert_at_end
...
Allow inserting at end of array again
2025-04-14 19:39:54 -05:00
Thaddeus Crews
3d80279f80
Merge pull request #90971 from billuo/string-format-rid
...
Fix `RID` cannot be string formatted
2025-04-14 19:39:50 -05:00
aaronp64
ecf63dd079
Optimize Array min/max methods
...
Updated Array::min and Array::max to not copy Variants for comparison, and store index instead of copying each time new min/max is found.
2025-04-14 15:40:06 -04:00
Windy Darian
effd1b71ce
allow inserting at end of array again
2025-04-12 22:16:19 -04:00
Thaddeus Crews
0d267e7b1e
Core: Add dedicated `BitField` template
2025-04-11 11:53:26 -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
Thaddeus Crews
7b74eb1a9b
Merge pull request #105205 from aaronp64/dictionary_has_validated_key
...
Use validated key in `Dictionary::has`
2025-04-09 18:12:02 -05:00
Thaddeus Crews
7a6c3b309f
Merge pull request #105130 from bruvzg/uri_fix_plus
...
Add uri_file_decode to handle + in file names.
2025-04-09 18:11:56 -05:00
aaronp64
117b1c3da1
Use validated key in Dictionary::has
...
Updated Dictionary::has to use validated key when checking variant_map, to handle cases when passed in key is converted to Dictionary's key type.
2025-04-09 12:22:48 -04:00
Pāvels Nadtočajevs
7c4d45ba3b
Add bswap methods to the `PackedByteArray` bindings.
2025-04-09 18:51:50 +03:00
Thaddeus Crews
ec675fc329
Merge pull request #100333 from YYF233333/reduce_list
...
Use `LocalVector` instead of `List` as arg of `Dictionary::get_key_list`
2025-04-09 08:51:45 -05:00
Yufeng Ying
f7e4987d0e
Dictionary::get_key_list use LocalVector instead of List.
2025-04-09 02:46:24 +08:00
Rarysson Guilherme
fe39ffeb7d
Add negative index to `Array.remove_at` and `Array.insert`
2025-04-08 14:55:39 -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
b9665b9ee9
Merge pull request #104991 from nikitalita/fix_inf_neg
...
`VariantWriter::write`: fix writing negative infinity when `p_compat` is true
2025-04-07 08:43:21 -05:00
Thaddeus Crews
8a93218aab
Core: Natively convert enum/BitField with Variant
2025-04-05 12:35:34 -05:00
Thaddeus Crews
21db8487a2
Merge pull request #104664 from tomfull123/missing-typed-dictionary-initializer-list
...
Add missing `initializer_list` constructor to TypedDictionary
2025-04-03 16:50:23 -05:00
nikitalita
046651e729
`VariantWriter::write`: fix writing negative infinity when p_compat is true
2025-04-03 14:36:34 -07:00
Thaddeus Crews
207a2b6472
Core: Integrate warning suppression macro helpers
2025-04-03 10:13:46 -05:00
Tom
8a3f9846c5
Add missing initializer_list constructor for TypedDictionary
2025-04-03 00:17:44 +01:00
Yufeng Ying
4f4031a675
Replace size() == 0 with is_empty().
2025-04-02 19:18:43 +08: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
Rémi Verschelde
be1333dc0a
Merge pull request #97002 from bruvzg/mbchar_iconv
...
Add methods to decode/encode multibyte encodings.
2025-03-28 17:29:47 +01: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
kobewi
75881f8322
Use initializer list in Arrays
2025-03-26 18:38:15 +01:00
Thaddeus Crews
1cb3cfaa8e
Style: Convert namespaces to PascalCase
2025-03-23 19:10:24 -05:00
Thaddeus Crews
325c698331
Merge pull request #103647 from aaronp64/dictionary_multiple_lookup
...
Avoid multiple lookups in `Dictionary::operator[]`
2025-03-23 19:04:00 -05:00
Rémi Verschelde
3f14e6a1b7
Merge pull request #104374 from aaronp64/array_swap_move
...
Optimize `Array` methods with `SWAP`/`std::move`
2025-03-21 13:04:04 +01:00
Thaddeus Crews
f6a35e2a6e
Merge pull request #86015 from kitbdev/array-initializer-list
...
Add list initialization to Array, Variant, and TypedArray
2025-03-19 17:46:06 -05:00
aaronp64
3eb4e6c6ff
Optimize Array methods with SWAP/std::move
...
Updated Array::shuffle() to use SWAP instead of copying through temporary variables, which makes shuffling simple types around 2x faster, and refcounted object types around 20x faster.
Also updated multiple methods that insert into/modify the array to move their validated Variant to avoid an extra copy, speed increase varies depending on type and how much else the methods are doing, usually around 5-10% faster.
2025-03-19 12:17:14 -04:00
kobewi
10f6c01b9c
Remove ABS in favor of Math::abs
2025-03-19 13:52:40 +01:00
Rémi Verschelde
2fa721b1bc
Merge pull request #104127 from Ivorforce/360-noclip
...
Remove `String` clipping constructors.
2025-03-19 12:27:10 +01:00
rune-scape
0c7d78f455
StringLikeVariantOrder: Compare in-place
2025-03-18 11:21:30 -07:00
Thaddeus Crews
4320800621
Core: Expand `is_zero_constructible` coverage
2025-03-17 11:45:26 -05: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
22a7079afd
Merge pull request #104047 from YYF233333/dict_iter
...
Add const iteration support to `Dictionary`
2025-03-13 08:57:23 -05:00
Thaddeus Crews
7f6a9380a0
Merge pull request #103999 from YYF233333/unneeded_array_read_only
...
Remove unneeded `read_only` check for `Array` const operator
2025-03-13 08:57:22 -05:00
Thaddeus Crews
e97bb76142
Merge pull request #100314 from Ivorforce/use-string-chr
...
Optimize `String::chr` to avoid calling `strlen`. Use `String::chr` instead of `String(&chr, 1)` where appropriate.
2025-03-13 08:57:20 -05:00
Yufeng Ying
bebe037abf
Add ConstIterator to Dictionary.
2025-03-13 01:28:46 +08:00
Lukas Tenbrink
75bc471965
Add `is_zero_constructible` to denote if a type can be semi-trivially constructed with all 0 bytes.
...
Optimize `CowData` and `LocalVector` resize for zero constructible types.
Mark several compatible types as `is_zero_constructible`.
2025-03-12 09:49:24 +01:00
Yufeng Ying
883ca56517
Remove unneeded read_only check for Array const operator.
2025-03-12 07:22:42 +08: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
Thaddeus Crews
a13067e61f
Merge pull request #97553 from AThousandShips/semantic_equal
...
[Core] Add `is_same` to types that have float components
2025-03-10 10:01:05 -05:00
A Thousand Ships
331a43a9d8
Add `String::remove_char(s)` methods for performance and convenience
2025-03-10 13:19:28 +01:00
Thaddeus Crews
324512e11c
Style: Replace header guards with `#pragma once`
2025-03-07 17:33:47 -06:00
Thaddeus Crews
3c43508ed7
Merge pull request #102427 from AThousandShips/fix_substr
...
Clean up some uses of `String::substr`
2025-03-07 15:12:33 -06:00
Thaddeus Crews
9c07d31fbb
Merge pull request #101618 from aaronfranke/var-parser-neg-ident
...
VariantParser: Fix reading negated identifiers, replace `inf_neg` with `-inf`
2025-03-07 12:06:35 -06:00
A Thousand Ships
5113022dfe
Clean up some uses of `String::substr`
...
Cases where the end position is either equvalent to the default or past
the end of the string.
2025-03-07 14:50:38 +01:00
aaronp64
7007380d0c
Avoid multiple lookups in Dictionary::operator[]
...
Updated Dictionary::operator[] to get reference to value once to avoid multiple HashMap lookups.
2025-03-05 13:07:30 -05:00
Hotkey
7bc030172e
Fix crash when calling get_argument_count() on invalid Callable
...
https://github.com/godotengine/godot/issues/103438
2025-03-04 13:32:34 +09: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
Aaron Franke
4d75c92225
VariantParser: Fix reading negated identifiers, replace `inf_neg` with `-inf`
2025-02-12 02:40:38 -08:00
Thaddeus Crews
a0f10a28a6
Merge pull request #100933 from Synzorasize/fix_100889
...
Fix parsing Resource type as value type of a Dictionary
2025-02-11 09:13:18 -06: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
Pāvels Nadtočajevs
b50d9742c2
Fix `is_valid_float`, `Variant` parser, `Expression` parser, script highlighter, and `TextServer` not handing capital E in scientific notation.
2025-02-05 18:39:40 +02:00
A Thousand Ships
e825085978
[Core] Add `is_same` to types that have float components
...
Compares `NaN` as equal.
Added to:
* `AABB`
* `Basis`
* `Color`
* `Plane`
* `Projection`
* `Quaternion`
* `Rect2`
* `Transform2D`
* `Transform3D`
* `Vector2`
* `Vector3`
* `Vector4`
And added as a method in `Math`
2025-02-03 19:25:50 +01:00
A Thousand Ships
46b6acdabb
[Core] Expose `Packed*Array::erase`
2025-02-03 19:25:09 +01:00
lawnjelly
5c6d7bfb98
Change `VariantUtility` to prevent undef `print_verbose`
...
Changes the `VariantUtility` function from `print_verbose` to `_print_verbose`, eliminating the need for undefining the `print_verbose` macro, which caused compilation problems.
2025-01-30 10:29:11 +00:00
David Snopek
696285f23a
Use `MethodInfo::get_compatibility_hash()` to generate the hash for `MethodBind::get_hash()` and other GDExtension hash clean up
2025-01-11 15:57:42 -06:00
Lukas Tenbrink
2aeca3e885
Optimize `String::chr` to avoid calling `strlen`. Use `String::chr` instead of `String(&chr, 1)` where appropriate.
2025-01-10 18:06:46 +01:00
Rémi Verschelde
76c8e76560
Merge pull request #101284 from akx/tyops
...
A handful of typo fixes
2025-01-08 15:53:33 +01:00
Rémi Verschelde
b857c2f3e6
Merge pull request #101016 from kiroxas/AddVariantStaticAssert
...
Add static assert checks in `Variant` constructors
2025-01-08 15:53:23 +01:00
Aarni Koskela
f134769506
Fix various typos
...
* Add TODO notes for typos that should be fixed for 5.0
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +02:00
Synzorasize
b0845da37d
Fix parsing Resource type as value type of a Dictionary
2025-01-07 18:37:31 -06:00
Rémi Verschelde
91fda4ecaf
Merge pull request #101055 from Ivorforce/variant-to-number-consolidate
...
Consolidate `Variant` int and float conversion functions to reduce duplicate logic.
2025-01-06 22:48:24 +01:00
Lukas Tenbrink
0e72967244
Consolidate `Variant` int and float conversion functions to reduce duplicate logic.
2025-01-03 20:16:43 +01:00
Rémi Verschelde
c049d07121
VariantParser: Ensure all parse errors have an explanation
...
Likewise in ResourceFormatText and JSON.
2025-01-03 17:17:37 +01:00
Rémi Verschelde
21e6671740
Merge pull request #100937 from Repiteo/style/clang-format-sync
...
Style: Enforce `AllowShortFunctionsOnASingleLine`
2025-01-03 00:49:44 +01:00
Rémi Verschelde
5ff616736a
Merge pull request #100825 from KoBeWi/colored_eight
...
Add `Color.from_rgba8` and deprecate Color8
2025-01-03 00:49:18 +01:00