summaryrefslogtreecommitdiffstats
path: root/editor/plugins/script_editor_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-12-07 15:11:32 +0100
committerGitHub <noreply@github.com>2018-12-07 15:11:32 +0100
commitc2e96c65b375def81fc13e737d1be02093951c44 (patch)
treef793e781b8505d35a1382edb08a9ba2e5ac7a2cf /editor/plugins/script_editor_plugin.cpp
parente4a2003b9860db00452e4a65f8cc55d7f525c463 (diff)
parentf6d137d3d0cdf97f8ecd7b79fbeb1779684552a8 (diff)
downloadredot-engine-c2e96c65b375def81fc13e737d1be02093951c44.tar.gz
Merge pull request #23327 from YeldhamDev/search_shaders
Added "shader" filter to "Find in Files"
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
-rw-r--r--editor/plugins/script_editor_plugin.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 0bbe08821a..75529d6007 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -40,6 +40,7 @@
#include "editor/editor_settings.h"
#include "editor/find_in_files.h"
#include "editor/node_dock.h"
+#include "editor/plugins/shader_editor_plugin.h"
#include "editor/script_editor_debugger.h"
#include "scene/main/viewport.h"
#include "script_text_editor.h"
@@ -2778,13 +2779,18 @@ void ScriptEditor::_on_find_in_files_requested(String text) {
void ScriptEditor::_on_find_in_files_result_selected(String fpath, int line_number, int begin, int end) {
RES res = ResourceLoader::load(fpath);
- edit(res);
-
- ScriptEditorBase *seb = _get_current_editor();
+ if (fpath.get_extension() == "shader") {
+ 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);
+ shader_editor->get_shader_editor()->goto_line_selection(line_number - 1, begin, end);
+ } else {
+ edit(res);
- ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(seb);
- if (ste) {
- ste->goto_line_selection(line_number - 1, begin, end);
+ ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(_get_current_editor());
+ if (ste) {
+ ste->goto_line_selection(line_number - 1, begin, end);
+ }
}
}