From 3911e71a52cc001df5bc228ef42418c862260fc9 Mon Sep 17 00:00:00 2001 From: kobewi Date: Sun, 13 Jun 2021 01:32:28 +0200 Subject: Fix some virtual methods --- doc/classes/EditorPlugin.xml | 18 +++++++++--------- doc/classes/EditorResourcePicker.xml | 22 +++++++++++----------- editor/editor_plugin.cpp | 2 +- editor/editor_resource_picker.cpp | 12 ++++++------ 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml index 2736414cb1..0c0439e9d3 100644 --- a/doc/classes/EditorPlugin.xml +++ b/doc/classes/EditorPlugin.xml @@ -334,6 +334,15 @@ Restore the state saved by [method _get_state]. + + + + + + + Restore the plugin GUI layout saved by [method _get_window_layout]. + + @@ -697,15 +706,6 @@ Use this method if you always want to receive inputs from 3D view screen inside [method _forward_spatial_gui_input]. It might be especially usable if your plugin will want to use raycast in the scene. - - - - - - - Restore the plugin GUI layout saved by [method _get_window_layout]. - - diff --git a/doc/classes/EditorResourcePicker.xml b/doc/classes/EditorResourcePicker.xml index 508b546ef3..0029955819 100644 --- a/doc/classes/EditorResourcePicker.xml +++ b/doc/classes/EditorResourcePicker.xml @@ -10,30 +10,30 @@ - - - - - Returns a list of all allowed types and subtypes corresponding to the [member base_type]. If the [member base_type] is empty, an empty list is returned. - - - + - This virtual method can be implemented to handle context menu items not handled by default. See [method set_create_options]. + This virtual method can be implemented to handle context menu items not handled by default. See [method _set_create_options]. - + This virtual method is called when updating the context menu of [EditorResourcePicker]. Implement this method to override the "New ..." items with your own options. [code]menu_node[/code] is a reference to the [PopupMenu] node. - [b]Note:[/b] Implement [method handle_menu_selected] to handle these custom items. + [b]Note:[/b] Implement [method _handle_menu_selected] to handle these custom items. + + + + + + + Returns a list of all allowed types and subtypes corresponding to the [member base_type]. If the [member base_type] is empty, an empty list is returned. diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 091c5bea44..f2502b7e70 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -916,7 +916,7 @@ void EditorPlugin::_bind_methods() { BIND_VMETHOD(MethodInfo("_save_external_data")); BIND_VMETHOD(MethodInfo("_apply_changes")); BIND_VMETHOD(MethodInfo(Variant::PACKED_STRING_ARRAY, "_get_breakpoints")); - BIND_VMETHOD(MethodInfo("set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); + BIND_VMETHOD(MethodInfo("_set_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); BIND_VMETHOD(MethodInfo("_get_window_layout", PropertyInfo(Variant::OBJECT, "layout", PROPERTY_HINT_RESOURCE_TYPE, "ConfigFile"))); BIND_VMETHOD(MethodInfo(Variant::BOOL, "_build")); BIND_VMETHOD(MethodInfo("_enable_plugin")); diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 495e43577c..1ea8c71f85 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -361,8 +361,8 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) { void EditorResourcePicker::set_create_options(Object *p_menu_node) { // If a subclass implements this method, use it to replace all create items. - if (get_script_instance() && get_script_instance()->has_method("set_create_options")) { - get_script_instance()->call("set_create_options", p_menu_node); + if (get_script_instance() && get_script_instance()->has_method("_set_create_options")) { + get_script_instance()->call("_set_create_options", p_menu_node); return; } @@ -418,8 +418,8 @@ void EditorResourcePicker::set_create_options(Object *p_menu_node) { } bool EditorResourcePicker::handle_menu_selected(int p_which) { - if (get_script_instance() && get_script_instance()->has_method("handle_menu_selected")) { - return get_script_instance()->call("handle_menu_selected", p_which); + if (get_script_instance() && get_script_instance()->has_method("_handle_menu_selected")) { + return get_script_instance()->call("_handle_menu_selected", p_which); } return false; @@ -640,8 +640,8 @@ void EditorResourcePicker::_bind_methods() { ClassDB::bind_method(D_METHOD("set_editable", "enable"), &EditorResourcePicker::set_editable); ClassDB::bind_method(D_METHOD("is_editable"), &EditorResourcePicker::is_editable); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("set_create_options", PropertyInfo(Variant::OBJECT, "menu_node"))); - ClassDB::add_virtual_method(get_class_static(), MethodInfo("handle_menu_selected", PropertyInfo(Variant::INT, "id"))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo("_set_create_options", PropertyInfo(Variant::OBJECT, "menu_node"))); + ClassDB::add_virtual_method(get_class_static(), MethodInfo("_handle_menu_selected", PropertyInfo(Variant::INT, "id"))); ADD_PROPERTY(PropertyInfo(Variant::STRING, "base_type"), "set_base_type", "get_base_type"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_resource", PROPERTY_HINT_RESOURCE_TYPE, "Resource", 0), "set_edited_resource", "get_edited_resource"); -- cgit v1.2.3