Commit graph

255 commits

Author SHA1 Message Date
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
Yuri Roubinsky
d7cf1b5c73 Fix docs generation for Vector2i/Vector3i/Rect2i 2020-06-03 15:22:26 +03:00
bruvzg
409562558a
Docs: Fix order of variant constants. 2020-05-20 16:45:42 +03: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
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
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
69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02: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
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
Thakee Nathees
e32cdbe568 Fix: can't convert Transform -> Transform2D
Fix: #38528
2020-05-07 21:40:53 +05:30
Aaron Franke
90df1d67cb
Color with alpha constructor 2020-04-29 14:41:12 -04:00
Aaron Franke
540156b387
[Core] Rename linear_interpolate to lerp 2020-04-29 04:02:49 -04:00
Aaron Franke
72ecd36cb3
Print errors when passing an invalid type to xform 2020-04-28 14:24:16 -04:00
lupoDharkael
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Zak Grumbles
d648f77119
Make dict erase node sequenced godotengine#37477
* Updated macro call to make the visual Dictionary Erase node sequenced.
2020-04-01 22:10:12 -05:00
Rémi Verschelde
56175bb6fa
Merge pull request #36896 from kuruk-mm/doc_return_variant_2
Doctool and core: Fix return type in docs for some Variant methods...
2020-03-16 19:55:07 +01:00
Mateo Miccino
64cd5d197d Doctool and core: Fix return type in docs for some Variant methods assigning PROPERTY_USAGE_NIL_IS_VARIANT to MethodInfo usage when we have something to return 2020-03-09 13:36:03 -03:00
Fabio Alessandrelli
b8ddaf9c33 Refactor ScriptDebugger.
EngineDebugger is the new interface to access the debugger.
It tries to be as agnostic as possible on the data that various
subsystems can expose.

It allows 2 types of interactions:

- Profilers:
  A subsystem can register a profiler, assigning it a unique name.
  That name can be used to activate the profiler or add data to it.
  The registered profiler can be composed of up to 3 functions:
    - Toggle: called when the profiler is activated/deactivated.
    - Add: called whenever data is added to the debugger
      (via `EngineDebugger::profiler_add_frame_data`)
    - Tick: called every frame (during idle), receives frame times.

- Captures: (Only relevant in remote debugger for now)
  A subsystem can register a capture, assigning it a unique name.
  When receiving a message, the remote debugger will check if it starts
  with `[prefix]:` and call the associated capture with name `prefix`.

Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new
profiler system.

Port SceneDebugger and RemoteDebugger to the new capture system.
The LocalDebugger also uses the new profiler system for scripts
profiling.
2020-03-08 12:36:39 +01:00
Michael Alexsander
8c8c48a7ad Turn Rect2's 'intersects_touch()' into an extra argument of 'intersects()' 2020-03-04 09:32:34 -03:00
Rémi Verschelde
6c8f2ae53a Update docs and bindings for new integer vector types 2020-02-25 15:27:29 +01:00
Juan Linietsky
33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
Juan Linietsky
88f84c78ca Store arrays inside of Variant as shared.
Arrays inside of Variant are unique and use reference counting.
When you assign a variant containing a packed array to another, or
when you call non const functions to arrays, this will work even
if the array is inside a dictionary, so they will from now pass
as reference.

The difference with regular variant arrays is that, once passed
to a function in the C++ API, they are no longer shared. This is
required for security and thread safety, as those arrays are
mainly used to pass data back and forth even between threads.
2020-02-23 22:42:26 +01:00
Juan Linietsky
6da0eef9e6 Add support for Vector2i, Rect2i and Vector3i to Variant
WARNING: Requires C++17 'guaranteed copy elision' to fix ambiguous
operator problems in Variant.

This was added for this commit (and future C++17 uses) in #36457.
2020-02-22 23:16:44 +01:00
Juan Linietsky
3c0059650d Added StringName as a variant type.
Also changed all relevant properties defined manually to StringName.
2020-02-21 14:25:29 +01:00
Juan Linietsky
69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Juan Linietsky
3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Juan Linietsky
867d073b98 Changed logic and optimized ObjectID in ObjectDB and Variant, removed RefPtr. 2020-02-15 08:36:04 -03:00
Hanif Bin Ariffin
7bc1dc828f Remove deprecated Color::gray
It was marked to be removed in Godot 3.1.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2020-02-12 11:22:33 +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