You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-19 14:31:59 +00:00
Signals became a tab
added icons to contextual scene tree menu
This commit is contained in:
@@ -94,8 +94,8 @@ void ConnectDialog::_notification(int p_what) {
|
||||
|
||||
if (p_what==NOTIFICATION_DRAW) {
|
||||
|
||||
RID ci = get_canvas_item();
|
||||
get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
|
||||
//RID ci = get_canvas_item();
|
||||
//get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
|
||||
}
|
||||
|
||||
if (p_what==NOTIFICATION_ENTER_TREE) {
|
||||
@@ -480,21 +480,21 @@ ConnectDialog::~ConnectDialog()
|
||||
|
||||
|
||||
|
||||
void ConnectionsDialog::_notification(int p_what) {
|
||||
void ConnectionsDock::_notification(int p_what) {
|
||||
|
||||
if (p_what==NOTIFICATION_DRAW) {
|
||||
|
||||
RID ci = get_canvas_item();
|
||||
get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
|
||||
//RID ci = get_canvas_item();
|
||||
//get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
|
||||
}
|
||||
}
|
||||
|
||||
void ConnectionsDialog::_close() {
|
||||
void ConnectionsDock::_close() {
|
||||
|
||||
hide();
|
||||
}
|
||||
|
||||
void ConnectionsDialog::_connect() {
|
||||
void ConnectionsDock::_connect() {
|
||||
|
||||
TreeItem *it = tree->get_selected();
|
||||
ERR_FAIL_COND(!it);
|
||||
@@ -533,13 +533,13 @@ void ConnectionsDialog::_connect() {
|
||||
|
||||
|
||||
|
||||
void ConnectionsDialog::ok_pressed() {
|
||||
void ConnectionsDock::_connect_pressed() {
|
||||
|
||||
|
||||
TreeItem *item = tree->get_selected();
|
||||
if (!item) {
|
||||
//no idea how this happened, but disable
|
||||
get_ok()->set_disabled(true);
|
||||
connect_button->set_disabled(true);
|
||||
return;
|
||||
}
|
||||
if (item->get_parent()==tree->get_root() || item->get_parent()->get_parent()==tree->get_root()) {
|
||||
@@ -584,7 +584,7 @@ void ConnectionsDialog::ok_pressed() {
|
||||
}
|
||||
}
|
||||
/*
|
||||
void ConnectionsDialog::_remove() {
|
||||
void ConnectionsDock::_remove() {
|
||||
|
||||
if (!tree->get_selected())
|
||||
return;
|
||||
@@ -600,7 +600,7 @@ void ConnectionsDialog::_remove() {
|
||||
}
|
||||
*/
|
||||
/*
|
||||
void ConnectionsDialog::_remove_confirm() {
|
||||
void ConnectionsDock::_remove_confirm() {
|
||||
|
||||
if (!tree->get_selected())
|
||||
return;
|
||||
@@ -620,17 +620,15 @@ void ConnectionsDialog::_remove_confirm() {
|
||||
}
|
||||
*/
|
||||
|
||||
struct _ConnectionsDialogMethodInfoSort {
|
||||
struct _ConnectionsDockMethodInfoSort {
|
||||
|
||||
_FORCE_INLINE_ bool operator()(const MethodInfo& a, const MethodInfo& b) const {
|
||||
return a.name < b.name;
|
||||
}
|
||||
};
|
||||
|
||||
void ConnectionsDialog::update_tree() {
|
||||
void ConnectionsDock::update_tree() {
|
||||
|
||||
if (!is_visible())
|
||||
return; //don't update if not visible, of course
|
||||
tree->clear();
|
||||
|
||||
if (!node)
|
||||
@@ -643,7 +641,7 @@ void ConnectionsDialog::update_tree() {
|
||||
|
||||
node->get_signal_list(&node_signals);
|
||||
|
||||
//node_signals.sort_custom<_ConnectionsDialogMethodInfoSort>();
|
||||
//node_signals.sort_custom<_ConnectionsDockMethodInfoSort>();
|
||||
bool did_script=false;
|
||||
StringName base = node->get_type();
|
||||
|
||||
@@ -773,68 +771,72 @@ void ConnectionsDialog::update_tree() {
|
||||
}
|
||||
}
|
||||
|
||||
get_ok()->set_text(TTR("Connect"));
|
||||
get_ok()->set_disabled(true);
|
||||
connect_button->set_text(TTR("Connect"));
|
||||
connect_button->set_disabled(true);
|
||||
|
||||
}
|
||||
|
||||
void ConnectionsDialog::set_node(Node* p_node) {
|
||||
void ConnectionsDock::set_node(Node* p_node) {
|
||||
|
||||
node=p_node;
|
||||
update_tree();
|
||||
}
|
||||
|
||||
void ConnectionsDialog::_something_selected() {
|
||||
void ConnectionsDock::_something_selected() {
|
||||
|
||||
TreeItem *item = tree->get_selected();
|
||||
if (!item) {
|
||||
//no idea how this happened, but disable
|
||||
get_ok()->set_text(TTR("Connect.."));
|
||||
get_ok()->set_disabled(true);
|
||||
connect_button->set_text(TTR("Connect.."));
|
||||
connect_button->set_disabled(true);
|
||||
|
||||
} else if (item->get_parent()==tree->get_root() || item->get_parent()->get_parent()==tree->get_root()) {
|
||||
//a signal - connect
|
||||
get_ok()->set_text(TTR("Connect.."));
|
||||
get_ok()->set_disabled(false);
|
||||
connect_button->set_text(TTR("Connect.."));
|
||||
connect_button->set_disabled(false);
|
||||
|
||||
} else {
|
||||
//a slot- disconnect
|
||||
get_ok()->set_text(TTR("Disconnect"));
|
||||
get_ok()->set_disabled(false);
|
||||
connect_button->set_text(TTR("Disconnect"));
|
||||
connect_button->set_disabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ConnectionsDialog::_bind_methods() {
|
||||
void ConnectionsDock::_bind_methods() {
|
||||
|
||||
|
||||
ObjectTypeDB::bind_method("_connect",&ConnectionsDialog::_connect);
|
||||
ObjectTypeDB::bind_method("_something_selected",&ConnectionsDialog::_something_selected);
|
||||
ObjectTypeDB::bind_method("_close",&ConnectionsDialog::_close);
|
||||
// ObjectTypeDB::bind_method("_remove_confirm",&ConnectionsDialog::_remove_confirm);
|
||||
ObjectTypeDB::bind_method("update_tree",&ConnectionsDialog::update_tree);
|
||||
ObjectTypeDB::bind_method("_connect",&ConnectionsDock::_connect);
|
||||
ObjectTypeDB::bind_method("_something_selected",&ConnectionsDock::_something_selected);
|
||||
ObjectTypeDB::bind_method("_close",&ConnectionsDock::_close);
|
||||
ObjectTypeDB::bind_method("_connect_pressed",&ConnectionsDock::_connect_pressed);
|
||||
ObjectTypeDB::bind_method("update_tree",&ConnectionsDock::update_tree);
|
||||
|
||||
|
||||
}
|
||||
|
||||
ConnectionsDialog::ConnectionsDialog(EditorNode *p_editor) {
|
||||
ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
|
||||
|
||||
editor=p_editor;
|
||||
set_title(TTR("Edit Connections.."));
|
||||
set_hide_on_ok(false);
|
||||
|
||||
VBoxContainer *vbc = memnew( VBoxContainer );
|
||||
add_child(vbc);
|
||||
set_child_rect(vbc);
|
||||
set_name(TTR("Signals"));
|
||||
|
||||
|
||||
VBoxContainer *vbc = this;
|
||||
|
||||
tree = memnew( Tree );
|
||||
tree->set_columns(1);
|
||||
tree->set_select_mode(Tree::SELECT_ROW);
|
||||
tree->set_hide_root(true);
|
||||
vbc->add_margin_child(TTR("Connections:"),tree,true);
|
||||
vbc->add_child(tree);
|
||||
tree->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
connect_button = memnew( Button );
|
||||
connect_button->set_text("Connect");
|
||||
HBoxContainer *hb = memnew( HBoxContainer);
|
||||
vbc->add_child(hb);
|
||||
hb->add_spacer();
|
||||
hb->add_child(connect_button);
|
||||
connect_button->connect("pressed",this,"_connect_pressed");
|
||||
// add_child(tree);
|
||||
|
||||
connect_dialog = memnew( ConnectDialog );
|
||||
@@ -858,12 +860,12 @@ ConnectionsDialog::ConnectionsDialog(EditorNode *p_editor) {
|
||||
remove_confirm->connect("confirmed", this,"_remove_confirm");
|
||||
connect_dialog->connect("connected", this,"_connect");
|
||||
tree->connect("item_selected", this,"_something_selected");
|
||||
get_cancel()->set_text(TTR("Close"));
|
||||
|
||||
add_constant_override("separation",3*EDSCALE);
|
||||
}
|
||||
|
||||
|
||||
ConnectionsDialog::~ConnectionsDialog()
|
||||
ConnectionsDock::~ConnectionsDock()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user