Focus current node after connecting
(cherry picked from commit d17c522991
)
This commit is contained in:
parent
3fd5fecfc1
commit
ffc87b2bb1
|
@ -39,6 +39,7 @@
|
||||||
#include "editor/editor_settings.h"
|
#include "editor/editor_settings.h"
|
||||||
#include "editor/editor_undo_redo_manager.h"
|
#include "editor/editor_undo_redo_manager.h"
|
||||||
#include "editor/gui/scene_tree_editor.h"
|
#include "editor/gui/scene_tree_editor.h"
|
||||||
|
#include "editor/node_dock.h"
|
||||||
#include "editor/scene_tree_dock.h"
|
#include "editor/scene_tree_dock.h"
|
||||||
#include "plugins/script_editor_plugin.h"
|
#include "plugins/script_editor_plugin.h"
|
||||||
#include "scene/gui/button.h"
|
#include "scene/gui/button.h"
|
||||||
|
@ -1440,6 +1441,7 @@ ConnectionsDock::ConnectionsDock() {
|
||||||
connect_button->connect("pressed", callable_mp(this, &ConnectionsDock::_connect_pressed));
|
connect_button->connect("pressed", callable_mp(this, &ConnectionsDock::_connect_pressed));
|
||||||
|
|
||||||
connect_dialog = memnew(ConnectDialog);
|
connect_dialog = memnew(ConnectDialog);
|
||||||
|
connect_dialog->connect("connected", callable_mp(NodeDock::get_singleton(), &NodeDock::restore_last_valid_node), CONNECT_DEFERRED);
|
||||||
add_child(connect_dialog);
|
add_child(connect_dialog);
|
||||||
|
|
||||||
disconnect_all_dialog = memnew(ConfirmationDialog);
|
disconnect_all_dialog = memnew(ConfirmationDialog);
|
||||||
|
|
|
@ -70,6 +70,9 @@ void NodeDock::update_lists() {
|
||||||
void NodeDock::set_node(Node *p_node) {
|
void NodeDock::set_node(Node *p_node) {
|
||||||
connections->set_node(p_node);
|
connections->set_node(p_node);
|
||||||
groups->set_current(p_node);
|
groups->set_current(p_node);
|
||||||
|
if (p_node) {
|
||||||
|
last_valid_node = p_node;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_node) {
|
if (p_node) {
|
||||||
if (connections_button->is_pressed()) {
|
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() {
|
NodeDock::NodeDock() {
|
||||||
singleton = this;
|
singleton = this;
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ class NodeDock : public VBoxContainer {
|
||||||
HBoxContainer *mode_hb = nullptr;
|
HBoxContainer *mode_hb = nullptr;
|
||||||
|
|
||||||
Label *select_a_node = nullptr;
|
Label *select_a_node = nullptr;
|
||||||
|
Node *last_valid_node = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static NodeDock *singleton;
|
static NodeDock *singleton;
|
||||||
|
@ -60,6 +61,7 @@ protected:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_node(Node *p_node);
|
void set_node(Node *p_node);
|
||||||
|
void restore_last_valid_node();
|
||||||
|
|
||||||
void show_groups();
|
void show_groups();
|
||||||
void show_connections();
|
void show_connections();
|
||||||
|
|
Loading…
Reference in New Issue