Commit graph

3965 commits

Author SHA1 Message Date
Jonathan Gollnick 6710ad1737
Let var2str display StringName with correct sigil 2021-06-10 16:30:28 -05:00
Marcel Admiraal b3a962945e Add OS.get_external_data_dir() to get Android external directory 2021-06-10 16:48:17 +01:00
reduz c66b2651a6 Refactor CommandQueueMT
* RingBuffer had no reason to be in this context
* A single buffer is used that can grow as much as the game needs.

This should make thread loading entirely reliable.
2021-06-09 13:10:49 -03:00
Rémi Verschelde d92e46233c
Merge pull request #49394 from akien-mga/fileaccess-store_buffer-err-len-0
FileAccess: Don't err in `store_buffer` with buffer of size 0
2021-06-07 22:33:01 +02:00
Rémi Verschelde 6e9a4c268f
Merge pull request #49318 from reduz/native-extension
Add API for registering native extensions
2021-06-07 20:11:41 +02: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
TwistedTwigleg 8aa3c2f091 New and improved IK system for Skeleton2D
This PR and commit adds a new IK system for 2D with the Skeleton2D node
that adds several new IK solvers, a way to control bones in a Skeleton2D
node similar to that in Skeleton3D. It also adds additional changes
and functionality.

This work was sponsored by GSoC 2020 and TwistedTwigleg.

Full list of changes:
* Adds a SkeletonModifier2D resource
  * This resource is the base where all IK code is written and executed
  * Has a function for clamping angles, since it is so commonly used
  * Modifiers are unique when duplicated so it works with instancing
* Adds a SkeletonModifierStack2D resource
  * This resource manages a series of SkeletonModification2Ds
  * This is what the Skeleton2D directly interfaces with to make IK possible
* Adds SkeletonModifier2D resources for LookAt, CCDIK, FABRIK, Jiggle, and TwoBoneIK
  * Each modification is in its own file
  * There is also a SkeletonModifier2D resource that acts as a stack for using multiple stacks together
* Adds a PhysicalBone2D node
  * Works similar to the PhysicalBone3D node, but uses a RigidBody2D node
* Changes to Skeleton2D listed below:
  * Skeleton2D now holds a single SkeletonModificationStack2D for IK
  * Skeleton2D now has a local_pose_override, which overrides the Bone2D position similar to how the overrides work in Skeleton3D
* Changes to Bone2D listed below:
  * The default_length property has been changed to length. Length is the length of the bone to its child bone node
  * New bone_angle property, which is the angle the bone has to its first child bone node
  * Bone2D caches its transform when not modified by IK for IK interpolation purposes
  * Bone2D draws its own editor gizmo, though this is stated to change in the future
* Changes to CanvasItemEditor listed below:
  * Bone2D gizmo drawing code removed
  * The 2D IK code is removed. Now Bone2D is the only bone system for 2D
* Transform2D now has a looking_at function for rotating to face a position
* Two new node notifications: NOTIFICATION_EDITOR_PRE_SAVE and NOTIFICATION_EDITOR_POST_SAVE
  * These notifications only are called in the editor right before and after saving a scene
  * Needed for not saving the IK position when executing IK in the editor
