Commit graph

3358 commits

Author SHA1 Message Date
Rémi Verschelde 850134aff9
Merge pull request #39617 from mrushyendra/bilinear_interpolation
Fix upscaling image with bilinear interpolation option specified
2020-06-24 21:58:43 +02:00
Rémi Verschelde 42c4a701dd
Merge pull request #39755 from Faless/crypto/encryption_pr_4.0
Crypto enhancements, AESContext, RSA public key, signature, verification.
2020-06-22 23:31:58 +02:00
Rémi Verschelde 35414f1dec
Merge pull request #39053 from timoschwarzer/static-assert-variant-arg-max
Add static_assert checks where code assumes VARIANT_ARG_MAX == 5
2020-06-19 23:51:22 +02:00
Andy Maloney 37a2a5a997 Ensure FileAccessBuffered structs are properly initialized 2020-06-19 11:36:28 -04:00
Maganty Rushyendra f24ec3878e Fix upscaling image with bilinear interpolation option specified
Fix error in calculation of 4 nearest points in source image when
resizing image with bilinear interpolation.
2020-06-19 09:38:42 +08:00
Fabio Alessandrelli 8e3f9aa681 Implement RSA encryption/decryption. 2020-06-18 15:29:39 +02:00
Fabio Alessandrelli dfcc11fa52 Implement sign and verify in crypto. 2020-06-18 15:29:39 +02:00
Fabio Alessandrelli 788f18086e CryptoKey supports public keys. 2020-06-18 15:29:39 +02:00
Fabio Alessandrelli 9a462e07a4 Add AESContext.
GDScript interface to CryptoCore::AESContext.
Also add CBC mode in CryptoCore::AESContext and expose it.
2020-06-18 15:26:24 +02:00
Aaron Franke 0fa478a050
Simplify Transform2D get_rotation 2020-06-17 01:00:42 -04:00
Rémi Verschelde 309adb93cd
Merge pull request #39484 from hbina/use_nullptr_in_macros
Check pointers against nullptr.
2020-06-16 10:42:56 +02:00
Rémi Verschelde 4b5b60de85
Merge pull request #39189 from touilleMan/issue-38925
Unify OS.get_system_time_* and OS.get_unix_time
2020-06-15 23:57:16 +02:00
Hanif Bin Ariffin 4fea536517 Check pointers against nullptr. 2020-06-15 16:20:36 -04:00
Rémi Verschelde 6f938c761e
Merge pull request #39483 from AndreaCatania/euler
Added more euler rotation orders support.
2020-06-15 20:38:11 +02:00
Rémi Verschelde f61e4216b7
Merge pull request #39439 from Lefl1/rename_get_action_list
Renamed InputMap.get_action_list to InputMap.action_get_events
2020-06-15 19:59:07 +02:00
Lennard f515071edc Renamed InputMap.get_action_list to InputMap.get_action_events 2020-06-15 14:01:53 +02:00
Andrea Catania 2331300989 - Added more euler rotation orders support.
- Fixed floating point issue on the old one.
- Fixed the equation on the get_euler_yxz function.
- Added unit tests.

This work has been kindly sponsored by IMVU.
2020-06-12 20:03:27 +02:00
Rémi Verschelde b3bc5aafc5 Object: Add usage hint to instantiate Object properties in editor
Fixes #36372 as Path2D/Path3D's `curve` property no longer uses a Curve
instance as default value, but instead it gets a (unique) default Curve
instance when created through the editor (CreateDialog).

ClassDB gets a sanity check to ensure that we don't do the same mistake
for other properties in the future, but instead use the dedicated
property usage hint.

Fixes #36372.
Fixes #36650.

Supersedes #36644 and #36656.

