summaryrefslogtreecommitdiff
path: root/core/object
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2022-05-03 01:43:50 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-05-03 01:43:50 +0200
commit180e5d30286279c979507a571bf6d336aa49da9d (patch)
tree09c6d33aef3fd40a0f37a044d5eb6248e8a5f87b /core/object
parent87622861106b4bb06040a603060bedc2835648ba (diff)
Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`
These typedefs don't save much typing compared to the full `Ref<Resource>` and `Ref<RefCounted>`, yet they sometimes introduce confusion among new contributors.
Diffstat (limited to 'core/object')
-rw-r--r--core/object/object.cpp2
-rw-r--r--core/object/ref_counted.cpp4
-rw-r--r--core/object/ref_counted.h4
-rw-r--r--core/object/script_language.h2
4 files changed, 5 insertions, 7 deletions
diff --git a/core/object/object.cpp b/core/object/object.cpp
index 897b5d18de..1defd85a14 100644
--- a/core/object/object.cpp
+++ b/core/object/object.cpp
@@ -1476,7 +1476,7 @@ String Object::tr_n(const StringName &p_message, const StringName &p_message_plu
void Object::_clear_internal_resource_paths(const Variant &p_var) {
switch (p_var.get_type()) {
case Variant::OBJECT: {
- RES r = p_var;
+ Ref<Resource> r = p_var;
if (!r.is_valid()) {
return;
}
diff --git a/core/object/ref_counted.cpp b/core/object/ref_counted.cpp
index c9a7b2a608..726e2c012c 100644
--- a/core/object/ref_counted.cpp
+++ b/core/object/ref_counted.cpp
@@ -108,7 +108,7 @@ Variant WeakRef::get_ref() const {
}
RefCounted *r = cast_to<RefCounted>(obj);
if (r) {
- return REF(r);
+ return Ref<RefCounted>(r);
}
return obj;
@@ -118,7 +118,7 @@ void WeakRef::set_obj(Object *p_object) {
ref = p_object ? p_object->get_instance_id() : ObjectID();
}
-void WeakRef::set_ref(const REF &p_ref) {
+void WeakRef::set_ref(const Ref<RefCounted> &p_ref) {
ref = p_ref.is_valid() ? p_ref->get_instance_id() : ObjectID();
}
diff --git a/core/object/ref_counted.h b/core/object/ref_counted.h
index dcacf19890..bd06a84bd8 100644
--- a/core/object/ref_counted.h
+++ b/core/object/ref_counted.h
@@ -234,8 +234,6 @@ public:
}
};
-typedef Ref<RefCounted> REF;
-
class WeakRef : public RefCounted {
GDCLASS(WeakRef, RefCounted);
@@ -247,7 +245,7 @@ protected:
public:
Variant get_ref() const;
void set_obj(Object *p_object);
- void set_ref(const REF &p_ref);
+ void set_ref(const Ref<RefCounted> &p_ref);
WeakRef() {}
};
diff --git a/core/object/script_language.h b/core/object/script_language.h
index 69002c81f4..f58ef45743 100644
--- a/core/object/script_language.h
+++ b/core/object/script_language.h
@@ -323,7 +323,7 @@ public:
String display;
String insert_text;
Color font_color;
- RES icon;
+ Ref<Resource> icon;
Variant default_value;
Vector<Pair<int, int>> matches;
int location = LOCATION_OTHER;