* Documentation for all the changes listed above.
2021-06-05 15:19:51 -04:00
reduz 98a81fe8aa Add API for registering native extensions
* First step for GDNative to behave more like modules
* Only Object and ClassDB, the rest needs to happen on the GDNative side.
2021-06-04 14:56:46 -03:00
Marcel Admiraal 8acd13a456 Rename Quat to Quaternion 2021-06-04 18:14:32 +01:00
Aaron Franke 028d9fa2bd
Add "Transform" compatibility name for "Transform3D" in VariantParser 2021-06-04 08:07:08 -04:00
Rémi Verschelde 875ed4d600
Merge pull request #47336 from Calinou/rename-shader-file-extension
Rename the `.shader` file extension to `.gdshader`
2021-06-04 11:26:14 +02:00
Rémi Verschelde 5d9cab3aeb
Merge pull request #38430 from aaronfranke/transform3d 2021-06-03 23:07:21 +02:00
Rémi Verschelde ea2a0b5455
Merge pull request #43450 from aaronfranke/mouse-mode-bitwise
Add MOUSE_MODE_CONFINED_HIDDEN to MouseMode enum
2021-06-03 22:00:15 +02:00
Rémi Verschelde a9c6d2a96c
Merge pull request #45624 from aaronfranke/clamp
Allow clamping vectors and colors in addition to floats and ints
2021-06-03 21:20:37 +02:00
Rémi Verschelde a867c5ab77
Merge pull request #49269 from sarchar/fix-dns-locks
Fix DNS resolve mutex locks
2021-06-03 21:08:08 +02:00
Aaron Franke 2e13e3ed4a
Allow clamping vectors and colors 2021-06-03 12:05:20 -04:00
Aaron Franke 94bc0bd919
Rename Vector2 clamped to limit_length and add limit_length to Vector3 2021-06-03 12:04:57 -04:00
Chuck 48f7e06976 Fix DNS resolve mutex locks
This fixes #49261, which was happening because of a deadlock in the resolver mutex.  There was leftover old mutex code and it's all be converted to new MutexLock class now.
2021-06-03 22:58:40 +07:00
Aaron Franke 98aa3b669e
Add MOUSE_MODE_CONFINED_HIDDEN
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2021-06-03 11:44:28 -04:00
Rémi Verschelde 7ab34e1a96
Merge pull request #48889 from Calinou/file-rename-endian-swap
Rename File's `endian_swap` to `big_endian`
2021-06-03 15:19:07 +02:00
Aaron Franke a3c29ed899
Rename files and the exposed name for Transform3D 2021-06-03 07:30:01 -04:00
Aaron Franke 08a85352fb
Rename Variant TRANSFORM to TRANSFORM3D
Also _transform to _transform3d
2021-06-03 07:30:01 -04:00
Aaron Franke de3f6699a5
Rename Transform to Transform3D in core 2021-06-03 07:30:01 -04:00
Rémi Verschelde 9990f28d84
Merge pull request #49026 from sarchar/multiple-dns-resolves 2021-06-01 18:41:41 +02:00
Rémi Verschelde c5f237eaf8
Merge pull request #45393 from Paulb23/code_edit_autocomplete 2021-06-01 17:58:19 +02:00
Fabio Alessandrelli d779b5aa3e [Net] Refactor RPCs, remove RSETs
In this PR:
- Removed rset
- rpc_config can now optionally configure transfer mode
  (reliable/unreliable/ordered) and channel (channels are not actually
  implemented yet.)
- Refactor how the RPC id is computed to minimize the logic in Node and
  scripts that now only needs a single `get_rpc_methods` function.
2021-06-01 17:24:21 +02:00
Paulb23 1c16673798 Move and expose AutoComplete in CodeEdit 2021-06-01 15:38:45 +01:00
Chuck dd8fa11ac1 Support multiple address resolution in DNS requests
Add two new functions to the IP class that returns all addresses/aliases associated with a given address.

This is a cherry-pick merge from 010a3433df which was merged in 2.1, and has been updated to build with the latest code.

This merge adds two new methods IP.resolve_hostname_addresses and IP.get_resolve_item_addresses that returns a List of all addresses returned from the DNS request.
2021-06-01 11:24:34 +07:00
Rémi Verschelde 5ec8920cde
Merge pull request #49142 from Chaosus/bvh_fix_possible_crash
Fixed possible crash in `DynamicBVH::optimize_incremental`
2021-05-31 21:04:08 +02:00
Rémi Verschelde 643da45e16
Merge pull request #49173 from KoBeWi/navigational_oblivion
Tweak arguments of list_dir_begin() (skips navigational and hidden files by default)
2021-05-31 14:33:58 +02:00
kobewi bd50006aae Tweak arguments of list_dir_begin() 2021-05-31 12:16:26 +02:00
Rémi Verschelde 6ebe3bebae
Merge pull request #49192 from lawnjelly/bvh_current_tree4
BVH - fix stale current_tree in deactivate function [4.x]
2021-05-31 11:33:24 +02:00
reduz 0d2e02945b Implement shader caching
* Shader compilation is now cached. Subsequent loads take less than a millisecond.
* Improved game, editor and project manager startup time.
* Editor uses .godot/shader_cache to store shaders.
* Game uses user://shader_cache
* Project manager uses $config_dir/shader_cache
* Options to tweak shader caching in project settings.
* Editor path configuration moved from EditorSettings to new class, EditorPaths, so it can be available early on (before shaders are compiled).
* Reworked ShaderCompilerRD to ensure deterministic shader code creation (else shader may change and cache will be invalidated).
* Added shader compression with SMOLV: https://github.com/aras-p/smol-v
2021-05-31 10:13:09 +02:00
lawnjelly bd42de5fea BVH - fix stale current_tree in deactivate function [4.x]
Changes passing of current_tree from a member variable to a function argument, making bugs due to stale state less likely.

