Commit graph

328 commits

Author SHA1 Message Date
Silc 'Tokage' Renew
865da09871 Implement cubic_interpolate() as MathFunc for refactoring 2022-02-12 18:11:17 +09:00
Hendrik Brucker
b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +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
Rémi Verschelde
f425d403fe
Merge pull request #57066 from KoBeWi/in_the_name_of_the_custom 2022-02-08 11:15:01 +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
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
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
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
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
bruvzg
ddd96b3059
[GDExtension] Fix registration of functions with enum or native pointer return type. 2022-02-03 16:03:23 +02: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
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
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
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
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
Pedro J. Estébanez
7b0ed2aa5e Rename Variant::is_ref() to is_ref_counted() 2022-01-20 18:46:25 +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
9912492e93
Merge pull request #56668 from akien-mga/array-slice-nicer-bound-checks 2022-01-18 13:22:35 +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
c6cefb1b79
Array: Relax slice bound checks to properly handle negative indices
The same is done for `Vector` (and thus `Packed*Array`).

`begin` and `end` can now take any value and will be clamped to
`[-size(), size()]`. Negative values are a shorthand for indexing the array
from the last element upward.

`end` is given a default `INT_MAX` value (which will be clamped to `size()`)
so that the `end` parameter can be omitted to go from `begin` to the max size
of the array.

This makes `slice` works similarly to numpy's and JavaScript's.
2022-01-10 22:42:03 +01:00
Aaron Franke
2c52f16464
Add length and length_squared to Vector2i/3i 2022-01-06 10:06:56 -08:00
Rémi Verschelde
6af77c7b09
Merge pull request #53684 from TokageItLab/orthogonal-mode 2022-01-05 16:05:40 +01:00
Rémi Verschelde
42312f066b
Merge pull request #53313 from KoBeWi/debinded_konnekt 2022-01-04 12:22:46 +01:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
cdemirer
e2ed9d13eb Fix Array and Dictionary id() and dictionary test bug 2021-12-30 13:14:09 +08:00
Silc 'Tokage' Renew
61759da5b3 Fix some gizmo behavior to make more consistent 2021-12-25 03:24:04 +09:00
Haoyu Qiu
1fb59d13c2 Fix font preview text color on light background 2021-12-18 00:34:28 +08:00
Haoyu Qiu
e4e4e475f8 Make --doctool locale aware
* Adds `indent(str)` to `String`:
    * Indent the (multiline) string with the given indentation.
    * This method is added in order to keep the translated XML correctly
      indented.
* Moves the loading of tool/doc translation into
  `editor/editor_translation.{h,cpp}`.
    * This will be used from both `EditorSettings` and the doc tool from
      `main`.
* Makes use of doc translation when generating XML class references, and
  setup the translation locale based on `-l LOCALE` CLI parameter.

