Commit graph

4117 commits

Author SHA1 Message Date
Rémi Verschelde c91860bb11
ResourceUID: Fix remove_id binding
Fixes #50833.
2021-07-25 11:55:56 +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 fb821b8398
Merge pull request #50535 from ChristopheClaustre/packedbytearray_decode_api
Change in PackedByteArray decode api and docs
2021-07-24 21:54:48 +02:00
ChristopheClaustre 20818c12b7 New to_***_array method to decode PackedByteArray to Packed***Array
Documentation for new PackedByteArray::to_***_array methods
Documentation for to_byte_array method for PackedInt32/Int64/Float32/Float64Array
2021-07-24 21:06:47 +02: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
Rémi Verschelde b918c4c3ce
Merge pull request #50789 from aaronfranke/fix-input-action-raw-str
Fix Input get_action_raw_strength binding
2021-07-23 22:59:02 +02:00
Rémi Verschelde 4c3d5850de
Merge pull request #50748 from JFonS/gizmo_rework
Node3D gizmo improvements
2021-07-23 21:55:16 +02:00
jfons cfb555a081 Node3D gizmo improvements
* Clean-up of node_3d_editor_plugin.{h,cpp}: removed unused code, fixed some bugs.
* Moved node_3d_editor_gizmos.{h,cpp} to editor/plugins.
* Added support for multiple gizmos per node. This means custom gizmos will no longer override the built-in ones and that multiple gizmos can be used in more complex nodes.
* Added support for handle IDs. When adding handles to a gizmo, an ID can be specified for each one, making it easier to work with gizmos that have a variable number of handles.
* Added support for subgizmos, selectable elements that can be transformed without needing a node of their own. By overriding _subgizmo_intersect_frustum() and/or _subgizmo_intersect_ray() gizmos can define which subgizmos should be selected on a region or click selection. Subgizmo transformations are applied using get/set/commit virtual methods, similar to how handles work.
2021-07-23 21:01:10 +02:00
Rémi Verschelde c25fa02c1c
Merge pull request #50765 from Calinou/resource-importer-expose-order-enum
Expose an ImportOrder enum in ResourceImporter
2021-07-23 19:32:44 +02:00
Rémi Verschelde e0d48f87f9
Merge pull request #50782 from timothyqiu/undoredo-ref
Fix UndoRedo crash when clearing history
2021-07-23 19:27:51 +02:00
Rémi Verschelde eefc67a810
Merge pull request #50747 from bruvzg/move_alert_to_os
Move `alert` function from `DisplayServer` to `OS`.
2021-07-23 19:27:31 +02:00
Haoyu Qiu c3baf83e28 Fix UndoRedo crash when clearing history 2021-07-24 00:53:58 +08: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
Aaron Franke 4147c67bb0
Fix Input get_action_raw_strength 2021-07-22 21:05:44 -04:00
Fabio Alessandrelli 1147fa5c19 Make Object "meta" functions take StringName.
The various get_meta, set_meta, has_meta, get_meta_list, remove_meta
functions now uses StringName, allowing further optimizations via the
SNAME macro when used from C++ (this PR does not change the various
usage though).
2021-07-22 22:52:30 +02:00
bruvzg 618eb27e8b Move alert function from DisplayServer to OS. 2021-07-22 21:50:35 +03: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
Rémi Verschelde 6b1886f998
Merge pull request #50319 from nekomatata/optimize-node-path-check
Optimize NodePath update when renaming or deleting nodes in the editor
2021-07-22 12:13:10 +02:00
Gilles Roudière b2187797df Add min_axis and max_axis to Vector2i 2021-07-21 12:29:51 +02:00
Hugo Locurcio 4bd5e4fd9b
Use the standard C INFINITY and NAN constants directly
The `Math_INF` and `Math_NAN` defines were just aliases for those
constants, so we might as well use them directly.

Some portions of the code were already using `INFINITY` directly.
2021-07-21 10:41:08 +02:00
reduz cee905f04f Adds ability to debug stringnames
* References (which include hash tables) can be profiled with --debug-stringnames
2021-07-20 17:31:51 -03:00
Rémi Verschelde 693f9b4e20
Merge pull request #50655 from JFonS/sname_opt
Editor StringName and Viewport optimizations
2021-07-20 21:49:32 +02:00
Joan Fons a6adb58493 Editor StringName and Viewport optimizations
* Added explicit return type to the SNAME macro.
* Add some extra SNAME usages.
* Change some ClassDB methods to use const StringName & arguments.
* Cache the Window parent in Control because it's used in
  is_layout_rtl(), which is called often.
