Commit Graph

5084 Commits

Author SHA1 Message Date
George Marques 62ad18a3a1
Remove argument name strings from release builds
They are not needed in release, so we can remove them to reduce the
binary size.
2022-04-05 20:40:07 -03:00
Rémi Verschelde 099b024a2b Fix DynamicBVH crash after #59867
I made a wrong assumption that initialization the other pointer in the
union would properly initialize the `childs` array.
2022-04-05 02:17:34 +02:00
Rémi Verschelde f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
Rémi Verschelde c630c2001d
Merge pull request #59633 from EricEzaM/better-code-complete-update
Improve sorting of Code Completion options.
2022-04-03 12:34:00 +02:00
Eric M 4ab605d14d Improve sorting of Code Completion options.
Done by ordering options by their location in the code - e.g. local, parent class, global, etc.
2022-04-01 20:39:09 +10:00
bruvzg 947d7c8329
Fix some issues found by clang sanitizers. 2022-03-31 18:35:56 +03:00
Rémi Verschelde a647fb3e62 Fix typos with codespell
Using codespell 2.2-dev from current git.

Fix a couple incorrect uses of gendered pronouns.
2022-03-31 14:07:29 +02:00
Rémi Verschelde 03c58954c0
Merge pull request #58436 from piiertho/feature/typed-vararg-method-bind 2022-03-30 13:47:35 +02:00
Pierre-Thomas Meisels 63f7f44ccb Make vararg method bind no return and return
Type emit_signal exposed method return type

set UndoRedo add_do_method and add_undo_method exposed return void

Set TreeItem::_call_recursive_bind returns void

Set _rpc_bind and _rpc_id_bind returns void in Node

Set _call_group and _call_group_flags method returns void in SceneTree

Set godot-cpp-test CI flag to false
2022-03-30 11:43:12 +02:00
reduz 45f74ceb85 Add PortableCompressedTexture
* Resource that allows saving textures embedded in scenes or standalone.
* Supports only formats that are portable: Lossy, Lossles or BasisUniversal

This is something I wanted to add for a long time. I made it now because @fire
requires it for importing GLTF2 files with embedded textures, but also this
will allow saving Godot scenes as standalone binary files that will run
in all platforms (because textures will load everywhere).

This is ideal when you want to distribute individual standalone assets online
in games that can be built from Godot scenes.
2022-03-30 10:39:41 +02:00
Rémi Verschelde 482cdeaf71
Merge pull request #58608 from KoBeWi/metadefault 2022-03-29 16:14:28 +02:00
Rémi Verschelde 7119d355eb String: Remove TTR and DTR defines in non-tools build
This ensures we don't use TTR in runtime code, as it's specifically meant
to source translations for the editor.
2022-03-28 20:26:35 +02:00
Rémi Verschelde abbb0dc082
Merge pull request #59548 from akien-mga/obj-remove-unused-categories 2022-03-28 14:17:24 +02:00
Rémi Verschelde 41d075de58
Merge pull request #59456 from Calinou/color-expose-to-linear-srgb 2022-03-28 13:36:19 +02:00
Rémi Verschelde 143d13717b
Merge pull request #59553 from reduz/script-extension-support 2022-03-28 13:35:21 +02:00
Juan Linietsky ed14ff5a08
Revert "Sort autocomplete/code completion options in a better way" 2022-03-28 13:31:32 +02:00
Hugo Locurcio 1c343cd54d Expose Color's `to_linear()` and `to_srgb()` to scripting 2022-03-28 12:17:55 +02:00
Rémi Verschelde 097b81f147
Merge pull request #59611 from mashumafi/const-ref-callable
Const Ref Callable for custom sort/search
2022-03-28 09:13:19 +02:00
Rémi Verschelde 7fe5bece45
Merge pull request #58931 from EricEzaM/proposals/4189-better-code-completion
Sort autocomplete/code completion options in a better way
2022-03-28 08:56:27 +02:00
Rémi Verschelde 6a74d81e02
Merge pull request #59600 from Bromeon/feature/extension_to_string
GDExtension: change to_string signature to accept `GDNativeStringPtr` instead of returning `const char*`
2022-03-28 08:53:40 +02:00
mashumafi 9c2bfeb2fb Const Ref Callable for custom sort/search 2022-03-27 22:10:36 -04:00
Jan Haller f88bdac403 GDExtension: change to_string signature to accept GDNativeStringPtr instead of returning const char* 2022-03-27 21:31:00 +02:00
Fabio Alessandrelli 331f1662df [Net] Drop is_connected_to_host for TCP and UDP.
The UDP method is now called `is_socket_connected` to limit confusion
with the actual host connection status which doesn't make sense in UDP.

The TCP method is completly dropped, use get_status instead.

The only one left is the WebSocketPeer one, which should be fine as is
for now.
2022-03-27 16:36:44 +02:00
Fabio Alessandrelli 0e52867668 [Net] Make StreamPeerTCP::_poll_connection explicit.
No longer hacked into `get_status` and renamed to `poll`.

The old `poll` (for *nix `poll`, win `select`) is now called `wait`.
2022-03-27 16:36:44 +02:00
reduz 360dea5348 Add GDExtension support to Script
* Ability to create script languages from GDExtension
* Some additions to gdnative_extension.h to make this happen
* Moved the GDExtension binder to core

This now allows creating scripting languages from GDExtension, with the same ease as if it was a module. It replaces the old PluginScript from Godot 3.x.
Warning: GodotCPP will need to be updated to support this (it may be a bit of work as ScriptInstance needs to be created over there again).
2022-03-27 16:13:00 +02:00
Markus Sauermann 0494e024d8 Rename warp mouse functions to warp_mouse 2022-03-27 14:12:01 +02:00
Rémi Verschelde 5371009d8e Object: Remove unused category boilerplate
We might want to re-add something like this if/when we find a good use case
for it and do the effort to categorize all objects in the API properly.

Until then, it's better to remove that boilerplate since it's not needed.

