Commit Graph

707 Commits

Author SHA1 Message Date
George Marques 150b50cfcd
Make freed object different than null in comparison operators
This is so everything is consistent, as a freed object is not equivalent
to `null` in general. The booleanization of a freed object still returns
`false` to work as an easy check for validity of objects. Similarly, the
negation of a freed object returns `true`.

Also makes freed objects different from each other (if they are not the
same reference).
2023-08-21 10:45:26 -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
Jan Haller 38334fdc11 PtrToArg::convert() returns const-references where possible, avoids unnecessary copies 2023-08-07 20:40:23 +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
Ninni Pipping c8c43997c7 Fix type check for max/min 2023-03-11 15:08:34 +01:00
Mario Liebisch 4e72e09343
Added the missing second case for string keys 2023-03-11 01:08:23 +01:00
George Marques a1e3ef919c
Add operator NOT for all Variant types 2023-03-10 15:58:55 -03:00
Mario Liebisch 46e5311d5a
Fixed read-only dictionaries adding missing keys
When querying a non-existing key on a read-only
dictionary, the key was still added (albeit never set).

This fixes #74726.
2023-03-10 17:26:34 +01:00
Ninni Pipping e6a9e0cdec Fix Variant hashing for floats
Incorrectly hashed floats as single precision
2023-03-08 12:52:50 +01:00
Rémi Verschelde 3863199ab9
Merge pull request #73881 from vnen/max-min-only-for-numbers
Make max() and min() global functions only accept numbers
2023-02-25 01:36:19 +01:00
Dmitrii Maganov c5f7a89b0f Core: Identity compare objects by id, not by pointers 2023-02-24 23:33:29 +02:00
George Marques ed81b165eb
Make max() and min() global functions only accept numbers
The behavior for those are not well defined for non-numeric arguments.
To avoid confusion the other types are forbidden.
2023-02-24 14:06:11 -03:00
mashumafi 2a12213c31 Fix: Typed arrays aren't working with + 2023-02-22 18:42:26 -05:00
Dmitrii Maganov 9cb2da89d6 GDScript: Fix usage of ints with typed array of floats 2023-02-13 22:06:38 +02:00
Rémi Verschelde 4a2c2170b4
Merge pull request #62921 from cdemirer/fix-variant-in
Fix `Variant::in()` error on invalid `evaluate`
2023-02-13 12:59:02 +01:00
cdemirer 44b2747dfd
Fix `Variant::in()` error on invalid `evaluate` 2023-02-13 12:37:41 +01:00
Gilles Roudière a825f955ab Make sure Variant is not implicitely cast when using operator[]
Co-authored-by: Hein-Pieter van Braam-Stewart <hp@tmm.cx>
2023-02-13 10:50:22 +01:00
Dmitrii Maganov 8400308ab3 GDScript: Fix can_reference check for typed arrays 2023-02-06 22:00:16 +02:00
Rémi Verschelde bbff9fd7a4
Merge pull request #71786 from raulsntos/dotnet/array
Sync C# Array with Core
2023-02-04 00:24:06 +01:00
George Marques 5fc7918594
GDScript: Improve usability of setter chains
- Consider PackedArrays non-shared since they are copied on C++/script
  boundaries.
- Add error messages in the analyzer when assigning to read-only
  properties.
- Add specific error message at runtime when assignment fails because
  the property is read-only.
2023-02-02 10:20:35 -03:00
Rémi Verschelde 394bb0ee2b
Fix various typos with codespell
Finally do the childs -> children rename too.
2023-02-01 08:45:41 +01:00
Dmitrii Maganov 5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02:00
bruvzg 5aa87ccc03
Move Array:set_typed to internal GDExtension structure and unexposed it. 2023-01-30 14:23:31 +02:00
Raul Santos 54f8fb010c
Sync C# Array with Core
- Add `AddRange` method.
- Add `Fill` method.
- Add `Max` and `Min` methods.
- Add `PickRandom` method.
- Add `Reverse` method.
- Add `RecursiveEqual` method.
- Add `Sort` method.
- Add `Slice` and `GetSliceRange` methods.
- Add `IndexOf` overload that takes an index parameter.
- Add `LastIndexOf` method.
- Add `BinarySearch` method.
- Add/update documentation.
2023-01-30 05:41:53 +01:00
Rémi Verschelde 9d555f5c68
Merge pull request #62499 from fire/gltf-binary-img-compression
Handle gltf binary images
2023-01-27 11:35:55 +01:00
K. S. Ernest (iFire) Lee 39922d7167 Handle gltf binary
[ Ignore and Warn | Extract Textures (default) | Optimize Loading Embedded as Basisu ]

