Commit Graph

1240 Commits

Author SHA1 Message Date
Pedro J. Estébanez 045401c64e Use WorkerThreadPool for threaded resource loading 2023-05-10 18:53:41 +02:00
Pedro J. Estébanez b6647a5808 Avoid sync issues in materials with scheduled shader updates 2023-05-10 18:53:41 +02:00
Pedro J. Estébanez 5a4613f551 Avoid sync issues in resources with deferred updates 2023-05-10 18:53:41 +02:00
Pedro J. Estébanez 8983b20ccd Avoid interaction issues between resource loading threads 2023-05-10 18:53:41 +02:00
Rémi Verschelde 491a437df5
Merge pull request #76540 from reduz/redo-remote-filesystem
Redo how the remote filesystem works
2023-05-08 13:52:51 +02:00
Rémi Verschelde e85f6871ba
Merge pull request #76561 from KoBeWi/most_obscure_class_that_has_ever_existed
Improve and document PackedDataContainer
2023-05-08 12:20:33 +02:00
Juan Linietsky 273a6eeb66 Redo how the remote filesystem works
Instead of reading files over the network, the new version uses a local file cache and only updates files when it changes.

The original remote filesystem was created 14 years ago, when ethernet was faster than hard drives or even flash. Also, mobile devices have a very small amount of storage.
Nowadays, this is no longer the case so the approach is changed to using a persistent cache in the target device.

Co-authored-by: m4gr3d
2023-05-08 11:57:54 +02:00
Clay John 610877e326
Merge pull request #72288 from MewPurPur/use-string-repeat
Use `String.repeat()` to optimize several String methods
2023-05-05 09:56:48 -07:00
Samuele Panzeri 59f04e16b8 Support long path in file access on windows
Changed windows file access file to check for path length and use the \\?\ long format when needed
2023-05-05 10:04:39 +02:00
VolTer 6b84e258d2 Use String.repeat() in more places 2023-05-01 02:27:46 +02:00
kobewi c08e96ef0d Improve and document PackedDataContainer 2023-04-29 00:29:40 +02:00
Rémi Verschelde efb42c3101
Merge pull request #75447 from bruvzg/brotli_packedarray
Expose brotli decompression to the scripting API.
2023-04-25 16:16:56 +02:00
Danil Alexeev 36bedd341a
Fix misuses of error macros 2023-04-18 10:20:48 +03:00
Ninni Pipping cf64e2fa47 Expose more compression formats in Image and fix compress check
Check for compressing ASTC checked if the function for BPTC was present
2023-04-13 09:39:03 +02:00
tefusion 1514376e46 Fix HTTPClient _request using wrong size
This only affects HttpClient in GDScript.
2023-04-10 11:45:41 +02:00
Bartłomiej T. Listwon bff0c71e2e Fix moving position indicator out of bounds in FileAccessMemory 2023-04-04 10:10:25 +02:00
Rémi Verschelde cef3587427
Merge pull request #74120 from RandomShaper/res_loader_teardown
Clear resource load tasks at exit
2023-04-03 15:59:51 +02:00
bruvzg 0e4bd964cc
Expose brotli decompression to the scripting API. 2023-03-29 22:43:36 +03:00
bruvzg 09465f3fe6
Remove (or make verbose only) various debug prints. 2023-03-20 08:14:18 +02:00
Jakub Mateusz Marcowski 0a55a32085
Modify JSON.stringify so that it doesn't create unnecessary empty lines from empty arrays 2023-03-07 10:30:28 +01:00
Rémi Verschelde e80ab423ef
Merge pull request #73793 from myaaaaaaaaa/init-race
Fix some race conditions that happen during initialization
2023-03-06 19:57:38 +01:00
myaaaaaaaaa d337ed1c64 Fix data races in startup/teardown 2023-03-06 11:47:12 -05:00
Rémi Verschelde bdb3738023
Merge pull request #74166 from RandomShaper/fix_res_loader_read_freed
Fix crash in resource load
2023-03-03 11:06:15 +01:00
bitsawer 5a9d7fd8a6 Fix Image.convert() overwriting custom mipmaps 2023-03-02 16:46:06 +02:00
Rémi Verschelde 4fceabc30c
Merge pull request #73862 from RandomShaper/fix_subthreaded_res_load
Lift restriction that resource load thread requester has to be the initiator
2023-03-02 11:26:54 +01:00
Pedro J. Estébanez 047671df0f Fix crash in resource load 2023-03-01 18:30:16 +01:00
Pedro J. Estébanez b8b6a05c17 Clear resource load tasks at exit 2023-02-28 18:56:21 +01:00
Pedro J. Estébanez b60197d1c6 Fix deadlock in cyclic resource load 2023-02-26 17:19:48 +01:00
Pedro J. Estébanez c51229491d Lift restriction that resource load thread requester has to be the initiator 2023-02-24 13:19:31 +01:00
Rémi Verschelde b87f9f679e
Merge pull request #73647 from RandomShaper/fix_threaded_load
Fix threading issues in resource loading
2023-02-23 11:04:55 +01:00
bitsawer c56058fe9a Fix FileAccess last open error flag update 2023-02-21 17:02:21 +02:00
Pedro J. Estébanez b862fc8c9b Fix cases of resource load tasks not being awaitable 2023-02-20 21:20:05 +01:00
Pedro J. Estébanez 618bb173ba Fix race condition in resource loader when a load task is reused 2023-02-20 21:20:05 +01:00
voidedWarranties c586835541 Make `ResourceCache::get_cached_resources` thread-safe 2023-02-20 01:02:08 -08:00
bruvzg bc95b0b171
Restore FileAccess.close method. 2023-02-16 15:34:20 +02:00
Rémi Verschelde 68299e0f94
Merge pull request #72492 from maiself/fix-binary-res-typed-array
Fix loading of binary resources with typed arrays
2023-02-01 08:02:28 +01:00
Mai Lavelle 87e6885f5e Fix loading of binary resources with typed arrays 2023-02-01 01:22:43 -05:00
Raul Santos 9e9eac4676
Use enum instead of int in virtual methods return type 2023-01-31 19:06:49 +01:00
Juan Linietsky 28f51ba547 Refactor high quality texture import
* Only two texture import modes for low/high quality now:
  * S3TC/BPTC
  * ETC2/ASTC