Closes #18711.
2022-03-26 15:46:01 +01:00
Rémi Verschelde 283246a9fe
Merge pull request #59452 from reduz/refactor-metadata 2022-03-25 12:30:45 +01:00
reduz 09b951b99b Refactor Object metadata
* API kept the same (Although functions could be renamed to set_metadata/get_metadata in a later PR), so not much should change.
* Metadata now exposed as individual properties.
* Properties are editable in inspector (unless metadata name begins with _) under the metadata/ namespace.
* Added the ability to Add/Remove metadata properties to the inspector.

This is a functionality that was requested very often, that makes metadata work a bit more similar to custom properties in Blender.
2022-03-24 14:21:52 +01:00
Eric M f9e1c094a2 Improve sorting of Code Completion options.
Done by ordering options by their location in the code - e.g. local, parent class, global, etc.
2022-03-24 22:24:14 +10:00
Hugo Locurcio 7d8b344f01
Increase the maximum number of concurrent DNS queries from 32 to 256
This makes the following error message less likely to be printed
when performing many concurrent HTTP requests:

    Condition ' resolving == IP::RESOLVER_INVALID_ID ' is true. returned: ERR_BUG
2022-03-23 18:18:23 +01:00
Rémi Verschelde 6b131b7d4b
Merge pull request #59437 from lawnjelly/bvh_check_invalid_handles 2022-03-23 11:37:53 +01:00
lawnjelly 109d08c84a Add protective checks for invalid handle use in BVH
Adds DEV_ASSERTS that will halt at runtime if the BVH is misused with invalid IDs, and adds ERR_FAIL macros to prevent calling with invalid IDs.

Any such misuse is a bug in the physics, but this should flag any errors quickly.
2022-03-23 09:19:26 +00:00
Haoyu Qiu 680bcef825 Fix crash when exporting projects with shared libraries 2022-03-23 13:53:32 +08:00
Rémi Verschelde 9162f27836
Merge pull request #59314 from reduz/add-static-methods-to-classdb 2022-03-22 19:22:46 +01:00
reduz 2f651277da Add static method support to ClassDB
* Based on the work done for Variant in the past.
* Added `ClassDB::bind_static_method`
* Cleaned up ClassDB::bind_method to use variadic templates.

This adds support for having static methods in Object derived classes.
Note that this does not make it work yet in GDScript or Mono and, while it works for GDExtension, GodotCPP needs to be updated.
2022-03-22 16:27:34 +01:00
kobewi 3eb7fc4bfd Add optional 'default' argument to get_meta() 2022-03-22 15:50:47 +01:00
Rémi Verschelde 4c55a6529a
Merge pull request #59354 from Chaosus/astar3d 2022-03-22 13:15:21 +01:00
Rémi Verschelde 44267327a9
Merge pull request #59276 from bruvzg/mo_trans 2022-03-22 12:48:14 +01:00
Yuri Roubinsky 7913e04950 Rename `AStar` to `AStar3D` 2022-03-20 17:34:40 +03:00
Marcel Admiraal ea20049afc Ensure minimum modifiers are pressed when matching actions 2022-03-20 08:02:54 +00:00
bruvzg 35e8fd4d04
Add binary MO translation file support. 2022-03-18 23:23:32 +02:00
Rémi Verschelde 46472ea78e
Merge pull request #59257 from Calinou/key-name-backspace
Rename the "BackSpace" and "BackTab" key strings to "Backspace"/"Backtab"
2022-03-18 19:23:21 +01:00
Hugo Locurcio 03841bd8da
Rename the "BackSpace" and "BackTab" key strings to "Backspace"/"Backtab" 2022-03-18 18:09:21 +01:00
Rémi Verschelde 5c8bd6fd71
Merge pull request #58233 from bruvzg/gde_ts 2022-03-18 14:29:58 +01:00
Rémi Verschelde 5c4de463fe
Merge pull request #59229 from taigi100/Bugfix-#59215-Standard-color-name-returns-non-standard-color-code 2022-03-17 11:38:06 +01:00
Rémi Verschelde bc576af969
Merge pull request #57675 from TokageItLab/fix-blending 2022-03-17 10:49:34 +01:00
taigi100 bd247fa315 Update color constants to use HEX codes 2022-03-17 11:36:23 +02:00
bruvzg f19cd44346
Unify TextServer built-in module and GDExtension code. 2022-03-17 08:15:29 +02:00
Rémi Verschelde c9d764e14a
Merge pull request #59140 from reduz/physics-server-extension 2022-03-16 17:11:40 +01:00
Silc 'Tokage' Renew b06d253920 Fix blend animation to solve TRS track bug & blend order inconsistency 2022-03-16 05:11:55 +09:00
Rémi Verschelde fb28025785
Merge pull request #59153 from Calinou/debug-stringnames-improve
Improve `--debug-stringnames` to be more useful
2022-03-15 20:26:18 +01:00
Hugo Locurcio 38995961df
Improve `--debug-stringnames` to be more useful
- Print all StringNames, not just the top 100.
- Print statistics at the end of the list of StringNames,
  with unreferenced and rarely referenced StringNames.
- List the CLI argument in `--help` and shell completion.
2022-03-15 18:54:51 +01:00
reduz 8b547331be Create GDExtension clases for PhysicsServer3D
* Allows creating a GDExtension based 3D Physics Server (for Bullet, PhysX, etc. support)
* Some changes on native struct binding for PhysicsServer

