Commit graph

1765 commits

Author SHA1 Message Date
Thaddeus Crews
c2202d36c1
Merge pull request #103838 from ebeem/master
Core: Fix translation remaps incorrectly falling back
2025-08-01 11:45:22 -05:00
Thaddeus Crews
c5d2033e98
Merge pull request #109123 from beicause/fix-img-nearest-cubic-resize-bias
Fix `Image` nearest and cubic resizing bias
2025-08-01 11:45:13 -05:00
Almarhoon Ibraheem
9add19a4ad Core: Fix translation remaps incorrectly falling back 2025-08-01 19:23:06 +03:00
Mikael Hermansson
d0826b0bfe Fix external resource IDs being lost for default properties 2025-07-31 16:57:35 +02:00
Jojo-1000
ab178719d9 Mark methods for various classes as required 2025-07-30 19:24:56 +02:00
LuoZhihao
a32b59622f Fix Image nearest and cubic resizing bias 2025-07-30 23:54:12 +08:00
Aaron Franke
b626695f70
Fix internal JSON stringify not preserving p_full_precision 2025-07-21 08:36:29 -07:00
Rémi Verschelde
1123d7fd9c
Merge pull request #102499 from Jordyfel/resource-docs
Improve documentation of some `Resource` methods
2025-06-28 13:02:54 +02:00
BlueCube3310
16b9ee6f50 Image: Implement 16-bit unorm and uint formats 2025-06-28 00:30:52 +02:00
Pāvels Nadtočajevs
42733a2a5c
Implement sparse bundle PCK support. 2025-06-26 00:47:25 +02:00
Thaddeus Crews
bf9346caad
Merge pull request #107898 from BlueCube3310/image-invis-fix
Image: Fix `is_invisible` detection for RGBAH and RGBAF
2025-06-25 15:14:07 -05:00
Mateo "Kuruk" Miccino
38c69f1814
Fix file handle leak in ZipArchive and FileAccessZip 2025-06-24 07:34:22 -03:00
BlueCube3310
e35c80b61c Image: Fix is_invisible detection for RGBAH and RGBAF 2025-06-23 18:21:04 +02:00
lawnjelly
14a814586a Provide quick access to Object ancestry 2025-06-23 07:11:11 +01: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
ee84a5a100
Merge pull request #107482 from nikitalita/fix-pck-misalign
PCKPacker: Fix first file being written mis-aligned
2025-06-13 18:37:46 +02:00
nikitalita
6e823b4b14 PCKPacker: Fix first file being written mis-aligned 2025-06-13 16:25:38 +02:00
Hugo Locurcio
16d551a8dd
Improve error messages in ResourceLoader
- Remove part of the "Failed loading resource" message about opening
  the project in the editor, as it's sometimes misleading.
- Fix `(expected type: )` appearing at the end of the
  "No loader found for resource:" error message.
2025-06-13 02:00:59 +02:00
Rémi Verschelde
94d7a54fea
Merge pull request #107402 from mihe/lsp-uid-bug
Stop `FileAccess::fix_path` from emitting errors for invalid UIDs
2025-06-12 23:32:51 +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
Mikael Hermansson
d160d71796 Stop FileAccess::fix_path from emitting errors for invalid UIDs 2025-06-12 17:21:44 +02:00
Rémi Verschelde
e9f5bd8e51
Merge pull request #107355 from beicause/fix-resource-script-property-save
Fix `script` property of custom resources inherited from scripts are not saved
2025-06-12 11:56:46 +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
1498eb327f Make IPAddress to String conversion explicit. 2025-06-11 15:44:16 +02:00
LuoZhihao
784823ada1 Fix script property of custom resources inherited from scripts are not saved 2025-06-10 23:03:13 +08:00
Danil Alexeev
24494d840e
Core: Unify display of error type prefixes 2025-06-09 20:18:51 +03: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
KaiN
19a94159a2 Fix async resource loading progress on empty p_original_path 2025-06-04 15:24:39 +02:00
Thaddeus Crews
344b8ce1f1
Merge pull request #106190 from aaronfranke/compression64
Support 64-bit sizes in Compression
2025-06-03 15:30:24 -05:00
Michael Alexsander
454e4f817c
Make build profile project detection also set build options 2025-06-03 11:11:33 -03:00
Aaron Franke
5777a88b76
Support 64-bit sizes in Compression 2025-06-03 00:03:01 -07: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
Thaddeus Crews
e8a02152c4
Merge pull request #105757 from bruvzg/no_temp
[PCK] Move directory to the end of file, write exported/saved PCK in place.
2025-06-02 18:51:28 -05:00
Pāvels Nadtočajevs
8cb2817976
[PCK] Move directory to the end of file, write exported/saved PCK in place. 2025-06-02 12:54:09 +03:00
Aaron Franke
f6f1df7d73
Add 64-bit versions of core power of 2 functions 2025-06-01 23:11:12 -07:00
Marwen Azouzi
873833b4a7
Remove redundant queue_redraw() & fix typo 2025-05-29 17:22:32 +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
Thaddeus Crews
c38b856f39
Merge pull request #106717 from KoBeWi/uid_in_path_factory
Expose helper methods for converting UIDs
2025-05-26 11:24:40 -05: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
Pedro J. Estébanez
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
kobewi
9c37ca5383 Expose helper methods for converting UIDs 2025-05-25 00:26:16 +02:00
Pāvels Nadtočajevs
d609cf62a0
Implement get_filesystem_type on macOS and Linux. 2025-05-23 23:05:06 +03:00
Thaddeus Crews
a2aefab4c7
Merge pull request #106486 from BlueCube3310/image-ch-detect-fix
Image: Fix detecting color channels
2025-05-19 08:01:40 -05:00
Pedro J. Estébanez
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
BlueCube3310
0f9986470a Image: Fix detecting color channels 2025-05-16 12:47:57 +02:00
Lukas Tenbrink
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
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