Enable compressed mip maps from Basis Universal for faster compressions.

Increase the quality of Basis to avoid corruption.

To keep compatibility use the first mip of the previous internal Godot format.

Because texture names may have invalid filename characters, adds String::validate_filename to sanitize filenames for import pipeline use.
2023-01-27 02:02:02 -08:00
Dmitrii Maganov abe6d67232 GDScript: Fix test for read-only state of constants 2023-01-27 05:28:08 +02:00
Adam Scott 37248d7c87 Add `@GlobalScope` `is_same(a, b)` and `Variant::identity_compare()` 2023-01-25 10:46:21 -05:00
Jan Haller 15686ca786 Fix bind " convergence_dist" containing space 2023-01-23 20:07:59 +01:00
kobewi 615c517034 Use range iterators in LocalVector loops 2023-01-21 18:44:42 +01:00
Raul Santos 97610c8bfc
Add property usage to array indexer
This makes the `Array` indexer show as returning `Variant` instead of `void` in the documentation.
2023-01-19 14:22:11 +01:00
Rémi Verschelde 4005fc4b8d
Merge pull request #71279 from vonagam/fix-iterator-number-type
GDScript: Fix typing of iterator in for loop
2023-01-16 22:21:26 +01:00
Raul Santos 7560340ef6
Rename `center` method to `get_center` in Plane. 2023-01-15 17:18:50 +01:00
Dmitrii Maganov 40613ebd21 GDScript: Fix typing of iterator in for loop 2023-01-13 15:36:11 +02:00
Rémi Verschelde c2790ec2b9
Merge pull request #68450 from KoBeWi/bracket_escapist
Allow to escape closing brackets in CFG tags
2023-01-12 21:53:15 +01:00
Juan Linietsky 33d3b7eea7 Fix Callable call error reporting.
* Fix potential crash when using bind in `Variant::get_callable_error_text()`
* Properly compute bound arguments so they can be properly shown.
* Add a function to obtain the actual bound arguments.
2023-01-10 13:56:27 +01:00
Rémi Verschelde d3fc9d9e41
Merge pull request #71051 from vonagam/consts-are-deep-start
GDScript: Begin making constants deep, not shallow or flat
2023-01-09 23:22:59 +01:00
Rémi Verschelde 88940571f2
Merge pull request #71082 from AThousandShips/array_find_fix
Fix for comparisons with PackedArrays
2023-01-09 14:19:09 +01:00
Rémi Verschelde 31f94574d4
Merge pull request #70996 from reduz/properly-report-callable-bound-arguments
Properly report Callable bound arguments
2023-01-09 08:34:28 +01:00
Juan Linietsky 0e0ca01bce Properly report Callable bound arguments
Fixes #63213
Adds a function: Callable::get_amount_of_arguments_bound() to query this in callables. Exposed to the engine API.
2023-01-08 23:35:11 +01:00
Juan Linietsky 2b815df3c1 Use BitField<> in core type masks
* All core types masks are now correctly marked as bitfields.
* The enum hacks in MouseButtonMask and many other types are gone. This ensures that binders to other languages non C++ can actually implement type safe bitmasks.
* Most bitmask operations replaced by functions in BitField<>
* Key is still a problem because its enum and mask at the same time. While it kind of works in C++, this most likely can't be implemented safely in other languages and will have to be changed at some point. Mostly left as-is.
* Documentation and API dump updated to reflect bitfields in core types.
2023-01-08 22:17:40 +01:00
Ninni Pipping 86240d97e1 Fix for PackedArray comparison 2023-01-08 21:22:28 +01:00
Dmitrii Maganov 5e2ac1a31e GDScript: Begin making constants deep, not shallow or flat 2023-01-08 07:29:10 +02:00
Rémi Verschelde 41b74c675f
Merge pull request #71000 from reduz/callable-bind-from-array
Allow binding Callable arguments from an array
2023-01-07 13:18:53 +01:00
Juan Linietsky d762a0395a Allow binding Callable arguments from an array
Restores 3.x functionality that was removed in the Signal/Callable refactor of 4.0.

