summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuri Sizov <11782833+YuriSizov@users.noreply.github.com>2023-03-15 16:17:50 +0100
committerGitHub <noreply@github.com>2023-03-15 16:17:50 +0100
commitf08ffdc3729278f86f78b7dbe6bb7f727b41edd1 (patch)
tree3a808c69be8bcef37cec51b53a0d4289f841cd84
parent7b1b5117a6502f185b51d6443763d7051f6cd87e (diff)
parente5601b517ef232e26a4773e3704a7b44c64e991f (diff)
downloadredot-engine-f08ffdc3729278f86f78b7dbe6bb7f727b41edd1.tar.gz
Merge pull request #74869 from fahadshihab/master
Added drag and drop support for shader include files in shader editor
-rw-r--r--editor/plugins/shader_editor_plugin.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index b8c8fb7e62..49459a0ba0 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -384,6 +384,12 @@ bool ShaderEditorPlugin::can_drop_data_fw(const Point2 &p_point, const Variant &
return true;
}
}
+ if (ResourceLoader::exists(file, "ShaderInclude")) {
+ Ref<ShaderInclude> sinclude = ResourceLoader::load(file);
+ if (sinclude.is_valid()) {
+ return true;
+ }
+ }
}
return false;
}
@@ -413,11 +419,10 @@ void ShaderEditorPlugin::drop_data_fw(const Point2 &p_point, const Variant &p_da
for (int i = 0; i < files.size(); i++) {
String file = files[i];
- if (!ResourceLoader::exists(file, "Shader")) {
- continue;
+ Ref<Resource> res;
+ if (ResourceLoader::exists(file, "Shader") || ResourceLoader::exists(file, "ShaderInclude")) {
+ res = ResourceLoader::load(file);
}
-
- Ref<Resource> res = ResourceLoader::load(file);
if (res.is_valid()) {
edit(res.ptr());
}