diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-03-24 19:50:41 +0100 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-03-24 21:33:44 +0100 |
commit | b191a7547c0bc6b14ab7e37e7cd36d37ec6dc276 (patch) | |
tree | b05275cbd2aebe7bd6872c543f7d501cf407a720 | |
parent | 9a64d6b2b2001920affdaedd0fb8c0bc6074b13a (diff) |
Rename the `.shader` file extension to `.gdshader`
This lets third-party software recognize Godot shaders more easily,
without relying on guesswork since the `.shader` extension is generic.
-rw-r--r-- | core/config/project_settings.cpp | 2 | ||||
-rw-r--r-- | editor/editor_asset_installer.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | misc/dist/linux/org.godotengine.Godot.xml | 6 | ||||
-rw-r--r-- | scene/resources/shader.cpp | 6 |
5 files changed, 12 insertions, 6 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp index f87dc6704e..f4f4dda7f4 100644 --- a/core/config/project_settings.cpp +++ b/core/config/project_settings.cpp @@ -1103,7 +1103,7 @@ ProjectSettings::ProjectSettings() { if (Engine::get_singleton()->has_singleton("GodotSharp")) { extensions.push_back("cs"); } - extensions.push_back("shader"); + extensions.push_back("gdshader"); GLOBAL_DEF("editor/script/search_in_file_extensions", extensions); custom_prop_info["editor/script/search_in_file_extensions"] = PropertyInfo(Variant::PACKED_STRING_ARRAY, "editor/script/search_in_file_extensions"); diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index 2d29076476..f4fea00074 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -137,7 +137,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) { extension_guess["atlastex"] = tree->get_theme_icon("AtlasTexture", "EditorIcons"); extension_guess["scn"] = tree->get_theme_icon("PackedScene", "EditorIcons"); extension_guess["tscn"] = tree->get_theme_icon("PackedScene", "EditorIcons"); - extension_guess["shader"] = tree->get_theme_icon("Shader", "EditorIcons"); + extension_guess["gdshader"] = tree->get_theme_icon("Shader", "EditorIcons"); extension_guess["gd"] = tree->get_theme_icon("GDScript", "EditorIcons"); extension_guess["vs"] = tree->get_theme_icon("VisualScript", "EditorIcons"); } diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index b298474406..0f9c253a52 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -3172,7 +3172,7 @@ void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_numb if (ResourceLoader::exists(fpath)) { RES res = ResourceLoader::load(fpath); - if (fpath.get_extension() == "shader") { + if (fpath.get_extension() == "gdshader") { ShaderEditorPlugin *shader_editor = Object::cast_to<ShaderEditorPlugin>(EditorNode::get_singleton()->get_editor_data().get_editor("Shader")); shader_editor->edit(res.ptr()); shader_editor->make_visible(true); diff --git a/misc/dist/linux/org.godotengine.Godot.xml b/misc/dist/linux/org.godotengine.Godot.xml index 2f647f71a6..e51179cd61 100644 --- a/misc/dist/linux/org.godotengine.Godot.xml +++ b/misc/dist/linux/org.godotengine.Godot.xml @@ -21,6 +21,12 @@ <glob pattern="*.escn"/> </mime-type> + <mime-type type="application/x-godot-shader"> + <comment>Godot Engine shader</comment> + <icon name="x-godot-shader" /> + <glob pattern="*.gdshader"/> + </mime-type> + <mime-type type="application/x-gdscript"> <comment>GDScript script</comment> <icon name="x-gdscript" /> diff --git a/scene/resources/shader.cpp b/scene/resources/shader.cpp index 77c6199794..0ad21b0f0f 100644 --- a/scene/resources/shader.cpp +++ b/scene/resources/shader.cpp @@ -184,7 +184,7 @@ 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"); + p_extensions->push_back("gdshader"); } bool ResourceFormatLoaderShader::handles_type(const String &p_type) const { @@ -193,7 +193,7 @@ bool ResourceFormatLoaderShader::handles_type(const String &p_type) const { String ResourceFormatLoaderShader::get_resource_type(const String &p_path) const { String el = p_path.get_extension().to_lower(); - if (el == "shader") { + if (el == "gdshader") { return "Shader"; } return ""; @@ -224,7 +224,7 @@ Error ResourceFormatSaverShader::save(const String &p_path, const RES &p_resourc void ResourceFormatSaverShader::get_recognized_extensions(const RES &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("shader"); + p_extensions->push_back("gdshader"); } } } |