Fixes #64668.
Implements https://github.com/godotengine/godot-proposals/issues/6034

Usage:

```GDScript

callable.bindv([arg1,arg2,arg3])

```
2023-01-06 22:37:25 +01:00
Juan Linietsky 576ae694e0 Unbind Variant methods that change immutable types.
Fixes #62706.
Code is commented instead of removed to clarify why they should not be re-added.
2023-01-06 17:17:43 +01:00
Rémi Verschelde d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
George Marques 0c15844551
GDScript: Error when assigning return value of void function
This also makes built-in method calls empty the return value when the
method is void, to avoid keeping returning a garbage value in such case.
2022-12-30 12:08:58 -03:00
Yuri Rubinsky fff3d812a5 Fix empty zero assigners for the variant types 2022-12-20 19:02:44 +03:00
Rémi Verschelde 762c6d4b36
Merge pull request #69709 from RandomShaper/refactor_spirv_reflection
Refactor SPIR-V reflection into a generic RenderingDevice feature
2022-12-15 09:21:35 +01:00
lawnjelly 491594ef0f VariantParser make readahead optional
It turns out some areas are independently moving / reading filepointers outside of the VariantParser, which can cause the readahead caching to get out of sync.

This PR makes the VariantParser readahead to be optional to allow for these use cases.
2022-12-12 15:14:39 +00:00
Pedro J. Estébanez 2095ca26d0 Add default, zeroing constructor to BitField 2022-12-12 12:12:26 +01:00
Rémi Verschelde f1edd03d4c
Merge pull request #69718 from groud/finally_rename_gdnative_to_gdextension
Rename all gdnative occurences to gdextension
2022-12-12 11:43:59 +01:00
Gilles Roudière be1c9d677d Rename all gdnative occurences to gdextension
Non-exhaustive list of case-sensitive renames:

GDExtension -> GDNative
GDNATIVE -> GDEXTENSION
gdextension -> gdnative
ExtensionExtension ->Extension (for where there was GDNativeExtension)
EXTENSION_EXTENSION ->EXTENSION (for where there was GDNATIVE_EXTENSION)
gdnlib -> gdextension
gdn_interface -> gde_interface
gdni -> gde_interface
2022-12-12 11:04:57 +01:00
Rémi Verschelde 907298d673
Merge pull request #68747 from rune-scape/rune-stringname-unification
GDScript: Unify StringName and String
2022-12-09 18:06:48 +01:00
Aaron Franke d543ddf1c9
Fix Variant StringName `is_zero` being inverted 2022-12-06 21:49:43 -06:00
rune-scape e79be6ce07 Unify String and StringName 2022-12-05 21:46:47 -05:00
Rindbee 694ee1bf52 Fix suppressed error message on error when using % format string
Before, the valid flag would always be true. On formatting errors,
an error message is returned as the result. (No error prompts.)
2022-12-05 22:09:10 +08:00
Rémi Verschelde f4bccf90a3
Merge pull request #69119 from lawnjelly/faster_variant_parser_master
Add readahead to VariantParser [4.x]
2022-12-05 00:06:14 +01:00
kobewi 0765908868 Don't break parsing on missing resources 2022-11-28 16:19:15 +01:00
Micky 67cdac6db8 Remove `Array.find_last()` 2022-11-25 18:34:50 +01:00
Rémi Verschelde 4a8b725bc9
Merge pull request #68386 from MewPurPur/snappedi-snappedf
Implement snappedi, snappedf, and Vector[2/3/4]i.snapped
2022-11-24 18:54:49 +01:00
lawnjelly 5df29fec20 Add readahead to VariantParser
Adds a readahead buffer to VariantParser, to prevent large numbers of freads for single bytes, which is inefficient.
2022-11-24 15:54:16 +00:00
Yaohua Xiong f9fa182abc Refactor Curve3D::_bake() method
The main change is to caculate tangent directly from bezier curve, without going
through discretized polyline, avoiding pitfalls of discretization.

