Commit graph

89 commits

Author SHA1 Message Date
Rémi Verschelde
ee931e2be5
Merge pull request #76814 from KoBeWi/underdata
Don't refresh inspector when changing internal meta
2023-05-09 17:44:49 +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
kobewi
5e3a985c91 Don't refresh inspector when changing internal meta 2023-05-07 22:12:22 +02:00
RedworkDE
1a4eccf7e7 Prevent infinite loop when signal disconnection fails during object deletion. 2023-05-05 13:34:25 +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
Rémi Verschelde
e0e93ce094
Merge pull request #72421 from myaaaaaaaaa/signal-hashmap
Store Object signals in a HashMap rather than a VMap
2023-04-25 19:26:35 +02:00
Pedro J. Estébanez
2f4168daeb Fix edge cases of object lifetime when signals involved 2023-04-11 17:27:39 +02:00
Juan Linietsky
8950943356 Optimize Object::get_class_name
* Run the static function once per class instead of one per instance.
* Saves some memory in Object derived classes.
2023-04-08 19:25:50 +02:00
kobewi
8f8178bda6 Fix auto-translations in editor 2023-03-22 23:57:12 +01:00
myaaaaaaaaa
1ec5381c16 Store Object signals in a HashMap rather than a VMap 2023-02-25 18:44:09 -05:00
Rémi Verschelde
2b55ac445b
Merge pull request #72111 from raulsntos/method-info-metadata
Add `GodotTypeInfo::Metadata` to `MethodInfo`
2023-01-27 15:41:38 +01:00
Raul Santos
cac7a784d6
Add GodotTypeInfo::Metadata to MethodInfo 2023-01-26 15:51:34 +01:00
Aaron Franke
2a65f6812b
Add PROPERTY_USAGE_NEVER_DUPLICATE flag and use for script
Co-authored-by: Yakov Borevich <j.borevich@gmail.com>
2023-01-24 16:37:50 -06: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
Juan Linietsky
0e0a6bb39b
Removed unused property hints and Object::get_translatable_strings()
* Remove unused `EditorPropertyMember` and related hints, previouly used by
  VisualScript. Such logic should be implemented in the VS module itself.
* As the above broke compatibility with the VS module, clean up the other
  hacks that were still in core in support of VisualScript.
* `PROPERTY_USAGE_INTERNATIONALIZED` was only used in Object's
  `get_translatable_strings()`, which is a legacy function not used anywhere.
  So both are removed.
* Reordered some usage flags after the above removal to minimize the diff.
* General clean up.

Fixes #30203.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-01-09 16:56:01 +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
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
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
Yuri Sizov
a9961b378a Add missing public property_*_revert getters 2022-11-29 23:07:40 +03:00
Emmanuel Leblond
1e8756c94b
Use StringName in the whole GDExtension API instead of const char * 2022-11-08 21:44:07 +01:00
Rémi Verschelde
6ad5637ffc Merge pull request #66427 from Mickeon/object-methods-autocompletion
Add autocompletion to several Object methods
2022-10-13 18:41:24 +02:00
Micky
dc51ff8c5b Rename set/get_indexed's "property" to "property_path"
Also touches up the Documentation slightly.
2022-10-12 10:27:44 +02:00
Micky
2a66ddb1bb Add autocompletion to several Object methods
Add autocompletion for the following Object methods:
-  `connect`, `is_connected`, `disconnect`, `emit_signal`, `has_signal`;
- `call`, `call_deferred`, `callv`, `has_method`;
- `set`, `set_deferred`, `get`;
- `set_meta`, `remove_meta`, `has_meta`, `remove_meta`.
2022-09-26 10:02:31 +02:00
Micky
dd26ecdd31 Rename CONNECT_ONESHOT TO CONNECT_ONE_SHOT
For consistency. Every other exposed `one_shot` is spaced out like this.
2022-09-06 19:00:33 +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
Rémi Verschelde
91e5f48ea7
Merge pull request #64009 from KoBeWi/arrayy_lmao
Replace Array return types with TypedArray (part 2)
2022-08-24 08:18:56 +02:00
kobewi
1abdffe7a0 Replace Array return types with TypedArray 2 2022-08-23 23:21:32 +02:00
bruvzg
56101080cc
[GDExtension] Fix _property_can_revert and _property_get_revert methods using incorrect string type. 2022-08-23 14:58:28 +03:00
Yuri Sizov
1a24c9e14b Make _validate_property a multilevel method 2022-08-22 18:35:11 +03:00
Yuri Sizov
980f5f32f4 Make property_*_revert methods multilevel and expose them for scripting 2022-08-18 00:03:53 +03:00
Hristo Stamenov
0e1f7e9f89 Removed faulty function update after get_property_list.
The function tried to rearrange properties but that lead to problems with duplication or deleted properties. Implemented the logic that that function did inside the get_property_list both for tool scripts and non-tool scripts.
2022-08-03 21:45:16 +03: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
Jan Haller
60ffadd133 GDExtension: reuse code with constructor PropertyInfo(const GDNativePropertyInfo&) 2022-06-29 19:30:01 +02:00
K. S. Ernest (iFire) Lee
9ddebc0c22 Add a const call mode to Object, Variant and Script.
For this to work safely (user not call queue_free or something in the expression), a const call mode was added to Object and Variant (and optionally Script).

