Commit graph

69 commits

Author SHA1 Message Date
Joel Croteau
f44d6a235f Fix reload of GDExtension libraries in framework package on macos
`GDExtension::open_library` has a check in it to see if the library was loaded
from a temp file, and if it was to restore the original name as that is the one
we actually care about. This check is breaking extension reloading on Mac when
the library path is to a framework folder, as the file inside the framework
will not generally be the same name as the folder.

This check also shouldn't be necessary even on Windows, which is the only
platform that uses `generate_temp_files`, since disposal of the created temp
file is handled within `OS_Windows::open_dynamic_library`, and
`GDExtension::open_library` (which is the only function to call
`open_dynamic_library` with a `p_data` argument) only cares about the original
library file path and has to do extra work to remove the name of the temp file.
Instead, I have removed that check and set `OS_Windows::open_dynamic_library`
to return the name of the original file and not the name of the copy.

This fixes GDExtension reloading on macOS. I do not have a Windows machine
available to test that it still works properly on Windows, so someone should
check that before merging this.
2024-08-08 08:31:49 -06:00
Mai Lavelle
16eea2c837
Fix to restore library_path as absolute path 2024-07-14 20:37:38 -04:00
Rémi Verschelde
9d4a736d0c
Merge pull request #91502 from lyuma/gdextension_open_library_compat
Bind compatibility GDExtension methods removed in #88418
2024-05-30 11:47:43 +02:00
Lyuma
0e5e743258 Bind compatibility GDExtension methods removed in 88418
These functions were likely not used, but we must ensure they are still bound to ensure API stability.
2024-05-07 01:36:36 -07:00
A Thousand Ships
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
Jan Haller
27a637d287 GDExtension: provide free_property_list_func with length of array 2024-04-27 14:13:17 +02:00
David Snopek
45463f75d6 Fix ptrcalls to static GDExtension methods 2024-04-25 08:20:22 -05:00
Rémi Verschelde
e22743298a
Merge pull request #90961 from Lateasusual/gdextension-hot-reloading-borked
GDExtension: Fix missing library path breaking hot reloading
2024-04-22 22:18:34 +02:00
Chris Clyne
8564e94547 GDExtension: Fix missing library path breaking hot reloading 2024-04-20 21:08:11 +01:00
Fredia Huya-Kouadio
764de7fe31 Collapse the gdextension arguments into the GDExtensionData struct
This is used to reduce the number of arguments to `OS::open_dynamic_library(...)`.
2024-04-19 07:56:02 -07:00
Fredia Huya-Kouadio
ede88cf59d Fix loading GDExtension dependencies on Android 2024-04-19 07:55:08 -07:00
DmitriySalnikov
b73e740786 Add renaming of PDB files to avoid blocking them 2024-04-05 00:14:23 +03:00
Samuel Nicholas
5f89b15098
Print correct path when unable to find GDExtension library 2024-03-26 00:13:56 +01:00
Robert Yevdokimov
13e82094ee Remove word duplicates in comments and strings, and fix casing and punctuation 2024-02-23 17:28:28 -05:00
Rémi Verschelde
b652a81da7
Merge pull request #82554 from dsnopek/gdextension-placeholders
Allow registering "runtime classes" from GDExtension
2024-02-20 17:13:24 +01:00
David Snopek
ea75307a11 Allow registering "runtime classes" 2024-02-20 09:20:58 -06:00
Rémi Verschelde
e076405f30
GDExtension: Fix -Wtype-limits warning in compatibility_maximum patch check
And cleanup some dead code in `version.h`, we now always define `VERSION_PATCH`.
2024-02-19 01:19:30 +01:00
Rémi Verschelde
dc41f2504b
Merge pull request #88417 from dsnopek/gdextension-compatibility-maximum
Allow GDExtensions to set a `compatibility_maximum`
2024-02-19 00:08:14 +01:00
David Snopek
99fd6ca98c Unbind GDExtension methods that can't reasonably be used 2024-02-16 16:31:09 -06:00
David Snopek
2afa3557b4 Allow GDExtensions to set a compatibility_maximum 2024-02-16 16:02:55 -06:00
Muller-Castro
a8bc9f3e78 Add const lvalue ref to core/* container parameters 2024-02-14 11:20:36 -03:00
Rémi Verschelde
306dd5be3f
Merge pull request #87758 from dsnopek/gdextension-register-virtual-method
Allow GDExtensions to register virtual methods and call them on scripts
2024-02-12 23:29:37 +01:00
David Snopek
be11002e41 Allow GDExtensions to register virtual methods and call them on scripts 2024-02-12 13:29:18 -06:00
Mikhail Tishin
dc4c6cfb9b Add null check for gdextension deinitialization 2024-02-04 18:38:59 +03:00
Riteo
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
Muller-Castro
96a95cb974 Add const lvalue ref to container parameters 2024-01-05 14:49:57 -03:00
Daylily-Zeleen
fe6b073811 Distinguishs between dynamic library not found and can't be opened. 2024-01-01 20:01:57 +08:00
Rémi Verschelde
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
bruvzg
d4d5d68eda
[iOS, GDExtension] Fix loading and exporting static libraries and xcframeworks. 2023-11-09 20:04:40 +02:00
David Snopek
09fcc3a1ad Change GDExtension's library_path back to an absolute path 2023-11-09 11:24:57 -06:00
David Snopek
f86054e3a0 GDExtension: Save and compare modification times separately for reload 2023-11-02 08:29:22 -05:00
Mario Liebisch
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
Yuri Sizov
582ed157b5 Fix StringName leaks in GDExtension, core, and editor themes 2023-10-18 17:36:20 +02:00
David Snopek
16a86b9604 GDExtension: Prevent issues with the editor trying to reload GDExtensions through its usual mechanism 2023-10-13 13:24:29 -05:00
Rémi Verschelde
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
David Snopek
87cb0bfa50 GDExtension: Fix incorrect error message about vararg methods 2023-10-10 08:46:25 -05:00
David Snopek
88b6fee547 GDExtension: Use correct return pointer for validated calls that return Variant 2023-10-10 08:31:08 -05:00
A Thousand Ships
f18aa00e85 Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-10-08 17:23:33 +02:00
Rémi Verschelde
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
Rémi Verschelde
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
Mikael Hermansson
5c6353ae17 Fix extensions loading/initializing even when entry point fails 2023-10-05 18:24:58 +02:00
Yuri Sizov
d427851013 Resolve relative icon paths for GDExtensions 2023-10-05 12:49:31 +02:00
David Snopek
55596eaac6 GDExtension: Convert validated_call() to ptrcall() (rather than call()) 2023-10-04 10:53:17 -05:00
kkolyan
43f92e4752 Fix inconsistent last_modified_time handling (prevent GDExtension reload spam on Windows 10) 2023-10-01 22:05:57 +04:00
David Snopek
2733a6f762 Implement reloading of GDExtensions 2023-09-25 22:10:17 -05:00
Jeff Ward
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
David Snopek
6554ccf86d GDExtension: Delete left-over DLL copy before making a new copy 2023-09-12 09:57:40 -05:00
A Thousand Ships
893f889d74 [Core] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-11 19:45:49 +02:00
Rémi Verschelde
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
David Snopek
abef8e3874 Allow implementing Object::_validate_property() from GDExtension 2023-09-10 11:17:59 -05:00