Commit graph

4024 commits

Author SHA1 Message Date
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
Philip Whitfield
3d9f29910c
fix url parsing with port numbers
String.get_slice_count is always at least 1 or 2 for bases with a port number.
Before this change the following URL would return ERR_INVALID_PARAMETER ```ws://127.0.0.1:8000/test```
2021-06-11 10:09:05 +02:00
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
floppyhammer
81ed9fa31b fix-vram-compressed-mipmaps 2021-06-08 21:38:45 +08: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
Hugo Locurcio
5ea1c75d63
Rename String.is_abs_path() to String.is_absolute_path()
This is more consistent with `NodePath.is_absolute()`.
2021-06-03 16:00:06 +02: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
Heikki Simojoki
09a905ca80
Increase String::num default decimal precision
Fixes #34541

Renamed MAX_DIGITS to MAX_DECIMALS, since it only changes the
amount of digits after the decimal point.

Increased MAX_DECIMALS to 32, and made String::num use
MAX_DECIMALS consistently. If -1 is passed as
decimal precision to String::num, it now gets changed to
the correct precision based on the number's magnitude,
instead of using printf default(which is 6)

String::num_real also calculates the correct precision now.

Also made the types used in floating-point math more
consistent in a few places.
2021-05-29 11:24:57 -04: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
bruvzg
139a9d6370
Add symlink API to the DirAccess (on macOS and Linux). 2021-05-22 17:33:34 +03:00
Rémi Verschelde
5d2d24202d
Merge pull request #48927 from KoBeWi/I_fixed_your_left
Fix usage of String.left()
2021-05-22 13:09:34 +02:00
kobewi
ea9660e1cf Fix usage of String.left() 2021-05-21 23:01:44 +02:00
Marcel Admiraal
afdc5edb2a Remove alloca from loop and use a single fixed size array declaration 2021-05-21 13:04:55 +01:00
Rémi Verschelde
31246a58e0
Merge pull request #48806 from timothyqiu/xml-parser-fixes
Fix XMLParser behavior for comments and premature endings
2021-05-21 12:26:34 +02:00
Rémi Verschelde
d5f9f58b61
Merge pull request #48903 from Calinou/math-funcs-remove-old-msvc-ifdef 2021-05-21 00:35:48 +02:00
Rémi Verschelde
bfe4af91a2
Merge pull request #36180 from KoBeWi/I_broke_your_right
Change behavior of String.right
2021-05-20 23:56:17 +02:00
Hugo Locurcio
b57d9c8005
Remove #ifdef catering to MSVC 2012 and earlier in math_funcs.h
For the `master` branch, the minimum supported MSVC version is now
MSVC 2017 (with MSVC 2019 being recommended).
2021-05-20 23:24:04 +02:00
Tomasz Chabora
b1859510ab Change behavior of String.right 2021-05-20 23:07:57 +02:00
Rémi Verschelde
98071ec136
Merge pull request #48887 from aaronfranke/round
Use global scope round method for rounding
2021-05-20 23:03:38 +02:00
Hugo Locurcio
12462d9055
Rename File's endian_swap to big_endian
This new name is more consistent with ResourceSaver and StreamPeer.
2021-05-20 14:58:03 +02:00
Rémi Verschelde
342f3efc7e
Merge pull request #48882 from aaronfranke/approx-use-double
Make is_equal_approx have explicit float and double versions
2021-05-20 14:17:58 +02:00
Rémi Verschelde
db4cf63482
Merge pull request #48860 from JohnM666/fix-basis-variant-initialization
Fix RigidBody3D.get_inverse_inertia_tensor() crash
2021-05-20 14:05:29 +02:00
Aaron Franke
b01aa69c80
Use global scope round method for rounding 2021-05-20 07:29:35 -04:00
Rémi Verschelde
4219a4cb6f
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:38:56 +02:00
Aaron Franke
b5b6d3a8ec
Make is_equal_approx have explicit float and double versions 2021-05-20 06:18:11 -04:00
JohnM666
b19544e91d Fix #46282 Executing RigidBody3D.get_inverse_inertia_tensor() crashes Godot 2021-05-20 10:46:24 +03:00
Marcel Admiraal
0846943ad5 Fix Quat includes 2021-05-19 15:09:21 +01:00
Marcel Admiraal
7104229a85 Fix InputMap.action_erase_event() failing to erase events correctly. 2021-05-19 11:43:02 +01:00
Haoyu Qiu
549ad70760 Fix XMLParser behavior for comments and premature endings 2021-05-18 15:01:21 +08:00
Rémi Verschelde
6c367f8e0d
Merge pull request #48168 from LightningAA/control-to-ctrl-4.0 2021-05-17 17:38:02 +02:00
Rémi Verschelde
7c72185917
Merge pull request #48792 from foxydevloper/fix-inputeventmidi-typo
Fix typo in InputEventMIDI string
2021-05-17 16:20:12 +02:00
fox
df52f5de75 Fix typo in InputEventMIDI string 2021-05-17 09:54:28 -04:00
Pedro J. Estébanez
469fa47e06
Make all file access 64-bit (uint64_t)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-17 15:06:19 +02:00
Marcel Admiraal
5cdf167dcc Make printing of InputEvents consistent
- Removes the undesired spaces before the colon
- Adds missing commas between parameters
- Adds quotes or brackets to strings
- Removes brackets around single values
2021-05-15 13:55:22 +01:00
Marcus Brummer
7e8e40a38e Fixed build with SCRIPT_AES256_ENCRYPTION_KEY set 2021-05-14 14:53:13 +02:00
Rémi Verschelde
fcbf7145fe
Merge pull request #42337 from zaevi/fix-zip-open-twice
Fix zip file opening twice
2021-05-14 12:56:33 +02:00
Rémi Verschelde
08b4383e3f
SCons: Abort if SCRIPT_AES256_ENCRYPTION_KEY is invalid
Helps users figure out that something is wrong if they did define this
environment variable and it turns out being ignored.
2021-05-14 11:46:10 +02:00
Zae
f403e62df1 Fix zip file opening twice 2021-05-14 13:53:43 +08:00
Rémi Verschelde
ed11756d26
GDNative: Fix size mismatch on 32-bit platforms for Signal and Callable
Fixes #48645.
2021-05-11 20:25:01 +02:00
PouleyKetchoupp
3877ed73d0 Dynamic BVH broadphase in 2D & 3D Godot Physics
Port lawnjelly's dynamic BVH implementation from 3.x to be used in
both 2D and 3D broadphases.

