Commit graph

160 commits

Author SHA1 Message Date
Rémi Verschelde d7a39cc346
Merge pull request #38992 from Dragoncraft89/master
Error handling functions for GdScript
2021-08-11 18:43:27 +02:00
Aaron Franke fa3a32a2d6
Use Key enum instead of plain integers 2021-08-10 16:26:55 -05:00
Rémi Verschelde 46beaacec3
Merge pull request #51017 from vnen/extension-fixes 2021-08-10 16:42:31 +02:00
Rémi Verschelde 16d73fefdb
Merge pull request #50682 from aaronfranke/basis-looking-at
Move code for looking_at to Basis
2021-08-10 11:28:12 +02:00
bruvzg 7c3c5603d0 [Text Server] Improve object (image/table) inline alignment. 2021-08-08 22:35:47 +03:00
George Marques 3f362cec68
Improve extension system
- Fix library loading and initialization.
- Add extra methods/parameters in the interface needed by extenstions.
- Add Variant destructors and functions for extracting values and
  creating Variants from values.
2021-08-05 14:57:31 -03:00
George Marques 97947bc063
Fix a few default parameters in bindings
They have the wrong type and cause issues with extensions.
2021-08-05 14:57:29 -03:00
Aaron Franke 9f3ae0adcd
Move code for looking_at to Basis 2021-08-01 12:49:02 -05:00
Rémi Verschelde d7b61838b1
Merge pull request #51084 from aaronfranke/no-dectime
Remove obsolete `dectime` method
2021-07-31 10:20:29 +02:00
Aaron Franke 2733b9abd8
Remove obsolete "dectime" method
Replaced by "move_toward"
2021-07-30 16:41:28 -05:00
Rémi Verschelde f3aaa713d9
VariantParser: Fix uninitialized ResourceParser funcs
They could cause a segfault when parsing values with ID "Resource"
as apparently we never set a valid `func` for it.

