Thaddeus Crews
06bdfa5a16
Merge pull request #110478 from beicause/opt-node-path-to-string
...
Optimize NodePath to String by using cached path
2025-10-23 11:03:53 -05:00
Thaddeus Crews
20430236e7
Merge pull request #107999 from timothyqiu/translation-cleanup
...
Clean up editor translation related methods
2025-10-15 16:31:09 -05:00
Thaddeus Crews
49219de402
Merge pull request #108862 from timothyqiu/plural-rules
...
Move context and plural support to `Translation`
2025-10-15 16:31:07 -05:00
Lukas Tenbrink
839e0358b3
Assert that dictionary.h does not include String, and that neither of the fundamental containers include Object.
2025-10-06 23:03:27 +02:00
Thaddeus Crews
f1f9f54ac3
Merge pull request #111244 from Ivorforce/dont-include-array
...
Remove `Array` include from `dictionary.h` and `ustring.h`.
2025-10-06 14:34:10 -05:00
Lukas Tenbrink
dc5e615a1d
Remove Array include from dictionary.h and ustring.h.
2025-10-06 16:21:36 +02:00
Thaddeus Crews
5935a32e32
Core: Cleanup headers in core/config
...
- `MainLoop` now forward-declared in `OS`
2025-10-06 09:20:56 -05:00
Thaddeus Crews
d1d28c0bcf
Merge pull request #111223 from Ivorforce/remove-iterator-include
...
Replace `std::size` usage with `std_size` to avoid `<iterator>` include.
2025-10-06 09:06:49 -05:00
Thaddeus Crews
d8df20a2e6
Merge pull request #110932 from Ivorforce/string-buffer-size-comment
...
Add comments to `String::size` to lead people to `length()` and explain the difference.
2025-10-06 09:06:40 -05:00
Lukas Tenbrink
ad600125df
Rewrite HashMapHasherDefault based on type traits - it is now possible to declare a default hashing function for any type.
...
Remove cross-project includes from `hashfuncs.h`.
Improve hashing function for `Color` (based on values instead of `String`).
Move `Variant` comparison from `hash_map.h` to `dictionary.cpp` (`VariantComparatorDictionary`), where it's used.
Remove now unnecessary `HashableHasher`.
2025-10-05 01:49:11 +02:00
Lukas Tenbrink
1db0a60dc0
Replace std::size usage with std_size to avoid <iterator> include.
2025-10-05 00:26:11 +02:00
Lukas Tenbrink
712bc99668
Add STATIC_ASSERT_INCOMPLETE_TYPE to enforce include minimality.
...
Add enforcements against `Dictionary` for `ustring.h` and two for `Dictionary` and `String` from `array.h`.
2025-10-01 23:46:35 +02:00
Lukas Tenbrink
bac9a9be85
Add comments to String::size to lead people to length() and explain the difference.
...
# Conflicts:
# core/string/ustring.h
2025-10-01 12:08:37 +02:00
Thaddeus Crews
62933b683e
Merge pull request #105928 from Ivorforce/cowdata-reserve-capacity
...
Core: Add `reserve` function to `Array`, `Vector`, and `String`
2025-09-30 11:19:13 -05:00
Thaddeus Crews
f6fc2f4a08
Core: Remove skip_cr argument from String
2025-09-28 10:07:24 -05:00
Haoyu Qiu
4e80190a46
Move context and plural support to Translation
...
- `TranslationPO` is now an empty class. It exists for compatibility.
- `OptimizedTranslation` stays the same, no context or plural support.
2025-09-26 10:51:57 +08:00
Haoyu Qiu
e882e42e1b
Add default plural rules
...
This makes the PO loader correctly handle the situation where the optional
`Plural-Forms` header field does not exist.
The `Translation` class and its subclasses always have access to valid plural
rules via `_get_plural_rules()`. Plural rules are prioritized:
1. `Translation.plural_rules_override`
2. `TranslationServer.get_plural_rules(locale)`
3. The English plural rules: `nplurals=2; plurals=(n != 1)`
Co-Authored-By: Pāvels Nadtočajevs <7645683+bruvzg@users.noreply.github.com >
2025-09-26 10:51:57 +08:00
Haoyu Qiu
ebb96e2303
Move plural rules logic into a separate class
...
- Extracts plural rules logic in `TranslationPO` into a new `PluralRules` class.
- Changes caching the last used plural index in `TranslationPO` into an LRU cache in `PluralRules`.
- Adds tests for `PluralRules`.
2025-09-26 10:51:55 +08:00
Lukas Tenbrink
1bf821c1e1
Store current capacity in CowData buffers, and rewrite most of it.
...
Add `reserve` to `CowData`, `Vector` and `Array`.
# Conflicts:
# core/os/memory.h
# core/templates/cowdata.h
2025-09-25 22:00:17 +02:00
Edward Moulsdale
e366471fdc
Add GDSOFTCLASS to deeper inheritors of Object
2025-09-24 19:15:56 +01:00
Lukas Tenbrink
c6f57c7a55
Change "reserve called with a capacity smaller than the current size" error message to a verbose message.
2025-09-23 20:02:40 +02:00
Thaddeus Crews
9b7a723aac
Merge pull request #107721 from YYF233333/ps_include
...
Remove dependency of `variant.h` in `print_string.h`
2025-09-22 08:50:04 -05:00
Thaddeus Crews
40bd86819b
Merge pull request #104332 from ColinSORourke/FindSeq
...
Add 'Find Sequence' to `Span`s, and consolidate negative indexing behavior
2025-09-20 13:41:34 -05:00
Thaddeus Crews
8eeef165d4
Merge pull request #104781 from Ivorforce/string-encode-complete
...
Expose missing `String` encoding conversion functions
2025-09-19 20:54:26 -05:00
Yufeng Ying
05dae23f18
Remove dependency of variant.h in print_string.h
...
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com >
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com >
2025-09-19 14:57:36 +08:00
Lukas Tenbrink
a916325e6a
Use Span for String.sprintf, to accelerate vformat not needing to allocate an Array.
2025-09-18 19:29:04 +02:00
Lukas Tenbrink
d1fd42bf3c
Expose copy_from_unchecked as append_utf32_unchecked and String::utf32_unchecked in String for high performance string copies. Expose append_wstring and String::wstring for platform strings.
2025-09-18 19:26:57 +02:00
Haoyu Qiu
3f03260a21
Cleanup editor translation related methods
...
- Unify logic for loading editor/property/doc/extractable translations.
- Replace legacy `TranslationServer` methods with translation domains for internal translations.
- Only pre-create editor/property/doc translation domains in editor builds.
- Prevent adding `null` translation.
- Fixes potential loading of duplicated editor translations.
- Add internal `has_translation_for_locale()` instead of calling `get_loaded_translations().has()`.
2025-09-18 20:27:09 +08:00
Colin O'Rourke
03d32c68a9
Added Find Sequence to Spans
...
Added FindSequence to Span.h
Refactored String find to use Span::Find_Seq in Ustring.cpp
2025-09-16 12:37:07 -07:00
Lukas Tenbrink
0d700e53f3
Check for NUL characters in string parsing functions.
2025-09-16 10:55:44 +02:00
Luo Zhihao
d16413a346
Optimize NodePath to String by using cahced path
2025-09-13 17:09:40 +08:00
Mikael Hermansson
494471dda2
Fix printraw causing infinite recursion in Logger._log_message
2025-07-31 20:24:47 +02:00
Mikael Hermansson
836a1a0b02
Prevent infinite recursion during printing
2025-07-22 16:13:03 +02:00
Adam Simpkins
21bc4b509f
Remove an unnecessarily include of main/ code from core/
...
Code in core/ generally should not depend on code from main/
This include was added in #41100 in order to call
`Main::is_project_manager()`. The `is_project_manager()` check was
later removed in #52742 but this include was never cleaned up.
This clean-up is related to #108429 .
2025-07-09 19:09:11 -07:00
Thaddeus Crews
e748514112
Merge pull request #105835 from bruvzg/edited_scene_direction
...
Improve edited scene layout direction detection.
2025-07-09 11:33:11 -05:00
Thaddeus Crews
8de08c7c21
Merge pull request #107646 from stuartcarnie/string_append_utf8_bug
...
Core: Fix invalid resize after appending
2025-06-18 18:14:11 -05:00
Thaddeus Crews
d4fa7e15ed
Merge pull request #106919 from kitbdev/fix-codeedit-hover-word-lookup
...
Fix CodeEdit hover word lookup
2025-06-18 18:13:43 -05:00
Stuart Carnie
4b3800582e
Core: Fix invalid resize after appending
2025-06-18 08:57:05 +10:00
Haoyu Qiu
296aba7dc5
Fix CSV translation not updating after reimport
2025-06-17 17:22:49 +08:00
Rémi Verschelde
7f925a104f
Merge pull request #107380 from Ivorforce/no-stringname-search
...
Core: Remove unused `StringName::search`.
2025-06-13 15:53:55 +02:00
Rémi Verschelde
ae484828bb
Merge pull request #107408 from Ivorforce/node-path-string-explicit
...
Make conversions from `NodePath` to `String` explicit.
2025-06-12 22:49:03 +02: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
Lukas Tenbrink
e2931a5c19
Make conversions from NodePath to String explicit.
2025-06-11 16:50:27 +02:00
Lukas Tenbrink
29f75ad5fa
Remove unused StringName::search.
2025-06-11 00:16:51 +02:00
Lukas Tenbrink
d2f9d31270
Make more types (Callable, Signal) conversion to String explicit.
2025-06-10 23:55:35 +02:00
Thaddeus Crews
7a3d2f6779
Merge pull request #106606 from aaronfranke/pow2_64
...
Add 64-bit versions of core power of 2 functions
2025-06-02 18:51:56 -05:00
Aaron Franke
f6f1df7d73
Add 64-bit versions of core power of 2 functions
2025-06-01 23:11:12 -07:00
Lukas Tenbrink
70672ef008
Optimize String::get_data, length and is_empty by making better assumptions and inlining.
2025-05-30 09:25:21 +02:00
kit
ebf71cd4f3
Fix CodeEdit hover word lookup
2025-05-28 18:35:15 -04:00
Thaddeus Crews
b09c70c8db
Merge pull request #106855 from timothyqiu/control-through-stillness
...
Don't update scene tree when calling `Translation::set_locale()`
2025-05-27 09:39:33 -05:00