Commit Graph

562 Commits

Author SHA1 Message Date
Aaron Franke 6f7eccc758
Add a type conversion method to Variant Utility and expose to scripting 2023-09-08 10:12:48 -05:00
Yuri Sizov d8ff69d53c Extract ScriptInstance to simplify includes
This allows to include script_instance.h directly in the
generated gdvirtual.gen.inc, and remove excessive includes
from the codebase.

This should also allow Resource to use GDVIRTUAL macros,
which wasn't possible previously due to a circular dependency.
2023-09-06 22:54:38 +02:00
Daylily-Zeleen 67e1401891 Set builtin varrarg ptrcalls, called without arg. 2023-09-02 00:34:16 +08:00
Rémi Verschelde bbdd1aaa38
Merge pull request #81131 from AThousandShips/callable_fix
Fix comparison of `Callable`s with binds
2023-09-01 16:02:35 +02:00
Jcrespo 528a76486c Add inverse hyperbolic functions `asinh()`, `acosh()` & `atanh()`
GDScript has the following built-in trigonometry functions:

- `sin()`
- `cos()`
- `tan()`
- `asin()`
- `acos()`
- `atan()`
- `atan()`
- `sinh()`
- `cosh()`
- `tanh()`

However, it lacks the hyperbolic arc (also known as inverse
hyperbolic) functions:

- `asinh()`
- `acosh()`
- `atanh()`

Implement them by just exposing the C++ Math library, but clamping
its values to the closest real defined value.
For the cosine, clamp input values lower than 1 to 1.
In the case of the tangent, where the limit value is infinite,
clamp it to -inf or +inf.

References #78377
Fixes godotengine/godot-proposals#7110
2023-09-01 01:27:56 +02:00
A Thousand Ships 2caf5ae453 Fix comparison of `Callable`s with binds 2023-08-29 16:10:14 +02:00
Danil Alexeev 5d689ad560
Core: Fix recursion level check for `VariantWriter::write()` with objects 2023-08-29 15:05:53 +03:00
Thaddeus Crews c82bdef2fc
Undefine typed array templates after use 2023-08-19 12:30:43 -05:00
Rémi Verschelde 1d70968e9a
Merge pull request #79370 from dalexeev/core-array-recursion-check
Core: Fix recursion level check for array stringification
2023-08-18 15:43:29 +02:00
Rémi Verschelde 20e24bd2bb
Merge pull request #78529 from Chaosus/string_reverse
Add `String.reverse` method
2023-08-16 16:53:40 +02:00
Rémi Verschelde 4ed08409b0
Merge pull request #78108 from aaronfranke/variant-util-header
Make a header for VariantUtilityFunctions
2023-08-03 14:46:29 +02:00
Joseph Davies 510de82f43
Fix typo in modulo error message. 2023-08-01 04:47:18 -07:00
Yuri Sizov 3d04a22d7c
Merge pull request #79103 from AThousandShips/array_slice_range
Fix range error for `Array.slice`
2023-07-17 16:48:48 +02:00
Danil Alexeev bb40bd9aaa
Core: Fix recursion level check for array stringification 2023-07-12 14:59:44 +03:00
Rémi Verschelde 0c1442f82a
Merge pull request #78551 from AThousandShips/call_rpc
Fix `rpc` calls with binds
2023-07-08 18:15:41 +02:00
Ninni Pipping 7752a0d8d1 Fix range error for `Array.slice` 2023-07-07 23:19:42 +02:00
Gabor Koncz a2ede8c4da Fix GDVIRTUAL_NATIVE_PTR
This commit fixes the usage of GDExtensionPtr and GDExtensionConstPtr
in GDExtension by introducing the required VariantInternalAccessor
specializations.

