Commit Graph

95 Commits

Author SHA1 Message Date
f468e59efd GDExtension: add an interface for loading extra documentation
Adds two new GDExtension interface methods:
 - `editor_help_load_xml_from_utf8_chars`
 - `editor_help_load_xml_from_utf8_chars_and_len`

Both of these methods parse the XML passed into an extra documentation
container which, when needed, is merged into the main doc container.

Co-Authored-By: Rémi Verschelde <rverschelde@gmail.com>
2024-01-26 13:53:33 +01:00
96a95cb974 Add const lvalue ref to container parameters 2024-01-05 14:49:57 -03:00
fe6b073811 Distinguishs between dynamic library not found and can't be opened. 2024-01-01 20:01:57 +08:00
dfe2df989d Merge pull request #84493 from bruvzg/gde_ios_static_fix
[iOS, GDExtension] Fix loading and exporting static libraries and xcframeworks.
2023-11-10 10:44:56 +01:00
d4d5d68eda [iOS, GDExtension] Fix loading and exporting static libraries and xcframeworks. 2023-11-09 20:04:40 +02:00
09fcc3a1ad Change GDExtension's library_path back to an absolute path 2023-11-09 11:24:57 -06:00
f86054e3a0 GDExtension: Save and compare modification times separately for reload 2023-11-02 08:29:22 -05:00
f2bcd7d61f GDExtension: Fixed error on loading extensions
Previously, before loading an extension, the editor just tried to
retrieve the extension by path to test if it's been loaded already.

While this is handled gracefully, it ignored an error thrown inside
`GDExtensionManager::get_extension()`, that would essentially still
report a not yet loaded extension to the engine's log:

```
ERROR: Condition "!E" is true. Returning: Ref<GDExtension>()
   at: GDExtensionManager::get_extension (core\extension\gdextension_manager.cpp:165)
```

This change actively checks whether the extension path is known and only
then proceeds to actually return the already loaded extension or loads
and returns the new one otherwise.
2023-10-21 17:00:18 +02:00
582ed157b5 Fix StringName leaks in GDExtension, core, and editor themes 2023-10-18 17:36:20 +02:00
16a86b9604 GDExtension: Prevent issues with the editor trying to reload GDExtensions through its usual mechanism 2023-10-13 13:24:29 -05:00
b40d90d333 Merge pull request #83107 from dsnopek/validated-method-vararg-message
GDExtension: Fix incorrect error message about vararg methods
2023-10-10 22:51:41 +02:00
87cb0bfa50 GDExtension: Fix incorrect error message about vararg methods 2023-10-10 08:46:25 -05:00
88b6fee547 GDExtension: Use correct return pointer for validated calls that return Variant 2023-10-10 08:31:08 -05:00
f18aa00e85 Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-10-08 17:23:33 +02:00
a6a2d0d159 Merge pull request #82794 from dsnopek/gdextension-validated-call
GDExtension: Convert `validated_call()` to `ptrcall()` (rather than `call()`)
2023-10-06 16:50:57 +02:00
7c56631419 Merge pull request #82861 from mihe/gdext-entry-false
Fix extensions loading/initializing even when entry point fails
2023-10-05 22:50:35 +02:00
5c6353ae17 Fix extensions loading/initializing even when entry point fails 2023-10-05 18:24:58 +02:00
d427851013 Resolve relative icon paths for GDExtensions 2023-10-05 12:49:31 +02:00
55596eaac6 GDExtension: Convert validated_call() to ptrcall() (rather than call()) 2023-10-04 10:53:17 -05:00
43f92e4752 Fix inconsistent last_modified_time handling (prevent GDExtension reload spam on Windows 10) 2023-10-01 22:05:57 +04:00
2733a6f762 Implement reloading of GDExtensions 2023-09-25 22:10:17 -05:00
60851af4da Add functions for non-ptr style virtual calls in GDExtension
This adds two functions to `GDExtensionClassCreationInfo` that allow for developers to supply a generic virtual call function along with user data to be sent to that call.

If `get_virutal_call_data_func` is not null, extensions call this function to get user data to pass to a supplied `call_virtual_with_data_func`. Both must be provided is one is provided.

If `get_virtual_call_data_func` is null, Godot falls back to the old `get_virtual_func` logic.

Fixes #63275

Co-authored-by: David Snopek <dsnopek@gmail.com>
2023-09-19 22:33:32 -04:00
6554ccf86d GDExtension: Delete left-over DLL copy before making a new copy 2023-09-12 09:57:40 -05:00
893f889d74 [Core] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-11 19:45:49 +02:00
43c7e8d3b5 Merge pull request #81515 from dsnopek/gdextension-validate-property-object
Allow implementing `Object::_validate_property()` from GDExtension
2023-09-11 15:40:05 +02:00
abef8e3874 Allow implementing Object::_validate_property() from GDExtension 2023-09-10 11:17:59 -05:00
41ffe5461f Allow GDExtension to register unexposed class. 2023-09-04 10:18:20 +08: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
908b8c0507 GDExtension: Remove DLL copy if it fails to load 2023-08-17 13:23:31 -05:00
1e3b1a7137 Merge pull request #80188 from vnen/gdextension-copy-dll
GDExtension: Copy DLL to a temp file before opening
2023-08-16 16:55:19 +02:00
97ef4a0536 Fix version check for GDExtension 2023-08-15 10:10:04 +02:00
cff69b0612 GDExtension: Copy DLL to a temp file before opening
This is done only in the editor and only on Windows, to avoid a file
lock that prevents the original library being updated (e.g. by a
compiler).

When the game runs it will load the original DLL and pick up any
changes, only the editor will stay with the copy (until it is restarted
and create a new copy).

The copy is done in place by prepending a `~` to the original file name,
so dependencies that are loaded with a relative file path still work.
When the library is unloaded the copy file is deleted. The copy is also
marked as hidden to not show up in explorer.
2023-08-11 10:44:23 -03:00
2173821b38 Add support for indexed properties in GDExtension 2023-07-21 22:59:24 +02:00
ef9cb793d3 Remove GDExtension compatibility code for Godot 4.0 2023-06-07 13:01:42 -05:00
699b66b62d Merge pull request #77010 from dsnopek/gdextension-editor-plugins
Allow GDExtensions to add editor plugins
2023-05-26 11:00:32 +02:00
3007163210 Allow GDExtensions to add editor plugins 2023-05-25 09:14:29 -05:00
80bf8fd186 Merge pull request #73511 from dsnopek/gdextension-object-name
Add GDExtension function to get Object class name
2023-05-22 14:02:59 +02:00
c6b0d4aae3 Add GDExtension function to get Object class name 2023-05-22 06:58:59 -05:00
402b3d146a Bind forgotten default value for GDExtension::open_library argument 2023-05-22 00:14:55 +02:00
9b9482d4bb Rework GDExtension interface from a struct to loading function pointers 2023-05-16 10:27:46 -05:00
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
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
ee2cc347c6 Add support for icons in GDExtension classes
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2023-03-31 21:39:02 +02: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
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