Removed alternative broadphase implementations which are not meant to be
used anymore since they are much slower.

Includes changes in Rect2, Vector2, Vector3 that help with the template
implementation of the dynamic BVH by uniformizing the interface between
2D and 3D math.

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2021-05-10 16:28:55 -07:00
Lightning_A
97fecd1b69 Rename "Control" key to "Ctrl" and add "_pressed" suffix to all InputEventWithModifiers properties/methods 2021-05-07 14:00:50 -06:00
Rémi Verschelde
c3f7465b7e
Merge pull request #48535 from groud/tiles_squashed
TileSet and TileMap rework (squashed)
2021-05-07 20:46:06 +02:00
Gilles Roudière
a3dda2df85 Rework the TileSet resource and TileMap nodes:
- Move most properties from TileMap to TileSet,
- Make TileSet more flexible, supporting more feature (several
  collision layers, etc...),
- Fusion both the TileMap and TileSet editor,
- Implement TileSetSources, and thus a new way to index tiles in the TileSet,
- Rework the TileSet and TileMap editors completely,
- Implement an editor zoom widget (and use it in several places)
2021-05-07 18:06:17 +02:00
Rémi Verschelde
bcbd480c32
Merge pull request #45144 from dalexeev/color-consts
Rename color constants (alternative)
2021-05-07 12:22:49 +02:00
Rémi Verschelde
8962d36bb1
Merge pull request #33577 from Calinou/highlight-control-flow-keywords
Highlight control flow keywords with a different color
2021-05-07 00:52:50 +02:00
Hugo Locurcio
ce4aa07276
Implement the %command% placeholder in the Main Run Args setting
This can be used to tell Godot to run an executable that will run Godot
rather than running Godot directly. This is useful to make Godot start
on the dedicated GPU when using a NVIDIA Optimus setup on Linux:
`prime-run %command%`

The `editor/run/main_run_args` setting declaration was moved to make it
visible in the ProjectSettings documentation.
2021-05-07 00:05:02 +02:00
Rémi Verschelde
01f80201bf
Merge pull request #38645 from KoBeWi/FMR
Add filter, map and reduce to Array
2021-05-06 20:44:01 +02:00
Hugo Locurcio
3f078c99f6
Rename IP_Unix, IP_Address and TCP_Server to remove underscores 2021-05-06 02:52:01 +02:00
Hugo Locurcio
e905e8f145
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-05 22:38:12 +02:00
MaxStgs
d89d7ecd08 Add PackedDataContainer data pointer check for non nullable 2021-05-05 21:17:49 +05:00
Tomasz Chabora
c50acc7339 Add filter, map and reduce to Array 2021-05-05 15:54:57 +02:00
Rémi Verschelde
02e96d9748
Fix error handling for user-defined ResourceFormatLoader.load
See #48463.
2021-05-05 15:43:49 +02:00