The XML class reference won't be translated if `-l LOCALE` parameter is
not given, or when it's `-l en`.
2021-12-16 17:49:22 +08:00
Nathan Franke
49403cbfa0
Replace String comparisons with "", String() to is_empty()
Also:
- Adds two stress tests to test_string.h
- Changes to .empty() on std::strings
2021-12-09 04:48:38 -06:00
Nathan Franke
41a20171eb
align to horizontal_alignment, valign to vertical_alignment, related 2021-12-09 01:38:46 -06:00
Rémi Verschelde
46d384060e
Merge pull request #35901 from nathanfranke/pool-byte-array-subarray-exclusive 2021-12-07 14:00:59 +01:00
Aaron Franke
24f57886d0
Expose max_axis_index and max_axis_index for Vector2(i)
Some cleanup with Vector3(i)'s methods so that it is consistent with Vector2, for example it returns enums internally (GDScript still gets ints).
2021-12-02 23:45:41 -06:00
Raul Santos
a367378f9e Rename Vector parameters to be consistent
Renames parameters that were named differently across different
scripting languages or their documentation to use the same name
everywhere.
2021-12-01 21:14:46 +01:00
Nathan Franke
dd30253cdc
PackedByteArray, Array slice end exclusive, rename subarray to slice 2021-11-26 22:13:12 -06:00
Lightning_A
e078f970db Rename remove() to remove_at() when removing by index 2021-11-23 18:58:57 -07:00
Yuri Roubinsky
a74acca858 Expose randfn to global scope 2021-11-17 14:29:19 +03:00
Hugo Locurcio
8fb7e622a6
Rename built-in SGN() macro to SIGN()
This matches the name of the GDScript function (except it's uppercase
here).
2021-11-16 20:40:49 +01:00
Aaron Franke
3c0fdcc8ac
Use "enum class" for input enums 2021-11-12 15:37:54 -06:00
Rémi Verschelde
1aa3c8419b
Merge pull request #54869 from akien-mga/string-remove-erase 2021-11-11 13:00:21 +01:00
Rémi Verschelde
e2e9b08cc7
Color: Bind from_hsv as static method 2021-11-11 11:50:02 +01:00
Rémi Verschelde
2beaae4b6f
String: Remove erase method, bindings can't mutate String 2021-11-11 11:23:32 +01:00
Rémi Verschelde
06a33e590f
Merge pull request #53819 from TokageItLab/re-implement-ping-pong
Reimplement ping-pong animation and reverse playback
2021-11-09 22:11:04 +01:00
Rémi Verschelde
63559f2c80
Merge pull request #54186 from miraz12/fix-packedByteArray-memcpy-crash 2021-11-08 13:33:07 +01:00
Brian Semrau
dc11e73bf0 Rename AABB get_area to get_volume 2021-11-05 18:22:42 -04:00
Silc 'Tokage' Renew
953a7bce7e reimplement ping-pong 2021-11-03 13:39:33 +09:00
Rémi Verschelde
ab6ec9310c
Merge pull request #54453 from KoBeWi/slice_of_string 2021-11-02 13:18:34 +01:00
kobewi
e5725c7deb Expose String.get_slice 2021-11-02 11:24:07 +01:00
Emmanuel Leblond
f9ba2efe1e
Modify Dictionary::operator== to do real key/value comparison with recursive support (and add unittests) 2021-10-30 13:11:01 +02:00
Rémi Verschelde
3b11e33a09
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 15:19:35 +02:00
Anton Christoffersson
9ed8417271 Fixed crash in variant_call when trying to memcpy 0 bytes. 2021-10-27 19:01:33 +02:00
reduz
d03b7fbe09 Refactored Node3D rotation modes
* Made the Basis euler orders indexed via enum.
* Node3D has a new rotation_order property to choose Euler rotation order.
* Node3D has also a rotation_mode property to choose between Euler, Quaternion and Basis

Exposing these modes as well as the order makes Godot a lot friendlier for animators, which can choose the best way to interpolate rotations.
The new *Basis* mode makes the (exposed) transform property obsolete, so it was removed (can still be accessed by code of course).
2021-10-25 14:34:00 -03:00
reduz
a69541da4c Implement Animation Compression
Roughly based on https://github.com/godotengine/godot-proposals/issues/3375 (used format is slightly different).

