Skip to content

Commit ac5a528

Browse files
committed
Merge pull request #84944 from KoBeWi/legacy_of_ancient_godots
Fix some legacy code
2 parents 588cf16 + 0d1c388 commit ac5a528

File tree

4 files changed

+11
-22
lines changed

4 files changed

+11
-22
lines changed

core/io/resource.cpp

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -416,21 +416,15 @@ void Resource::_take_over_path(const String &p_path) {
416416
}
417417

418418
RID Resource::get_rid() const {
419-
if (get_script_instance()) {
420-
Callable::CallError ce;
421-
RID ret = get_script_instance()->callp(SNAME("_get_rid"), nullptr, 0, ce);
422-
if (ce.error == Callable::CallError::CALL_OK && ret.is_valid()) {
423-
return ret;
424-
}
425-
}
426-
if (_get_extension() && _get_extension()->get_rid) {
427-
RID ret = RID::from_uint64(_get_extension()->get_rid(_get_extension_instance()));
428-
if (ret.is_valid()) {
429-
return ret;
419+
RID ret;
420+
if (!GDVIRTUAL_CALL(_get_rid, ret)) {
421+
#ifndef DISABLE_DEPRECATED
422+
if (_get_extension() && _get_extension()->get_rid) {
423+
ret = RID::from_uint64(_get_extension()->get_rid(_get_extension_instance()));
430424
}
425+
#endif
431426
}
432-
433-
return RID();
427+
return ret;
434428
}
435429

436430
#ifdef TOOLS_ENABLED
@@ -558,11 +552,8 @@ void Resource::_bind_methods() {
558552
ADD_PROPERTY(PropertyInfo(Variant::STRING, "resource_name"), "set_name", "get_name");
559553
ADD_PROPERTY(PropertyInfo(Variant::STRING, "resource_scene_unique_id", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_scene_unique_id", "get_scene_unique_id");
560554

561-
MethodInfo get_rid_bind("_get_rid");
562-
get_rid_bind.return_val.type = Variant::RID;
563-
564-
::ClassDB::add_virtual_method(get_class_static(), get_rid_bind, true, Vector<String>(), true);
565555
GDVIRTUAL_BIND(_setup_local_to_scene);
556+
GDVIRTUAL_BIND(_get_rid);
566557
}
567558

568559
Resource::Resource() :

core/io/resource.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ class Resource : public RefCounted {
8787
virtual void reset_local_to_scene();
8888
GDVIRTUAL0(_setup_local_to_scene);
8989

90+
GDVIRTUAL0RC(RID, _get_rid);
91+
9092
public:
9193
static Node *(*_get_local_scene_func)(); //used by editor
9294
static void (*_update_configuration_warning)(); //used by editor

doc/classes/Resource.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<link title="When and how to avoid using nodes for everything">$DOCS_URL/tutorials/best_practices/node_alternatives.html</link>
1515
</tutorials>
1616
<methods>
17-
<method name="_get_rid" qualifiers="virtual">
17+
<method name="_get_rid" qualifiers="virtual const">
1818
<return type="RID" />
1919
<description>
2020
Override this method to return a custom [RID] when [method get_rid] is called.

editor/plugins/script_editor_plugin.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4415,13 +4415,9 @@ bool ScriptEditorPlugin::handles(Object *p_object) const {
44154415
void ScriptEditorPlugin::make_visible(bool p_visible) {
44164416
if (p_visible) {
44174417
window_wrapper->show();
4418-
script_editor->set_process(true);
44194418
script_editor->ensure_select_current();
44204419
} else {
44214420
window_wrapper->hide();
4422-
if (!window_wrapper->get_window_enabled()) {
4423-
script_editor->set_process(false);
4424-
}
44254421
}
44264422
}
44274423

0 commit comments

Comments
 (0)