Commit graph

4957 commits

Author SHA1 Message Date
Hugo Locurcio
3ca4514866
Merge pull request #50175 from kleonc/image-blit-blend-fix-rects
`Image.blit_rect/blend_rect` Fix rects calculations for negative arguments
2022-04-19 16:30:08 +02:00
laws65
cf9fc0b936 Proper validation of negative values in datetime strings and datetime dicts 2022-04-17 19:12:18 +09:30
Oğuzhan Eroğlu
2b8eb126b4 Quick fix: Crash when parsing invalid datetime string #60189 2022-04-15 23:30:34 +03:00
Rémi Verschelde
c7922af4e5
Merge pull request #60203 from RedHeadphone/master
Fix Time.get_datetime_string_from_dict() does not validate input
2022-04-14 00:14:32 +02:00
Rémi Verschelde
bd9ba4bd10
Merge pull request #60208 from Magorx/input-set-custom-mouse-cursor-fix
Added p_shape check to avoid engine crash in DisplayServer
2022-04-14 00:12:51 +02:00
Rémi Verschelde
8ada85ef1d
Merge pull request #60093 from TokageItLab/reset-blend
Make blend animation to use ResetTrack as default value
2022-04-13 22:46:45 +02:00
Rémi Verschelde
d999116054
Merge pull request #60191 from novaplusplus/file-open-fix 2022-04-13 17:42:41 +02:00
nova++
1a3cb23955 Fix "File must be opened" error with File.open() 2022-04-13 08:51:07 -04:00
KingCakeTheFruity
29a2809d21 Added p_shape check to avoid engine crush 2022-04-13 14:50:30 +03:00
RedHeadphone
7e35af3dc3 validate input in Time.get_datetime_string_from_dict()
format fix

better fix to handle ERR_FAIL_COND_V_MSG return data type
2022-04-13 16:24:32 +05:30
Rémi Verschelde
46ef52162e Color: Rename to_srgb/to_linear to include base color space
This helps reduce confusion around sRGB <> Linear conversions by making
both input and output color spaces explicit.
2022-04-13 11:45:52 +02:00
Rémi Verschelde
8432bf18e2
Merge pull request #60097 from V-Sekai/fix_triangle_mesh_selection
Rearrange TriangleMesh function to workaround MSVC compiler bug
2022-04-13 08:27:08 +02:00
SaracenOne
8fbed3d582 Rearrange TriangleMesh stack level incrementation to fix MSVC compiler optimization bug 2022-04-13 05:48:49 +01:00
Rémi Verschelde
c3cf4d4974
Merge pull request #60078 from Pineapple/cowdata-get-data
Remove get_data() from CowData
2022-04-12 14:27:48 +02:00
bruvzg
d2ebac3a30
Remove or make private FileAccess close() methods. 2022-04-12 14:50:14 +03:00
bruvzg
4bf99f4af2 Narrow FileAccess scope to prevent deadlocks. 2022-04-12 10:54:39 +03:00
Rémi Verschelde
f62f36cd91
Merge pull request #53573 from Klowner/53568-safelist-leak-fix 2022-04-11 17:55:35 +02:00
Rémi Verschelde
df51e5fab0
Merge pull request #60046 from Zylann/print_line_function 2022-04-11 17:51:10 +02:00
bruvzg
9381acb6a4
Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
Silc 'Tokage' Renew
860fac4e6f Make blend animation to use ResetTrack as default value 2022-04-10 13:00:00 +09:00
Bartłomiej T. Listwon
6dfcfecd3d Remove get_data() from CowData 2022-04-09 21:25:31 +02:00
Marc Gilleron
cc29d39800 Changed print_line macro to a function 2022-04-09 00:45:34 +01:00
Mark Riedesel
4f3769fd75 add SafeList destructor which calls maybe_cleanup() to prevent mem leak 2022-04-08 09:50:49 -04:00
Rémi Verschelde
bf153b82c7
Merge pull request #59324 from Zylann/fix_fvec_array_binary_load
Fix loading binary resources with float=64
2022-04-08 09:06:04 +02:00
Marc Gilleron
0b108f159a Fix loading binary resources with float=64
- PackedVector2Array
- PackedVector3Array
- PackedColorArray
2022-04-08 00:29:44 +01:00
bruvzg
f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
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