* Only enable internal processing for viewports that need it.
* Change CanvasItem::group to be a StringName because it's only used as
  that.
2021-07-20 20:35:41 +02:00
Fabio Alessandrelli de4ad63e6f
Merge pull request #49882 from Faless/mp/4.x_rpc_gd
[Net] New `@rpc` annotation, "sync" is no longer part of mode.
2021-07-20 13:55:54 +02:00
Rémi Verschelde a98677181b
Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@241fed0a44.
2021-07-20 13:08:50 +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
Rémi Verschelde d022f361d3
Merge pull request #50518 from timothyqiu/locale-az
Fix missing locale names
2021-07-20 11:11:30 +02:00
Rémi Verschelde b4baec08cf
Merge pull request #50206 from groud/undoredo_increase_args_count
Increase the number of arguments accepted by UndoRedo methods
2021-07-20 09:50:01 +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 5717118bcc [HTML5] Add 2 controllers to the godot database.
Sony PlayStation DualShock 4 (054c:05c4 first gen).
Unofficial Switch controller.
2021-07-17 23:51:48 +02: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
Hugo Locurcio 523d6b2ae8
Merge pull request #47395 from sygi/shape_idx_collision
Add shape_idx to CollisionObject2D mouse_entered signal
2021-07-16 19:05:08 +02:00
Haoyu Qiu 7eec8334d4 Fix missing locale names 2021-07-16 23:07:07 +08:00
reduz b5d5d13f56 Add ability to set object instance binding on creation
* Required by binding generators
* Makes it easier to create the bindings on construction.
2021-07-15 11:41:57 -03:00
Joan Fons cfec291978 Fix equality operators in List's ConstIterator 2021-07-15 10:47:20 +02:00
Rémi Verschelde 06568bbfdf
Misc cleanup of header includes
Was looking for misuse of module headers without checking that the module is
actually enabled and got carried away...
2021-07-15 00:46:43 +02:00
George Marques 7bc52e56c0
Merge pull request #50056 from Blackiris/fix-in-operator
Fix 'in' operator to check if an object member exists
2021-07-13 14:25:42 -03:00
Rémi Verschelde 8747f25653
Merge pull request #50381 from reduz/implement-disable-classes
Implement the ability to disable classes
2021-07-13 15:31:38 +02:00
Rémi Verschelde b44b277f6f
Merge pull request #50169 from pycbouh/theme-type-variations 2021-07-13 15:13:00 +02:00
reduz 5ad4f26659 Implement the ability to disable classes
* This PR adds the ability to disable classes when building.
* For now it's only possible to do this via command like:
  `scons disable_classes=RayCast2D,Area3D`
* Eventually, a proper UI will be implemented to create a build config file to do this at large scale, as well as detect what is used in the project.
2021-07-13 09:25:14 -03:00
Rémi Verschelde dd27413907
Merge pull request #50412 from timothyqiu/fastlz-decompress 2021-07-13 12:12:46 +02:00
Faymoon 78ead60372
Let thread func have optional parameter
Fixes #38042.
2021-07-13 10:44:53 +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
Rémi Verschelde e2b79e9591
Merge pull request #49291 from NoFr1ends/fix-49262
String::format leave passed values untouched
2021-07-13 09:33:46 +02:00
Rémi Verschelde a766661f6a
Merge pull request #50304 from timothyqiu/memfree-param
Fix memfree parameter name
2021-07-13 08:29:47 +02:00
Yuri Sizov 4ee0e6ddf5 Add type variations to Theme 2021-07-13 02:26:28 +03:00
Fabio Alessandrelli 88d68346ee [Net] Rename NetworkedMultiplayerPeer to MultiplayerPeer. 2021-07-12 16:36:34 +02:00
Hendrik Brucker 74ab336fe3 Change VSync mode project setting enum type from string to integer 2021-07-12 03:35:51 +02:00