Commit graph

843 commits

Author SHA1 Message Date
Fabio Alessandrelli fd5a140039 [Net] Fix RPC ID encoding/decoding for Node methods. 2021-07-29 00:00:30 +02:00
luz paz 5cf3bed0c8 Fix various typos
Follow-up typos found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,fave,findn,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint`
2021-07-25 07:18:25 -04:00
Rémi Verschelde ff0b5f8fa1
Merge pull request #50809 from akien-mga/iterators-const-references 2021-07-25 12:52:58 +02:00
Rémi Verschelde 2f221e5fd5
Merge pull request #50250 from luzpaz/typos
Fix various typos
2021-07-25 12:38:58 +02:00
Rémi Verschelde ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
Rémi Verschelde c91860bb11
ResourceUID: Fix remove_id binding
Fixes #50833.
2021-07-25 11:55:56 +02:00
luz paz 3564c16cb8
Fix various typos with codespell
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,fave,findn,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint`
2021-07-25 11:21:51 +02:00
Aaron Franke dd116d7998
Fix check for the first key in JSON stringify from Dictionary code 2021-07-24 21:28:50 -04:00
Rémi Verschelde 2b1e6e303e
Merge pull request #50786 from reduz/implement-resource-uids
Implement Resource UIDs
2021-07-24 17:18:12 +02:00
reduz 32b43cfeb3 Implement Resource UIDs
* Most resource types now have unique identifiers.
* Applies to text, binary and imported resources.
* File formats reference both by text and UID (when available). UID always has priority.
* Resource UIDs are 64 bits for better compatibility with the engine.
* Can be represented and used textually, example `uuid://dapwmgsmnl28u`.
* A special binary cache file is used and exported, containing the mappings.

Example of how it looks:

```GDScript
[gd_scene load_steps=2 format=3 uid="uid://dw86wq31afig2"]

[ext_resource type="PackedScene" uid="uid://bt36ojelx8q6c" path="res://subscene.scn" id="1_t56hs"]
```

GDScript, shaders and other special resource files can't currently provide UIDs, but this should be doable with special keywords on the files.
This will be reserved for future PRs.
2021-07-24 09:16:52 -03:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
Hugo Locurcio 7f83977f37
Expose an ImportOrder enum in ResourceImporter
This avoids using magic numbers in code.
2021-07-23 12:12:25 +02:00
reduz 75755beeee
Implement textual ext/subresource IDs.
* Friendlier with version control.
* Generates pseudo unique IDs, to minimize conflicts when merging, but still
  user readable (so, not UUID).
* Eventually will also allow to have more precisely named sub-resources in
  imported files.
* This will allow better reloading on changes (including resources already
  loaded) as well as better keeping track of changes on the DCC.
* Keeps backward compatibility with the old formats.
* Binary and text format version incremented to mark breakage in forward
  compatibility.
2021-07-22 19:37:47 +02:00
Fabio Alessandrelli ddb68f76ff [Net] Single rpc annotation. "sync" no longer part of mode.
- Move the "sync" property for RPCs to RPCConfig.

- Unify GDScript annotations into a single one:
  - `@rpc(master)` # default
  - `@rpc(puppet)`
  - `@rpc(any)` # former `@remote`

- Implement three additional `@rpc` options:
  - The second parameter is the "sync" option (which also calls the
    function locally when RPCing). One of "sync", "nosync".
  - The third parameter is the transfer mode (reliable, unreliable,
    ordered).
  - The third parameter is the channel (unused for now).
2021-07-20 11:17:59 +02:00
reduz 6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
Fabio Alessandrelli 0e265b047e
Merge pull request #46554 from likeich/is_server_quiet_failure
MultiplayerAPI is_network_server Fails Silently
2021-07-16 20:04:41 +02:00
Haoyu Qiu ccf292df38 Fix decompression with FastLZ when buffer size is less than 16 bytes 2021-07-13 16:34:45 +08:00
Fabio Alessandrelli 88d68346ee [Net] Rename NetworkedMultiplayerPeer to MultiplayerPeer. 2021-07-12 16:36:34 +02:00
Fabio Alessandrelli d3ba0aa3e0 [Net] Fix crash when receiving RPC on node without a script. 2021-07-11 10:18:32 +02:00
Rémi Verschelde a0d800e967
Merge pull request #50362 from timothyqiu/http-eof
Fix unicode invalid skip error in AssetLib
2021-07-11 09:33:51 +02:00
Haoyu Qiu 0caaaf4018 Fix unicode invalid skip error in AssetLib 2021-07-11 12:14:08 +08:00
Haoyu Qiu 293050a919 Handle Z_BUF_ERROR in decompress_dynamic 2021-07-11 11:05:12 +08:00
K. S. Ernest (iFire) Lee c1d9170194 Network port comparison is always false
error: comparison is always false due to limited range of data type [-Werror=type-limits]
  ERR_FAIL_COND_V_MSG(p_port < 0 || p_port > 65535, ERR_INVALID_PARAMETER, "The local port number must be between 0 and 65535 (inclusive).");
