- Implements the concept of GDExtension loaders that can be used to customize how GDExtensions are loaded and initialized.
- Moves the parsing of `.gdextension` config files to the new `GDExtensionLibraryLoader`.
- `GDExtensionManager` is now meant to be the main way to load/unload extensions and can optionally take a `GDExtensionLoader`.
- `EditorFileSystem` avoids unloading extensions if the file still exists, this should prevent unloading extensions that are outside the user project.
`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.
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
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>
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.