Other changes are:
1. Add an bezier_derivative() method for Vector3, Vector2, and Math;
2. Add an tesselate_even_length() method to Curve3D, which tesselate bezier curve to even length segments adaptively;
3. Cache the tangent vectors in baked_tangent_vector_cache;
2022-11-24 10:52:06 +08:00
Rémi Verschelde 3791872c65
Merge pull request #67726 from HenryClones/integer-lerping-errors
Add case for Variant::INT in lerp variant switch
2022-11-23 08:33:53 +01:00
Xpertice 3e36cc7c73 Add case for Variant::INT in lerp variant switch 2022-11-22 22:37:22 -05:00
VolTer e26f0906f2 Implement snappedi, snappedf, and Vector[2/3/4]i.snapped 2022-11-19 06:18:55 +01:00
Rémi Verschelde cfb9cae23a
Merge pull request #62814 from KoBeWi/strint
Restore numeric from String constructors
2022-11-15 22:29:55 +01:00
Rémi Verschelde 80dbcfd995
Merge pull request #68657 from Sauermann/fix-redundant-initialization
Remove redundant non-trivial Variant types initializations
2022-11-14 23:23:54 +01:00
Hugo Locurcio efe3220b2e
Fix periods in editor strings and messages
- Ensure all strings with ellipsis end with 3 periods instead of 2.
- Fix extraneous period in "Error calling from signal '...' to callable"
  messages.
2022-11-14 19:36:36 +01:00
Markus Sauermann 3b14f0334c Remove redundant Variant-types initializations 2022-11-14 19:35:19 +01:00
kobewi 0d122ce459 Allow to escape closing brackets in CFG tags 2022-11-09 14:00:51 +01:00
Rémi Verschelde 12b4a263ee
Merge pull request #67730 from KoBeWi/late_to_the_call
Add call_deferred() method to Callable
2022-11-06 15:55:43 +01:00
kobewi 1778301cd0 Add call_deferred() method to Callable 2022-11-04 17:24:34 +01:00
kobewi 8a47a12207 Add support for empty delimiter in String.split 2022-11-04 15:09:12 +01:00
Rémi Verschelde 3eaf49765b
Merge pull request #68192 from aaronfranke/unify-node3d-euler
Unify Node3D RotationOrder with global EulerOrder
2022-11-03 12:07:42 +01:00
Aaron Franke 9e952c8386
Allow getting Quaternion rotation in different Euler orders 2022-11-02 19:20:10 -05:00
Aaron Franke 9225eb461e
Unify Node3D RotationOrder with global EulerOrder 2022-11-02 17:46:03 -05:00
Aaron Franke 8556fdd4bc
Move EulerOrder enum to math_defs.h and global scope 2022-11-02 13:44:13 -05:00
Rémi Verschelde d2e1b4b9f0
Merge pull request #68118 from aaronfranke/quat-from-euler
Replace Quaternion Euler constructor with `from_euler` method
2022-11-02 18:51:59 +01:00
Rémi Verschelde 62ed75df9c
Merge pull request #64830 from dalexeev/color-hide-internals
Remove internal functions of named colors from the public API
2022-11-02 18:51:27 +01:00
Rémi Verschelde d3a6855dfc
Merge pull request #66361 from dalexeev/remove-int-plus-string
Unexpose confusing `String + int` and `int + String` operations
2022-11-02 18:51:16 +01:00
Rafał Mikrut d7d130295e Support for checking that Projection is(not) null 2022-11-01 20:49:52 +01:00
Aaron Franke 83634119d4
Replace Quaternion Euler constructor with `from_euler` method 2022-11-01 09:28:12 -05:00
Clay John 682156e1f0
Merge pull request #66383 from aaronfranke/basis-from-euler
Clean up Basis from Euler code
2022-10-27 09:44:21 -07:00
Yuri Rubinsky 38691d5b1d
Merge pull request #67655 from MewPurPur/remove-dupe-registrations 2022-10-23 09:54:06 +03:00
Aaron Franke 7f9a8c99c9
Clean up Basis from Euler code 2022-10-21 17:54:49 -05:00
Max Hilbrunner 5cefc07d90
Merge pull request #67444 from nonunknown/array_pick_random
Add ability to pick random value from array
2022-10-21 16:25:52 +02:00
Danil Alexeev 653e8f5c86
Remove internal functions of named colors from the public API 2022-10-21 11:21:43 +03:00
Nonunknown 9f4dbf415d add ability to pick random value from array 2022-10-20 08:39:47 -03:00
VolTer 1fd59b98fb Remove duplicate operator registrations 2022-10-20 03:03:47 +02:00
Rémi Verschelde 00d44a9c73 Merge pull request #67118 from Mickeon/
Fix Typed Array of Objects not accepting `null`.
2022-10-17 17:30:38 +02:00
Rémi Verschelde 6d9d220d64 Merge pull request #67224 from Mickeon/jason
Use `JSON::stringify` where possible
2022-10-11 09:27:53 +02:00
Rémi Verschelde 4d5d33f7ff Merge pull request #67126 from Mickeon/i-was-very-bored
Strip unnecessary break on switches returning early in Variant
2022-10-11 09:27:17 +02:00
Rémi Verschelde 58eff50bf1 Merge pull request #64268 from timothyqiu/is-finite
Add `is_finite` method for checking built-in types
2022-10-11 09:25:46 +02:00
Micky fe56c1ff75 Use `JSON::stringify` where possible 2022-10-11 00:27:23 +02:00
Micky 41dcc36643 Strip unnecessary break on switches returning early in Variant
Tweaks comments around the touched-up parts. Also tweaks spacing

