diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2022-05-03 01:43:50 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2022-05-03 01:43:50 +0200 |
commit | 180e5d30286279c979507a571bf6d336aa49da9d (patch) | |
tree | 09c6d33aef3fd40a0f37a044d5eb6248e8a5f87b /drivers | |
parent | 87622861106b4bb06040a603060bedc2835648ba (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 'drivers')
-rw-r--r-- | drivers/gles3/storage/material_storage.cpp | 2 | ||||
-rw-r--r-- | drivers/gles3/texture_loader_gles3.cpp | 2 | ||||
-rw-r--r-- | drivers/gles3/texture_loader_gles3.h | 2 | ||||
-rw-r--r-- | drivers/png/resource_saver_png.cpp | 6 | ||||
-rw-r--r-- | drivers/png/resource_saver_png.h | 6 |
5 files changed, 9 insertions, 9 deletions
diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index 1b97e268df..8bfb09b83b 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -2232,7 +2232,7 @@ void MaterialStorage::global_variables_load_settings(bool p_load_textures) { } String path = value; - RES resource = ResourceLoader::load(path); + Ref<Resource> resource = ResourceLoader::load(path); ERR_CONTINUE(resource.is_null()); value = resource; } diff --git a/drivers/gles3/texture_loader_gles3.cpp b/drivers/gles3/texture_loader_gles3.cpp index 8c8724686d..ba4ddb3b37 100644 --- a/drivers/gles3/texture_loader_gles3.cpp +++ b/drivers/gles3/texture_loader_gles3.cpp @@ -37,7 +37,7 @@ #include <string.h> -RES ResourceFormatGLES2Texture::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { +Ref<Resource> ResourceFormatGLES2Texture::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress, CacheMode p_cache_mode) { unsigned int width = 8; unsigned int height = 8; diff --git a/drivers/gles3/texture_loader_gles3.h b/drivers/gles3/texture_loader_gles3.h index 54ddf80a96..6873858b89 100644 --- a/drivers/gles3/texture_loader_gles3.h +++ b/drivers/gles3/texture_loader_gles3.h @@ -38,7 +38,7 @@ class ResourceFormatGLES2Texture : public ResourceFormatLoader { public: - virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); + virtual Ref<Resource> load(const String &p_path, const String &p_original_path = "", Error *r_error = nullptr, bool p_use_sub_threads = false, float *r_progress = nullptr, CacheMode p_cache_mode = CACHE_MODE_REUSE); virtual void get_recognized_extensions(List<String> *p_extensions) const; virtual bool handles_type(const String &p_type) const; virtual String get_resource_type(const String &p_path) const; diff --git a/drivers/png/resource_saver_png.cpp b/drivers/png/resource_saver_png.cpp index 8633d2dc4e..704ddca726 100644 --- a/drivers/png/resource_saver_png.cpp +++ b/drivers/png/resource_saver_png.cpp @@ -35,7 +35,7 @@ #include "drivers/png/png_driver_common.h" #include "scene/resources/texture.h" -Error ResourceSaverPNG::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { +Error ResourceSaverPNG::save(const String &p_path, const Ref<Resource> &p_resource, uint32_t p_flags) { Ref<ImageTexture> texture = p_resource; ERR_FAIL_COND_V_MSG(!texture.is_valid(), ERR_INVALID_PARAMETER, "Can't save invalid texture as PNG."); @@ -72,11 +72,11 @@ Vector<uint8_t> ResourceSaverPNG::save_image_to_buffer(const Ref<Image> &p_img) return buffer; } -bool ResourceSaverPNG::recognize(const RES &p_resource) const { +bool ResourceSaverPNG::recognize(const Ref<Resource> &p_resource) const { return (p_resource.is_valid() && p_resource->is_class("ImageTexture")); } -void ResourceSaverPNG::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const { +void ResourceSaverPNG::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const { if (Object::cast_to<ImageTexture>(*p_resource)) { p_extensions->push_back("png"); } diff --git a/drivers/png/resource_saver_png.h b/drivers/png/resource_saver_png.h index f39e52c7ec..1a681faaec 100644 --- a/drivers/png/resource_saver_png.h +++ b/drivers/png/resource_saver_png.h @@ -39,9 +39,9 @@ public: static Error save_image(const String &p_path, const Ref<Image> &p_img); static Vector<uint8_t> save_image_to_buffer(const Ref<Image> &p_img); - virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); - virtual bool recognize(const RES &p_resource) const; - virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const; + virtual Error save(const String &p_path, const Ref<Resource> &p_resource, uint32_t p_flags = 0); + virtual bool recognize(const Ref<Resource> &p_resource) const; + virtual void get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const; ResourceSaverPNG(); }; |