summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scene/resources/material.cpp2
-rw-r--r--scene/resources/shader.cpp20
-rw-r--r--tools/editor/property_editor.cpp16
3 files changed, 19 insertions, 19 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 "";
}
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp
index 0fe3dee2ea..4ed3f3cbe0 100644
--- a/tools/editor/property_editor.cpp
+++ b/tools/editor/property_editor.cpp
@@ -89,13 +89,23 @@ void CustomPropertyEditor::_menu_option(int p_which) {
case OBJ_MENU_LOAD: {
file->set_mode(EditorFileDialog::MODE_OPEN_FILE);
- List<String> extensions;
String type=(hint==PROPERTY_HINT_RESOURCE_TYPE)?hint_text:String();
- ResourceLoader::get_recognized_extensions_for_type(type,&extensions);
- file->clear_filters();
+ List<String> extensions;
+ for (int i=0;i<type.get_slice_count(",");i++) {
+
+ ResourceLoader::get_recognized_extensions_for_type(type.get_slice(",",i),&extensions);
+ }
+
+ Set<String> valid_extensions;
for (List<String>::Element *E=extensions.front();E;E=E->next()) {
+ valid_extensions.insert(E->get());
+ }
+
+ file->clear_filters();
+ for (Set<String>::Element *E=valid_extensions.front();E;E=E->next()) {
+
file->add_filter("*."+E->get()+" ; "+E->get().to_upper() );
}