2021-06-30 02:39:17 -07:00
Paweł Fertyk 3dae9993ac Validate image formats, check if resize_to_po2 failed 2021-06-28 21:17:06 +02:00
Haoyu Qiu 0b7ffd4f68 Fix Image.adjust_bcs crash when image format is invalid 2021-06-27 20:52:42 +08:00
Fabio Alessandrelli b00c4a4360 [Net] Makes HTTPClient a custom instance class. 2021-06-23 14:10:45 +02:00
Fabio Alessandrelli 421e771012 [Net] Unify HTTPClient request and request_raw. 2021-06-23 13:53:43 +02:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Rémi Verschelde bbf6d645fb
Merge pull request #48080 from aaronfranke/real-serialization
Binary serialization for reals
2021-06-20 00:33:30 +02:00
Marcel Admiraal 2bafcd3422 Consolidate JSON, JSONParseResults and JSONParser into JSON
Renames JSON.parse_string() to parse()
Renames JSON.decode_data() to stringify()
2021-06-19 08:01:40 +01:00
Aaron Franke 29706651fe
Binary serialization for reals
Added new "encode_real" methods for handling real_t, and used them for vector types. Types are encoded based on compilation setting.

But for decoding, always check how it was encoded. This way, serialized data is cross-compatible with Godot compiled with singles and Godot compiled with doubles. At least, in theory.
2021-06-17 23:15:34 -04:00
Aaron Franke 8b692e8872
Add PROPERTY_USAGE_NONE and use it 2021-06-17 19:10:26 -04:00
Haoyu Qiu b3bd54001f Fix json dump and print of circular structure 2021-06-14 20:48:49 +08:00
Rémi Verschelde 6d98f84abb
Merge pull request #48746 from KoBeWi/bane_of_all_virtual_compatibility
Consistently prefix bound virtual methods with _
2021-06-12 23:00:40 +02:00
Rémi Verschelde ac73059b56
Merge pull request #49123 from aaronfranke/it-is-time
Add a Time singleton
2021-06-12 22:55:25 +02:00
kobewi 7ff135b015 Consistently prefix bound virtual methods with _ 2021-06-12 00:55:52 +02:00
Rémi Verschelde 530e069bc3
Merge pull request #49312 from RandomShaper/reference_to_ref_count
Rename `Reference` to `RefCounted`
2021-06-11 19:46:25 +02:00
Rémi Verschelde 50d1e0ea99
Merge pull request #47835 from mortarroad/master-lossless-webp
Implement lossless WebP encoding
2021-06-11 19:34:36 +02:00
Pedro J. Estébanez 04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
Morris Tabor 1bc1e94208 Implement lossless WebP encoding 2021-06-11 18:46:04 +02:00
Juan Linietsky fbb5a541ef
Merge pull request #49421 from floppyhammer/fix-vram-compressed-mipmaps
Fix mipmaps of VRAM compressed textures
2021-06-11 12:35:00 -03:00
Rémi Verschelde 8d4046929c
Merge pull request #49511 from akien-mga/core-diraccess-fileaccess-io
Core: Move DirAccess and FileAccess to `core/io`
2021-06-11 16:51:10 +02:00
Rémi Verschelde 6107d9e180
Merge pull request #34566 from Heikki00/34541_to_json_precision
Increased String::num default decimal precision
2021-06-11 15:56:59 +02:00
Aaron Franke f64fea1b23
Add Time singleton 2021-06-11 09:32:39 -04:00
Rémi Verschelde 9e328bb5b7
Core: Move DirAccess and FileAccess to core/io
File handling APIs are typically considered part of I/O, and we did have most
`FileAccess` implementations in `core/io` already.
2021-06-11 14:52:39 +02:00
floppyhammer 81ed9fa31b fix-vram-compressed-mipmaps 2021-06-08 21:38:45 +08:00
Rémi Verschelde 01d5c463be
FileAccess: Don't err in store_buffer with buffer of size 0
The error check was added for `FileAccessUnix` but it's not an error when both
`p_src` and `p_length` are zero.

Added correct error checks to all implementations to prevent the actual
erroneous case: `p_src` is nullptr but `p_length > 0` (risk of null pointer
indexing).

Fixes #33564.
2021-06-07 18:34:00 +02:00
Rémi Verschelde 896aa94283
Merge pull request #49221 from Faless/mp/4.x_rpc_refactor
[Net] Refactor RPCs, remove RSETs
2021-06-07 17:00:08 +02:00
Rémi Verschelde c1c76850cb
Style: Cleanup uses of double spaces between words
Or after punctuation. Tried to leave third-party stuff alone, unless it has
been heavily modified for Godot.
2021-06-07 11:03:08 +02:00
Marcel Admiraal 8acd13a456 Rename Quat to Quaternion 2021-06-04 18:14:32 +01:00