Fix a bug in deactivate where current_tree variable was stale. This may have resulted in visual anomalies.
2021-05-29 18:03:43 +01:00
Yuri Roubinsky 4d569df95f Fixed possible crash in DynamicBVH::optimize_incremental 2021-05-27 18:38:06 +03:00
Paweł Fertyk ee8c9bb614 Return error when decompressing empty PoolByteArray 2021-05-25 18:43:26 +02:00
Marcel Admiraal da5d7db610 Rename File::get_len() get_length() 2021-05-25 11:54:28 +01:00
Rémi Verschelde af03e9c830
Merge pull request #48939 from Calinou/screen-orientation-use-enum
Use an enum to represent screen orientation in the Project Settings
2021-05-24 19:53:19 +02:00
Rémi Verschelde 215e43242c
Merge pull request #49037 from vnen/fix-callable-freed-crash 2021-05-24 19:52:32 +02:00
George Marques ea44744e2d
Make Callable not crash on call when the object has been freed
Also add a GDScript test for this case.
2021-05-24 14:23:02 -03:00
Hugo Locurcio 660952a857
Use an enum to represent screen orientation in the Project Settings
- Tweak the setting property hint to be more informative.
- Make the setting a "basic" setting so it appears when Advanced Settings
  is disabled.
- Remove redundant orientation setting in the iOS export preset.
  The project setting is now used (like on Android).

Projects upgrading from a previous version will have to set the
screen orientation again in the Project Settings if it wasn't set
to the default value ("landscape").
2021-05-24 18:53:10 +02:00
Rémi Verschelde d9d920ed6c
Merge pull request #49023 from akien-mga/fix-OS-get_unix_time_from_datetime
OS: Better validation of invalid input for get_unix_time_from_datetime
2021-05-24 16:18:08 +02:00
Rémi Verschelde 65eff1cfdd
Merge pull request #46866 from bruvzg/symlinks_and_macos_gdn_framework_export_4 2021-05-24 15:14:02 +02:00
Rémi Verschelde 62efa30ed2
OS: Better validation of invalid input for get_unix_time_from_datetime
Default missing keys to Unix time 0 (1970-01-01 at 00:00:00 UTC).
Abort if year <= 0, this is not supported by the current algorithm.

Prevents an infinite loop further down.

Fixes #49022.
2021-05-24 13:37:36 +02:00
Zae a65dac3fa7 Fix duplicate close files when deconstructing ZipArchive 2021-05-24 14:25:02 +08:00
Hugo Locurcio 80f4e407b2
Add a keyboard shortcut to select the word under cursor in TextEdit
This also acts as a general-purpose "deselect" shortcut since pressing
it a second time will deselect text.

This is available both in the script editor and in TextEdit fields
in use, both in the editor and projects.

The Duplicate Line script editor shortcut was moved to Ctrl + Shift + D
since it conflicts with the new shortcut (Ctrl + D). The rationale for
doing so is that Duplicate Line is a less commonly used action, and
its behavior can be replicated by copying and pasting the current line
anyway. (With no selection active, the whole line will be copied.)
2021-05-22 23:47:43 +02:00
Rémi Verschelde de4c17f716
Merge pull request #48916 from mortarroad/master-convex-hull-ported
Replace QuickHull with Bullet's convex hull computer.
2021-05-22 23:22:48 +02:00
Morris Tabor d1bc88d426 Replace QuickHull with Bullet's convex hull computer.
The code is based on the current version of thirdparty/vhacd and modified to use Godot's types and code style.

Additional changes:
- extended PagedAllocator to allow leaked objects
- applied patch from https://github.com/bulletphysics/bullet3/pull/3037
2021-05-22 22:35:42 +02:00