Commit Graph

8678 Commits

Author SHA1 Message Date
2a03b459b9 Overhaul Resource::duplicate()
Thanks to a refactor, `Resource::duplicate_for_local_scene()` and `Resource::duplicate()` are now both users of the same, parametrized, implementation.

`Resource::duplicate()` now honors deepness in a more consistent and predictable fashion. `Resource::duplicate_deep()` is added (instead of just adding a parameter to the former, for compatibility needs).

The behavior after this change is as follows:
  - Deep (`deep=true`, formerly `subresources=true`):
    - Previously, only resources found as direct property values of the one to copy would be, recursively, duplicated.
    - Now, in addition, arrays and dictionaries are walked so the copy is truly deep, and only local subresources found across are copied.
    - Previously, subresources would be duplicated as many times as being referenced throughout the main resource.
    - Now, each subresource is only duplicated once and from that point, a referenced to that single copy is used. That's the enhanced behavior that `duplicate_for_local_scene()` already featured.
    - The behavior with respect to packed arrays is still duplication.
    - Formerly, arrays and dictionaries were recursive duplicated, with resources ignored.
    - Now, arrays and dictionaries are recursive duplicated, with resources duplicated.
    - When doing it through `duplicate_deep()`, there's a` deep_subresources_mode` parameter, with various possibilites to control if no resources are duplicated (so arrays, etc. are, but keeping referencing the originals), if only the internal ones are (resources with no non-local path, the default), or if all of them are. The default is to copy every subresource, just like `duplicate(true)`.
  - Not deep (`deep=false`, formerly `subresources=false`): <a name="resource-shallow"></a>
    - Previously, the first level of resources found as direct property values would be duplicated unconditionally. Packed arrays, arrays and dictionaries were non-recursively duplicated.
    - Now, no subresource found at any level in any form will be duplicated, but the original reference kept instead. Packed arrays, arrays and dictionaries are referenced, not duplicated at all.
    - Now, resources found as values of always-duplicate properties are duplicated, recursively or not matching what was requested for the root call.

