summaryrefslogtreecommitdiff
path: root/tools/editor/plugins
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2016-06-12 01:01:17 +0200
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2016-06-12 01:05:54 +0200
commit10881802bab109e076577edda3b9a86226367cda (patch)
tree3fcd3183f6ac90ea52661b027baee3e3bb4f49f1 /tools/editor/plugins
parent26d18b74ac8b5cc3f99fe3aa7d8a2438f9dd52cd (diff)
ConnectionsDock: Double click to create and go to signal connection
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp45
-rw-r--r--tools/editor/plugins/script_editor_plugin.h2
2 files changed, 47 insertions, 0 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp
index d2d1f9e625..d9df39baa9 100644
--- a/tools/editor/plugins/script_editor_plugin.cpp
+++ b/tools/editor/plugins/script_editor_plugin.cpp
@@ -2495,6 +2495,51 @@ void ScriptEditor::set_scene_root_script( Ref<Script> p_script ) {
}
}
+bool ScriptEditor::script_go_to_method(Ref<Script> p_script, const String& p_method) {
+
+ Vector<String> functions;
+ bool found=false;
+
+ for (int i=0;i<tab_container->get_child_count();i++) {
+ ScriptTextEditor *current = tab_container->get_child(i)->cast_to<ScriptTextEditor>();
+
+ if (current && current->get_edited_script()==p_script) {
+ functions=current->get_functions();
+ found=true;
+ break;
+ }
+ }
+
+ if (!found) {
+ String errortxt;
+ int line=-1,col;
+ String text=p_script->get_source_code();
+ List<String> fnc;
+
+ if (p_script->get_language()->validate(text,line,col,errortxt,p_script->get_path(),&fnc)) {
+
+ for (List<String>::Element *E=fnc.front();E;E=E->next())
+ functions.push_back(E->get());
+ }
+ }
+
+ String method_search = p_method + ":";
+
+ for (int i=0;i<functions.size();i++) {
+ String function=functions[i];
+
+ if (function.begins_with(method_search)) {
+
+ edit(p_script);
+ int line=function.get_slice(":",1).to_int();
+ _goto_script_line2(line-1);
+ return true;
+ }
+ }
+
+ return false;
+}
+
void ScriptEditor::set_live_auto_reload_running_scripts(bool p_enabled) {
auto_reload_running_scripts=p_enabled;
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 5a9dce759e..3d723adfe9 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -325,6 +325,8 @@ public:
void set_scene_root_script( Ref<Script> p_script );
+ bool script_go_to_method(Ref<Script> p_script, const String& p_method);
+
virtual void edited_scene_changed();
ScriptEditorDebugger *get_debugger() { return debugger; }