* Makes sense given this is the general preferred and most compatible combination in most platforms.
* Removed lossy_quality from VRAM texture compression options. It was unused everywhere.
* Added a new "high_quality" option to texture import. When enabled, it uses BPTC/ASTC (BC7/ASTC4x4) instead of S3TC/ETC2 (DXT1-5/ETC2,ETCA).
* Changed MacOS export settings so required texture formats depend on the architecture selected.

This solves the following problems:

* Makes it simpler to import textures as high quality, without having to worry about the specific format used.
* As the editor can now run on platforms such as web, Mac OS with Apple Silicion and Android, it should no longer be assumed that S3TC/BPTC is available by default for it.
2023-01-30 15:53:23 +01:00
Rémi Verschelde bde3310f02
Merge pull request #71995 from Faless/net/4.x_tls_verify
[NET] Refactor TLS configuration.
2023-01-30 13:28:31 +01:00
Adam Scott bfffb8f254 Fix `Resource::duplicate()` missing packed arrays 2023-01-28 23:06:44 -05:00
Fabio Alessandrelli 7cd80e6a6d [Net] Remove StreamPeerTLS.blocking_handshake option.
Which was unused internally, and can be replaced by:

```
while tls.get_status() == tls.STATUS_HANDSHAKING:
  tls.poll()
```
2023-01-28 11:08:02 +01:00
Fabio Alessandrelli adba870534 [NET] Refactor TLS configuration.
Use a TLSOptions configuration object which is created via static
functions.

