diff options
author | Franklin Sobrinho <franklin_gs@hotmail.com> | 2015-11-27 21:11:20 -0300 |
---|---|---|
committer | Franklin Sobrinho <franklin_gs@hotmail.com> | 2015-11-27 21:11:20 -0300 |
commit | 1138103c6374bee84680bfe85ff794191365e33a (patch) | |
tree | e503f811cd9b2464a6090e227cd4c5f2cc25a757 /scene | |
parent | ed4738fbed6d08e85bbf2b60b9dcad64bd4c8753 (diff) |
Fix shader loading, making possible load .shd and .sgp from editor
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 ""; } - - - - - - - - - - - - - |