diff --git a/core/io/resource.cpp b/core/io/resource.cpp index 432adb88da9..598c99c1880 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -416,21 +416,15 @@ void Resource::_take_over_path(const String &p_path) { } RID Resource::get_rid() const { - if (get_script_instance()) { - Callable::CallError ce; - RID ret = get_script_instance()->callp(SNAME("_get_rid"), nullptr, 0, ce); - if (ce.error == Callable::CallError::CALL_OK && ret.is_valid()) { - return ret; + RID ret; + if (!GDVIRTUAL_CALL(_get_rid, ret)) { +#ifndef DISABLE_DEPRECATED + if (_get_extension() && _get_extension()->get_rid) { + ret = RID::from_uint64(_get_extension()->get_rid(_get_extension_instance())); } +#endif } - if (_get_extension() && _get_extension()->get_rid) { - RID ret = RID::from_uint64(_get_extension()->get_rid(_get_extension_instance())); - if (ret.is_valid()) { - return ret; - } - } - - return RID(); + return ret; } #ifdef TOOLS_ENABLED @@ -558,11 +552,8 @@ void Resource::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::STRING, "resource_name"), "set_name", "get_name"); ADD_PROPERTY(PropertyInfo(Variant::STRING, "resource_scene_unique_id", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_scene_unique_id", "get_scene_unique_id"); - MethodInfo get_rid_bind("_get_rid"); - get_rid_bind.return_val.type = Variant::RID; - - ::ClassDB::add_virtual_method(get_class_static(), get_rid_bind, true, Vector(), true); GDVIRTUAL_BIND(_setup_local_to_scene); + GDVIRTUAL_BIND(_get_rid); } Resource::Resource() : diff --git a/core/io/resource.h b/core/io/resource.h index cc8a0d4387d..2c1a4312553 100644 --- a/core/io/resource.h +++ b/core/io/resource.h @@ -87,6 +87,8 @@ protected: virtual void reset_local_to_scene(); GDVIRTUAL0(_setup_local_to_scene); + GDVIRTUAL0RC(RID, _get_rid); + public: static Node *(*_get_local_scene_func)(); //used by editor static void (*_update_configuration_warning)(); //used by editor diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml index 74d083594f2..fe09472c149 100644 --- a/doc/classes/Resource.xml +++ b/doc/classes/Resource.xml @@ -14,7 +14,7 @@ $DOCS_URL/tutorials/best_practices/node_alternatives.html - + Override this method to return a custom [RID] when [method get_rid] is called. diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index c51eb44aee4..83c658dcf0f 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -4412,13 +4412,9 @@ bool ScriptEditorPlugin::handles(Object *p_object) const { void ScriptEditorPlugin::make_visible(bool p_visible) { if (p_visible) { window_wrapper->show(); - script_editor->set_process(true); script_editor->ensure_select_current(); } else { window_wrapper->hide(); - if (!window_wrapper->get_window_enabled()) { - script_editor->set_process(false); - } } }