You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 19:11:41 +00:00
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.
This commit is contained in:
@@ -1178,7 +1178,7 @@ Error EditorNode::load_resource(const String &p_resource, bool p_ignore_broken_d
|
||||
|
||||
Error err;
|
||||
|
||||
RES res;
|
||||
Ref<Resource> res;
|
||||
if (ResourceLoader::exists(p_resource, "")) {
|
||||
res = ResourceLoader::load(p_resource, "", ResourceFormatLoader::CACHE_MODE_REUSE, &err);
|
||||
} else if (textfile_extensions.has(p_resource.get_extension())) {
|
||||
@@ -1420,7 +1420,7 @@ void EditorNode::_set_scene_metadata(const String &p_file, int p_idx) {
|
||||
ERR_FAIL_COND_MSG(err != OK, "Cannot save config file to '" + path + "'.");
|
||||
}
|
||||
|
||||
bool EditorNode::_find_and_save_resource(RES p_res, Map<RES, bool> &processed, int32_t flags) {
|
||||
bool EditorNode::_find_and_save_resource(Ref<Resource> p_res, Map<Ref<Resource>, bool> &processed, int32_t flags) {
|
||||
if (p_res.is_null()) {
|
||||
return false;
|
||||
}
|
||||
@@ -1446,7 +1446,7 @@ bool EditorNode::_find_and_save_resource(RES p_res, Map<RES, bool> &processed, i
|
||||
}
|
||||
}
|
||||
|
||||
bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool> &processed, int32_t flags) {
|
||||
bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<Ref<Resource>, bool> &processed, int32_t flags) {
|
||||
bool ret_changed = false;
|
||||
List<PropertyInfo> pi;
|
||||
obj->get_property_list(&pi);
|
||||
@@ -1457,7 +1457,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool>
|
||||
|
||||
switch (E.type) {
|
||||
case Variant::OBJECT: {
|
||||
RES res = obj->get(E.name);
|
||||
Ref<Resource> res = obj->get(E.name);
|
||||
|
||||
if (_find_and_save_resource(res, processed, flags)) {
|
||||
ret_changed = true;
|
||||
@@ -1469,7 +1469,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool>
|
||||
int len = varray.size();
|
||||
for (int i = 0; i < len; i++) {
|
||||
const Variant &v = varray.get(i);
|
||||
RES res = v;
|
||||
Ref<Resource> res = v;
|
||||
if (_find_and_save_resource(res, processed, flags)) {
|
||||
ret_changed = true;
|
||||
}
|
||||
@@ -1482,7 +1482,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool>
|
||||
d.get_key_list(&keys);
|
||||
for (const Variant &F : keys) {
|
||||
Variant v = d[F];
|
||||
RES res = v;
|
||||
Ref<Resource> res = v;
|
||||
if (_find_and_save_resource(res, processed, flags)) {
|
||||
ret_changed = true;
|
||||
}
|
||||
@@ -1496,7 +1496,7 @@ bool EditorNode::_find_and_save_edited_subresources(Object *obj, Map<RES, bool>
|
||||
return ret_changed;
|
||||
}
|
||||
|
||||
void EditorNode::_save_edited_subresources(Node *scene, Map<RES, bool> &processed, int32_t flags) {
|
||||
void EditorNode::_save_edited_subresources(Node *scene, Map<Ref<Resource>, bool> &processed, int32_t flags) {
|
||||
_find_and_save_edited_subresources(scene, processed, flags);
|
||||
|
||||
for (int i = 0; i < scene->get_child_count(); i++) {
|
||||
@@ -1637,7 +1637,7 @@ static bool _find_edited_resources(const Ref<Resource> &p_resource, Set<Ref<Reso
|
||||
|
||||
for (const PropertyInfo &E : plist) {
|
||||
if (E.type == Variant::OBJECT && E.usage & PROPERTY_USAGE_STORAGE && !(E.usage & PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT)) {
|
||||
RES res = p_resource->get(E.name);
|
||||
Ref<Resource> res = p_resource->get(E.name);
|
||||
if (res.is_null()) {
|
||||
continue;
|
||||
}
|
||||
@@ -2043,7 +2043,7 @@ bool EditorNode::item_has_editor(Object *p_object) {
|
||||
return editor_data.get_subeditors(p_object).size() > 0;
|
||||
}
|
||||
|
||||
void EditorNode::edit_item_resource(RES p_resource) {
|
||||
void EditorNode::edit_item_resource(Ref<Resource> p_resource) {
|
||||
edit_item(p_resource.ptr());
|
||||
}
|
||||
|
||||
@@ -2128,7 +2128,7 @@ void EditorNode::_save_default_environment() {
|
||||
Ref<Environment> fallback = get_tree()->get_root()->get_world_3d()->get_fallback_environment();
|
||||
|
||||
if (fallback.is_valid() && fallback->get_path().is_resource_file()) {
|
||||
Map<RES, bool> processed;
|
||||
Map<Ref<Resource>, bool> processed;
|
||||
_find_and_save_edited_subresources(fallback.ptr(), processed, 0);
|
||||
save_resource_in_path(fallback, fallback->get_path());
|
||||
}
|
||||
@@ -2166,7 +2166,7 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
|
||||
ObjectID current = editor_history.get_current();
|
||||
Object *current_obj = current.is_valid() ? ObjectDB::get_instance(current) : nullptr;
|
||||
|
||||
RES res = Object::cast_to<Resource>(current_obj);
|
||||
Ref<Resource> res = Object::cast_to<Resource>(current_obj);
|
||||
if (p_skip_foreign && res.is_valid()) {
|
||||
if (res->get_path().find("::") > -1 && res->get_path().get_slice("::", 0) != editor_data.get_scene_path(get_current_tab())) {
|
||||
// Trying to edit resource that belongs to another scene; abort.
|
||||
@@ -3762,7 +3762,7 @@ void EditorNode::open_request(const String &p_path) {
|
||||
load_scene(p_path); // As it will be opened in separate tab.
|
||||
}
|
||||
|
||||
void EditorNode::edit_foreign_resource(RES p_resource) {
|
||||
void EditorNode::edit_foreign_resource(Ref<Resource> p_resource) {
|
||||
load_scene(p_resource->get_path().get_slice("::", 0));
|
||||
InspectorDock::get_singleton()->call_deferred("edit_resource", p_resource);
|
||||
}
|
||||
@@ -5699,7 +5699,7 @@ void EditorNode::_rendering_driver_selected(int p_which) {
|
||||
_update_rendering_driver_color();
|
||||
}
|
||||
|
||||
void EditorNode::_resource_saved(RES p_resource, const String &p_path) {
|
||||
void EditorNode::_resource_saved(Ref<Resource> p_resource, const String &p_path) {
|
||||
if (EditorFileSystem::get_singleton()) {
|
||||
EditorFileSystem::get_singleton()->update_file(p_path);
|
||||
}
|
||||
@@ -5707,7 +5707,7 @@ void EditorNode::_resource_saved(RES p_resource, const String &p_path) {
|
||||
singleton->editor_folding.save_resource_folding(p_resource, p_path);
|
||||
}
|
||||
|
||||
void EditorNode::_resource_loaded(RES p_resource, const String &p_path) {
|
||||
void EditorNode::_resource_loaded(Ref<Resource> p_resource, const String &p_path) {
|
||||
singleton->editor_folding.load_resource_folding(p_resource, p_path);
|
||||
}
|
||||
|
||||
@@ -5905,7 +5905,7 @@ EditorNode::EditorNode() {
|
||||
// Only if no touchscreen ui hint, disable emulation just in case.
|
||||
id->set_emulate_touch_from_mouse(false);
|
||||
}
|
||||
DisplayServer::get_singleton()->cursor_set_custom_image(RES());
|
||||
DisplayServer::get_singleton()->cursor_set_custom_image(Ref<Resource>());
|
||||
}
|
||||
|
||||
singleton = this;
|
||||
|
||||
Reference in New Issue
Block a user