diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-01-07 16:14:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 16:14:28 +0100 |
commit | 6a27d7361ac2055cd432a98922a7d002326878fb (patch) | |
tree | 3b4428495adcc33843fbcf812326dc1db6e4cf27 /editor/editor_resource_picker.cpp | |
parent | 129418962f47cc1ee6989385100dd1470960adfe (diff) | |
parent | 7d37f76241c7b2a946a581c5624214409f38448e (diff) |
Merge pull request #56321 from pycbouh/core-use-gdvirtual-everywhere
Diffstat (limited to 'editor/editor_resource_picker.cpp')
-rw-r--r-- | editor/editor_resource_picker.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 421d16313a..c649162d7e 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -387,8 +387,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) { void EditorResourcePicker::set_create_options(Object *p_menu_node) { _ensure_resource_menu(); // 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 (GDVIRTUAL_CALL(_set_create_options, p_menu_node)) { return; } @@ -444,8 +443,9 @@ 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); + bool success; + if (GDVIRTUAL_CALL(_handle_menu_selected, p_which, success)) { + return success; } return false; @@ -706,8 +706,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"))); + GDVIRTUAL_BIND(_set_create_options, "menu_node"); + GDVIRTUAL_BIND(_handle_menu_selected, "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", PROPERTY_USAGE_NONE), "set_edited_resource", "get_edited_resource"); |