You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Replace BIND_VMETHOD by new GDVIRTUAL syntax
* New syntax is type safe. * New syntax allows for type safe virtuals in native extensions. * New syntax permits extremely fast calling. Note: Everything was replaced where possible except for `_gui_input` `_input` and `_unhandled_input`. These will require API rework on a separate PR as they work different than the rest of the functions. Added a new method flag METHOD_FLAG_OBJECT_CORE, used internally. Allows to not dump the core virtuals like `_notification` to the json API, since each language will implement those as it is best fits.
This commit is contained in:
@@ -54,17 +54,17 @@
|
||||
/*** SYNTAX HIGHLIGHTER ****/
|
||||
|
||||
String EditorSyntaxHighlighter::_get_name() const {
|
||||
ScriptInstance *si = get_script_instance();
|
||||
if (si && si->has_method("_get_name")) {
|
||||
return si->call("_get_name");
|
||||
String ret;
|
||||
if (GDVIRTUAL_CALL(_get_name, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return "Unnamed";
|
||||
}
|
||||
|
||||
Array EditorSyntaxHighlighter::_get_supported_languages() const {
|
||||
ScriptInstance *si = get_script_instance();
|
||||
if (si && si->has_method("_get_supported_languages")) {
|
||||
return si->call("_get_supported_languages");
|
||||
Array ret;
|
||||
if (GDVIRTUAL_CALL(_get_supported_languages, ret)) {
|
||||
return ret;
|
||||
}
|
||||
return Array();
|
||||
}
|
||||
@@ -81,9 +81,8 @@ Ref<EditorSyntaxHighlighter> EditorSyntaxHighlighter::_create() const {
|
||||
void EditorSyntaxHighlighter::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_get_edited_resource"), &EditorSyntaxHighlighter::_get_edited_resource);
|
||||
|
||||
BIND_VMETHOD(MethodInfo(Variant::STRING, "_get_name"));
|
||||
BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_supported_languages"));
|
||||
BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_supported_extentions"));
|
||||
GDVIRTUAL_BIND(_get_name)
|
||||
GDVIRTUAL_BIND(_get_supported_languages)
|
||||
}
|
||||
|
||||
////
|
||||
@@ -223,8 +222,6 @@ void ScriptEditorBase::_bind_methods() {
|
||||
// TODO: This signal is no use for VisualScript.
|
||||
ADD_SIGNAL(MethodInfo("search_in_files_requested", PropertyInfo(Variant::STRING, "text")));
|
||||
ADD_SIGNAL(MethodInfo("replace_in_files_requested", PropertyInfo(Variant::STRING, "text")));
|
||||
|
||||
BIND_VMETHOD(MethodInfo("_add_syntax_highlighter", PropertyInfo(Variant::OBJECT, "highlighter")));
|
||||
}
|
||||
|
||||
static bool _is_built_in_script(Script *p_script) {
|
||||
|
||||
Reference in New Issue
Block a user