Add GDExtension support to Script

* Ability to create script languages from GDExtension
* Some additions to gdnative_extension.h to make this happen
* Moved the GDExtension binder to core

This now allows creating scripting languages from GDExtension, with the same ease as if it was a module. It replaces the old PluginScript from Godot 3.x.
Warning: GodotCPP will need to be updated to support this (it may be a bit of work as ScriptInstance needs to be created over there again).
This commit is contained in:
reduz 2022-03-26 16:48:43 +01:00
parent a5eed70fa2
commit 360dea5348
38 changed files with 2019 additions and 267 deletions

View file

@ -2296,6 +2296,18 @@ Vector<String> Engine::get_singleton_list() const {
return ret;
}
void Engine::register_script_language(ScriptLanguage *p_language) {
ScriptServer::register_language(p_language);
}
int Engine::get_script_language_count() {
return ScriptServer::get_language_count();
}
ScriptLanguage *Engine::get_script_language(int p_index) const {
return ScriptServer::get_language(p_index);
}
void Engine::set_editor_hint(bool p_enabled) {
::Engine::get_singleton()->set_editor_hint(p_enabled);
}
@ -2347,6 +2359,10 @@ void Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("unregister_singleton", "name"), &Engine::unregister_singleton);
ClassDB::bind_method(D_METHOD("get_singleton_list"), &Engine::get_singleton_list);
ClassDB::bind_method(D_METHOD("register_script_language", "language"), &Engine::register_script_language);
ClassDB::bind_method(D_METHOD("get_script_language_count"), &Engine::get_script_language_count);
ClassDB::bind_method(D_METHOD("get_script_language", "index"), &Engine::get_script_language);
ClassDB::bind_method(D_METHOD("is_editor_hint"), &Engine::is_editor_hint);
ClassDB::bind_method(D_METHOD("set_print_error_messages", "enabled"), &Engine::set_print_error_messages);