Fixes crash part of #42115.
2021-07-30 23:23:31 +02:00
Fabio Alessandrelli 324636473a [Net] Fix Marshalls infinite recursion crash.
Variants like dictionaries and arrays can have cyclic references, which
caused `encode_variant` to run an infinite recursion.
Instead of keeping a stack and looking for cyclic references which would
make serialization slower, this commit adds a `MAX_RECURSION_DEPTH`
constant to Variant, and have `encode_variant` keep track of the current
recursion depth, bailing when it's too high since this likely means a
cyclic reference has been encountered.
2021-07-30 16:13:43 +02:00
Rémi Verschelde b4778082d1
Merge pull request #50939 from vnen/fix-variant-bool-conversion
Change Variant bool conversion to uint8_t
2021-07-27 15:04:20 +02:00
George Marques 84c37423fb
Change Variant bool conversion to uint8_t
This ensures more portable conversion since not every path assume bool
is 32-bits and there's no loss converting to 8-bits anyway.
2021-07-27 09:00:56 -03:00
Fabio Alessandrelli 95088f6bfa [Core] Make enum variant cast and encoding 64 bits
This should fix various issues where retrieving enum values from
scripting languages would result in corrupted values (where 32 bits
were valid, and the other 32 random data).
2021-07-27 12:29:03 +02:00
Rémi Verschelde ff0b5f8fa1
Merge pull request #50809 from akien-mga/iterators-const-references 2021-07-25 12:52:58 +02:00
Rémi Verschelde ac3322b0af
Use const references where possible for List range iterators 2021-07-25 12:22:25 +02:00
luz paz 3564c16cb8
Fix various typos with codespell
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,fave,findn,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint`
2021-07-25 11:21:51 +02:00
Rémi Verschelde fb821b8398
Merge pull request #50535 from ChristopheClaustre/packedbytearray_decode_api
Change in PackedByteArray decode api and docs
2021-07-24 21:54:48 +02:00
ChristopheClaustre 20818c12b7 New to_***_array method to decode PackedByteArray to Packed***Array
Documentation for new PackedByteArray::to_***_array methods
Documentation for to_byte_array method for PackedInt32/Int64/Float32/Float64Array
2021-07-24 21:06:47 +02:00
Aaron Franke 4e6efd1b07
Use C++ iterators for Lists in many situations 2021-07-23 17:38:28 -04:00
Hugo Locurcio 4bd5e4fd9b
Use the standard C INFINITY and NAN constants directly
The `Math_INF` and `Math_NAN` defines were just aliases for those
constants, so we might as well use them directly.

Some portions of the code were already using `INFINITY` directly.
2021-07-21 10:41:08 +02:00
Rémi Verschelde b4baec08cf
Merge pull request #50206 from groud/undoredo_increase_args_count
Increase the number of arguments accepted by UndoRedo methods
2021-07-20 09:50:01 +02:00
George Marques 7bc52e56c0
Merge pull request #50056 from Blackiris/fix-in-operator
Fix 'in' operator to check if an object member exists
2021-07-13 14:25:42 -03:00
Gilles Roudière 2f9a0268dd Increase the number of arguments accepted by UndoRedo methods 2021-07-06 18:52:28 +02:00
bruvzg eca4d2fccc Fix Variant tags parsing. 2021-07-05 15:46:41 +03:00
reduz 379b90fd33 Force String as Dictionary key instead of StringName
* Lua table syntax uses named indexing: `{ mykey = myvalue }`
* Python style syntax uses string indexing: `{ "mykey" : myvalue }`
* Both are incompatible since a StringName key wont fetch a String key, hence confusing.
* This PR proposes always using String for indexing at a very minimal performance cost. Always indexing with StringNames will be faster, but they are considerably more expensive to create.
2021-07-01 16:03:37 -03:00
Julien Nguyen 0a823e85d2 Fix 'in' operator to check if an object member exists 2021-07-01 20:59:26 +02:00
Lyuma 8f1efa656b Add Callable.is_valid() analogous to FuncRef.is_valid() from 3.x 2021-07-01 02:54:01 -07:00
reduz b1d15c51bc Implement native extension system
* Deprecates GDNative in favor of a simpler, lower level interface.
* New extension system allows registering core engine classes.
* Simple header interface in gdnative_interace.h
2021-06-25 17:32:45 -03:00
Aaron Franke e919d894f8
Move many input enums to their own file 2021-06-20 11:53:01 -04:00
Lightning_A e28fd07b2b Rename instance()->instantiate() when it's a verb 2021-06-19 20:49:18 -06:00
Rémi Verschelde d88be9b70c
Merge pull request #44806 from madmiraal/consolidate_json
Consolidate JSON, JSONParseResults and JSONParser into JSON
2021-06-19 21:45:34 +02:00
Marcel Admiraal 2bafcd3422 Consolidate JSON, JSONParseResults and JSONParser into JSON
Renames JSON.parse_string() to parse()
Renames JSON.decode_data() to stringify()
2021-06-19 08:01:40 +01:00
Rémi Verschelde a9c53fa599
Merge pull request #49287 from reduz/expose-variant-internal-binders
Make some Variant internal functions public.
2021-06-19 01:11:03 +02:00
Rémi Verschelde 92f20fd70e
Merge pull request #49659 from LightningAA/string-valid-integer-to-int 2021-06-18 16:14:14 +02:00
Rémi Verschelde 7aebb8f81c
Merge pull request #44156 from aaronfranke/quat-angle-to
Add Quaternion angle_to method
2021-06-18 12:35:58 +02:00
Rémi Verschelde 3fc39954ec
Merge pull request #49638 from aaronfranke/multiply-transforms
Allow multiplying Transforms and Basis by numbers
2021-06-18 12:35:14 +02:00
Aaron Franke 93b494d4ae
Add Quaternion angle_to method 2021-06-17 23:57:00 -04:00
Michael Alexsander Silva Dias 0ff4095b36 Better format arguments in variant parser 2021-06-18 00:06:40 -03:00
reduz 2c81e5fa0e Make some variant internal functions public.
-Make constructors, ops and setget inline functions public
-Should help optimizing the GDScript VM
2021-06-17 19:59:28 -03:00
Lightning_A b6af2a29eb Rename is_valid_integer() to is_valid_int()
Method from `String`
2021-06-16 10:32:22 -06:00
Aaron Franke bd6ed3fb09
Allow multiplying Transforms and Basis by numbers 2021-06-15 22:26:29 -04:00
Haoyu Qiu b3bd54001f Fix json dump and print of circular structure 2021-06-14 20:48:49 +08:00
Rémi Verschelde 600b4c9c7b
Merge pull request #34668 from aaronfranke/to-string
[Core] Reformat structure string operators
2021-06-13 11:58:24 +02:00
Rémi Verschelde 326e483ef3
VariantParser: Fix reading StringNames with '&'.
Keep support for '@' for now for compatibility.

Fixes #49535.
Fixes #49542.
2021-06-12 22:13:35 +02:00
Pedro J. Estébanez 04688b92ff Rename Reference to RefCounted 2021-06-11 18:48:42 +02:00
Aaron Franke 554c776e08
Reformat structure string operators
The order of numbers is not changed except for Transform2D. All logic is done inside of their structures (and not in Variant).

For the number of decimals printed, they now use String::num_real which works best with real_t, except for Color which is fixed at 4 decimals (this is a reliable number of float digits when converting from 16-bpc so it seems like a good choice)
2021-06-11 10:53:20 -04:00
Rémi Verschelde 8d4046929c
Merge pull request #49511 from akien-mga/core-diraccess-fileaccess-io
Core: Move DirAccess and FileAccess to `core/io`
2021-06-11 16:51:10 +02:00
Rémi Verschelde 6b0183ec89
Merge pull request #49279 from Calinou/rename-string-is-abs-path-method
Rename `String.is_abs_path()` to `String.is_absolute_path()`
2021-06-11 15:58:16 +02:00