You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +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:
@@ -172,7 +172,7 @@ Shader::~Shader() {
|
||||
|
||||
////////////
|
||||
|
||||
RES ResourceFormatLoaderShader::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> ResourceFormatLoaderShader::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) {
|
||||
if (r_error) {
|
||||
*r_error = ERR_FILE_CANT_OPEN;
|
||||
}
|
||||
@@ -210,7 +210,7 @@ String ResourceFormatLoaderShader::get_resource_type(const String &p_path) const
|
||||
return "";
|
||||
}
|
||||
|
||||
Error ResourceFormatSaverShader::save(const String &p_path, const RES &p_resource, uint32_t p_flags) {
|
||||
Error ResourceFormatSaverShader::save(const String &p_path, const Ref<Resource> &p_resource, uint32_t p_flags) {
|
||||
Ref<Shader> shader = p_resource;
|
||||
ERR_FAIL_COND_V(shader.is_null(), ERR_INVALID_PARAMETER);
|
||||
|
||||
@@ -229,7 +229,7 @@ Error ResourceFormatSaverShader::save(const String &p_path, const RES &p_resourc
|
||||
return OK;
|
||||
}
|
||||
|
||||
void ResourceFormatSaverShader::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const {
|
||||
void ResourceFormatSaverShader::get_recognized_extensions(const Ref<Resource> &p_resource, List<String> *p_extensions) const {
|
||||
if (const Shader *shader = Object::cast_to<Shader>(*p_resource)) {
|
||||
if (shader->is_text_shader()) {
|
||||
p_extensions->push_back("gdshader");
|
||||
@@ -237,6 +237,6 @@ void ResourceFormatSaverShader::get_recognized_extensions(const RES &p_resource,
|
||||
}
|
||||
}
|
||||
|
||||
bool ResourceFormatSaverShader::recognize(const RES &p_resource) const {
|
||||
bool ResourceFormatSaverShader::recognize(const Ref<Resource> &p_resource) const {
|
||||
return p_resource->get_class_name() == "Shader"; //only shader, not inherited
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user