- "TLSOptions.client": uses the standard CA and common name verification.
- "TLSOptions.client_unsafe": uses optional CA verification (i.e. if specified)
- "TLSOptions.server": is the standard server configuration (chain + key)

This will allow us to expand the TLS configuration options to include
e.g. mutual authentication without bloating the classes that uses
StreamPeerTLS and PacketPeerDTLS as underlying peers.
2023-01-28 11:08:02 +01:00
Aaron Franke 2a65f6812b
Add PROPERTY_USAGE_NEVER_DUPLICATE flag and use for script
Co-authored-by: Yakov Borevich <j.borevich@gmail.com>
2023-01-24 16:37:50 -06:00
Aaron Franke 2bc0bcbd26
PropertyUsage: Rename "DO_NOT_SHARE_ON_DUPLICATE" to "ALWAYS_DUPLICATE" 2023-01-24 16:05:07 -06:00
Rémi Verschelde 5b1df48c6c
Convert en_GB spelling to en_US with codespell 2023-01-23 11:02:20 +01:00
Rémi Verschelde ebd0b40f6e
Merge pull request #71687 from reduz/support-script-class-name-in-efs
Support script global resource name in EditorFileSystem
2023-01-21 16:54:23 +01:00
Juan Linietsky dddd8d43f6 Support script global resource name in EditorFileSystem
* Works for binary and text files.
* Makes EditorQuickOpen work with custom resources again.
* Information is cached and easily accessible.

Properly fixes #66179. Supersedes #66215 and supersedes #62417

**WARNING**: This required breaking backwards binary compatibility (.res and .scn files). Files saved after this PR is merged will no longer open in any earlier versions of Godot.
2023-01-21 14:19:27 +01:00
Rémi Verschelde 2435eef617
Merge pull request #71390 from reduz/fix-json-as-resource
Fixes to JSON as resource
2023-01-21 11:30:08 +01:00
Rémi Verschelde 4ca6a9809d
Merge pull request #44596 from KoBeWi/🧹🧹🧹
Cleanup unused engine code v2
2023-01-19 19:32:51 +01:00
kobewi c0083e431b Cleanup unused engine code v2 2023-01-19 13:02:18 +01:00
bruvzg db7d8c2d87
[GDExtension] Expose some low level functions and String operators. 2023-01-19 12:50:49 +02:00
Juan Linietsky 1aaff63b8f Fixes to JSON as resource
* It was not a resource, hence it was not working to load it as such.
* Changed so, when opened in editor, a parse error will not fail load and the text will be kept.
* This should allow proper editing from within the code editor, including syntax checking and saving files as-is in text.

Partially addresses #66820.

The code editor still needs to be changed for this to work.
2023-01-14 14:41:51 +01:00
Rémi Verschelde c2790ec2b9
Merge pull request #68450 from KoBeWi/bracket_escapist
Allow to escape closing brackets in CFG tags
2023-01-12 21:53:15 +01:00
Rémi Verschelde 0231b4a0e8
Merge pull request #70726 from heppocogne/Fix-open_compressed-get_path
Fix `get_path()` is not working when files are opend with `open_compressed`
2023-01-10 10:48:15 +01:00
Juan Linietsky 07a964fce3 Ability to change a resource UID from API
* Works for text, binary and imported resources
* Allows better clean up of duplicate files.

TODO (future PRs):

* Use this API for assigning new UIDs to copied files.
* Use this API for UID conflict on FS scanning (if more than one file has the same UID, the newer one(s) should get assigned a different UID).
2023-01-09 18:52:00 +01:00
Rémi Verschelde 163f6f5fe8
Merge pull request #68429 from KoBeWi/PropertySettings
Add PropertyInfo overload for GLOBAL_DEF
2023-01-06 22:59:29 +01:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Clay John 61c7b7fb13
Merge pull request #67853 from Zylann/fix_lods_with_doubles
Fix usages of mesh simplification functions in float=64 builds
2023-01-02 12:33:44 -07:00
heppocogne ea11ffc88c Fix `get_path()` is not working when files are opend with `open_compressed`
And also fixed `get_absolute_path()` in the same way
2022-12-30 10:31:12 +09:00
stmSi 96b0fbb756 Fix crashed when compressing empty image data. 2022-12-21 16:39:35 +06:30
Rémi Verschelde f318d60e06
Merge pull request #65376 from reduz/astc-support
Implement basic ASTC support
2022-12-20 12:44:30 +01:00
Juan Linietsky 71d21c7ccb Implement basic ASTC support
Implements basic ASTC support:
* Only 4x4 and 8x8 block sizes.
* Other block sizes are too complex to handle for Godot image compression handling. May be implemented sometime in the future.

