summaryrefslogtreecommitdiff
path: root/tools/editor
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor')
-rw-r--r--tools/editor/connections_dialog.cpp7
-rw-r--r--tools/editor/editor_node.cpp26
-rw-r--r--tools/editor/editor_node.h4
-rw-r--r--tools/editor/groups_editor.cpp20
-rw-r--r--tools/editor/groups_editor.h4
-rw-r--r--tools/editor/icons/icon_connection_and_groups.pngbin0 -> 760 bytes
-rw-r--r--tools/editor/node_dock.cpp104
-rw-r--r--tools/editor/node_dock.h38
-rw-r--r--tools/editor/scene_tree_dock.cpp14
-rw-r--r--tools/editor/scene_tree_dock.h3
-rw-r--r--tools/editor/scene_tree_editor.cpp33
-rw-r--r--tools/editor/scene_tree_editor.h4
12 files changed, 220 insertions, 37 deletions
diff --git a/tools/editor/connections_dialog.cpp b/tools/editor/connections_dialog.cpp
index 40828c4664..e2b8f2884f 100644
--- a/tools/editor/connections_dialog.cpp
+++ b/tools/editor/connections_dialog.cpp
@@ -516,6 +516,9 @@ void ConnectionsDock::_connect() {
undo_redo->add_undo_method(node,"disconnect",signal,target,dst_method);
undo_redo->add_do_method(this,"update_tree");
undo_redo->add_undo_method(this,"update_tree");
+ undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree
+ undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree
+
undo_redo->commit_action();
@@ -577,6 +580,8 @@ void ConnectionsDock::_connect_pressed() {
undo_redo->add_undo_method(node,"connect",c.signal,c.target,c.method,Vector<Variant>(),c.flags);
undo_redo->add_do_method(this,"update_tree");
undo_redo->add_undo_method(this,"update_tree");
+ undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree
+ undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree
undo_redo->commit_action();
c.source->disconnect(c.signal,c.target,c.method);
@@ -629,7 +634,7 @@ struct _ConnectionsDockMethodInfoSort {
void ConnectionsDock::update_tree() {
- tree->clear();
+ tree->clear();
if (!node)
return;
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index eb5f77d262..5d0617d8ab 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -1533,7 +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);
+ node_dock->set_node(NULL);
scene_tree_dock->set_selected(NULL);
return;
}
@@ -1679,7 +1679,7 @@ void EditorNode::_edit_current() {
scene_tree_dock->set_selected(NULL);
property_editor->edit( NULL );
- connections_dock->set_node(NULL);
+ node_dock->set_node(NULL);
object_menu->set_disabled(true);
_display_top_editors(false);
@@ -1699,7 +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);
+ node_dock->set_node(NULL);
object_menu->set_disabled(false);
//resources_dock->add_resource(Ref<Resource>(current_res));
@@ -1716,7 +1716,7 @@ void EditorNode::_edit_current() {
property_editor->edit( current_node );
- connections_dock->set_node( current_node );
+ node_dock->set_node( current_node );
scene_tree_dock->set_selected(current_node);
object_menu->get_popup()->clear();
@@ -1725,7 +1725,7 @@ void EditorNode::_edit_current() {
} else {
property_editor->edit( current_obj );
- connections_dock->set_node(NULL);
+ node_dock->set_node(NULL);
//scene_tree_dock->set_selected(current_node);
//object_menu->get_popup()->clear();
@@ -3822,6 +3822,10 @@ ScenesDock *EditorNode::get_scenes_dock() {
return scenes_dock;
}
+SceneTreeDock *EditorNode::get_scene_tree_dock() {
+
+ return scene_tree_dock;
+}
void EditorNode::_instance_request(const String& p_path){
@@ -5793,7 +5797,7 @@ EditorNode::EditorNode() {
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->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.\nOn 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."));
@@ -5801,9 +5805,9 @@ EditorNode::EditorNode() {
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("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->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.\nWhen used remotely on a device, this is more efficient with network 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->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.\nWhen used remotely on a device, this is more efficient with network filesystem."));
p->connect("item_pressed",this,"_menu_option");
/*
@@ -6070,9 +6074,9 @@ 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);
+ node_dock = memnew( NodeDock );
+ //node_dock->set_undoredo(&editor_data.get_undo_redo());
+ dock_slot[DOCK_SLOT_RIGHT_BL]->add_child(node_dock);
scenes_dock = memnew( ScenesDock(this) );
scenes_dock->set_name(TTR("FileSystem"));
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index 736c2ad57a..7d9b11ed83 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -49,6 +49,7 @@
#include "tools/editor/call_dialog.h"
#include "tools/editor/reparent_dialog.h"
#include "tools/editor/connections_dialog.h"
+#include "tools/editor/node_dock.h"
#include "tools/editor/settings_config_dialog.h"
#include "tools/editor/groups_editor.h"
#include "tools/editor/editor_data.h"
@@ -272,7 +273,7 @@ private:
SceneTreeDock *scene_tree_dock;
//ResourcesDock *resources_dock;
PropertyEditor *property_editor;
- ConnectionsDock *connections_dock;
+ NodeDock *node_dock;
VBoxContainer *prop_editor_vb;
ScenesDock *scenes_dock;
EditorRunNative *run_native;
@@ -665,6 +666,7 @@ public:
void request_instance_scene(const String &p_path);
ScenesDock *get_scenes_dock();
+ SceneTreeDock *get_scene_tree_dock();
static UndoRedo* get_undo_redo() { return &singleton->editor_data.get_undo_redo(); }
EditorSelection *get_editor_selection() { return editor_selection; }
diff --git a/tools/editor/groups_editor.cpp b/tools/editor/groups_editor.cpp
index 906ee27d1b..898e1e115e 100644
--- a/tools/editor/groups_editor.cpp
+++ b/tools/editor/groups_editor.cpp
@@ -30,6 +30,7 @@
#include "scene/gui/box_container.h"
#include "scene/gui/label.h"
+#include "editor_node.h"
void GroupsEditor::_add_group(const String& p_group) {
@@ -47,8 +48,10 @@ void GroupsEditor::_add_group(const String& p_group) {
undo_redo->add_do_method(node,"add_to_group",name,true);
undo_redo->add_do_method(this,"update_tree");
- undo_redo->add_undo_method(node,"remove_from_group",name,get_text());
+ undo_redo->add_undo_method(node,"remove_from_group",name);
undo_redo->add_undo_method(this,"update_tree");
+ undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree
+ undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree
undo_redo->commit_action();
@@ -72,6 +75,8 @@ void GroupsEditor::_remove_group(Object *p_item, int p_column, int p_id) {
undo_redo->add_do_method(this,"update_tree");
undo_redo->add_undo_method(node,"add_to_group",name,true);
undo_redo->add_undo_method(this,"update_tree");
+ undo_redo->add_do_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree
+ undo_redo->add_undo_method(EditorNode::get_singleton()->get_scene_tree_dock()->get_tree_editor(),"update_tree"); //to force redraw of scene tree
undo_redo->commit_action();
}
@@ -125,14 +130,10 @@ GroupsEditor::GroupsEditor() {
node=NULL;
- set_title(TTR("Group Editor"));
-
- VBoxContainer *vbc = memnew( VBoxContainer );
- add_child(vbc);
- set_child_rect(vbc);
+ VBoxContainer *vbc = this;
HBoxContainer *hbc = memnew( HBoxContainer );
- vbc->add_margin_child(TTR("Group"), hbc);
+ vbc->add_child(hbc);
group_name = memnew( LineEdit );
group_name->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -147,10 +148,9 @@ GroupsEditor::GroupsEditor() {
tree = memnew( Tree );
tree->set_hide_root(true);
tree->set_v_size_flags(SIZE_EXPAND_FILL);
- vbc->add_margin_child(TTR("Node Group(s)"), tree, true);
+ vbc->add_child(tree);
tree->connect("button_pressed",this,"_remove_group");
-
- get_ok()->set_text(TTR("Close"));
+ add_constant_override("separation",3*EDSCALE);
}
GroupsEditor::~GroupsEditor()
diff --git a/tools/editor/groups_editor.h b/tools/editor/groups_editor.h
index 6a897d0cbb..6edb577140 100644
--- a/tools/editor/groups_editor.h
+++ b/tools/editor/groups_editor.h
@@ -39,9 +39,9 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
-class GroupsEditor : public AcceptDialog {
+class GroupsEditor : public VBoxContainer {
- OBJ_TYPE(GroupsEditor,AcceptDialog);
+ OBJ_TYPE(GroupsEditor,VBoxContainer);
Node *node;
diff --git a/tools/editor/icons/icon_connection_and_groups.png b/tools/editor/icons/icon_connection_and_groups.png
new file mode 100644
index 0000000000..1fe4a28ed7
--- /dev/null
+++ b/tools/editor/icons/icon_connection_and_groups.png
Binary files differ
diff --git a/tools/editor/node_dock.cpp b/tools/editor/node_dock.cpp
new file mode 100644
index 0000000000..fb5a50e633
--- /dev/null
+++ b/tools/editor/node_dock.cpp
@@ -0,0 +1,104 @@
+#include "node_dock.h"
+#include "editor_node.h"
+
+void NodeDock::show_groups() {
+
+ groups_button->set_pressed(true);
+ connections_button->set_pressed(false);
+ groups->show();
+ connections->hide();
+}
+
+void NodeDock::show_connections(){
+
+ groups_button->set_pressed(false);
+ connections_button->set_pressed(true);
+ groups->hide();
+ connections->show();
+}
+
+
+void NodeDock::_bind_methods() {
+
+ ObjectTypeDB::bind_method(_MD("show_groups"),&NodeDock::show_groups);
+ ObjectTypeDB::bind_method(_MD("show_connections"),&NodeDock::show_connections);
+}
+
+void NodeDock::_notification(int p_what) {
+
+ if (p_what==NOTIFICATION_ENTER_TREE) {
+ connections_button->set_icon(get_icon("Connect","EditorIcons"));
+ groups_button->set_icon(get_icon("Groups","EditorIcons"));
+ }
+}
+
+NodeDock *NodeDock::singleton=NULL;
+
+void NodeDock::set_node(Node* p_node) {
+
+ connections->set_node(p_node);
+ groups->set_current(p_node);
+
+ if (p_node) {
+ if (connections_button->is_pressed())
+ connections->show();
+ else
+ groups->show();
+
+ mode_hb->show();
+ select_a_node->hide();
+ } else {
+ connections->hide();
+ groups->hide();
+ mode_hb->hide();
+ select_a_node->show();
+ }
+}
+
+NodeDock::NodeDock()
+{
+ singleton=this;
+
+ set_name(TTR("Node"));
+ mode_hb = memnew( HBoxContainer );
+ add_child(mode_hb);
+ mode_hb->hide();
+
+
+ connections_button = memnew( ToolButton );
+ connections_button->set_text(TTR("Signals"));
+ connections_button->set_toggle_mode(true);
+ connections_button->set_pressed(true);
+ connections_button->set_h_size_flags(SIZE_EXPAND_FILL);
+ mode_hb->add_child(connections_button);
+ connections_button->connect("pressed",this,"show_connections");
+
+ groups_button = memnew( ToolButton );
+ groups_button->set_text(TTR("Groups"));
+ groups_button->set_toggle_mode(true);
+ groups_button->set_pressed(false);
+ groups_button->set_h_size_flags(SIZE_EXPAND_FILL);
+ mode_hb->add_child(groups_button);
+ groups_button->connect("pressed",this,"show_groups");
+
+ connections = memnew( ConnectionsDock(EditorNode::get_singleton()) );
+ connections->set_undoredo(EditorNode::get_singleton()->get_undo_redo());
+ add_child(connections);
+ connections->set_v_size_flags(SIZE_EXPAND_FILL);
+ connections->hide();
+
+ groups = memnew( GroupsEditor );
+ groups->set_undo_redo(EditorNode::get_singleton()->get_undo_redo());
+ add_child(groups);
+ groups->set_v_size_flags(SIZE_EXPAND_FILL);
+ groups->hide();
+
+ select_a_node = memnew( Label );
+ select_a_node->set_text(TTR("Select a Node to edit Signals and Groups."));
+ select_a_node->set_v_size_flags(SIZE_EXPAND_FILL);
+ select_a_node->set_valign(Label::VALIGN_CENTER);
+ select_a_node->set_align(Label::ALIGN_CENTER);
+ select_a_node->set_autowrap(true);
+ add_child(select_a_node);
+
+}
diff --git a/tools/editor/node_dock.h b/tools/editor/node_dock.h
new file mode 100644
index 0000000000..02312b90b5
--- /dev/null
+++ b/tools/editor/node_dock.h
@@ -0,0 +1,38 @@
+#ifndef NODE_DOCK_H
+#define NODE_DOCK_H
+
+#include "connections_dialog.h"
+#include "groups_editor.h"
+
+class NodeDock : public VBoxContainer {
+
+ OBJ_TYPE(NodeDock,VBoxContainer);
+
+ ToolButton *connections_button;
+ ToolButton *groups_button;
+
+ ConnectionsDock *connections;
+ GroupsEditor *groups;
+
+ HBoxContainer *mode_hb;
+
+ Label* select_a_node;
+
+protected:
+
+ static void _bind_methods();
+ void _notification(int p_what);
+
+public:
+
+ static NodeDock *singleton;
+
+ void set_node(Node* p_node);
+
+ void show_groups();
+ void show_connections();
+
+ NodeDock();
+};
+
+#endif // NODE_DOCK_H
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index 6dba04dd4f..9612305a0f 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -271,8 +271,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
break;
//if (!_validate_no_foreign())
// break;
- groups_editor->set_current(current);
- groups_editor->popup_centered_ratio();
+ //groups_editor->set_current(current);
+ //groups_editor->popup_centered_ratio();
} break;
case TOOL_SCRIPT: {
@@ -1685,8 +1685,8 @@ void SceneTreeDock::_tree_rmb(const Vector2& p_menu_pos) {
menu->add_icon_item(get_icon("Instance","EditorIcons"),TTR("Instance Child Scene"),TOOL_INSTANCE);
menu->add_separator();
menu->add_icon_item(get_icon("Reload","EditorIcons"),TTR("Change Type"),TOOL_REPLACE);
- menu->add_separator();
- menu->add_icon_item(get_icon("Groups","EditorIcons"),TTR("Edit Groups"),TOOL_GROUP);
+ //menu->add_separator(); moved to their own dock
+ //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_icon_item(get_icon("Script","EditorIcons"),TTR("Add Script"),TOOL_SCRIPT);
@@ -1820,9 +1820,9 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
add_child(create_dialog);
create_dialog->connect("create",this,"_create");
- groups_editor = memnew( GroupsEditor );
- add_child(groups_editor);
- groups_editor->set_undo_redo(&editor_data->get_undo_redo());
+ //groups_editor = memnew( GroupsEditor );
+ //add_child(groups_editor);
+ //groups_editor->set_undo_redo(&editor_data->get_undo_redo());
//connect_dialog = memnew( ConnectionsDialog(p_editor) );
//add_child(connect_dialog);
diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h
index b1a2dcb689..60bec9b4f4 100644
--- a/tools/editor/scene_tree_dock.h
+++ b/tools/editor/scene_tree_dock.h
@@ -86,7 +86,7 @@ class SceneTreeDock : public VBoxContainer {
EditorData *editor_data;
EditorSelection *editor_selection;
- GroupsEditor *groups_editor;
+ //GroupsEditor *groups_editor;
//ConnectionsDialog *connect_dialog;
ScriptCreateDialog *script_create_dialog;
AcceptDialog *accept;
@@ -166,6 +166,7 @@ public:
void perform_node_renames(Node* p_base,List<Pair<NodePath,NodePath> > *p_renames, Map<Ref<Animation>, Set<int> > *r_rem_anims=NULL);
SceneTreeEditor *get_tree_editor() { return scene_tree; }
+
SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelection *p_editor_selection,EditorData &p_editor_data);
};
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index 09a5e7860f..bc12ff23e5 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -216,6 +216,17 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id)
warning->set_text(config_err);
warning->popup_centered_minsize();
+ } else if (p_id==BUTTON_SIGNALS) {
+
+ item->select(0);
+ NodeDock::singleton->get_parent()->call("set_current_tab",NodeDock::singleton->get_index());
+ NodeDock::singleton->show_connections();
+
+ } else if (p_id==BUTTON_GROUPS) {
+
+ item->select(0);
+ NodeDock::singleton->get_parent()->call("set_current_tab",NodeDock::singleton->get_index());
+ NodeDock::singleton->show_groups();
}
}
@@ -285,10 +296,25 @@ bool SceneTreeEditor::_add_nodes(Node *p_node,TreeItem *p_parent) {
}
}
- String warning = p_node->get_configuration_warning();
- if (warning!=String()) {
- item->add_button(0,get_icon("NodeWarning","EditorIcons"),BUTTON_WARNING);
+
+ if (can_rename) { //should be can edit..
+
+ String warning = p_node->get_configuration_warning();
+ if (warning!=String()) {
+ item->add_button(0,get_icon("NodeWarning","EditorIcons"),BUTTON_WARNING);
+ }
+
+ bool has_connections = p_node->has_persistent_signal_connections();
+ bool has_groups = p_node->has_persistent_groups();
+
+ if (has_connections && has_groups) {
+ item->add_button(0,get_icon("ConnectionAndGroups","EditorIcons"),BUTTON_SIGNALS);
+ } else if (has_connections) {
+ item->add_button(0,get_icon("Connect","EditorIcons"),BUTTON_SIGNALS);
+ } else if (has_groups) {
+ item->add_button(0,get_icon("Groups","EditorIcons"),BUTTON_GROUPS);
+ }
}
if (p_node==get_scene_node() && p_node->get_scene_inherited_state().is_valid()) {
@@ -999,6 +1025,7 @@ void SceneTreeEditor::_bind_methods() {
ObjectTypeDB::bind_method(_MD("can_drop_data_fw"), &SceneTreeEditor::can_drop_data_fw);
ObjectTypeDB::bind_method(_MD("drop_data_fw"), &SceneTreeEditor::drop_data_fw);
+ ObjectTypeDB::bind_method(_MD("update_tree"), &SceneTreeEditor::update_tree);
ADD_SIGNAL( MethodInfo("node_selected") );
ADD_SIGNAL( MethodInfo("node_renamed") );
diff --git a/tools/editor/scene_tree_editor.h b/tools/editor/scene_tree_editor.h
index 94be75ea8e..ae0afa32ec 100644
--- a/tools/editor/scene_tree_editor.h
+++ b/tools/editor/scene_tree_editor.h
@@ -49,7 +49,9 @@ class SceneTreeEditor : public Control {
BUTTON_SCRIPT=2,
BUTTON_LOCK=3,
BUTTON_GROUP=4,
- BUTTON_WARNING=5
+ BUTTON_WARNING=5,
+ BUTTON_SIGNALS=6,
+ BUTTON_GROUPS=7,
};
enum {