Skip to content

Commit

Permalink
Make script method connection gutter appear/disappear instantly after…
Browse files Browse the repository at this point in the history
… connect/disconnect
  • Loading branch information
jsjtxietian committed Jul 12, 2024
1 parent 97b8ad1 commit c2fbd08
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions editor/connections_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,8 @@ void ConnectionsDock::_connect(const ConnectDialog::ConnectionData &p_cd) {
undo_redo->add_undo_method(SceneTreeDock::get_singleton()->get_tree_editor(), "update_tree");

undo_redo->commit_action();

ScriptEditor::get_singleton()->update_connected_methods();
}

/*
Expand All @@ -1028,6 +1030,7 @@ void ConnectionsDock::_disconnect(const ConnectDialog::ConnectionData &p_cd) {
undo_redo->add_undo_method(SceneTreeDock::get_singleton()->get_tree_editor(), "update_tree");

undo_redo->commit_action();
ScriptEditor::get_singleton()->update_connected_methods();
}

/*
Expand Down Expand Up @@ -1061,6 +1064,8 @@ void ConnectionsDock::_disconnect_all() {
undo_redo->add_undo_method(SceneTreeDock::get_singleton()->get_tree_editor(), "update_tree");

undo_redo->commit_action();

ScriptEditor::get_singleton()->update_connected_methods();
}

void ConnectionsDock::_tree_item_selected() {
Expand Down
8 changes: 8 additions & 0 deletions editor/plugins/script_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3766,6 +3766,14 @@ void ScriptEditor::unregister_syntax_highlighter(const Ref<EditorSyntaxHighlight
syntax_highlighters.erase(p_syntax_highlighter);
}

void ScriptEditor::update_connected_methods() {
ScriptTextEditor *ste = Object::cast_to<ScriptTextEditor>(_get_current_editor());

if (ste) {
ste->_update_connected_methods();
}
}

int ScriptEditor::script_editor_func_count = 0;
CreateScriptEditorFunc ScriptEditor::script_editor_funcs[ScriptEditor::SCRIPT_EDITOR_FUNC_MAX];

Expand Down
2 changes: 2 additions & 0 deletions editor/plugins/script_editor_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ class ScriptEditor : public PanelContainer {
void register_syntax_highlighter(const Ref<EditorSyntaxHighlighter> &p_syntax_highlighter);
void unregister_syntax_highlighter(const Ref<EditorSyntaxHighlighter> &p_syntax_highlighter);

void update_connected_methods();

static void register_create_script_editor_function(CreateScriptEditorFunc p_func);

ScriptEditor(WindowWrapper *p_wrapper);
Expand Down

0 comments on commit c2fbd08

Please sign in to comment.