* Implement bitwidth based animation compression (see animation.h for format).
* Can compress imported animations up to 10 times.
* Compression format opens the door to streaming.
* Works transparently (happens all inside animation.h)
2021-10-21 18:27:34 -03:00
mennomax
b4eeeb315a
Swap args of Plane(point, normal) constructor
Now (normal, point)
2021-10-15 20:49:42 -05:00
George Marques
4c14051b3f
Zero Dictionary and Array variants when changing type with reset
So they don't reference to the old values anymore and instead refer to
a new value.
2021-10-14 11:22:17 -03:00
Juan Linietsky
610de0974d
Revert "Implement reverse playback and ping-pong loop in AnimationPlayer and NodeAnimation" 2021-10-11 19:27:50 -03:00
Rémi Verschelde
9ed4f8367b
Merge pull request #48332 from TokageItLab/implement-ping-pong 2021-10-11 22:55:01 +02:00
Yuri Roubinsky
e270d1cce3 Fix autocompletion of built-in functions in GDScript 2021-10-11 19:06:17 +03:00
Tokage
372ba76663 implement ping-pong loop in animation
Co-authored-by: Chaosus <chaosus89@gmail.com>
2021-10-09 18:08:43 +09:00
mashumafi
575d4e00b6 Enhance and cleanup stringify for Vector 2021-10-09 06:19:25 +00:00
Bartłomiej T. Listwon
4a723842b6 Faster hash_compare for integer and string keys in dictionaries 2021-10-08 10:09:13 +02:00
Rémi Verschelde
49e7e049ab
Merge pull request #53422 from KoBeWi/add_LUA_to_Godot 2021-10-07 23:37:37 +02:00
Rémi Verschelde
6090f90743
Merge pull request #53545 from vnen/gdscript-release 2021-10-07 23:28:34 +02:00
George Marques
fafa8c7f6e
Enable method type information on release builds
This is needed to ensure GDScript compilation works properly on release
builds and make use of optimized typed instructions.
2021-10-07 16:13:44 -03:00
George Marques
13a2d03dde
Add Variant in operator for any String/StringName operands
Allow using String or StringName types as operand in any position of the
`in` operator, which is more convenient in scripting when interacting
with data in the engine (such as a Node name).
2021-10-06 22:07:32 -03:00
Thakee Nathees
3f3ed5d34c NaN, INF read/write bug fixed
Fix: #40589
2021-10-05 09:25:49 -04:00
kobewi
9e5fdbc79d Fix LUA-style assignment in Dictionary 2021-10-05 12:17:13 +02:00
kobewi
cdac60759e Add support for unbinding in connection dialog 2021-10-04 21:41:21 +02:00
Rémi Verschelde
b32f84d473
Merge pull request #52850 from mashumafi/vector-bsearch 2021-10-01 07:52:51 +02:00
mashumafi
214bbfbefe Implement bsearch for Vector and Packed*Array 2021-09-30 23:57:26 +00:00
Lightning_A
c63b18507d Use range iterators for Map 2021-09-30 15:09:12 -06:00
Fabio Alessandrelli
0276c2e74a Fix const pointers types in docs and extension API.
The GDVIRTUAL_NATIVE_PTR did not declare the correct GDNativeConstPtr
template, resulting in "void*" being used as it's type info in both the
documentation and the extension API dump.
2021-09-29 16:04:20 +02:00
Fabio Alessandrelli
d18cbdf5e4
Merge pull request #52481 from Faless/net/4.x_native_peers
[Net] Extension system for network peers, webrtc.
2021-09-28 12:57:45 +02:00
Rémi Verschelde
0abe464162
Merge pull request #52849 from KoBeWi/know_no_binds 2021-09-25 00:10:56 +02:00
Fabio Alessandrelli
b9e6cc8f4f [Net] Enable PacketPeer native extensions. 2021-09-24 18:40:39 +02:00
kobewi
7bf5fc709e Remove binds from Signal.connect 2021-09-24 17:07:33 +02:00
Rémi Verschelde
ba57252bd8
Merge pull request #52878 from AnilBK/add-get-center 2021-09-21 21:30:30 +02:00
Anilforextra
90908cd67d Add Get Center Method for Rect2/Rect2i and AABB. 2021-09-21 21:14:17 +05:45
Hugo Locurcio
650b1db4b8
Add print_verbose() built-in function to print in verbose mode only
This can be used as a shorthand for:

    if OS.is_stdout_verbose():
        print("...")

Unlike `print_debug()`, this works in release builds too and can
be toggled off in debug builds.
2021-09-21 15:59:49 +02:00
Rémi Verschelde
89417ba75b
Merge pull request #52398 from deakcor/dev-transform 2021-09-20 08:46:51 +02:00
Vincent D
aa82cb6f35 Expose get_skew for transform2d and add new constructor
Expose set_scale and set_skew for transform2d

Replacing float by real_t

Adding const parameters

Updated transform2d doc
2021-09-19 17:10:05 +02:00
George Marques
262d9397fb
Allow indexing of String values in scripting languages 2021-09-17 16:24:56 -03:00
Rémi Verschelde
220b69ab56
Merge pull request #52450 from aaronfranke/they-came-from-scale
Replace Vector3.to_diagonal_matrix with Basis.from_scale
2021-09-17 19:38:36 +02:00
George Marques
455e142d37
Allow comparing equality between builtin types and null 2021-09-17 12:33:52 -03:00
Aaron Franke
bf0213470c
Replace Vector3.to_diagonal_matrix with Basis.from_scale 2021-09-17 10:30:30 -05:00
Matthew Newall
f048a9ad4e Added explicit type conversions 2021-09-13 14:26:47 +00:00
Gilles Roudière
4bd7700e89 Implement properties arrays in the Inspector. 2021-09-07 09:51:28 +02:00
George Marques
25ae279317
Merge pull request #52270 from KoBeWi/goodbye_polar
Remove cartesian2polar and polar2cartesian
2021-09-01 09:33:13 -03:00
George Marques
cf59028972
Merge pull request #48237 from KoBeWi/they_came_from_angle
Add Vector2.from_angle() method
2021-09-01 09:32:42 -03:00
kobewi
3f3739ccb5 Add Vector2.from_angle() method 2021-08-31 01:53:58 +02:00
kobewi
017c94222e Remove cartesian2polar and polar2cartesian 2021-08-31 01:41:41 +02:00
Wilson E. Alvarez
d11c1afc04
Rename String::is_rel_path to String::is_relative_path 2021-08-29 20:41:29 -04:00