Co-authored-by: Thakee Nathees <thakeenathees@gmail.com>
Co-authored-by: simpuid <utkarsh.email@yahoo.com>
2020-06-12 14:30:18 +02:00
Rémi Verschelde cbcc0eacd5 String: Use ABS macro in padding code
Follow-up to #39261.
2020-06-11 11:39:21 +02:00
Rémi Verschelde 7217a7edbd
Merge pull request #39230 from ntfshard/expression_string_singlequote
Fix for Expression class: string inside an expression can't be single quoted
2020-06-11 09:37:35 +02:00
Rémi Verschelde 786fc63faa
Merge pull request #39261 from mrushyendra/string_padding
Enable zero padding with float specifier for format strings
2020-06-11 09:37:16 +02:00
Pedro J. Estébanez 4e4b1d7568 Fix potential crash when listing leaked objects
Note:
Casting to the C++ classes and calling the methods there would work as well,
but would require including he header files for the specific object types handled
here, which wouldn't be OK either.
2020-06-10 20:44:11 +02:00
Rémi Verschelde 47f1faf512
Merge pull request #39409 from akien-mga/astar-get_closest_point-deterministic
AStar: Make get_closest_point() deterministic for equidistant points
2020-06-10 10:46:35 +02:00
Rémi Verschelde 187ba4c5a8 AStar: Make get_closest_point() deterministic for equidistant points
Closes godotengine/godot-docs#3667.
Supersedes #39405.
2020-06-09 11:04:12 +02:00
Rémi Verschelde 2b5545270a Core: Add hints to run with --verbose when leaking nodes/resources at exit 2020-06-08 16:48:21 +02:00
Rémi Verschelde e7ebda975a VariantParser: Fix crash on malformed vectors
Each time `r_err_str` is set, we should return a parse error.

Removed redundant `return OK;` which were already handled after the big
`if`/`else if`/`else` for `TK_IDENTIFIER`.

Part of #17372.
2020-06-08 11:38:13 +02:00
Rémi Verschelde ec1bf96e41
Merge pull request #39200 from azagaya/fix-blend-2
Fixing wrong blending rect methods
2020-06-07 15:52:22 +02:00
Fabio Alessandrelli 87cc283b8b Crypto as a custom instance class. 2020-06-06 17:33:44 +02:00
Fabio Alessandrelli 054f52364f Fix editor crash when mbedtls is disabled. 2020-06-06 17:33:43 +02:00
Rémi Verschelde 50cb781b1b
Merge pull request #39316 from Anutrix/remove-hashmap-reduntant-func
Remove unused function get_key_value_ptr_array from hash_map.h and another tiny fix.
2020-06-05 11:53:54 +02:00
unknown c9edc82b3b Remove unused function get_key_value_ptr_array from hash_map.h and also fix parameter name in function get_key_list. 2020-06-05 13:13:42 +05:30
Rémi Verschelde 938334cc9e Sync controller mappings DB with SDL2 community repo
Synced with gabomdq/SDL_GameControllerDB@6191f6333b.
2020-06-04 15:52:27 +02:00
Maganty Rushyendra b7d835d9ca Enable zero padding with float specifier for format strings
Godot currently supports zero padding for integers, octals and
hexadecimals when using format strings, but not for floats.

This commit adds support for zero padding for floats, thus ensuring
consistent behavior for all types, and making Godot's format specifiers'
behavior closer to c's `printf()`.

Before: `print("<%07.2f>" % -0.2345)` prints `<  -0.23>`.
Now: `print("<%07.2f>" % -0.2345)` prints `<-000.23>`.
     `print("<%7.2f>" % -0.2345)` prints `<  -0.23>`.
2020-06-03 21:21:27 +08:00
Yuri Roubinsky d7cf1b5c73 Fix docs generation for Vector2i/Vector3i/Rect2i 2020-06-03 15:22:26 +03:00
Aaron Franke 25c978730b
Rename String bin_to_int64 to bin_to_int
And also change String static to_int(const char *) to return int64_t
2020-06-03 00:04:15 -04:00
Aaron Franke e5ae89775a
Remove 32-bit String hex_to_int method 2020-06-03 00:03:34 -04:00
Aaron Franke bb8aa107fd
Remove 32-bit String to_int method 2020-06-03 00:03:34 -04:00
ntfs.hard ec164b2301 Fix for Expression class: inner string can be single quoted 2020-06-02 13:44:53 +03:00
Hugo Locurcio 9c0d214776
Print errors when calling MIDI input methods on unsupported platforms
This partially addresses #32065.
2020-05-31 19:10:27 +02:00
azagaya b211a86ebe Fixing wrong blending rect methods
Using Color.blend function instead of custom code

