Merge pull request #74869 from fahadshihab/master

Added drag and drop support for shader include files in shader editor
This commit is contained in:
Yuri Sizov 2023-03-15 16:17:50 +01:00 committed by GitHub
commit f08ffdc372
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -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());
}