Sponsored by Migeran (https://migeran.com)
2023-07-03 10:52:02 +02:00
Ninni Pipping 9159208ed1 Ensure `RID`, `Callable`, and `Signal` are stored as strings
Prevents parser errors in `.tscn` and `.tres` files where the assignment
would otherwise be empty.
2023-06-22 17:01:08 +02:00
Ninni Pipping 7d174c8dfe Fix `rpc` calls with binds 2023-06-22 11:07:53 +02:00
Yuri Roubinski 230385b587 Add `String.reverse` method 2023-06-21 20:40:48 +03:00
Rémi Verschelde 248e5245e4
Merge pull request #73540 from mashumafi/fix-typed-array-add
Fix: Typed arrays aren't working with +
2023-06-20 15:12:39 +02:00
Rémi Verschelde 867ea7fe59
Merge pull request #74730 from MarioLiebisch/fix-74726
Fix read-only dictionaries adding missing keys
2023-06-19 21:38:38 +02:00
Rémi Verschelde b8bf28e2b6
Merge pull request #75758 from Pylgos/fix-gdextension-variant-construction
Fix GDExtension Variant type conversion
2023-06-19 10:27:20 +02:00
Rémi Verschelde 1a62f1e4fc
Merge pull request #74741 from vnen/variant-not-for-everyone
Allow boolean operators for all Variant types
2023-06-18 16:28:10 +02:00
Aaron Franke 7e9b5e59d4
Make a header for VariantUtilityFunctions 2023-06-12 11:29:42 -05:00
Aaron Franke 5654d40367
Don't use a const reference for the enum constructor in Variant 2023-06-11 15:13:05 -05:00
Pylgos d7eb7108f0 Fix gdextension variant type conversion 2023-06-10 10:52:17 +09:00
David Snopek 77733faede Attempt to standardize Object ptrcall encoding on `Object **` 2023-05-25 21:46:22 -05:00
Juan Linietsky 5fdc1232ef Add the ability to look-at in model-space.
This is a much simpler attempt to solve the same problem as #76060, but without breaking any compatibility.

* Adds a description of what model space is in the Vector3 enums (MODEL_* constants). This has the proper axes laid out for imported 3D assets.
* Adds the option to `look_at` using model_space, which uses Vector3.MODEL_FRONT as forward vector.

The attempt of this PR is to still break the assumption that there is a single direction of forward (which is not the case in Godot)
and make it easier to understand where 3D models are facing, as well as orienting them via look_at.
2023-05-24 10:10:24 +09:00
Emmanuel Leblond e785dd9dd9
Improve user-friendliness of "return value as function param" pattern in GDExtension API
This commit introduce separate types (e.g. GDNativeStringPtr vs GDNativeUninitializedStringPtr)
depending on if the pointed data is already initialized (C++ style where constructor is alway
called when create a variable even if it is to be passed as return value) or not (C style).
On top of that, small changes has been made to `GDNativeInterface` so that it methods are
consistent on using uninitialized return value.
2023-05-15 17:14:57 +02:00
clayjohn f83a90192f Revert "Add API for HSL conversion"
This reverts commit 0b7fd664c1.
2023-05-10 17:45:56 -03:00
Rémi Verschelde 0f444f101a
Merge pull request #76661 from bonjorno7/hsl
Add API for HSL conversion
2023-05-09 19:28:35 +02:00
Rémi Verschelde 5ade250c7d
Merge pull request #76735 from AThousandShips/natural_cmp
Add `naturalcasecmp_to` function to `String`
2023-05-09 17:44:37 +02:00
bonjorno7 0b7fd664c1 Add API for HSL conversion
Math ported pretty much 1:1 from https://en.wikipedia.org/wiki/HSL_and_HSV
Style doesn't match the existing HSV code exactly, but should be close enough.
2023-05-09 17:43:10 +02:00
Rémi Verschelde 491a437df5
Merge pull request #76540 from reduz/redo-remote-filesystem
Redo how the remote filesystem works
2023-05-08 13:52:51 +02:00
Rémi Verschelde 3e6a731904
Merge pull request #76418 from reduz/method-bind-validated-call
Add ValidatedCall to MethodBind
2023-05-08 13:52:42 +02:00
Juan Linietsky 273a6eeb66 Redo how the remote filesystem works
Instead of reading files over the network, the new version uses a local file cache and only updates files when it changes.

The original remote filesystem was created 14 years ago, when ethernet was faster than hard drives or even flash. Also, mobile devices have a very small amount of storage.
Nowadays, this is no longer the case so the approach is changed to using a persistent cache in the target device.

Co-authored-by: m4gr3d
2023-05-08 11:57:54 +02:00
Ninni Pipping 46a7018e3c Add `naturalcasecmp_to` function to `String`
Functions as a complement to `naturalnocasecmp_to`
2023-05-07 10:17:53 +02:00
Clay John 7a13cf9aeb
Merge pull request #75510 from SilicDev/string_erase
Reimplement `String.erase()` as immutable method
2023-05-05 10:03:49 -07:00
SilicDev 6fa4f71ca6 Reimplement String.erase 2023-05-04 00:52:35 +02:00
Juan Linietsky 1c93606e47 Add ValidatedCall to MethodBind
* This should optimize GDScript function calling _enormously_.
* It also should simplify the GDScript VM considerably.

NOTE: GDExtension calling performance has most likely been affected until going via ptrcall is fixed.
2023-04-30 20:01:26 +02:00
Aaron Franke 290b09b36c
Expose `determinant` in Transform2D, rename internal method 2023-04-22 13:44:14 -05:00
Paweł 899da22002 Fix lerp error message 2023-04-21 10:01:59 +02:00
kleonc 7a871212ed Fix expected argument count in Callable call error text 2023-04-19 16:06:00 +02:00
Haoyu Qiu 6cd8e706fa Unify descriptions of vector methods
* is_equal_approx
* normalize
* length_squared
* posmod
* posmodv
2023-04-14 23:31:33 +08:00
Pedro J. Estébanez 33f674d0f7 Complete support of callables of static methods 2023-04-12 18:12:19 +02:00
bendn ca0feabbb0
add `hex_decode()` to `String` 2023-04-05 19:44:00 +07:00
bruvzg d72b563250
Add GDScript `to_wchar_buffer` and `get_string_from_wchar` functions. 2023-03-21 15:39:54 +02:00
Yuri Sizov 6f4646c6bf
Merge pull request #74909 from AThousandShips/array_slice
Fix `Array.slice()` rounding for `abs(step) != 1`
2023-03-15 14:25:16 +01:00
Ninni Pipping 10f385fb79 Fix `Array.slice()` rounding for `abs(step) != 1` 2023-03-14 15:46:45 +01:00