This mode ensures only const functions can be called, making it safe to use from the editor.

Co-Authored-By: reduz <reduzio@gmail.com>
2022-06-27 13:33:06 -07:00
reduz
dd8c0522a6 Implement varargs in Methodinfo
Variadic templates are an awful thing. Implements #62233 using them in MethodInfo so less changes are required.
2022-06-23 14:50:38 +02:00
Marcus Elg
46bbbd9770 Allow autocompletion of "noslider" in export_range 2022-06-19 17:11:49 +02:00
kobewi
a3a029d4c6 Change set/get binding to use StringName 2022-06-14 16:27:33 +02:00
reduz
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
reduz
8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
reduz
0a57f964a3 Implement missing Node & Resource placeholders
Implemented by request of @neikeq to advance in the GDExtension version of Mono.

* If a Resource type is missing upon load, it will be remembered together with its data (Unless manually overriden).
* If a Node type is missing upon load, it will be also be remembered together with its data (unless deleted).

This feature makes working with GDExtension much easier, as it ensures that missing types no longer cause data loss.
2022-05-03 17:08:09 +02:00
Hugo Locurcio
180e5d3028
Remove RES and REF typedefs in favor of spelled out Ref<>
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
bruvzg
9381acb6a4
Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
Pierre-Thomas Meisels
63f7f44ccb Make vararg method bind no return and return
Type emit_signal exposed method return type

set UndoRedo add_do_method and add_undo_method exposed return void

Set TreeItem::_call_recursive_bind returns void

Set _rpc_bind and _rpc_id_bind returns void in Node

Set _call_group and _call_group_flags method returns void in SceneTree

Set godot-cpp-test CI flag to false
2022-03-30 11:43:12 +02:00
Rémi Verschelde
482cdeaf71
Merge pull request #58608 from KoBeWi/metadefault 2022-03-29 16:14:28 +02:00
Jan Haller
f88bdac403 GDExtension: change to_string signature to accept GDNativeStringPtr instead of returning const char* 2022-03-27 21:31:00 +02:00
reduz
09b951b99b Refactor Object metadata
* API kept the same (Although functions could be renamed to set_metadata/get_metadata in a later PR), so not much should change.
* Metadata now exposed as individual properties.
* Properties are editable in inspector (unless metadata name begins with _) under the metadata/ namespace.
* Added the ability to Add/Remove metadata properties to the inspector.

This is a functionality that was requested very often, that makes metadata work a bit more similar to custom properties in Blender.
2022-03-24 14:21:52 +01:00
kobewi
3eb7fc4bfd Add optional 'default' argument to get_meta() 2022-03-22 15:50:47 +01:00
Rémi Verschelde
741bbb9d7c
Merge pull request #58690 from elmordo/bugfix-57553-gdextension-inheritance-fix 2022-03-10 11:23:18 +01:00
reduz
21637dfc25 Remove VARIANT_ARG* macros
* Very old macros from the time Godot was created.
* Limited arguments to 5 (then later changed to 8) in many places.
* They were replaced by C++11 Variadic Templates.
* Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
* Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-09 18:39:13 +01:00
Ing. Petr Jindra
c4770e1605 fix of reading property list from custom nodes imported from GDExtension when inheritance between custom nodes is used 2022-03-02 18:50:00 +01:00