Also adds some spacing in all cases of Variant::`reference()`. This is a special for consistency, because it ends up making the cases more readable.
2022-10-10 22:09:51 +02:00
Rémi Verschelde 2fe8ac085b Merge pull request #64692 from touilleMan/no-variant-destructor-for-struct-builtins
Remove Transform2/3D,AABB,Basis from Variant destructors given they are POD structs
2022-10-10 17:42:08 +02:00
Rémi Verschelde 51bb3c36dd Merge pull request #66584 from rune-scape/rune-validated-call-obj-bug
Fix unset `ObjectID` with validated `get_object()` call
2022-10-10 13:53:26 +02:00
Micky bf64a068a4 Fix Array.`slice()` and `filter()` forgetting Typed Array 2022-10-09 12:34:19 +02:00
Micky 03bef1562b Fix Typed Array of Objects not accepting `null`. 2022-10-09 10:32:48 +02:00
Haoyu Qiu 5da515773d Add `is_finite` method for checking built-in types 2022-10-08 13:25:08 +08:00
Rémi Verschelde 62b066dbd6 Fix more MSVC C4702 (unreachable code) warnings 2022-10-07 14:43:59 +02:00
bruvzg 0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00
Rémi Verschelde 3a2b0ab73d Merge pull request #66898 from aaronfranke/proj-mat-columns
Rename Projection `matrix` to `columns`
2022-10-05 08:35:26 +02:00
Hugo Locurcio 6afbf0bd5a
Improve dictionary printing to avoid confusion with arrays
- Add leading and trailing spaces within dictionaries, as the `{}`
  characters are hard to distinguish from `[]` on some fonts.
  This is especially helpful with empty arrays and dictionaries.
