diff options
author | Fahad Shihab <fahadshihab@gmail.com> | 2023-03-13 21:51:26 +0530 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-03-27 17:26:36 +0200 |
commit | e99b184b6c9882dd2ae578b11c7a2673b5e0f511 (patch) | |
tree | 7ebca66eab8e4d54f085f04d5d76529413221f0b /editor | |
parent | 7fe9c48e2bee9bf59d9c8c9f3f8d61258b62171a (diff) |
Added drag and drop support for shaderinclude
Dragging and dropping now works for shader include file.
(cherry picked from commit e5601b517ef232e26a4773e3704a7b44c64e991f)
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/shader_editor_plugin.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 907bc81674..7861c8d354 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -376,6 +376,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; } @@ -405,11 +411,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()); } |