This commit also changes what's the virtual method to override to customize the duplication (now it's the protected `_duplicate()` instead of the public `duplicate()`).
2025-05-26 10:05:25 +02:00
9c37ca5383 Expose helper methods for converting UIDs 2025-05-25 00:26:16 +02:00
d609cf62a0 Implement get_filesystem_type on macOS and Linux. 2025-05-23 23:05:06 +03:00
ba68e2a1e8 Update time.cpp year/unix time conversions to be constant time
Added functions to convert between year and day from unix timestamps in constant time, to avoid having to iterate one year at a time.
2025-05-23 14:02:14 -04:00
8773f95e40 Optimize and simplify sarray. 2025-05-23 23:47:57 +08:00
3545e945f6 Simplify implementation of errarray. 2025-05-23 23:14:59 +08:00
ea6fbd6687 Use OkHSV for rainbow labels. 2025-05-22 22:53:32 +02:00
4371aa864d Simplify Memory::memnew_arr_placement to always initialize memory, to force callers to make the decision of whether to initialize. 2025-05-22 22:25:12 +02:00
15cd5e1619 Merge pull request #106689 from aaronp64/ringbuffer_localvector
Use `LocalVector` for `RingBuffer`
2025-05-22 12:15:03 -05:00
6258a3e224 Merge pull request #98750 from aaronfranke/grisu
Use Grisu2 algorithm in `String::num_scientific` to fix serializing
2025-05-22 12:15:02 -05:00
c3c3657a0d Merge pull request #106661 from KirbyRider1337/dont-compare-the-same-item-with-itself
Prevent comparison of items with themselves while partitioning sort arrays
2025-05-22 12:14:58 -05:00
1b5064e3e3 Merge pull request #105505 from Ivorforce/simplify-force-trivial
Simplify use of `LocalVector` `force_trivial` template parameter.
2025-05-22 12:14:58 -05:00
15de1d6c35 Use Grisu2 algorithm in String::num_scientific to fix serializing 2025-05-22 09:13:16 -07:00
42249bb659 Add @export_file_path to export raw paths (no UID) 2025-05-22 13:25:17 +02:00
1a427d3dec Add feature hint string and "On" text for checkable groups 2025-05-21 14:56:55 -07:00
caf8053b86 Adjusted get_median_from_3 and partitioner to also retrieve the pivot's index and check if either end of the partitioner has reached it to avoid comparing things with themselves 2025-05-21 14:38:09 -04:00
2a02cabe4d Use LocalVector for RingBuffer
Updated RingBuffer to use LocalVector instead of Vector, to avoid _copy_on_write overhead when writing to the buffer.
2025-05-21 13:50:10 -04:00
7aafa6ef18 GDScript: Remove leftmost_column and rightmost_column fields 2025-05-21 18:16:20 +03:00
25a3c27c41 Merge pull request #105628 from rsanchezsaez/apple/ios-visionos-4.5
Native visionOS platform support
2025-05-20 23:09:07 +02:00
47971c0a27 Introduce 'visionos' platform derived from 'apple_embedded' 2025-05-19 15:47:01 -07:00
457299449d Introduce 'drivers/apple_embedded' abstract platform for code reuse 2025-05-19 15:37:13 -07:00
70f8dd29f5 Simplify use of LocalVector force_trivial template parameter. 2025-05-19 20:27:14 +02:00
a2aefab4c7 Merge pull request #106486 from BlueCube3310/image-ch-detect-fix
Image: Fix detecting color channels
2025-05-19 08:01:40 -05:00
6c2d288ef1 Merge pull request #106337 from TokageItLab/arc-tolerance
Fix Quaternion arc constructor tolerance
2025-05-19 08:01:37 -05:00
2bf7ac76cf Merge pull request #106456 from Repiteo/style/remove-DEBUG_METHODS_ENABLED
Style: Remove redundant `DEBUG_METHODS_ENABLED` macro
2025-05-19 08:01:35 -05:00
2d42b889d1 Merge pull request #104124 from Ivorforce/alloc-static-calloc
Add `Memory::alloc_static_zeroed` to allocate memory that's filled with zeroes.
2025-05-19 08:01:33 -05:00
f5383df83b Overhaul Resource::duplicate_for_local_scene()
- Serves as a first step for future refactors.
- Code is simpler.
- Algorithm is more efficient: instead of two passes (dumb copy + resolve copies), it's single-pass.
- Now obeys `PROPERTY_USAGE_NEVER_DUPLICATE`.
- Now handles deep self-references (the resource to be duplicated being referenced somewhere deep).
2025-05-19 10:01:11 +02:00
6fe17b264e Use if based mod in HashMap and HashSet in loops (faster than fastmod). 2025-05-18 20:05:34 +02:00
1384e82c2c Improve ScriptLanguage get keyword API. 2025-05-17 18:43:19 +08:00
5620a215a1 Merge pull request #106021 from Alex2782/fix_xbox_controller_on_android
Fix Xbox Controller on Android
2025-05-16 07:43:09 -05:00
0f9986470a Image: Fix detecting color channels 2025-05-16 12:47:57 +02:00
76a65de3ab Change fuzzy search to only set case sensitive within set_query 2025-05-15 12:00:55 -07:00
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
5538850d87 Core: Convert Pair/KeyValue to constexpr 2025-05-15 10:37:41 -05:00
820380817a Exclude RD creation test functions from templates 2025-05-15 10:12:38 +02:00
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
1de9789806 Linux: Drop ppc32 (32-bit PowerPC) architecture support
This was added together with `ppc64le` in #54490, but seemingly only for the
purpose of getting it to compile on a Linux distro that aims at maximizing
support for all CPU architectures.

I don't think anyone has ever _run_ Godot on a `ppc32` system (do those even
support OpenGL ES 3.0?) and so I don't think we should aim to support it.

Debian dropped support for its PowerPC (`ppc32`) arch in Debian 9, released
in 2017.
2025-05-14 10:22:12 +02:00
37aca09b23 Fix Quaternion arc constructor tolerance 2025-05-14 07:15:12 +09:00
0717136785 Merge pull request #106353 from YYF233333/hashmap_zst
Optimize `HashMap` size for zero-sized Allocators
2025-05-13 16:22:28 -05:00
1c4b660312 Merge pull request #96611 from Dynamic-Pistol/master
Add `PROPERTY_HINT_INPUT_NAME` for use with `@export_custom` to allow using input actions
2025-05-13 16:22:25 -05:00
f648eea7f4 Merge pull request #106209 from YYF233333/opt_get_actions
Optimize `InputMap::get_actions`
2025-05-13 16:22:23 -05:00
243c8932d3 Merge pull request #82497 from Repiteo/typed-array-consolidation
Typed array equality operator update
2025-05-13 16:22:15 -05:00
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
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
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
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
0babb2ab02 Optimize HashMap size for zero-sized Allocators. 2025-05-13 21:44:39 +08:00
3207066e19 Add Memory::alloc_static_zeroed to allocate memory that's filled with zeroes.
This is generally faster than `malloc` followed by `memset` / loop-set to 0.
2025-05-13 01:57:05 +02:00
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
03cae12314 Merge pull request #106295 from timothyqiu/legacy-l10n
Remove translation loading logic that was never used
2025-05-13 01:05:31 +02:00