Fixed clang_format

Removed unnecessary help
2020-05-31 14:06:53 -03:00
Emmanuel Leblond c6de3872f9
Remove OS.get_system_time_secs/get_system_time_msecs and change OS.get_unix_time return type to double 2020-05-31 14:19:31 +02:00
Rémi Verschelde 1620669f4e
Merge pull request #39051 from Xrayez/geometry-split
Split `Geometry` singleton into `Geometry2D` and `Geometry3D`
2020-05-29 12:10:37 +02:00
Rémi Verschelde a16031beb6 Use translated docs in PropertySelector
And do the dedent and stripping for both translated and
non-translated strings for consistency, and so that we
don't need to do it at the call site.
2020-05-28 12:02:12 +02:00
Maganty Rushyendra 4ef246f804 Fix unsigned integer bug in LocalVector::erase
`erase()` calls `find()` to get the index of the element to remove, if
any.

c2151e1813/core/local_vector.h (L77-L81)

`find()` returns a signed integer. In particular, it returns -1 if
no element is found. Since `erase()` converts this to an unsigned type, the
wrong element may be erroneously removed from the vector.

Other ways to fix this would involve changing function signatures, so
this seemed to be the least disruptive change.

Fixes #38884
2020-05-27 21:53:34 +08:00
Andrii Doroshenko (Xrayez) 69d5de632e Split Geometry singleton into Geometry2D and Geometry3D
Extra `_2d` suffixes are removed from 2D methods accoringly.
2020-05-27 14:28:34 +03:00
Timo Schwarzer 05b32fc01d
Add static_assert checks where code assumes VARIANT_ARG_MAX == 5 2020-05-25 21:55:03 +02:00
Rémi Verschelde 0183bfbb0f Improve documentation of ProjectSettings::setup
Subsequent PRs adding and fixing support for bundled PCKs
did not update the documentation /o\
2020-05-25 17:50:36 +02:00
Rémi Verschelde a55a97119b
Merge pull request #38887 from AndreaCatania/oahash_imp
OAHashMap crash fix and copy feature.
2020-05-25 11:55:06 +02:00
Andrea Catania 094a05d44e - Make sure it's impossible to initialize an OAHashMap with 0 capacity (would cause division by 0)
- Added possibility to copy an OAHashMap
- Added unit tests

