Commit Graph

57 Commits

Author SHA1 Message Date
a149280cea ClassDB: Use AHashMap for property_setget and constant/signal_map 2025-10-28 16:24:54 -03:00
93fd5c7ad0 Merge pull request #110907 from beicause/extension-deconstruct-before-object
Free script and extension instance before object deconstructing
2025-09-30 18:35:10 -05:00
727066fe1f Free script and extension instance before object deconstructing
Co-Authored-By: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-09-26 18:15:08 +08:00
a50fc5acd8 Change ClassDB::get_class_list and related stuff. 2025-09-16 15:00:33 +08:00
d237e31a89 Style: Remove redundant DEBUG_METHODS_ENABLED
• Replaced with functionally identical and far more ubiquitous `DEBUG_ENABLED`
2025-05-15 13:09:41 -05:00
a404b668a1 Change Node set_name to use StringName 2025-05-01 15:15:19 -07:00
91fe434a86 Always use String as StringName backing internally. 2025-04-23 14:57:03 +02:00
e6d166344b Remove unused get_inheritance_list_static from GDCLASS. 2025-04-03 17:18:28 +02:00
1f1b1c56e7 Merge pull request #104381 from Ivorforce/object-notification-nobool
Optimize `Object::notification` by avoiding runtime branches
2025-04-01 19:53:37 -05:00
8a76e31547 Remove bool from Object::notification virtual function; replace with separate functions to avoid branching. 2025-04-01 15:26:32 +02:00
fa0a3c9c6e Add and require GDSOFTCLASS for Object subclasses that want to cast but do not use GDCLASS. 2025-03-31 20:49:50 +02:00
75881f8322 Use initializer list in Arrays 2025-03-26 18:38:15 +01:00
b377562b52 Merge pull request #91660 from AThousandShips/methodinfo_vec
[Core] Use `Vector` for `MethodInfo::arguments`
2025-03-14 10:06:13 -05:00
66e9c2f998 [Tests] Add check for argument name validity
Checks that all method and signal arguments have valid names
2025-03-10 14:57:21 +01:00
d9721954e6 [Core] Use Vector for MethodInfo::arguments 2025-03-10 13:57:53 +01:00
324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
03b05cf9ac Core: Fix built-in enum constant bindings 2024-11-22 14:03:21 +03:00
0d350e7108 Set clang-format RemoveSemicolon rule to true
- Set clang-format `Standard` rule to `c++20`
2024-10-25 13:49:43 -04:00
bb77520599 Object: Add tests about the safety of tail destruction 2024-09-16 09:58:47 +02:00
c409e6d722 Import/export GLTF extras to node->meta
This is useful for custom tagging of objects with properties (for example in Blender) and having this available in the editor for scripting.

- Adds import logic to propagate the parsed GLTF extras all the way to the resulting Node->meta
- Adds export logic to save Godot Object meta into GLTF extras
- Supports `nodes`, `meshes` and `materials` (in GLTF sense of the words)
2024-08-29 19:17:04 +02:00
8bf4ecc026 Add String.is_valid_unicode_identifier()
- Adds `is_valid_unicode_identifier()`
- Adds `is_valid_ascii_identifier()`
- Deprecates `is_valid_identifier()`
- Renames `validate_identifier()` to `validate_ascii_identifier()`
2024-08-27 11:34:08 +08:00
61998b1a05 [Tests] Ensure all default method arguments can be encoded
Checks that all arguments of bound methods can be encoded in extensions, checking non-empty or non-null cases for containers and objects
2024-08-16 19:57:03 +02:00
5ced75aeb1 Fix Vector4, Vector4i, and Projection missing from ClassDB tests 2024-08-14 02:59:59 -07:00
ea2e6be0a6 [Tests] Fix some invalid error messages
These used `utf8().get_data()` when they should be passed as `String`
2024-07-10 15:57:52 +02:00
17929a3443 [Tests] Fix unit tests in template builds 2024-06-29 18:35:50 +02:00
413c11357d Use Core/Scene stringnames consistently 2024-05-13 23:41:07 +02:00
a262d2d881 Add shorthand for using singleton string names 2024-05-11 18:53:08 +02:00
a0dbdcc3ab Replace find with contains/has where applicable
* Replaces `find(...) != -1` with `contains` for `String`
* Replaces `find(...) == -1` with `!contains` for `String`
* Replaces `find(...) != -1` with `has` for containers
* Replaces `find(...) == -1` with `!has` for containers
2024-05-08 12:37:42 +02:00
955d5affa8 Reduce and prevent unnecessary random-access to List
Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when
accessing a single element)

