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

896 Commits

Author SHA1 Message Date
Thaddeus Crews
726c4e9fba Merge pull request #84658 from detomon/initialize-quaternion-variant-with-identity
Initialize `Quaternion` variant with identity
2025-09-30 11:19:19 -05:00
Thaddeus Crews
79d0eea742 Merge pull request #110616 from aaronfranke/fix-rtos-fix-32bit
Apply rtos_fix hack for handling 32-bit floats on all calls to rtos_fix
2025-09-30 11:19:16 -05: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
Lukas Tenbrink
406b22d2d5 Delete VariantGetInternalPtr and VariantImplicitConvert.
Replace uses with `VariantInternalAccessor`.
2025-09-19 00:20:07 +02:00
Lukas Tenbrink
f81287d765 Introduce VariantImplicitConvert<> template for types that can be implicitly converted to and from Variant.
De-duplicate a lot of `VariantGetInternalPtr`, `VariantInternalAccessor`, `VariantInitializer` and `VariantDefaultInitializer`.
2025-09-19 00:20:07 +02:00
Thaddeus Crews
d90d8afa5a Merge pull request #108118 from YYF233333/varray_and_vformat
Simplify `varray`
2025-09-18 12:42:25 -05: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
Aaron Franke
6bc6110a90 Apply rtos_fix hack for handling 32-bit floats on all calls to rtos_fix 2025-09-17 07:05:33 -07:00
Thaddeus Crews
1a89648c61 Merge pull request #110206 from aaronp64/remove_unused_enum_bitfield_param
Remove unused parameter in `__constant_get_enum_name`/`__constant_get_bitfield_name`
2025-09-16 20:29:01 -05:00
Thaddeus Crews
c39edeca6d Merge pull request #109744 from Repiteo/core/math-constants-semantic
Core: Integrate semantic constants in math structs
2025-09-16 11:44:49 -05:00
Yufeng Ying
8f36c97a49 Optimize varray. 2025-09-16 15:01:26 +08:00
aaronp64
4c3f2be16d Avoid repeated _copy_on_write() calls in Array::resize()
Updated Array::resize() to call ptrw() once before looping to initialize typed array elements, instead of accessing each through .write[].
2025-09-15 14:03:21 -04:00
aaronp64
cfde73ac17 Remove unused parameter in __constant_get_enum_name/__constant_get_bitfield_name
Removed unused String parameter in __constant_get_enum_name() and __constant_get_bitfield_name() to avoid creating/destroying extra Strings.
2025-09-02 13:13:12 -04:00
Thaddeus Crews
84c0ec04f3 Core: Integrate semantic constants in math structs
- Excludes self-explanatory constants (ZERO, ONE, etc)
2025-08-19 10:15:08 -05:00
Mikael Hermansson
494471dda2 Fix printraw causing infinite recursion in Logger._log_message 2025-07-31 20:24:47 +02:00
George Marques
28d3214acd Expose type validator from Dictionary and allow testing without error
- Now you can get the ContainerTypeValidate from a Dictionary (both for
  keys and for values).
- ContainerTypeValidate exposes a validator function that does not show
  any error in case of failure. This allows testing values before trying
  to use them in Dictionary.
2025-07-24 13:35:48 -03: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
Rémi Verschelde
6eb6e3e6e0 Merge pull request #107457 from akien-mga/improve-error-message-call-single-argument
Improve error messages for method calls expecting only 1 argument
2025-06-12 22:49:36 +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
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
Rémi Verschelde
d1083c9722 Improve error messages for method calls expecting only 1 argument 2025-06-12 17:02:59 +02:00
Rémi Verschelde
d9cd011e2f Merge pull request #107406 from Ivorforce/ip-to-string-explicit
Core: Remove implicit conversions from `IPAddress` to `String`, to avoid accidental conversions
2025-06-12 01:15:53 +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
Lukas Tenbrink
e2931a5c19 Make conversions from NodePath to String explicit. 2025-06-11 16:50:27 +02:00
Lukas Tenbrink
1498eb327f Make IPAddress to String conversion explicit. 2025-06-11 15:44:16 +02:00
Lukas Tenbrink
d2f9d31270 Make more types (Callable, Signal) conversion to String explicit. 2025-06-10 23:55:35 +02:00
Thaddeus Crews
86415f1732 Merge pull request #99150 from dalexeev/gds-fix-callable-call-errror-text
GDScript: Fix `Callable` call error text
2025-06-09 12:31:39 -05:00
Thaddeus Crews
7d5ecc2c6f Merge pull request #107295 from Ivorforce/explicit-math-to-string
Remove implicit conversions from math types to `String`, to avoid accidental conversions
2025-06-09 12:31:30 -05:00
Thaddeus Crews
01ef1c0eae Merge pull request #105231 from Ivorforce/ptr-to-arg-nomacro
Convert `PtrToArg` macros to regular C++ structs.
2025-06-09 12:31:25 -05:00
Lukas Tenbrink
ed836df150 Make conversions from math types to String explicit, to avoid accidental conversions. 2025-06-09 01:58:18 +02:00
Rémi Verschelde
f759f52d8f Merge pull request #106902 from lyuma/config_file_uids
Implement UID references in VariantParser
2025-06-09 00:44:32 +02:00
Lyuma
f948ab5366 Implement uid Resource references in VariantWriter
VariantWriter now writes the uid and the path into Resource() references.
This change will affect ConfigFile, used for .import or project settings.
2025-06-08 06:11:35 -07:00
Lukas Tenbrink
78ae5919af Convert PtrToArg macros to regular C++ structs. 2025-06-07 22:17:06 +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
aaronp64
6b2674fe18 Reuse and optimize sorting logic for List, SelfList, and HashMap
Added SortList class, and updated List, SelfList, and HashMap sort methods to use it.  Sorting is done with merge sort, with an initial check to optimize for already sorted lists, and sorted lists that were appended to.
2025-06-04 10:18:22 -04: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
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
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