summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-08-18 16:43:23 -0300
committerJuan Linietsky <reduzio@gmail.com>2017-08-18 16:44:03 -0300
commitb20952ebfff216acc07f6bbcad35b5a1e97a310c (patch)
tree5e9d834ff2b0aa9b1738a13b5112c56f8404c337 /editor
parent2ed87f33cf0ba91ecda081be3fd4231071a9c19e (diff)
Update script signals in real-time when script changes. Fixes #8980
Diffstat (limited to 'editor')
-rw-r--r--editor/connections_dialog.h3
-rw-r--r--editor/node_dock.cpp5
-rw-r--r--editor/node_dock.h2
-rw-r--r--editor/plugins/script_editor_plugin.cpp10
-rw-r--r--editor/plugins/script_editor_plugin.h1
-rw-r--r--editor/plugins/script_text_editor.cpp1
6 files changed, 19 insertions, 3 deletions
diff --git a/editor/connections_dialog.h b/editor/connections_dialog.h
index bff85941cb..849bb880d4 100644
--- a/editor/connections_dialog.h
+++ b/editor/connections_dialog.h
@@ -103,8 +103,6 @@ class ConnectionsDock : public VBoxContainer {
ConfirmationDialog *remove_confirm;
ConnectDialog *connect_dialog;
- void update_tree();
-
void _close();
void _connect();
void _something_selected();
@@ -121,6 +119,7 @@ public:
void set_node(Node *p_node);
String get_selected_type();
+ void update_tree();
ConnectionsDock(EditorNode *p_editor = NULL);
~ConnectionsDock();
diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp
index 0f3f4b96f5..b1a538ed2e 100644
--- a/editor/node_dock.cpp
+++ b/editor/node_dock.cpp
@@ -63,6 +63,11 @@ void NodeDock::_notification(int p_what) {
NodeDock *NodeDock::singleton = NULL;
+void NodeDock::update_lists() {
+
+ connections->update_tree();
+}
+
void NodeDock::set_node(Node *p_node) {
connections->set_node(p_node);
diff --git a/editor/node_dock.h b/editor/node_dock.h
index 0af65719c9..29e5dc5169 100644
--- a/editor/node_dock.h
+++ b/editor/node_dock.h
@@ -59,6 +59,8 @@ public:
void show_groups();
void show_connections();
+ void update_lists();
+
NodeDock();
};
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 1873a3f58b..fc89a4b9b4 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -34,18 +34,19 @@
#include "editor/script_editor_debugger.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
+#include "node_dock.h"
#include "os/file_access.h"
#include "os/input.h"
#include "os/keyboard.h"
#include "os/os.h"
#include "project_settings.h"
#include "scene/main/viewport.h"
-
/*** SCRIPT EDITOR ****/
void ScriptEditorBase::_bind_methods() {
ADD_SIGNAL(MethodInfo("name_changed"));
+ ADD_SIGNAL(MethodInfo("script_changed"));
ADD_SIGNAL(MethodInfo("request_help_search", PropertyInfo(Variant::STRING, "topic")));
ADD_SIGNAL(MethodInfo("request_help_index"));
ADD_SIGNAL(MethodInfo("request_open_script_at_line", PropertyInfo(Variant::OBJECT, "script"), PropertyInfo(Variant::INT, "line")));
@@ -1714,6 +1715,7 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
_update_script_names();
_save_layout();
se->connect("name_changed", this, "_update_script_names");
+ se->connect("script_changed", this, "_script_changed");
se->connect("request_help_search", this, "_help_search");
se->connect("request_open_script_at_line", this, "_goto_script_line");
se->connect("go_to_help", this, "_help_class_goto");
@@ -2200,6 +2202,11 @@ void ScriptEditor::register_create_script_editor_function(CreateScriptEditorFunc
script_editor_funcs[script_editor_func_count++] = p_func;
}
+void ScriptEditor::_script_changed() {
+
+ NodeDock::singleton->update_lists();
+}
+
void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_file_dialog_action", &ScriptEditor::_file_dialog_action);
@@ -2241,6 +2248,7 @@ void ScriptEditor::_bind_methods() {
ClassDB::bind_method("_history_back", &ScriptEditor::_history_back);
ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts);
ClassDB::bind_method("_unhandled_input", &ScriptEditor::_unhandled_input);
+ ClassDB::bind_method("_script_changed", &ScriptEditor::_script_changed);
ClassDB::bind_method(D_METHOD("get_current_script"), &ScriptEditor::_get_current_script);
ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts);
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 4614a41605..f87a20a1f0 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -318,6 +318,7 @@ class ScriptEditor : public PanelContainer {
void _update_script_colors();
void _update_modified_scripts_for_external_editor(Ref<Script> p_for_script = Ref<Script>());
+ void _script_changed();
int file_dialog_option;
void _file_dialog_action(String p_file);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 422c656351..1aa9f04484 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -524,6 +524,7 @@ void ScriptTextEditor::_validate_script() {
}
emit_signal("name_changed");
+ emit_signal("script_changed");
}
static Node *_find_node_for_script(Node *p_base, Node *p_current, const Ref<Script> &p_script) {