The need for ASTC is mostly for the following use cases:
* Implement a high quality compression option for textures on mobile and M1 Apple hardware.
* For this, the 4x4 is sufficient, since it uses the same size as BPTC.

ASTC supports a lot of block sizes, but the benefit of supporting most of them is slim, while the implementation complexity in Godot is very high.
Supporting only 4x4 (and 8x8) solves the real problem, which is lack of a BPTC alternative on hardware where it's missing.

Note: This does not yet support encoding on import, an ASTC encoder will need to be added.
2022-12-20 11:26:30 +01:00
Rémi Verschelde f1edd03d4c
Merge pull request #69718 from groud/finally_rename_gdnative_to_gdextension
Rename all gdnative occurences to gdextension
2022-12-12 11:43:59 +01:00
Gilles Roudière be1c9d677d Rename all gdnative occurences to gdextension
Non-exhaustive list of case-sensitive renames:

GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension ->Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION ->EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
2022-12-12 11:04:57 +01:00
kobewi 7c6b659bd7 Add PropertyInfo overload for GLOBAL_DEF 2022-12-11 21:36:48 +01:00
Adam Scott 4a16b8630e Fix `ResourceLoader::thread_load_tasks` crash 2022-12-07 16:59:10 -05:00
bruvzg ecec415988
Use system fonts as fallback and improve system font handling.
Add support for font weight and stretch selection when using system fonts.
Add function to get system fallback font from a font name, style, text, and language code.
Implement system font support for Android.
Use system fonts as a last resort fallback.
2022-12-04 18:44:20 +02:00
Bastiaan Olij ebec23d8d8 ETCPAK expects BGRA data for ETC 2022-12-02 01:34:05 +11:00
Fabio Alessandrelli 2c576eb281 [Core] Fix Resource.resource_name type.
The methods returns a String, but the Variant was bound as a StringName.

