Merge pull request #84944 from KoBeWi/legacy_of_ancient_godots

Fix some legacy code
This commit is contained in:
Rémi Verschelde 2024-08-26 23:28:14 +02:00
commit ac5a528620
No known key found for this signature in database
GPG key ID: C3336907360768E1
4 changed files with 11 additions and 22 deletions

View file

@ -416,21 +416,15 @@ void Resource::_take_over_path(const String &p_path) {
} }
RID Resource::get_rid() const { RID Resource::get_rid() const {
if (get_script_instance()) { RID ret;
Callable::CallError ce; if (!GDVIRTUAL_CALL(_get_rid, ret)) {
RID ret = get_script_instance()->callp(SNAME("_get_rid"), nullptr, 0, ce); #ifndef DISABLE_DEPRECATED
if (ce.error == Callable::CallError::CALL_OK && ret.is_valid()) {
return ret;
}
}
if (_get_extension() && _get_extension()->get_rid) { if (_get_extension() && _get_extension()->get_rid) {
RID ret = RID::from_uint64(_get_extension()->get_rid(_get_extension_instance())); ret = RID::from_uint64(_get_extension()->get_rid(_get_extension_instance()));
if (ret.is_valid()) { }
#endif
}
return ret; return ret;
}
}
return RID();
} }
#ifdef TOOLS_ENABLED #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_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"); 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<String>(), true);
GDVIRTUAL_BIND(_setup_local_to_scene); GDVIRTUAL_BIND(_setup_local_to_scene);
GDVIRTUAL_BIND(_get_rid);
} }
Resource::Resource() : Resource::Resource() :

View file

@ -87,6 +87,8 @@ protected:
virtual void reset_local_to_scene(); virtual void reset_local_to_scene();
GDVIRTUAL0(_setup_local_to_scene); GDVIRTUAL0(_setup_local_to_scene);
GDVIRTUAL0RC(RID, _get_rid);
public: public:
static Node *(*_get_local_scene_func)(); //used by editor static Node *(*_get_local_scene_func)(); //used by editor
static void (*_update_configuration_warning)(); //used by editor static void (*_update_configuration_warning)(); //used by editor

View file

@ -14,7 +14,7 @@
<link title="When and how to avoid using nodes for everything">$DOCS_URL/tutorials/best_practices/node_alternatives.html</link> <link title="When and how to avoid using nodes for everything">$DOCS_URL/tutorials/best_practices/node_alternatives.html</link>
</tutorials> </tutorials>
<methods> <methods>
<method name="_get_rid" qualifiers="virtual"> <method name="_get_rid" qualifiers="virtual const">
<return type="RID" /> <return type="RID" />
<description> <description>
Override this method to return a custom [RID] when [method get_rid] is called. Override this method to return a custom [RID] when [method get_rid] is called.

View file

@ -4415,13 +4415,9 @@ bool ScriptEditorPlugin::handles(Object *p_object) const {
void ScriptEditorPlugin::make_visible(bool p_visible) { void ScriptEditorPlugin::make_visible(bool p_visible) {
if (p_visible) { if (p_visible) {
window_wrapper->show(); window_wrapper->show();
script_editor->set_process(true);
script_editor->ensure_select_current(); script_editor->ensure_select_current();
} else { } else {
window_wrapper->hide(); window_wrapper->hide();
if (!window_wrapper->get_window_enabled()) {
script_editor->set_process(false);
}
} }
} }