Commit graph

236 commits

Author SHA1 Message Date
Aaron Franke
3ab5183ffa
[3.2] Backport core documentation changes to 3.2
Also add AABB.abs()
2020-07-21 21:22:54 -04:00
Andrea Catania
74d10e766e - 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.

(cherry picked from commit 2331300989)
2020-06-18 11:29:28 +02:00
bruvzg
c4e652a6a3 Docs: Fix order of variant constants.
(cherry picked from commit 409562558a)
2020-05-25 16:32:25 +02:00
Thakee Nathees
7cfbde19c9 Fix: can't convert Transform -> Transform2D
Fix: #38528
(cherry picked from commit e32cdbe568)
2020-05-11 11:01:13 +02:00
Pedro J. Estébanez
3bdc0913a5 Make wording of all Variant warnings consistent 2020-04-27 13:15:52 +02:00
Pedro J. Estébanez
ac8b4708a3 Fix GDNative compat breakage due to dangling Variants fix
This moves the instance id member from Variant to the ObjectRC so that Variant is still the same size as before the fix (and also regardless if debug or release build).
2020-04-27 13:07:52 +02:00
Pedro J. Estébanez
d904d05e65 Fix dangling and reassigned Variants
This commit addresses multiple issues with `Variant`s that point to an `Object`
which is later released, when it's tried to be accessed again.

Formerly, **while running on the debugger the system would check if the instance id was
still valid** to print warnings or return special values. Some cases weren't being
warned about whatsoever.

Also, a newly allocated `Object` could happen to be allocated at the same memory
address of an old one, making cases of use hard to find and having **`Variant`s pointing
to the old one magically reassigned to the new**.

This commit makes the engine realize all these situations **under debugging**
so you can detect and fix them. Running without a debugger attached will still
behave as it always did.

Also the warning messages have been extended and made clearer.

All that said, in the name of performance there's still one possible case of undefined
behavior: in multithreaded scripts there would be a race condition between a thread freeing
an `Object` and another one trying to operate on it. The latter may not realize the
`Object` has been freed soon enough. But that's a case of bad scripting that was never
supported anyway.
2020-04-23 13:51:02 +02:00
Zak Grumbles
6fa871027c Make dict erase node sequenced godotengine#37477
* Updated macro call to make the visual Dictionary Erase node sequenced.

(cherry picked from commit d648f77119)
2020-04-16 12:04:10 +02:00
Michael Alexsander
bd2a2a7e40 Turn Rect2's 'intersects_touch()' into an extra argument of 'intersects()'
(cherry picked from commit 8c8c48a7ad)
2020-03-06 23:51:26 +01:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
Aaron Franke
1b8b380993
Document that translated does not behave like rotated or scaled 2019-12-15 12:31:08 -05:00
Rémi Verschelde
9abc0ad8a5
Merge pull request #27792 from Giacom/fix_quat
Fixes being unable to use the Quat(Vector3) constructor
2019-12-11 22:04:09 +01:00
Rémi Verschelde
77816fea8b
Merge pull request #32477 from aaronfranke/equal-approx-separate
Make is_equal_approx separate and make == exact again
2019-11-07 14:54:15 +01:00
PouleyKetchoupp
475115c0c3 Added empty() function to pool array types 2019-10-31 16:27:32 +01:00
Aaron Franke
218f38c7ec
Expose is_equal_approx and restore == to be exact again
This commit changes behavior for GDScript and C#.

Also did some organizing of the order to logically group related methods, mostly for Rect2 and AABB.
2019-10-14 16:48:59 -04:00
Aaron Franke
86922ff70b
Make is_equal_approx separate for structures
This commit adds exposed behavior for C#
2019-10-14 16:46:54 -04:00
qarmin
04c6579fd7 Don't use in some functions empty PoolByteArrays 2019-10-11 11:39:40 +02:00
Rémi Verschelde
7f075e519a
Merge pull request #32741 from qarmin/fix_string_utf_ascii
Don't use to_utf8() and to_ascii() on empty String
2019-10-11 11:24:40 +02:00
qarmin
c62da553cb Don't use to_utf8() and to_ascii() on empty String 2019-10-11 09:13:30 +02:00
qarmin
684156f711 Fix decompress PoolByteArray crash 2019-10-10 17:15:10 +02:00
Andrii Doroshenko (Xrayez)
a0d00c0e99 Bind the String::humanize_size method
The method signature is also changed to use `uint64_t` instead of `size_t`
for it to be Variant-compatible.
2019-10-04 15:51:13 +03:00
Rémi Verschelde
ef2a7834c9
Merge pull request #31883 from aole/create-string-function-repeat
Create a GDScript String function repeat
2019-09-24 11:50:58 +02:00
Cameron Reikes
757c509437 Add array slice method 2019-09-14 13:08:28 -07:00
Bhupendra Aole
073f625a91 Create a GDScript String function repeat
Fixes #30610
2019-09-03 13:06:13 -04:00
Andrii Doroshenko (Xrayez)
07cff56f48 Add transform methods for PoolVector*Array
Similarly to `Vector2` and `Rect2` transforms in 2D and Vector3, Plane,
and AABB in 3D. PoolVector2Array and PoolVector3Array were the only
missing Variant types in both Transform2D and Transform respectively.
2019-08-29 14:47:33 +03:00
Rémi Verschelde
51d50e167d
Merge pull request #31094 from aaronfranke/vector-sign-mod-etc
Add Vector2/3 sign and posmod functions, axis, docs, misc additions
2019-08-23 09:07:47 +02:00
Rémi Verschelde
7402fd2c56 Revert "Feature: Add SHA256 for PoolByteArray"
This reverts commit e2c3bbabb0.