We could alternatively change the method return type but that's a
breaking change which will requires code changes in other parts of the
engine.
2022-11-29 15:43:08 +01:00
Rémi Verschelde 65a45eb7e3
Merge pull request #64284 from kleonc/image-rotate90-in-place
`Image` Fix `rotate_90`/`rotate_180` methods
2022-11-22 21:18:58 +01:00
Rémi Verschelde 8e00e71d35
Merge pull request #67619 from nongvantinh/fix-calling-pckpacker-crash
Fixes engine crashes caused by the user failing to initialize PCKPacker with pck_start()
2022-11-17 11:57:23 +01:00
Marc Gilleron 2aefdcc26e Fix usages of mesh simplification functions in float=64 builds 2022-11-12 00:38:00 +00:00
kobewi 0d122ce459 Allow to escape closing brackets in CFG tags 2022-11-09 14:00:51 +01:00
bruvzg d77902f33a
Implement SVG in OT support. 2022-11-04 14:10:54 +02:00
Rémi Verschelde 9ec7aadc06
Merge pull request #66017 from Mickeon/rename-image-copy-rect
Rename Image's `get_rect` to `get_region`
2022-11-02 22:36:57 +01:00
Micky ebf86c96e9 Rename Image's `get_rect` to `get_region`
Also renames its parameter to from "rect" to "region".
2022-11-01 23:35:48 +01:00
dzil123 1fa8b3dd42 Fix Image::bump_map_to_normal_map incorrectly keeping mipmap flag 2022-11-01 03:54:04 -07:00
Rémi Verschelde 5947f22be9
Merge pull request #67578 from KoBeWi/GEDITOR
Unify usage of GLOBAL/EDITOR_GET
2022-10-31 13:15:58 +01:00
Rémi Verschelde be126d42d4
Merge pull request #67588 from KoBeWi/if(!GDVIRTUAL_CALL)don't
Simplify GDVIRTUAL_CALL calls
2022-10-31 11:55:56 +01:00
Rémi Verschelde 40258bbbe8
Merge pull request #67577 from qarmin/fix_exporting_big_templates
Fix exporting with big export templates
2022-10-31 10:39:08 +01:00
Gilles Roudière e23f82f3c1 Expose the logic to recognize a save path in ResourceSaver 2022-10-28 11:15:25 +02:00
Yuri Rubinsky adec51cde8 Fix crash when calling `fill` method on an empty `Image` 2022-10-24 11:28:10 +03:00
Nong Van Tinh 5194c8af7c Fixes engine crashes caused by the user failing to initialize PCKPacker with pck_start() 2022-10-19 20:19:02 +07:00
Rafał Mikrut 86fa3ba560 Fix exporting big templates 2022-10-19 08:29:29 +02:00
kobewi d06a8320e5 Simplify GDVIRTUAL_CALL calls 2022-10-19 00:05:48 +02:00
kobewi e48c5daddf Unify usage of GLOBAL/EDITOR_GET 2022-10-18 19:01:48 +02:00
Rémi Verschelde dc4b616596 Merge pull request #63332 from KoBeWi/static_images_aka_photos
Make some Image methods static
2022-10-15 12:56:57 +02:00
Rémi Verschelde 96ec73f3ee Merge pull request #65281 from MisterMX/zip-module
Expose minizip API to allow creating zips using scripts
2022-10-15 12:56:26 +02:00
Marcelo Fernandez ea6cc3e260 Expose minizip API to allow creating zips using scripts
Co-authored-by: Marcelo Fernandez <marcelofg55@gmail.com>
Co-authored-by: James Westman <flyingpimonster@gmail.commail>
Co-authored-by: MisterMX <mbxd12@web.de>

Signed-off-by: MisterMX <mbxd12@web.de>
2022-10-14 21:51:38 +02:00
kobewi 072f6feaba Make some Image methods static 2022-10-14 14:34:15 +02:00
Rémi Verschelde 07b488e643 Merge pull request #67241 from groud/expose_resource_format_loader_recognize_path
Exposes ResourceFormatLoader.recognize_path to scripting
2022-10-11 13:46:24 +02:00
Gilles Roudière 8aa904f56c Exposes ResourceFormatLoader.recognize_path to scripting 2022-10-11 12:35:27 +02:00
kobewi 14b82c36a2 Defer clearing of ResourceUID cache and silence warnings 2022-10-10 11:20:23 +02:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Rémi Verschelde 53403972ef Merge pull request #66886 from akien-mga/error-print-cleanup
Logger: Don't print error twice on `ERR_PRINT`
2022-10-05 08:37:19 +02:00
Aaron Franke 2cea42cc7f
Rename Projection `matrix` to `columns` 2022-10-04 12:34:19 -05:00
Rémi Verschelde ac3917c42f Logger: Don't print error twice on `ERR_PRINT`
Also fix broken `ERR_PRINT_ED` macro and simplify comments.
For the record these macros aren't used yet, they're intended to be used
where needed to surface messages in the toaster when useful to end users,
but we haven't done that codebase review yet.
2022-10-04 17:56:30 +02:00
Haoyu Qiu d873c549a2 Fix crash when executing `ResourceUID.set_id` 2022-09-30 09:41:05 +08:00
bruvzg ea1848ce0a
Use `constexpr` in the conditions with template parameters and `sizeof`s to suppress C4127 warnings. 2022-09-29 10:38:21 +03:00