This code is generously donated by IMVU.
2020-05-25 11:18:02 +02:00
Rémi Verschelde 57d21ebeda
Merge pull request #38396 from nekomatata/unexpose-sort-children
Fix Container sorting not working when overriding _sort_children in gdscript
2020-05-23 20:22:44 +02:00
Rémi Verschelde a891c71426
Merge pull request #38886 from Xrayez/save-png-to-buffer-bind
Expose `Image.save_png_to_buffer` method
2020-05-22 09:48:23 +02:00
Paul Herman 7d4b3e6587 Expose loading TGA images in Image. 2020-05-21 16:02:53 +02:00
bruvzg 409562558a
Docs: Fix order of variant constants. 2020-05-20 16:45:42 +03:00
Andrii Doroshenko (Xrayez) d4d4229d9d Expose Image.save_png_to_buffer method 2020-05-20 14:43:24 +03:00
bruvzg d0b5174b6a
[Windows] Add tablet driver selection. 2020-05-20 09:37:32 +03:00
Rémi Verschelde 85220fec01 Style: Remove unnecessary semicolons from core
Semicolons are not necessary after function definitions or control flow
blocks, and having some code use them makes things inconsistent (and
occasionally can mess up `clang-format`'s formatting).

Removing them is tedious work though, I had to do this manually (regex
+ manual review) as I couldn't find a tool for that. All other code
folders would need to get the same treatment.
2020-05-19 15:57:56 +02:00
Rémi Verschelde ca3192d18a Style: Fix unnecessary semicolons that confused clang-format 2020-05-19 11:24:58 +02:00
Rémi Verschelde 36ba9fabde
Merge pull request #38567 from AndreaCatania/AndreaCatania-patch-3
Removed const from OAHashMap iterator value
2020-05-19 10:26:05 +02:00
Pedro J. Estébanez b720a01849 Fix leaks and crashes in OAHashMap
This changes the way the lifespan of items is managed to be consistent.

Bonus: Simplify cases of destroy-then-emplace.
2020-05-18 14:02:52 +02:00
PouleyKetchoupp 3ad694018f Fix Container sorting not working when overriding _sort_children in gdscript
Remove _sort_children from script bindings:
_sort_children is an internal method which shouldn't be exposed to scripts.

Added support for non-bound methods in MessageQueue:
So we can use deferred calls without exposing internal methods to scripts.

Added debug checks in CallableCustomMethodPointer:
Adding method pointer callables to the message queue was causing crashes
in case an object was destroyed and the same memory was allocated for
another one. The new object had a valid object id but the call was erroneous.
Release will be fixed later, along with Variant which has the same problem and
is also fixed for debug only.
2020-05-16 18:13:25 +02:00
Hugo Locurcio d935a4348d
Remove HQ2X and the Image.expand_2x_hq2x() method
As of Godot 3.0, HQ2X is no longer used to upscale the editor theme
and icons on hiDPI displays, which limited its effective uses.
HQ2X was also used to upscale the project theme when the "Use Hidpi"
project setting was enabled, but results were often less than ideal.
The new StyleBoxFlat and SVG support also make HQ2X less important
to have as a core feature.

This decreases binary sizes slightly (-150 KB on most platforms,
-212 KB on WebAssembly release).

This partially addresses #12419.
2020-05-16 16:10:50 +02:00
Rémi Verschelde 5b53f22774
Merge pull request #38760 from akien-mga/error-macros-style
Error macros: Improve style of error messages
2020-05-15 22:04:52 +02:00
Rémi Verschelde 0ed7d3a40a Error macros: Improve style of error messages
Document why the `if (1) {} else ((void)0)` construct is used.
2020-05-15 18:21:14 +02:00
Rémi Verschelde f06c44a02c
Merge pull request #38717 from madmiraal/fix-image-uninitialized-warning
Silence 'w' may be used uninitialized in image.cpp warning.
2020-05-15 18:05:53 +02:00
Rémi Verschelde 0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde 07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde 710b34b702 Style: Fix missing/invalid copyright headers 2020-05-14 16:54:54 +02:00
Marcel Admiraal 6c4c1bf53d Silence 'w' may be used uninitialized in image.cpp warning.
Rename `w` to the more meaningful `data_write`
2020-05-14 15:24:17 +01:00
Rémi Verschelde dcd1151d77 Enforce use of bool literals instead of integers
Using clang-tidy's `modernize-use-bool-literals`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde 1a8167867b Modernize remaining uses of 0/NULL instead of nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2020-05-14 13:45:01 +02:00
Rémi Verschelde 1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00
Marcel Admiraal e0d4e840b4 Implement half axis and inverted axis mapping. 2020-05-13 10:33:32 +01:00
Marcel Admiraal e7fee711b3 Update game controller enums. 2020-05-13 10:33:32 +01:00
Marcel Admiraal 1176e078b9 Parse SDL game controller half axis and inverted axis entries. 2020-05-13 10:33:19 +01:00
Fabio Alessandrelli ed225faf31 Add support for multiple RemoteDebuggerPeer(s).
It is now possible to register protocol handlers (default tcp://) to
support additional debugging communication layers (e.g. websocket).
2020-05-12 15:09:13 +02:00
Hugo Locurcio c6fbbdf15d Rename SSL certificate bundle setting to clarify the "overriding" aspect
This closes https://github.com/godotengine/godot-docs/issues/2531.
2020-05-12 10:13:27 +02:00
Rémi Verschelde 83b630b8c2 thirdparty: Cleanup after #38386, document provenance and copyright
Also renamed `delaunay.h` to `delaunay_2d.h` to match the class name.
2020-05-11 14:50:06 +02:00
Rémi Verschelde 32133a11b5
Merge pull request #38386 from reduz/new-lightmapper
New GPU lightmapper
2020-05-11 13:45:48 +02:00
Rémi Verschelde 1c61b31109 Input: Readd 'Default Android Gamepad' magic binding
Removed by mistake in #38292 like the Windows `__XINPUT_DEVICE__`,
this magic binding is referenced directly in our code.
2020-05-11 11:07:04 +02:00
Juan Linietsky 1bea8e1eac New lightmapper
-Added LocalVector (needed it)
-Added stb_rect_pack (It's pretty cool, we could probably use it for other stuff too)
-Fixes and changes all around the place
-Added library for 128 bits fixed point (required for Delaunay3D)
2020-05-10 15:59:09 -03:00
Rémi Verschelde 6a0473bcc2
Merge pull request #38548 from kuruk-mm/add_string_join_to_gdscript
GDScript: Add join method on String
2020-05-10 16:54:45 +02:00
Rémi Verschelde 94721f5ab8 Revert "Renamed plane's d to distance"
This reverts commit ec7b481170.

This was wrong, `d` is not a distance but the `d` constant in the
parametric equation `ax + by + cz = d` describing the plane.
2020-05-10 16:47:11 +02:00
Rémi Verschelde 69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Rémi Verschelde e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Rémi Verschelde 03b13e0c69 Style: Add missing copyright headers 2020-05-10 13:12:16 +02:00
Rémi Verschelde a128dd97d6
Merge pull request #37020 from aaronfranke/range
Allow using integer vectors for iteration and make range() use them
2020-05-10 13:11:07 +02:00
Marcus Elg ec7b481170 Renamed plane's d to distance 2020-05-10 12:12:51 +02:00
Rémi Verschelde a4b829410c
Merge pull request #38481 from RandomShaper/improve_yield
Fix object leaks caused by unfulfilled yields
2020-05-09 22:02:52 +02:00
Aaron Franke 38a0ff2249
Allow Vector2/Vector3 iterators to have non-integer values 2020-05-09 13:43:35 -04:00
Aaron Franke f7b50992b5
Allow using integer vectors for iteration and make range() use them 2020-05-09 13:43:35 -04:00
Mateo Kuruk Miccino 8c2dc177b6 GDScript: Add join method on String
Docs: Add join on String.xml
2020-05-09 12:16:21 -03:00
Andrea Catania 97f9bbcfa3
Removed const from OAHashMap iterator value
to allows to mutate the value while iterating over it.
2020-05-08 14:21:46 +02:00
hoontee 9aa29b85a8
Re-add __XINPUT_DEVICE__
Required for `JoypadWindows::probe_joypads`.
Partially reverts 510e83498e. Fixes #38554.
2020-05-07 22:19:42 -05:00
Rémi Verschelde ae33cf5f45
Merge pull request #36379 from aaronfranke/color-constructors
Add a Color constructor for Color with alpha
2020-05-07 21:16:51 +02:00
Rémi Verschelde bd75e2538b
Merge pull request #38536 from ThakeeNathees/trnasform-2-transform2d-convert-fix
Fix: can't convert Transform -> Transform2D
2020-05-07 20:56:50 +02:00
Thakee Nathees e32cdbe568 Fix: can't convert Transform -> Transform2D
Fix: #38528
2020-05-07 21:40:53 +05:30
Rémi Verschelde 77e19d116e
Merge pull request #38522 from ThakeeNathees/printing-empty-string-fix
Fix: printing empty string does nothing in editor output pannel
2020-05-07 18:05:36 +02:00
Thakee Nathees 5640cad1e1 Fix: printing empty string does nothing in editor output pannel
Fix: #38490
2020-05-07 05:56:29 +05:30
Rémi Verschelde 33d0b9e169
Merge pull request #38393 from nekomatata/printerr-remote-debugger-4.0
Format remote printerr properly in script debugger output
2020-05-06 07:31:57 +02:00