* Removed subscript operator, in favor of a more explicit `get`
* Added conversion from `Iterator` to `ConstIterator`
* Remade existing operations into other solutions when applicable
2024-05-04 16:08:55 +02:00
f9b488508c Add PackedVector4Array Variant type
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-05-03 00:58:27 +02:00
59bcc2888c Add methods to get argument count of methods
Added to:
* `Callable`s
* `Object`s
* `ClassDB`
* `Script(Instance)`s
2024-03-10 11:02:43 +01:00
f249667dc8 Fixed MERGE_ALL commit from repeating actions 2024-03-05 23:40:26 +00:00
c4705a590b Fix Object::notification order
Previously the `p_reversed` parameter didn't influence the order
in a correct way.
Also script overridden _notification functions were not called in
the correct order.

To fix this some `notification` functions had to add a `p_reversed`
parameter.

This made it necessary to adjust cpp-bindings.

Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-08-30 00:15:55 +02:00
67db4693eb Expose _validate_property() for scripting 2023-08-28 15:18:48 +02:00
951ea2415b Make EditorInterface accessible as a singleton
- EditorPlugin.get_editor_interface() is removed as redundant.
2023-08-09 16:01:31 +02:00
53ba9ccb19 Merge pull request #72346 from myaaaaaaaaa/disconnect-order
Avoid sorting CallableCustomMethodPointers by their actual address values
2023-07-26 18:39:08 +02:00
5cc961627d Avoid sorting CallableCustomMethodPointers by their actual address values 2023-06-20 08:40:01 -04:00
8e7afec479 Fix various errors when running the unit tests
Co-authored-by: bruvzg <7645683+bruvzg@users.noreply.github.com>
2023-05-09 18:40:56 +02:00
1ec5381c16 Store Object signals in a HashMap rather than a VMap 2023-02-25 18:44:09 -05:00
83026126d4 Add tests to ensure bound methods and signals are valid identifiers 2023-01-23 21:19:57 +01:00
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
b9be3ce75e Add tests for signals
- Adding signals
- Emitting signals
2022-12-29 16:07:45 +01:00
8f5d56e04a [GDExtension] Use function names with underscore for TextServer extension, add macros to generate wrappers for module functions. 2022-09-28 10:04:11 +03:00
980f5f32f4 Make property_*_revert methods multilevel and expose them for scripting 2022-08-18 00:03:53 +03:00
1362bc22bd Add tests for empty/unnamed arguments to ClassDB, Variant, GDScript 2022-08-08 16:36:01 +03:00
62423b691e Tests: Silence some intentional errors
Also fix printing messages in ClassDB test.
2022-08-04 22:03:44 +02:00
ca7d572908 [Net] Modularize multiplayer, expose MultiplayerAPI to extensions.
- RPC configurations are now dictionaries.
- Script.get_rpc_methods renamed to Script.get_rpc_config.
- Node.rpc[_id] and Callable.rpc now return an Error.
- Refactor MultiplayerAPI to allow extension.
- New MultiplayerAPI.rpc method with Array argument (for scripts).
- Move the default MultiplayerAPI implementation to a module.
2022-07-26 09:31:12 +02:00
5ac42cf576 Implement a BitField hint
Allows to specify the binder that an enum must be treated as a bitfield.
2022-07-05 22:13:37 +02:00
860e24683f Make enum/constant binds 64-bit. 2022-06-17 16:36:26 +03:00
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00