Signals became a tab

added icons to contextual scene tree menu
This commit is contained in:
Juan Linietsky 2016-06-03 21:03:09 -03:00
parent cd56cad9ac
commit 26332479d3
8 changed files with 95 additions and 76 deletions

View file

@ -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()
{
}

View file

@ -95,10 +95,11 @@ public:
};
class ConnectionsDialog : public ConfirmationDialog {
class ConnectionsDock : public VBoxContainer {
OBJ_TYPE( ConnectionsDialog , ConfirmationDialog );
OBJ_TYPE( ConnectionsDock , VBoxContainer );
Button *connect_button;
EditorNode *editor;
Node *node;
Tree *tree;
@ -114,7 +115,7 @@ class ConnectionsDialog : public ConfirmationDialog {
protected:
virtual void ok_pressed();
void _connect_pressed();
void _notification(int p_what);
static void _bind_methods();
public:
@ -124,8 +125,8 @@ public:
void set_node(Node* p_node);
String get_selected_type();
ConnectionsDialog(EditorNode *p_editor=NULL);
~ConnectionsDialog();
ConnectionsDock(EditorNode *p_editor=NULL);
~ConnectionsDock();
};

View file

@ -1533,6 +1533,7 @@ void EditorNode::push_item(Object *p_object,const String& p_property) {
if (!p_object) {
property_editor->edit(NULL);
connections_dock->set_node(NULL);
scene_tree_dock->set_selected(NULL);
return;
}
@ -1678,6 +1679,7 @@ void EditorNode::_edit_current() {
scene_tree_dock->set_selected(NULL);
property_editor->edit( NULL );
connections_dock->set_node(NULL);
object_menu->set_disabled(true);
_display_top_editors(false);
@ -1697,6 +1699,7 @@ void EditorNode::_edit_current() {
ERR_FAIL_COND(!current_res);
scene_tree_dock->set_selected(NULL);
property_editor->edit( current_res );
connections_dock->set_node(NULL);
object_menu->set_disabled(false);
//resources_dock->add_resource(Ref<Resource>(current_res));
@ -1713,6 +1716,7 @@ void EditorNode::_edit_current() {
property_editor->edit( current_node );
connections_dock->set_node( current_node );
scene_tree_dock->set_selected(current_node);
object_menu->get_popup()->clear();
@ -1721,6 +1725,7 @@ void EditorNode::_edit_current() {
} else {
property_editor->edit( current_obj );
connections_dock->set_node(NULL);
//scene_tree_dock->set_selected(current_node);
//object_menu->get_popup()->clear();
@ -5785,14 +5790,20 @@ EditorNode::EditorNode() {
debug_button->set_tooltip(TTR("Debug options"));
p=debug_button->get_popup();
p->add_check_item(TTR("Remote Debug Deploys"),RUN_DEPLOY_REMOTE_DEBUG);
p->add_check_item(TTR("Use PC Filesystem for Deploys"),RUN_FILE_SERVER);
p->add_check_item(TTR("Deploy with Remote Debug"),RUN_DEPLOY_REMOTE_DEBUG);
p->set_item_tooltip(p->get_item_count()-1,TTR("When exporting or deploying, the resulting executable will attempt to connect to the IP of this computer in order to be debugged."));
p->add_check_item(TTR("Small Deploy with Network FS"),RUN_FILE_SERVER);
p->set_item_tooltip(p->get_item_count()-1,TTR("When this option is enabled, export or deploy will produce a minimal executable.\nThe filesystem will be provided from the project by the editor over the network. On Android, deploy will use the USB cable for faster performance. This option speeds up testing for games with a large footprint."));
p->add_separator();
p->add_check_item(TTR("Visible Collision Shapes"),RUN_DEBUG_COLLISONS);
p->set_item_tooltip(p->get_item_count()-1,TTR("Collision shapes and raycast nodes (for 2D and 3D) will be visible on the running game if this option is turned on."));
p->add_check_item(TTR("Visible Navigation"),RUN_DEBUG_NAVIGATION);
p->set_item_tooltip(p->get_item_count()-1,TTR("Navigation meshes and polygons will be visible on the running game if this option is turned on."));
p->add_separator();
p->add_check_item(TTR("Mirror Scene Editing"),RUN_LIVE_DEBUG);
p->add_check_item(TTR("Mirror Script Changes"),RUN_RELOAD_SCRIPTS);
p->add_check_item(TTR("Sync Scene Changes"),RUN_LIVE_DEBUG);
p->set_item_tooltip(p->get_item_count()-1,TTR("When this option is turned on, any changes made to the scene in the editor will be replicated in the running game.\nThis works remotely, and is more efficient with networked filesystem."));
p->add_check_item(TTR("Sync Script Changes"),RUN_RELOAD_SCRIPTS);
p->set_item_tooltip(p->get_item_count()-1,TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nThis works remotely, and is more efficient with networked filesystem."));
p->connect("item_pressed",this,"_menu_option");
/*
@ -5917,7 +5928,7 @@ EditorNode::EditorNode() {
scene_tree_dock = memnew( SceneTreeDock(this,scene_root,editor_selection,editor_data) );
scene_tree_dock->set_name(TTR("Scene"));
//top_pallete->add_child(scene_tree_dock);
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scene_tree_dock);
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(scene_tree_dock);
#if 0
resources_dock = memnew( ResourcesDock(this) );
resources_dock->set_name("Resources");
@ -5925,7 +5936,7 @@ EditorNode::EditorNode() {
dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(resources_dock);
//top_pallete->set_v_size_flags(Control::SIZE_EXPAND_FILL);
#endif
dock_slot[DOCK_SLOT_RIGHT_BL]->hide();
dock_slot[DOCK_SLOT_LEFT_BR]->hide();
/*Control *editor_spacer = memnew( Control );
editor_spacer->set_custom_minimum_size(Size2(260,200));
editor_spacer->set_v_size_flags(Control::SIZE_EXPAND_FILL);
@ -5947,7 +5958,7 @@ EditorNode::EditorNode() {
VBoxContainer *prop_editor_base = memnew( VBoxContainer );
prop_editor_base->set_name(TTR("Inspector")); // Properties?
dock_slot[DOCK_SLOT_RIGHT_UL]->add_child(prop_editor_base);
dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(prop_editor_base);
HBoxContainer *prop_editor_hb = memnew( HBoxContainer );
@ -6059,10 +6070,14 @@ EditorNode::EditorNode() {
property_editor->set_undo_redo(&editor_data.get_undo_redo());
connections_dock = memnew( ConnectionsDock(this) );
connections_dock->set_undoredo(&editor_data.get_undo_redo());
dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(connections_dock);
scenes_dock = memnew( ScenesDock(this) );
scenes_dock->set_name(TTR("FileSystem"));
scenes_dock->set_use_thumbnails(int(EditorSettings::get_singleton()->get("file_dialog/display_mode"))==EditorFileDialog::DISPLAY_THUMBNAILS);
dock_slot[DOCK_SLOT_LEFT_BR]->add_child(scenes_dock);
dock_slot[DOCK_SLOT_LEFT_UR]->add_child(scenes_dock);
//prop_pallete->add_child(scenes_dock);
scenes_dock->connect("open",this,"open_request");
scenes_dock->connect("instance",this,"_instance_request");

View file

@ -272,6 +272,7 @@ private:
SceneTreeDock *scene_tree_dock;
//ResourcesDock *resources_dock;
PropertyEditor *property_editor;
ConnectionsDock *connections_dock;
VBoxContainer *prop_editor_vb;
ScenesDock *scenes_dock;
EditorRunNative *run_native;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 317 B

After

Width:  |  Height:  |  Size: 186 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 185 B

View file

@ -260,8 +260,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
//if (!_validate_no_foreign())
// break;
connect_dialog->popup_centered_ratio();
connect_dialog->set_node(current);
//connect_dialog->popup_centered_ratio();
//connect_dialog->set_node(current);
} break;
case TOOL_GROUP: {
@ -1663,8 +1663,8 @@ void SceneTreeDock::_tree_rmb(const Vector2& p_menu_pos) {
if (!EditorNode::get_singleton()->get_edited_scene()) {
menu->clear();
menu->add_item(TTR("New Scene Root"),TOOL_NEW,KEY_MASK_CMD|KEY_A);
menu->add_item(TTR("Inherit Scene"),TOOL_INSTANCE);
menu->add_icon_item(get_icon("Add","EditorIcons"),TTR("New Scene Root"),TOOL_NEW,KEY_MASK_CMD|KEY_A);
menu->add_icon_item(get_icon("Instance","EditorIcons"),TTR("Inherit Scene"),TOOL_INSTANCE);
menu->set_size(Size2(1,1));
menu->set_pos(p_menu_pos);
@ -1681,31 +1681,31 @@ void SceneTreeDock::_tree_rmb(const Vector2& p_menu_pos) {
if (selection.size()==1) {
menu->add_item(TTR("Add Child Node"),TOOL_NEW,KEY_MASK_CMD|KEY_A);
menu->add_item(TTR("Instance Child Scene"),TOOL_INSTANCE);
menu->add_icon_item(get_icon("Add","EditorIcons"),TTR("Add Child Node"),TOOL_NEW,KEY_MASK_CMD|KEY_A);
menu->add_icon_item(get_icon("Instance","EditorIcons"),TTR("Instance Child Scene"),TOOL_INSTANCE);
menu->add_separator();
menu->add_item(TTR("Change Type"),TOOL_REPLACE);
menu->add_icon_item(get_icon("Reload","EditorIcons"),TTR("Change Type"),TOOL_REPLACE);
menu->add_separator();
menu->add_item(TTR("Edit Groups"),TOOL_GROUP);
menu->add_item(TTR("Edit Connections"),TOOL_CONNECT);
menu->add_icon_item(get_icon("Groups","EditorIcons"),TTR("Edit Groups"),TOOL_GROUP);
//menu->add_icon_item(get_icon("Connect","EditorIcons"),TTR("Edit Connections"),TOOL_CONNECT);
menu->add_separator();
menu->add_item(TTR("Add Script"),TOOL_SCRIPT);
menu->add_icon_item(get_icon("Script","EditorIcons"),TTR("Add Script"),TOOL_SCRIPT);
menu->add_separator();
}
menu->add_item(TTR("Move Up"),TOOL_MOVE_UP,KEY_MASK_CMD|KEY_UP);
menu->add_item(TTR("Move Down"),TOOL_MOVE_DOWN,KEY_MASK_CMD|KEY_DOWN);
menu->add_item(TTR("Duplicate"),TOOL_DUPLICATE,KEY_MASK_CMD|KEY_D);
menu->add_item(TTR("Reparent"),TOOL_REPARENT);
menu->add_icon_item(get_icon("Up","EditorIcons"),TTR("Move Up"),TOOL_MOVE_UP,KEY_MASK_CMD|KEY_UP);
menu->add_icon_item(get_icon("Down","EditorIcons"),TTR("Move Down"),TOOL_MOVE_DOWN,KEY_MASK_CMD|KEY_DOWN);
menu->add_icon_item(get_icon("Duplicate","EditorIcons"),TTR("Duplicate"),TOOL_DUPLICATE,KEY_MASK_CMD|KEY_D);
menu->add_icon_item(get_icon("Reparent","EditorIcons"),TTR("Reparent"),TOOL_REPARENT);
if (selection.size()==1) {
menu->add_separator();
menu->add_item(TTR("Merge From Scene"),TOOL_MERGE_FROM_SCENE);
menu->add_item(TTR("Save Branch as Scene"),TOOL_NEW_SCENE_FROM);
menu->add_icon_item(get_icon("Blend","EditorIcons"),TTR("Merge From Scene"),TOOL_MERGE_FROM_SCENE);
menu->add_icon_item(get_icon("Save","EditorIcons"),TTR("Save Branch as Scene"),TOOL_NEW_SCENE_FROM);
}
menu->add_separator();
menu->add_item(TTR("Delete Node(s)"),TOOL_ERASE,KEY_DELETE);
menu->add_icon_item(get_icon("Remove","EditorIcons"),TTR("Delete Node(s)"),TOOL_ERASE,KEY_DELETE);
menu->set_size(Size2(1,1));
menu->set_pos(p_menu_pos);
@ -1824,9 +1824,9 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
add_child(groups_editor);
groups_editor->set_undo_redo(&editor_data->get_undo_redo());
connect_dialog = memnew( ConnectionsDialog(p_editor) );
add_child(connect_dialog);
connect_dialog->set_undoredo(&editor_data->get_undo_redo());
//connect_dialog = memnew( ConnectionsDialog(p_editor) );
//add_child(connect_dialog);
//connect_dialog->set_undoredo(&editor_data->get_undo_redo());
script_create_dialog = memnew( ScriptCreateDialog );
add_child(script_create_dialog);

View file

@ -87,7 +87,7 @@ class SceneTreeDock : public VBoxContainer {
EditorSelection *editor_selection;
GroupsEditor *groups_editor;
ConnectionsDialog *connect_dialog;
//ConnectionsDialog *connect_dialog;
ScriptCreateDialog *script_create_dialog;
AcceptDialog *accept;
ConfirmationDialog *delete_dialog;