2022-10-04 20:33:40 +02:00
Aaron Franke 2cea42cc7f
Rename Projection `matrix` to `columns` 2022-10-04 12:34:19 -05:00
Rémi Verschelde 6991e9b43d Merge pull request #66583 from bruvzg/constexpr
Use `constexpr` in the conditions with template parameters and `sizeof`s to suppress C4127 warnings.
2022-09-29 10:44:22 +02:00
bruvzg ea1848ce0a
Use `constexpr` in the conditions with template parameters and `sizeof`s to suppress C4127 warnings. 2022-09-29 10:38:21 +03:00
rune-scape 51c411c7ad Fix unset `ObjectID` with validated `get_object()` call
Fixes unset `ObjectID` in variant when calling a validated builtin method returning an `Object *`.
2022-09-28 23:04:22 -07:00
bruvzg 8a9659b152
Change BitField to use 64-bit int. 2022-09-28 17:36:59 +03:00
kobewi 52b20ce909 Use 64bit integers in utility methods 2022-09-28 02:26:37 +02:00
kobewi 7499f41264 Fix wrong floori() behavior 2022-09-27 19:09:34 +02:00
Danil Alexeev 453c5ef682
Remove confusing `String + int` and `int + String` operations 2022-09-24 18:13:44 +03:00
Rémi Verschelde 006e345695
Merge pull request #65817 from bruvzg/typed_array 2022-09-23 10:24:46 +02:00
bruvzg 163257d51b
[GDExtension] Implement support for typed arrays. 2022-09-22 23:31:27 +03:00
Ricardo Buring 0c2055d15d Callable: add callv method
This method can be called from GDExtension.
2022-09-21 08:25:48 +02:00
kobewi a43319b6c9 Restore numeric from String constructors 2022-09-19 14:31:16 +02:00
Emmanuel Leblond 529afd8fbb
Remove Transfor2/3D,AABB,Basis,RID from Variant destructors given Variant::clear() considers they don't need to be destroyed 2022-09-17 23:48:50 +02:00
Rémi Verschelde a981a8061f Merge pull request #65325 from TokageItLab/refactor-variant-for-anim
Move some static methods to `Animation` from `Variant` for refactoring `Animation` and `Tween`
2022-09-16 09:20:50 +02:00
Micky 0715250ae4 Use variadic template in `vformat()`
Allows `vformat()` to take more than 5 arguments. as well as being a general optimisation that avoids redundant empty Variant checks.
2022-09-14 23:55:34 +02:00
Silc Renew 9d47e079b7 Move some methods to Animation from Variant for refactoring 2022-09-15 04:52:43 +09:00
Rémi Verschelde 5062aafc2d Merge pull request #64417 from aaronfranke/has-space
Replace AABB/Rect2/Rect2i has_no_* methods with has_* methods
2022-09-06 17:00:44 +02:00
Micky b6daad8d4b Rename `range_lerp` to `remap` 2022-09-06 07:19:20 +02:00
Aaron Franke 995b9f94e8
Replace Rect2(i) has_no_area with has_area 2022-09-04 23:03:36 -05:00
Aaron Franke 817ae95667
Replace AABB has_no_volume with has_volume
Also replace has_no_surface with has_surface
2022-09-04 23:03:36 -05:00
Haoyu Qiu 3c0759608a Fix crash when encoding freed object in ConfigFile 2022-09-04 19:56:37 +08:00
Jonathan Nicholl 15d057c521 Add `is_zero_approx` methods to `Vector2`, `3`, and `4` 2022-09-02 00:29:50 -04:00
Rémi Verschelde 41156a1e83
Merge pull request #63968 from KoBeWi/finding_stuff_in_a_dictionary 2022-09-01 17:38:39 +02:00
Rémi Verschelde 10aec9057c
Merge pull request #63411 from Calinou/improve-null-object-dictionary-print
Improve null and object printing to avoid confusion with arrays
2022-08-31 17:37:08 +02:00
Hugo Locurcio 291d3aaabe
Improve null and object printing to avoid confusion with arrays
- Use different syntax for object printing to avoid confusion with arrays.
- Print null as `<null>` to avoid confusion with a string `"null"`.
- Display `<empty>` in editor resource pickers to avoid confusion
  with array-based properties.
2022-08-31 15:31:49 +02:00
Silc Renew c139d9ef7d Discontinued spherical_interpolate_with in Transform3D 2022-08-31 16:35:38 +09:00
Danil Alexeev d4555ef5fb
Add `String.to_{camel,pascal,snake}_case` methods 2022-08-30 12:36:24 +03:00
Aaron Franke 10a56981dc
Rename String `plus_file` to `path_join` 2022-08-29 19:38:13 -05:00
Silc Renew 931fb4dc11 Add linear/cubic angle interpolation to Animation interpolation type 2022-08-27 07:58:22 +09:00
Micky 59e11934d8 Rename `str2var` to `str_to_var` and similar
Affects the Math class, a good chunk of the audio code, and a lot of other miscellaneous classes, too.

- `var2str` -> `var_to_str`
- `str2var` -> `str_to_var`
- `bytes2var` -> `bytes_to_var`
- `bytes2var_with_objects` -> `bytes_to_var_with_objects`
- `var2bytes` -> `var_to_bytes`
- `var2bytes_with_objects` -> `var_to_bytes_with_objects`
- `linear2db` -> `linear_to_db`
- `db2linear` -> `db_to_linear`
- `deg2rad` -> `deg_to_rad`
- `rad2deg` -> `rad_to_deg`