This allows a 3D Physics server created entirely from GDExtension. Once it works, the idea is to port the 2D one to it.
2022-03-15 18:39:31 +01:00
Rémi Verschelde 51bbcbdec2
Merge pull request #45263 from KoBeWi/😕 2022-03-15 13:18:27 +01:00
Bartłomiej T. Listwon 6c6291b84f Include platform_config.h in thread.cpp and thread.h 2022-03-14 12:36:06 +01:00
Rémi Verschelde 2724e57288
Merge pull request #58772 from keptsecret/fix_filedialog_user_data_access
Fix unable to change directory in user access mode
2022-03-12 20:53:43 +01:00
Rémi Verschelde 015fdfc28d
Merge pull request #58986 from akien-mga/diraccessref 2022-03-11 12:51:22 +01:00
Rémi Verschelde 952b71a425
Merge pull request #58751 from bruvzg/loc_str_props 2022-03-11 10:45:02 +01:00
Rémi Verschelde 768f9422bc Convert uses of `DirAccess *` to `DirAccessRef` to prevent memleaks
`DirAccess *` needs to be deleted manually, and this is often forgotten
especially when doing early returns with `ERR_FAIL_COND`.
`DirAccessRef` is deleted automatically when it goes out of scope.

Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2022-03-11 09:13:11 +01:00
Rémi Verschelde 26fd6fe2b2
Merge pull request #58485 from aaronfranke/time-offset 2022-03-10 21:13:29 +01:00
reduz 6f51eca1e3 Discern between virtual and abstract class bindings
* Previous "virtual" classes (which can't be instantiated) are not corretly named "abstract".
* Added a new "virtual" category for classes, they can't be instantiated from the editor, but can be inherited from script and extensions.
* Converted a large amount of classes from "abstract" to "virtual" where it makes sense.

Most classes that make sense have been converted. Missing:

* Physics servers
* VideoStream
* Script* classes.

which will go in a separate PR due to the complexity involved.
2022-03-10 12:28:11 +01:00
Rémi Verschelde 741bbb9d7c
Merge pull request #58690 from elmordo/bugfix-57553-gdextension-inheritance-fix 2022-03-10 11:23:18 +01:00
Rémi Verschelde e19da63009
Merge pull request #58946 from akien-mga/remove-unused-bullet-code
Remove unused Bullet module and thirdparty code
2022-03-10 08:01:04 +01:00
keptsecret 664c461d28 fixed unable to change directory in user access mode 2022-03-09 19:33:56 -05:00
Rémi Verschelde b85e5d51b2 Fix UndoRedo method call argument count after #58929 2022-03-09 22:21:00 +01:00
Rémi Verschelde 3d7f155586 Remove unused Bullet module and thirdparty code
It has been disabled in `master` since one year (#45852) and our plan
is for Bullet, and possibly other thirdparty physics engines, to be
implemented via GDExtension so that they can be selected by the users
who need them.
2022-03-09 21:45:47 +01:00
reduz 21637dfc25 Remove VARIANT_ARG* macros
* Very old macros from the time Godot was created.
* Limited arguments to 5 (then later changed to 8) in many places.
* They were replaced by C++11 Variadic Templates.
* Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
* Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-09 18:39:13 +01:00
kobewi 39d429e497 Change some math macros to constexpr
Changes `MAX`, `MIN`, `ABS`, `CLAMP` and `SIGN`.
2022-03-09 16:24:32 +01:00
Rémi Verschelde 4e3d5a9a2c VariantUtility: Unexpose `Math::range_step_decimals`
This method was meant only as a convenience for editor code
to allow using a step of 0 to disable snapping.

It was exposed by mistake when refactoring GlobalScope.
2022-03-07 22:13:49 +01:00
Rémi Verschelde 95e6db09d0
Merge pull request #58859 from godotengine/revert-57972-fix_has_setting4 2022-03-07 14:32:25 +01:00
Rémi Verschelde 78bf9926f8
Revert "Fix ProjectSettings has_setting() when used on a overriden setting with feature tags" 2022-03-07 12:33:07 +01:00
lawnjelly 0565676893 Protection for array operator for Vector2 / 3 in DEV builds
A previous PR had changed the array operator to give unbounded access. This could cause crashes where old code depended on this previous safe behaviour.

This PR adds DEV_ASSERT macros for out of bound access to DEV builds, allowing us to quickly identify bugs in calling code, without affecting performance in release or release_debug editor builds.
2022-03-07 11:15:45 +00:00
Rémi Verschelde 6c3170e875
Merge pull request #57930 from piiertho/bugfix/add-none-flag-to-resource-saver 2022-03-07 12:05:35 +01:00
Pierre-Thomas Meisels f9d4f08090 Fix ResourceSaver::save method exposition flag parameter
enh: Add FLAG_NONE to SaverFlags in ResourceSaver to fix api inconsistency
fix: flags parameter of ResourceSaver::save is now uint32_t to allow flag composition in scripts
2022-03-07 10:39:51 +01:00
Rémi Verschelde a51f724b8b
Merge pull request #57812 from piiertho/bugfix/add-none-enum-global-constants 2022-03-07 10:23:25 +01:00
Pierre-Thomas Meisels a41fb2fa3c bugfix: bind core enums' none values 2022-03-07 09:16:25 +01:00
reduz b0ca03b0a2 Add a UniformSet cache
* Changed syntax usage for RD::Uniform to create faster with a single RID
* Converted render pass setup to use this in clustered renderer to test.

This is the first step into creating a proper uniform set cache system to simplify large parts of the codebase.
2022-03-06 13:03:33 +01:00
Rémi Verschelde 0d1e3893d9
Merge pull request #57630 from lawnjelly/bvh4_templated_checks
[4.x] BVH - Sync BVH with 3.x
2022-03-04 23:29:38 +01:00
bruvzg 12cb6386f6
Improve app name and system permission message localization.
Add localizable string (Dictionary<Lang Code, String>) property editor and property hint.
Add localized "app name" property to the project settings.
Add localized permission and copyright properties to the macOS and iOS export settings.
Remove some duplicated ("app name") and deprecated ("info") macOS and iOS export properties.
2022-03-04 18:11:31 +02:00
Rémi Verschelde 0ff45dd3a7
Merge pull request #58673 from Calinou/smooth-trimesh-collision-always-setting 2022-03-04 12:25:36 +01:00
Ing. Petr Jindra c4770e1605 fix of reading property list from custom nodes imported from GDExtension when inheritance between custom nodes is used 2022-03-02 18:50:00 +01:00
Hugo Locurcio 4219485a82
Always register the Smooth Trimesh Collision project setting
This ensures the project setting never disappears from the editor,
even if the current physics engine is GodotPhysics.

This also adds documentation for the Smooth Trimesh Collision
project setting.
2022-03-02 18:49:34 +01:00
Haoyu Qiu d1ca29cd8c Remove `TTRC()` with empty string
Fixes "duplicate message definition" when extracting messages.
2022-03-02 17:02:10 +08:00
Theraot 3590cdfd34 Added missing p_bidirectional to AStar2D methods
The methods disconnect_points and are_points_connected  now have an optional p_bidirectional parameter matching AStar.
2022-03-01 17:01:32 -05:00
Haoyu Qiu b00b7f9b7c Fix `UndoRedo::create_action()` invalid memory usage 2022-03-01 18:20:46 +08:00
Rémi Verschelde feee9d0aa5
Merge pull request #58629 from groud/fix_native_extion_init_order 2022-03-01 01:33:48 +01:00
Rémi Verschelde de9446186d
Merge pull request #58488 from lawnjelly/float_literals_casts 2022-03-01 01:32:07 +01:00
Gilles Roudière ce512b35c1 Reorder native extension types initialization, initializing editor last 2022-02-28 16:03:26 +01:00
Aaron Franke 061ab30051
Use is_zero_approx and fix spelling in CameraMatrix invert 2022-02-26 12:19:54 -06:00
Hugo Locurcio 8e57e5dc6a
Print every file exported with `PCKPacker.flush()`s verbose parameter
Previously, only one line per 100 files was printed.

This also refactors the print statement to use Godot methods and
make it more informative overall.
2022-02-25 02:42:58 +01:00
Bartłomiej T. Listwon 3f7f780a4c Optimize String concatenation and copy functions 2022-02-24 09:47:15 +01:00
lawnjelly 1485924a2b Float literals - fix main primitives to use real_t casting
Uses (real_t) casting to ensure appropriate calculations are done in 32 bit where real_t is compiled as 32 bit.
2022-02-24 08:15:10 +00:00
Aaron Franke 55aabb8b06
Add offset string from minutes conversion method to Time singleton 2022-02-23 22:12:02 -06:00
Rémi Verschelde e6c11e4dfd
Merge pull request #58331 from poiati/fix-extension-registration-order-2 2022-02-22 09:07:28 +01:00
Rémi Verschelde 3000a3076b
Merge pull request #58350 from kidrigger/patch-1 2022-02-21 12:44:32 +01:00
Paulo Poiati fe95aa2c90 Fix extension registration order. 2022-02-20 10:58:46 -03:00
Anish Bhobe b7ff421b55
Resolving suggestions on comment formatting. 2022-02-20 14:56:58 +01:00
Rémi Verschelde e3d89a76f7 Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@94b76208bc
2022-02-20 12:20:17 +01:00
Rémi Verschelde 91a57b5b6a
Merge pull request #58329 from Powerbyte7/patch-1 2022-02-20 12:11:53 +01:00
Anish Bhobe 102d9fc1b3
Fixing iteration for extension level loading.
Extensions are not getting instantiating properly due to iteration calling the wrong levels for loading.
2022-02-20 11:41:39 +01:00
Powerbyte7 b8a7ea034c
[HTML5] Add Stadia controller to database
Add web support for the Stadia controller.
2022-02-19 23:01:41 +01:00
Rémi Verschelde e031aa06ee Core: Use forward declares for Vector3/Vector3i
Add add Vector3 operator in Vector3i.
2022-02-19 16:47:24 +01:00
Rémi Verschelde 719762d4dc
Merge pull request #58166 from Zylann/fix_binary_resource_with_doubles
Fix loading of binary resources with 64-bit floats
2022-02-19 08:22:42 +01:00
Rémi Verschelde 420ad25348
Merge pull request #58205 from Zylann/fix_variant_encode_with_doubles
Add missing flag when encode_variant writes math types with doubles
2022-02-19 08:22:05 +01:00
bruvzg 759ca45820
[Editor] Fix "en" editor translation detection. 2022-02-18 22:15:02 +02:00
Rémi Verschelde 0217d44dfd
Merge pull request #58278 from Ev1lbl0w/fix_decompress_retcode 2022-02-18 15:56:21 +01:00
Ricardo Subtil 61790a03f5 Fix decompression functions not returning errcodes 2022-02-18 13:50:25 +00:00
Rémi Verschelde e1c303fa79 Revert "Fix extension registration order."
This reverts commit 94ef200bab.

This broke extension loading.
Fixes #58273.
2022-02-18 14:18:24 +01:00
Rémi Verschelde b4dc2e91e6
Merge pull request #58196 from poiati/fix-extension-registration-order 2022-02-18 09:07:21 +01:00
Marc Gilleron c69d303ba9 Add missing flag when encode_variant writes math types with doubles 2022-02-16 20:47:36 +00:00
Paulo Poiati 94ef200bab Fix extension registration order. 2022-02-16 14:46:33 -03:00
Rémi Verschelde 51a00c2855
Merge pull request #58182 from akien-mga/style-cleanup-if-semicolons-deadcode 2022-02-16 16:55:07 +01:00
Rémi Verschelde b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
jmb462 dcd2a92af3 Port existing _notification code to use switch statements (part 1/3) 2022-02-16 11:38:24 +01:00
Rémi Verschelde f5b9cbaff6
Merge pull request #58176 from timothyqiu/find-nearest 2022-02-16 11:01:13 +01:00
Haoyu Qiu 3057b19daa Make VMap::find_nearest return -1 when empty 2022-02-16 16:12:30 +08:00
Marc Gilleron 722945be61 Fix loading of binary resources with 64-bit floats 2022-02-16 00:55:13 +00:00
Hugo Locurcio ee7cd9a3a1
Add an `OS.get_processor_name()` method
This method can be used to get the CPU model name.
It can be used in conjunction with
`RenderingServer.get_video_adapter_name()` and
`RenderingServer.get_video_adapter_vendor()` for annotating benchmarks
and automatic graphics quality configuration.
2022-02-15 20:55:53 +01:00
Max 6aede992a9 Fixed variant decoding Segmentation Fault 2022-02-14 23:04:05 +03:00
Fabio Alessandrelli f72bd67068 [ResourceUID] Use CryptoCore::RandomGenerator for IDs. 2022-02-14 10:45:50 +01:00
Fabio Alessandrelli ee7b67e135 [Crypto] Implement CryptoCore::RandomGenerator.
As a cryptographically secure random generator.

Internally it uses mbedTLS CTR-DRBG implementation which gets re-seeded
with entropy from OS::get_entropy when needed.

CryptoCore now additionally depends on `ctr_drbg.c` and `entropy.c`
thirdparty mbedtls files.
2022-02-14 10:45:50 +01:00
Fabio Alessandrelli 6b5634b96a [OS/Crypto] Add get_entropy to OS.
Implemented via `BCryptGenRandom` on Windows.
Implemented via `getentropy` syscall when available.
Implemented via `/dev/urandom` device as a fallback.

The `/dev/urandom` fallback can be disabled via the `NO_URANDOM` build
flag.

Note: The HTML5 version relies on emscripten file system urandom
device which itself uses the Crypto API when available or the plain
old not crypto-safe `Math.random()` otherwise.

Restore get_entropy.
2022-02-14 10:45:50 +01:00
Rémi Verschelde 7224389468
Merge pull request #57954 from TokageItLab/refactor-cubic-interpolate
Implement `cubic_interpolate()` as MathFunc for refactoring
2022-02-13 10:34:13 +01:00
Rémi Verschelde 7d0b9ec21a
Merge pull request #52742 from Geometror/improve-project-manager-file-dialog 2022-02-12 15:28:09 +01:00
Hendrik Brucker 77fb65debf Use EditorFileDialog instead of FileDialog in the project manager 2022-02-12 12:06:51 +01:00
reduz 97feafd0ea Fix resource reuse in binary loader
* Reuse was not setting the internal index.
* Supersedes #52599, without re-reading all properties.
2022-02-12 10:57:51 +01:00
Silc 'Tokage' Renew 865da09871 Implement cubic_interpolate() as MathFunc for refactoring 2022-02-12 18:11:17 +09:00
Rémi Verschelde daf9729b92
Merge pull request #57703 from lawnjelly/float_literals_math_funcs 2022-02-12 10:01:48 +01:00
Rémi Verschelde 7a7fabe4f6
Merge pull request #57641 from Geometror/compilation-time-improvements-1 2022-02-12 09:46:02 +01:00
Hendrik Brucker b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Rémi Verschelde ea0337909c
Merge pull request #57972 from BimDav/fix_has_setting4 2022-02-11 15:31:12 +01:00
BimDav d39e416c61 has_setting now correctly returns true when the setting is present due to a feature tag 2022-02-11 14:35:30 +01:00
reduz 3ad3a43063 Fix Variant Ref<> assignment.
-Creating from object pointer via funcptr API was missing reference initialization.
-Supersedes https://github.com/godotengine/godot-cpp/pull/662
-Fixes several crashes in GDExtension
2022-02-11 12:30:49 +01:00
lawnjelly 5298e16e80 Float literals - fix main primitives to use .f
Converts float literals from double format (e.g. 0.0) to float format (e.g. 0.0f) where appropriate for 32 bit calculations.
2022-02-10 18:43:19 +00:00
Yuri Sizov 107b6f299c Reorganize inspector layout workflow for Control nodes 2022-02-10 20:29:34 +03:00
Rémi Verschelde 1bdb82c64e
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.
2022-02-10 12:30:19 +01:00
Rémi Verschelde d22ac13bc2
Merge pull request #57715 from Faless/debugger/4.x_core_includes_and_servers
[Debugger] Move most profilers to ServersDebugger, fix core includes.
2022-02-09 21:57:32 +01:00
Rémi Verschelde 85610588d1
Merge pull request #57843 from Pineapple/vector2-brackets-operator-master 2022-02-09 13:25:18 +01:00
Rémi Verschelde 90162851a7
Core: Move generated `VERSION_HASH` to a `.cpp` file
This lets us have its definition in `core/version.h` and avoid
rebuilding a handful of files every time the commit hash changes.
2022-02-09 09:20:17 +01:00
Bartłomiej T. Listwon 51cac0709e Fix Vector2 and Vector2i coord access via operator[] 2022-02-09 09:17:17 +01:00
Rémi Verschelde f425d403fe
Merge pull request #57066 from KoBeWi/in_the_name_of_the_custom 2022-02-08 11:15:01 +01:00
Rémi Verschelde 13d4cbb87c
Merge pull request #57788 from reduz/describe-sname-usage 2022-02-08 11:13:38 +01:00
Rémi Verschelde dc17cce995
Merge pull request #57795 from bruvzg/gde_missing_binds 2022-02-08 11:12:44 +01:00
reduz 38232c70db Clarify SNAME usage
* Explain where it should be used, with examples.
* Clarify that it should _not_ be used everywhere, only where needed.
* Supersedes #57720

This PR is the result of the discussion that happened in a contractor meeting, and it attempts to clarify the intended use for this macro for other contributors.
As a personal note, It is my view that other approaches to using SNAME (like having a global or per class table of string names) are mere overengineering without any real benefit (performance remains the same, and usage of stringnames becomes more cumbersome. Additionally, there was not any significant amount of errors in name mismatching as a result of using strings since Godot was open sourced).
2022-02-08 09:21:10 +01:00
Rémi Verschelde 0154ce2c8d
Merge pull request #43015 from Xrayez/refactor-auto-instaprop
Refactor auto-instantiation of `Object` properties in editor
2022-02-08 08:57:29 +01:00
bruvzg b801742b77
[GDExtension] Add binds for missing methods, operators, and constants required for GDExtension TextServer implementation. 2022-02-08 09:49:14 +02:00
kobewi a08fc442a0 Fix script editor errors with CustomCallables 2022-02-07 14:34:42 +01:00
Rémi Verschelde ec00283f91
ResourceImporter: Restore default append logic for new importers
This was changed in #56943 to allow adding new importers from plugins that
take precedence over built-in ones, but this should be opt-in, not the default
behavior.

Fixes #57730.
2022-02-07 09:47:16 +01:00
Rémi Verschelde 8aa4ed8b5b
Merge pull request #57729 from TechnoPorg/astar-fix-invalid-include
Remove a cross include from a_star.cpp
2022-02-07 00:35:42 +01:00
TechnoPorg 5108af42ad Remove a cross include from a_star.cpp 2022-02-06 15:05:17 -07:00
Fabio Alessandrelli 6583797305 [Debugger] Move servers-related behaviours to ServersDebugger.
Forcing draw during debug break is now handled by ServersDebugger, and
only happens when the proper message is sent from the EditorDebugger
("servers:draw").
In a similar way, briging the window in foreground is now also handled
by ServersDebugger upon receiving "servers:foreground" which is sent by
the EditorDebugger when resuming from a break ("continue").
2022-02-06 17:36:48 +01:00
Fabio Alessandrelli 87f4bbd668 [Debugger] Move most profilers to ServersDebugger.
Also splits bandwidth/rpc profiler (RPCProfiler is now in
SceneDebugger).
2022-02-06 17:36:48 +01:00
Fabio Alessandrelli 789e648f4d [Debugger] New extensible EngineProfiler class.
Uses GDExtension, replaces old Callable system for profilers, and is
also used internally.
2022-02-06 17:33:45 +01:00
reduz 8c7268664d
Fix integer vector mul/div operators and bindings.
* Vector2i and Vector3i mul/div by a float results in Vector2 and Vector3 respectively.
* Create specializations to allow proper bindings.

This fixes #44408 and supersedes #44441 and keeps the same rule of int <op> float returnig float, like with scalars.
2022-02-06 13:34:41 +01:00
Rémi Verschelde 9d1626b4d7
Merge pull request #57017 from godotengine/string-name-static-false-unclaimed 2022-02-05 20:26:34 +01:00
Rémi Verschelde bd32dd4a48
Merge pull request #56943 from V-Sekai/override-import
Make add_importer and add_post_importer_plugin override existing importers.
2022-02-05 19:50:37 +01:00
Rémi Verschelde 5f42e0d0ab
Merge pull request #57646 from Faless/mp/4.x_interfaces
[Net] Move RPC, Node cache out of MultiplayerAPI.
2022-02-05 18:26:04 +01:00
Rémi Verschelde eac1883791
Merge pull request #57657 from lawnjelly/err_macros_flush
Add fflush to error macros
2022-02-05 16:08:41 +01:00
lawnjelly 9963c4f0d3 Add fflush to error macros
CRASH_NOW macros would previously crash before outputting any error messages. This PR ensures calling fflush for stdout before terminating.
2022-02-05 12:31:54 +00:00
reduz 74adf0bf2e Remove RID_Owner.get_rid_by_index
* Implementing this function efficiently is not really possible.
* Replaced by an option to get all RIDs into a buffer for performance.
2022-02-05 11:59:34 +01:00
Rémi Verschelde df1724470d
Merge pull request #49775 from fire/faster-cvtt
Faster CVTT by lowering default quality
2022-02-05 10:28:07 +01:00
Rémi Verschelde a0c87d4c11
Merge pull request #57620 from Haydoggo/expression-exp-fix
Fix Expression's parsing of positive exponent literals
2022-02-05 10:14:10 +01:00
Hayden 1305ff92f7 Make parser treat all exponent literals as float 2022-02-05 16:34:26 +13:00
Fabio Alessandrelli 3acc39095e [Net] Fix bogus FileAccessNetwork deconstructor.
Now correctly erases old instances.
The code will likely need overhaul anyway to be usable.
It doesn't apply to editor runs, there's a bunch of inconsistencies on
how to clients are handled, and I don't really understand why multiple
instances are created for a single client/server.
2022-02-05 03:27:19 +01:00
Fabio Alessandrelli 347d2dfc42 [Net] Move RPC, Node cache out of MultiplayerAPI.
Now uses two interfaces so it can be overridden in the future, and
core no longer depends on Node.

The interfaces are implements in scene/multiplayer.
Replaces root_node with root_path.
Remove all Node references from MultiplayerAPI.
2022-02-05 02:00:23 +01:00
K. S. Ernest (iFire) Lee 419b342a9a Faster CVTT by reducing quality.
Make BC6 and BC7 CVTT faster while still having better quality than DXT5.
2022-02-04 15:15:26 -08:00
Rémi Verschelde 2885befbe6
Merge pull request #55950 from Faless/mp/4.x_replication_nodes 2022-02-04 19:03:10 +01:00
Rémi Verschelde 84290fe4b1
Merge pull request #57623 from akien-mga/core-math-struct-em-all 2022-02-04 19:02:57 +01:00
lawnjelly f8eaab5b47 BVH - Sync BVH with 3.x
Templated mask checks and generic NUM_TREES
Fix leaking leaves
2022-02-04 16:51:21 +00:00
Rémi Verschelde 5ddb518496
Core: Make all Variant math types structs
Some were declared as structs (public by default) and others as classes
(private by default) but in practice all these math types exposed as
Variants are all 100% public.
2022-02-04 16:48:24 +01:00
Rémi Verschelde e223bad86d
Core: Move Vector2i to its own `vector2i.h` header
Also reduce interdependencies and clean up a bit.
2022-02-04 16:32:21 +01:00
Fabio Alessandrelli d219547c96 [Net] New replication interface, spawner and synchronizer nodes.
Initial implementation of the MultiplayerReplicationInterface and its
default implementation (SceneReplicationInterface).

New MultiplayerSpawner node helps dealing with instantiation of scenes
on remote peers (e.g. clients).
It supports both custom spawns via a `_spawn_custom` virtual function,
and optional auto-spawn of known scenes via a TypedArray<PackedScenes>
property.

New MultiplayerSynchornizer helps synchronizing states between the local
and remote peers, supports both sync and spawn properties and is
configured via a `SceneReplicationConfig` resource.
It can also sync via path (i.e. without being spawned by a
MultiplayerSpawner if both peers has it in tree, but will not send the
spawn state in that case, only the sync one.
2022-02-04 14:56:30 +01:00
Rémi Verschelde 5f56d385b0
Core: Move Rect2i to its own `rect2i.h` header
And take the opportunity to improve interdependencies a bit with forward
declares where possible.
2022-02-04 14:17:30 +01:00
bruvzg 244db37508
Cleanup and move char functions to the `char_utils.h` header. 2022-02-04 11:35:01 +02:00
Rémi Verschelde b68db2f98a
Merge pull request #57571 from Haydoggo/improved-expression 2022-02-04 09:30:50 +01:00
Hayden Leete 018de19eba Added hex and bin literal support to Expression parser
fixed formatting
2022-02-04 10:49:19 +13:00
Rémi Verschelde f8f19b313d
Merge pull request #57562 from AnilBK/string-add-contains
String: Add contains().
2022-02-03 22:21:24 +01:00
Anilforextra adbe948bda String: Add contains(). 2022-02-04 01:28:02 +05:45
Rémi Verschelde 7191605324
Merge pull request #57587 from bruvzg/gde_fix_ptr_and_enum_returns
[GDExtension] Fix registration of functions with enum or native pointer return type.
2022-02-03 20:36:59 +01:00
Rémi Verschelde bf0253bab9
Merge pull request #56764 from madmiraal/fix-45592-2 2022-02-03 18:10:30 +01:00
bruvzg ddd96b3059
[GDExtension] Fix registration of functions with enum or native pointer return type. 2022-02-03 16:03:23 +02:00
Fabio Alessandrelli ac4fb2996b [Net] Non-blocking request in HTTPClientTCP.
HTTPClientJavaScript already supports non-blocking requests.
2022-02-03 02:45:30 +01:00
Fabio Alessandrelli 6ff753675a
Merge pull request #56771 from mhilbrunner/unacceptable
Verify custom HTTP headers, fix off by one error
2022-02-02 18:28:30 +01:00
Rémi Verschelde 050908626f
Merge pull request #57526 from tavurth/bugfix/high-macos-cpu-usage 2022-02-02 10:16:24 +01:00
Will Whitty c37bd41c79 Increase RemoteDebuggerPeerTCP poll to 6.9ms
Fix high CPU usage on MacOS by reverting the polling for Network
debugging to match 144hz refresh rate.
2022-02-01 23:35:30 +03:00
Anilforextra fc27636999 Vectors: Use clear() and has().
Use clear() instead of resize(0).

Use has() instead of "find(p_val) != -1".
2022-02-02 00:11:09 +05:45
Rémi Verschelde 8c7cd904f5
Merge pull request #57469 from Sauermann/fix-rect2i-intersect 2022-02-01 00:05:02 +01:00
Markus Sauermann 23a4fe5b27 Fix incorrect Rect2i calculations: intersects and encloses
Clarify expand documentation
2022-01-31 19:03:57 +01:00
bruvzg 8e79c5fb8d
Add support for the escaped UTF-16 and UTF-32 Unicode characters in the scripts and expressions. 2022-01-30 20:16:04 +02:00
Hugo Locurcio 736ac25306
Rename the physics server `run_on_thread` project settings
`run_on_separate_thread` is more explicit.
2022-01-29 17:35:50 +01:00
Nathan Franke 8a0a3accee
simplify formatting scripts, add a clang-tidy script, and run clang-tidy 2022-01-29 04:41:03 -06:00
Fabio Alessandrelli 49297d937c [Net] Simplify IP resolution code, fix caching.
First, we should not insert into cache if the hostname resolution has
failed (as it might be a temporary internet issue), second, the async
resolver should also properly insert into cache.

Took the chance to remove some duplicate code with critical section in
it at the cost of little performance when calling the blocking
resolve_hostname function.
2022-01-29 01:56:36 +01:00
Rémi Verschelde 9686d680b7
Merge pull request #57116 from bruvzg/win_net_share 2022-01-28 11:03:23 +01:00
Rémi Verschelde e6caaf4c80
Merge pull request #57205 from TechnoPorg/variant-template-cast
Allow method binds to take Object subclasses as arguments
2022-01-27 23:46:37 +01:00
Rémi Verschelde 899cd34426
Merge pull request #57281 from Rubonnek/rename-subsequence 2022-01-27 11:03:13 +01:00
Max Hilbrunner 3ef5a97505 Verify custom HTTP headers, fix off by one error 2022-01-27 03:22:37 +01:00
Max Hilbrunner 3a83872d26 HTTP comment cleanup 2022-01-27 03:22:37 +01:00
Max Hilbrunner 5deb5ebf23 Expose Transform3D::sphere_interpolate_with() 2022-01-27 02:53:20 +01:00
Wilson E. Alvarez 3eb5e0ac50
Rename String::is_subsequence_ofi to String::is_subsequence_ofn 2022-01-26 18:03:56 -05:00
Rémi Verschelde d74d4cbdff
Merge pull request #54173 from nathanfranke/fix-exact-match 2022-01-26 13:35:36 +01:00
cdemirer ddbb4878f2 Fix array variant reuse in constructor 2022-01-26 07:24:37 +08:00
TechnoPorg 051ef479c9 Allow method binds to take Object subclasses as arguments
This commit adds a condition to VariantCaster that casts Variants of type OBJECT to any type T, if T is derived from Object.
This change enables a fair bit of code cleanup. First, the Variant implicit cast operators for Node and Control can be removed, which allows for some invalid includes to be removed. Second, helper methods in Tree whose sole purpose was to cast arguments to TreeItem * are no longer necessary.
A few small changes also had to be made to other files, due to the changes cascading down all the includes.
2022-01-25 09:03:36 -07:00
bruvzg 9456454109
Fix translation with multiple sources for the same language.
Remove unnecessary locale length checks.
Add "C" -> "en" locale remap.
2022-01-24 18:58:16 +02:00
bruvzg cba8280515 [Windows] Add support for handling network share paths. 2022-01-24 16:22:59 +02:00
Nathan Franke dc1c4cfbfa
Fix action exact match 2022-01-24 05:55:37 -06:00
Rémi Verschelde 57a057f7ff
Merge pull request #56754 from madmiraal/fix-45592 2022-01-24 10:05:42 +01:00
Rémi Verschelde ce42ab238a
Merge pull request #56931 from lyuma/etcpak_po2
Enforce mult-of-4 requirements on etcpak input.
2022-01-23 09:31:35 +01:00
Lyuma b1b20f5f91 Pad etcpak input to 4x4 blocks. Fixes #49981 2022-01-22 17:20:17 -08:00
Fabio Alessandrelli 01e5e98312 [Net] Fix get_response_body_length for large files.
Parsing was fixed, but not the return value for the exposed getter.
2022-01-23 01:30:35 +01:00
Rémi Verschelde 668d6a1c5c
Merge pull request #56337 from cdemirer/fix-array-dictionary-id 2022-01-23 00:46:53 +01:00
kobewi f056cb8ebc Don't sort printed Dictionary 2022-01-22 13:45:02 +01:00
Rémi Verschelde 73d00131c6
Merge pull request #35012 from Xrayez/press-any-key 2022-01-20 22:51:01 +01:00
Rémi Verschelde cfb986c631
Merge pull request #51452 from omar-polo/fix-macros 2022-01-20 22:50:39 +01:00
Ignacio Roldán Etcheverry 0e659b4230
Fix false reporting unclaimed StringName at exit due to static refs 2022-01-20 22:09:03 +01:00
Rémi Verschelde d681d99e12
Merge pull request #52134 from RandomShaper/fix_naming 2022-01-20 22:01:37 +01:00
Omar Polo bd448e5535 Rename or refactor macros to avoid leading underscores
These are not used consistently and some can conflict with
system-specific defines.  While here, also delete some unused macros.
2022-01-20 20:29:15 +01:00
Andrii Doroshenko (Xrayez) 5d17fe7d0f Add `Input.is_anything_pressed` method 2022-01-20 20:55:14 +02:00
Pedro J. Estébanez 7b0ed2aa5e Rename Variant::is_ref() to is_ref_counted() 2022-01-20 18:46:25 +01:00
Rémi Verschelde 9e0973ca23
Merge pull request #56972 from lawnjelly/warn_unused 2022-01-20 15:34:41 +01:00
lawnjelly b411a731fe Add nodiscard to core math classes to catch c++ errors.
A common source of errors is to call functions (such as round()) expecting them to work in place, but them actually being designed only to return the processed value. Not using the return value in this case in indicative of a bug, and can be flagged as a warning by using the [[nodiscard]] attribute.
2022-01-20 13:07:49 +00:00
strank 88eb9f7aef Delete orphaned property default for exit_code which is not exposed any more. 2022-01-19 23:25:54 -05:00
bruvzg de48d5101b
Fix locale always selecting translation instead of "en", when no match found. 2022-01-19 16:46:48 +02:00
K. S. Ernest (iFire) Lee a6f34ea2d0 Make add_importer and add_post_importer_plugin override existing importers. 2022-01-19 04:53:28 -08:00
Rémi Verschelde ce2b5bdfa8
Merge pull request #52969 from bruvzg/locale_detection 2022-01-18 15:43:04 +01:00
Rémi Verschelde 28cd81c581
Merge pull request #56896 from akien-mga/dictionary-improve-VariantWriter-and-docs 2022-01-18 15:33:00 +01:00
Rémi Verschelde fd5fb7d64a
Merge pull request #56899 from touilleMan/fix-editor_node-set_exit_code 2022-01-18 14:48:55 +01:00
bruvzg 40c56ed410
Improve locale detection.
Use separate language, script and country lists.
Add locale selection dialog and property hint.
2022-01-18 14:30:00 +02:00
Rémi Verschelde 9912492e93
Merge pull request #56668 from akien-mga/array-slice-nicer-bound-checks 2022-01-18 13:22:35 +01:00
Emmanuel Leblond 2ec7c6a6bc
Replace use of `OS::set_exit_code()` by `SceneTree::quit()` in `EditorNode` 2022-01-18 13:09:30 +01:00
Rémi Verschelde 8898d6dadc
Dictionary: Serialize empty dict as `{}` instead of `{\n}`
Also make sure to always convert multiline dictionaries to a single line for
its EditorHelp representation, as multiline values break formatting.
2022-01-18 11:31:21 +01:00
Rémi Verschelde ff19feb8b8
Merge pull request #55939 from cdemirer/validated-array-add-fix
Fix validated version of array addition
2022-01-17 21:08:48 +01:00
cdemirer fbe903909d Fix validated version of array addition 2022-01-18 03:00:39 +08:00
Rémi Verschelde 24f8a5979c
Merge pull request #56809 from aaronfranke/replace-num-real 2022-01-17 16:55:34 +01:00
Rémi Verschelde d9a4ff7583
Merge pull request #55020 from bruvzg/vlk_device_surface_check 2022-01-17 13:34:23 +01:00
Rémi Verschelde 8bdef23f7f
Merge pull request #56012 from bruvzg/wt🤎4 2022-01-17 13:26:15 +01:00
Aaron Franke 13939734e0
Replace String::num_real code with a wrapper around String::num 2022-01-15 00:21:49 -06:00
Hugo Locurcio 40be15920f
Remove support for PVRTC texture encoding and decoding
On the only platform where PVRTC is supported (iOS),
ETC2 generally supersedes PVRTC in every possible way. The increased
memory usage is not really a problem thanks to modern iOS' devices
processing power being higher than its Android counterparts.
2022-01-14 21:08:22 +01:00
Rémi Verschelde d5fb68bbae
Merge pull request #56779 from aaronfranke/rect2-grow 2022-01-14 20:56:03 +01:00
Marcel Admiraal f41c72c538 Fix Actions mapped to triggers not using the full range 2022-01-14 15:36:20 +00:00
Aaron Franke 252c803d94
Remove zero size checks from Rect2 grow methods 2022-01-14 00:45:05 -06:00
Marcel Admiraal 5c3600b29f Fix mouse velocity not changing fast enough
- Uses all accumulated movements when calculating velocity
- Discards old accumulated movements
- Sets last mouse velocity to zero when there is no movement
2022-01-13 18:51:34 +00:00
Marcel Admiraal 5250cdd150 Use mouse event relative motion to calculate mouse velocity 2022-01-13 15:23:21 +00:00
Rémi Verschelde dbab0a9487
Merge pull request #56740 from AnilBK/camera-pre-allocate 2022-01-13 11:13:31 +01:00
Anilforextra 8a9c9a67ef CameraMatrix: Pre-allocate Vector in get_projection_planes(). 2022-01-13 10:14:59 +05:45
Rémi Verschelde 585231a172
Merge pull request #56492 from akien-mga/remove-author-docstrings 2022-01-12 15:24:17 +01:00
Rémi Verschelde 189662e5bd
Merge pull request #56696 from AnilBK/use-init-lists 2022-01-12 10:04:45 +01:00
Anilforextra 6c3a0460a8 Use List Initializations for Vectors. 2022-01-12 10:15:12 +05:45
Rémi Verschelde a074ceefcd
Merge pull request #56130 from Faless/mbedtls/2.28.0 2022-01-11 15:03:28 +01:00
Rémi Verschelde 46624388d4
Merge pull request #56322 from madmiraal/fix-42450 2022-01-11 11:33:59 +01:00