diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/material.cpp | 2 | ||||
-rw-r--r-- | scene/resources/shader.cpp | 20 |
2 files changed, 6 insertions, 16 deletions
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index 55bb4e9073..b4ea60cb8d 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -535,6 +535,8 @@ void ShaderMaterial::_shader_changed() { void ShaderMaterial::set_shader(const Ref<Shader>& p_shader) { + ERR_FAIL_COND(p_shader.is_valid() && p_shader->get_mode()!=Shader::MODE_MATERIAL); + if (shader.is_valid()) shader->disconnect(SceneStringNames::get_singleton()->changed,this,SceneStringNames::get_singleton()->_shader_changed); shader=p_shader; diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index a9376faf62..f0a2721016 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -448,31 +448,19 @@ RES ResourceFormatLoaderShader::load(const String &p_path, const String& p_origi void ResourceFormatLoaderShader::get_recognized_extensions(List<String> *p_extensions) const { - p_extensions->push_back("shader"); + ObjectTypeDB::get_extensions_for_type("Shader", p_extensions); } + bool ResourceFormatLoaderShader::handles_type(const String& p_type) const { - return p_type=="Shader"; + return ObjectTypeDB::is_type(p_type, "Shader"); } String ResourceFormatLoaderShader::get_resource_type(const String &p_path) const { - if (p_path.extension().to_lower()=="shader") + if (p_path.extension().to_lower()=="shd") return "Shader"; return ""; } - - - - - - - - - - - - - |