Skip to content

Commit

Permalink
Added drag and drop support for shaderinclude
Browse files Browse the repository at this point in the history
Dragging and dropping now works for shader include file.
  • Loading branch information
fahadshihab committed Mar 15, 2023
1 parent 550a779 commit e5601b5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions editor/plugins/shader_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit e5601b5

Please sign in to comment.