This was superseded by #29871 which adds more crypto features with a
dedicated interface.

Since this commit was never in a stable release (merged during 3.2 dev),
we revert it to avoid having to deprecate it in favor of the Crypto API.
See https://github.com/godotengine/godot/pull/31187#issuecomment-523377965
2019-08-22 13:44:57 +02:00
Fabio Alessandrelli
3495d1bfa0 Add hex_encode function to PoolByteArray 2019-08-21 16:59:38 +02:00
Fabio Alessandrelli
c19871af6d Move CryptoCore to it's own folder.
Crypto classes will be placed in core/crypto.
2019-08-19 16:31:05 +02:00
Aaron Franke
092346d82b
Add Vector2/3 sign and posmod functions, misc additions
Also make the docs more consistent, add Axis enum to Vector2, add > and >=. and C# also gets % and an override for vector-vector mod.
2019-08-17 18:31:55 -04:00
Braden Bodily
71d71d55b5 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'core/' and 'editor/'
Condensed some if and ERR statements. Added dots to end of error messages

Couldn't figure out EXPLAINC. These files gave me trouble: core/error_macros.h, core/io/file_access_buffered_fa.h (where is it?),
core/os/memory.cpp,
drivers/png/png_driver_common.cpp,
drivers/xaudio2/audio_driver_xaudio2.cpp (where is it?)
2019-08-17 12:33:15 +02:00
Aaron Franke
85f13a0d24
Add Basis constants and format Transform constants 2019-08-09 11:34:54 -07:00
Aaron Franke
7dbbb5eac7
[Mono] Deprecate Set methods
These silently fail, so they should be removed. I accidentally added most of these last year, trying to make everything else consistent with Quat, sorry!

Also, a few tiny nitpicking changes are included, like whitespace and misspellings.
2019-07-28 17:49:22 -04:00
Chaosus
080c0bb7fe Added count method to String 2019-07-23 18:55:54 +03:00
qarmin
6cbaf7662f Changed some code showed in LGTM and Coverage 2019-07-20 08:09:57 +02:00
Ibrahn Sahir
4e4697b1c4 Added release function to PoolVector::Access.
For clarity, assign-to-release idiom for PoolVector::Read/Write
replaced with a function call.
Existing uses replaced (or removed if already handled by scope)
2019-07-06 12:04:27 +01:00
Fabio Alessandrelli
6c512e21a9 Add sha1 functions to string (using new CryptoCore) 2019-07-03 18:42:46 +02:00
Fabio Alessandrelli
564d93ff10 CryptoCore class to access to base crypto utils.
Godot core needs MD5/SHA256/AES/Base64 which used to be provided by
separate libraries.
Since we bundle mbedtls in most cases, and we can easily only include
the needed sources if we so desire, let's use it.

To simplify library changes in the future, and better isolate header
dependencies all functions have been wrapped around inside a class in
`core/math/crypto_base.h`.

If the mbedtls module is disabled, we only bundle the needed source
files independently of the `builtin_mbedtls` option.
If the module is enabled, the `builtin_mbedtls` option works as usual.

Also remove some unused headers from StreamPeerMbedTLS which were
causing build issues.
2019-07-02 12:36:27 +02:00
Rémi Verschelde
2b52cd3e5c
Merge pull request #28648 from KoBeWi/substr-1
Make second parameter of substr optional
2019-06-19 12:43:46 +02:00
Rémi Verschelde
22afebcad7
Merge pull request #29598 from GodotExplorer/uri-encode
Expose String.http_escape and String.http_unescape
2019-06-19 10:47:34 +02:00
Zak
1a397f46e6 Improved documentation of rsplit Method for String class.
Improved documentation of rsplit Method for String class.

Removed "divisor" (i will also change variants_call.cpp) and added "delimiter" in its place. Also moved the example at the bottom of the description.
2019-06-11 13:39:18 +03:00
geequlim
ae839bd0d8 Expose String.http_escape and String.http_unescape 2019-06-08 16:33:12 +08:00
Rémi Verschelde
3c4fab295b
Merge pull request #27789 from Giacom/move_towards
Added move_toward functions for float, Vector2 and Vector3
2019-06-01 12:05:18 +02:00
Rémi Verschelde
af2c742f53 Fix and expose String::strip_escapes(), use it in LineEdit paste
Supersedes #27736.
2019-05-31 15:49:14 +02:00
Giacom
c00427add3 Added move_toward functions for float, Vector2 and Vector3 2019-05-28 11:39:35 +01:00
Tomasz Chabora
0b8a785539 Make second parameter of substr optional 2019-05-03 19:46:56 +02:00
Hein-Pieter van Braam
f2d3d3e679
Merge pull request #24269 from xsellier/feature/master-add-sha256
Add SHA256 for PoolByteArray
2019-04-23 06:38:03 +03:00
Juan Linietsky
a20235aeb0 Add ability to edit editor feature profiles
Allows enabling/disabling parts of the editor and storing/loading profiles for that.
2019-04-08 19:18:51 -03:00
Rémi Verschelde
7f3373d79f
Merge pull request #27452 from Chaosus/direction_to
Added method to retrieve a direction vector from one point to another
2019-04-08 12:00:54 +02:00
Giacom
c2e63fd27a Fixes being unable to use the Quat(Vector3) constructor
The Quat(Vector3) constructor, to initialise a Quat by a euler angle,
was impossible because Variant::construct would only check for
constructors with greater than 1 arguments. I changed it to greater than
or equal to 1 and moved it to the bottom of the priority list so it did
not overshadow the other checks that checked for arguments equal to 1
for simple copy constructors.
2019-04-08 02:52:21 +01:00