- `dict2inst` -> `dict_to_inst`
- `inst2dict` -> `inst_to_dict`
2022-08-26 14:58:22 +02:00
Yuri Rubinsky e97ece55aa Add constructor accepting four Vector4's to `Projection` 2022-08-24 08:30:40 +03:00
Rémi Verschelde 944bfc6d00
Merge pull request #63602 from TokageItLab/cubic-interp-time 2022-08-22 17:32:47 +02:00
rafallus da7a5653f4 Expose Basis `set_orthogonal_index` method as a GridMap function 2022-08-20 21:42:20 -05:00
Silc Renew dded7c72c1 Make `cubic_interpolate()` consider key time in animation 2022-08-19 14:48:37 +09:00
kobewi cc424bcb18 Add Dictionary.find_key() 2022-08-16 13:48:59 +02:00
Haoyu Qiu 9c4ad8191b Expose clear method for packed arrays 2022-08-10 17:12:20 +08:00
antonWetzel 40a1d6d100 vector4 distance_squared_to and update csharp 2022-08-09 01:59:17 +02:00
Rémi Verschelde 446fdc5b71
Merge pull request #64027 from Geometror/add-vector4-tests 2022-08-07 16:07:36 +02:00
Hendrik Brucker 36061c5dca Vector4/Vector4i: Add missing methods, tests and fix change of sign operator 2022-08-07 12:25:05 +02:00
Rémi Verschelde e6e13c8251
Merge pull request #63361 from KoBeWi/floorf_lol 2022-08-06 22:25:27 +02:00
kobewi ae3d83b17b Restore old lerp() behavior and add lerpf() 2022-08-06 21:15:37 +02:00
Rémi Verschelde dc04050cfd
Merge pull request #63698 from PrecisionRender/plane-operator-asterisk
Add operator `*` to `Plane`
2022-08-06 00:38:59 +02:00
Rémi Verschelde c717d5c64b Arrays: Zero new items of trivial types on resize() (bindings only)
This is not enabled by default in the core version for performance reasons,
as Vector/CowData are used in critical code paths where not zero'ing memory
which is going to be set later on can be important.

But for bindings / the scripting API, we make zero the new items by default
(which already happened for built types like Vector3, etc., but not for
trivial types like int, float).

Fixes #43033.

Co-authored-by: David Hoppenbrouwers <david@salt-inc.org>
2022-08-04 13:35:37 +02:00
Rémi Verschelde a49cf9fe90
Merge pull request #55923 from bluenote10/feature/consistent_transform_operations
Fix consistency of translated/scaled/rotated in Transform2D and Transform3D
2022-08-03 07:50:01 +02:00
Fabian Keller f242f9c738 Fix consistency of translated/scaled/rotated in Transform2D and Transform3D 2022-08-02 23:38:14 +02:00
lawnjelly bb273bc972 Variant large bucket memory pool - for Projection
Add a larger bucket size pool for the new Projection Matrix.
2022-08-02 16:27:57 +01:00
Rémi Verschelde 33258d850c
Merge pull request #61315 from lawnjelly/variant_bucket_pools
Variant memory pools
2022-08-02 15:54:18 +02:00
PrecisionRender 2adb67c3c5 Add `operator*` to `Plane` 2022-07-30 17:48:55 -05:00
Rémi Verschelde 7199314eb3
Merge pull request #63595 from reduz/remove-signal-connect-binds
Remove Signal connect binds
2022-07-29 18:10:39 +02:00
Juan Linietsky d4433ae6d3 Remove Signal connect binds
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind().
Changed all uses of it to Callable.bind()
2022-07-29 16:26:13 +02:00
kobewi ee6fd704b5 Fix Vector4 serialization 2022-07-29 12:09:03 +02:00
Rémi Verschelde 14d021287b
Merge pull request #63049 from Faless/mp/4.x_as_module 2022-07-28 20:46:31 +02:00
Rémi Verschelde a5f12f9c21
Merge pull request #63532 from TokageItLab/rename-cubic-slerp 2022-07-28 10:39:33 +02:00