mirror of
https://github.com/godotengine/godot.git
synced 2024-11-21 03:18:37 +08:00
Focus current node after connecting
This commit is contained in:
parent
2d6b880987
commit
d17c522991
@ -39,6 +39,7 @@
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_undo_redo_manager.h"
|
||||
#include "editor/gui/scene_tree_editor.h"
|
||||
#include "editor/node_dock.h"
|
||||
#include "editor/scene_tree_dock.h"
|
||||
#include "plugins/script_editor_plugin.h"
|
||||
#include "scene/gui/button.h"
|
||||
@ -1440,6 +1441,7 @@ ConnectionsDock::ConnectionsDock() {
|
||||
connect_button->connect("pressed", callable_mp(this, &ConnectionsDock::_connect_pressed));
|
||||
|
||||
connect_dialog = memnew(ConnectDialog);
|
||||
connect_dialog->connect("connected", callable_mp(NodeDock::get_singleton(), &NodeDock::restore_last_valid_node), CONNECT_DEFERRED);
|
||||
add_child(connect_dialog);
|
||||
|
||||
disconnect_all_dialog = memnew(ConfirmationDialog);
|
||||
|
@ -70,6 +70,9 @@ void NodeDock::update_lists() {
|
||||
void NodeDock::set_node(Node *p_node) {
|
||||
connections->set_node(p_node);
|
||||
groups->set_current(p_node);
|
||||
if (p_node) {
|
||||
last_valid_node = p_node;
|
||||
}
|
||||
|
||||
if (p_node) {
|
||||
if (connections_button->is_pressed()) {
|
||||
@ -88,6 +91,10 @@ void NodeDock::set_node(Node *p_node) {
|
||||
}
|
||||
}
|
||||
|
||||
void NodeDock::restore_last_valid_node() {
|
||||
set_node(last_valid_node);
|
||||
}
|
||||
|
||||
NodeDock::NodeDock() {
|
||||
singleton = this;
|
||||
|
||||
|
@ -47,6 +47,7 @@ class NodeDock : public VBoxContainer {
|
||||
HBoxContainer *mode_hb = nullptr;
|
||||
|
||||
Label *select_a_node = nullptr;
|
||||
Node *last_valid_node = nullptr;
|
||||
|
||||
private:
|
||||
static NodeDock *singleton;
|
||||
@ -60,6 +61,7 @@ protected:
|
||||
|
||||
public:
|
||||
void set_node(Node *p_node);
|
||||
void restore_last_valid_node();
|
||||
|
||||
void show_groups();
|
||||
void show_connections();
|
||||
|
Loading…
Reference in New Issue
Block a user