summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/editor_settings.cpp2
-rw-r--r--tools/editor/icons/icon_instance.pngbin446 -> 522 bytes
-rw-r--r--tools/editor/icons/icon_node_warning.pngbin0 -> 701 bytes
-rw-r--r--tools/editor/scene_tree_dock.cpp143
-rw-r--r--tools/editor/scene_tree_dock.h6
-rw-r--r--tools/editor/scene_tree_editor.cpp39
-rw-r--r--tools/editor/scene_tree_editor.h6
7 files changed, 60 insertions, 136 deletions
diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp
index d9351ffa80..1d79dddac9 100644
--- a/tools/editor/editor_settings.cpp
+++ b/tools/editor/editor_settings.cpp
@@ -438,7 +438,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
set("scenetree_editor/duplicate_node_name_num_separator",0);
hints["scenetree_editor/duplicate_node_name_num_separator"]=PropertyInfo(Variant::INT,"scenetree_editor/duplicate_node_name_num_separator",PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash");
- set("scenetree_editor/display_old_action_buttons",false);
+ //set("scenetree_editor/display_old_action_buttons",false);
set("gridmap_editor/pick_distance", 5000.0);
diff --git a/tools/editor/icons/icon_instance.png b/tools/editor/icons/icon_instance.png
index 82d8d41812..6ad9f38e53 100644
--- a/tools/editor/icons/icon_instance.png
+++ b/tools/editor/icons/icon_instance.png
Binary files differ
diff --git a/tools/editor/icons/icon_node_warning.png b/tools/editor/icons/icon_node_warning.png
new file mode 100644
index 0000000000..de799ac30f
--- /dev/null
+++ b/tools/editor/icons/icon_node_warning.png
Binary files differ
diff --git a/tools/editor/scene_tree_dock.cpp b/tools/editor/scene_tree_dock.cpp
index 6d0c21d5f8..d0569920bd 100644
--- a/tools/editor/scene_tree_dock.cpp
+++ b/tools/editor/scene_tree_dock.cpp
@@ -612,26 +612,8 @@ void SceneTreeDock::_notification(int p_what) {
canvas_item_plugin->get_canvas_item_editor()->connect("item_group_status_changed", scene_tree, "_update_tree");
scene_tree->connect("node_changed", canvas_item_plugin->get_canvas_item_editor()->get_viewport_control(), "update");
}
- static const char* button_names[TOOL_BUTTON_MAX]={
- "New",
- "Add",
- "Replace",
- "Connect",
- "Groups",
- "Script",
- "MoveUp",
- "MoveDown",
- "Duplicate",
- "Reparent",
- "CreateNewSceneFrom",
- "MultiNodeEdit",
- "Remove",
- };
-
-
-
- for(int i=0;i<TOOL_BUTTON_MAX;i++)
- tool_buttons[i]->set_icon(get_icon(button_names[i],"EditorIcons"));
+ button_add->set_icon(get_icon("Add","EditorIcons"));
+ button_instance->set_icon(get_icon("Instance","EditorIcons"));
filter_icon->set_texture(get_icon("Zoom","EditorIcons"));
@@ -1246,33 +1228,11 @@ void SceneTreeDock::_delete_confirm() {
}
editor_data->get_undo_redo().commit_action();
- _update_tool_buttons();
-}
-
-void SceneTreeDock::_update_tool_buttons() {
-
- Node *sel = scene_tree->get_selected();
- bool disable = !sel || (sel!=edited_scene && sel->get_owner()!=edited_scene);
- disable = disable || (edited_scene->get_scene_inherited_state().is_valid() && edited_scene->get_scene_inherited_state()->find_node_by_path(edited_scene->get_path_to(sel))>=0);
- bool disable_root = disable || sel->get_parent()==scene_root;
- bool disable_edit = !sel;
- tool_buttons[TOOL_INSTANCE]->set_disabled(disable_edit);
- tool_buttons[TOOL_REPLACE]->set_disabled(disable);
- tool_buttons[TOOL_CONNECT]->set_disabled(disable_edit);
- tool_buttons[TOOL_GROUP]->set_disabled(disable_edit);
- tool_buttons[TOOL_SCRIPT]->set_disabled(disable_edit);
- tool_buttons[TOOL_MOVE_UP]->set_disabled(disable_root);
- tool_buttons[TOOL_MOVE_DOWN]->set_disabled(disable_root);
- tool_buttons[TOOL_DUPLICATE]->set_disabled(disable_root);
- tool_buttons[TOOL_REPARENT]->set_disabled(disable_root);
- tool_buttons[TOOL_ERASE]->set_disabled(disable);
- tool_buttons[TOOL_NEW_SCENE_FROM]->set_disabled(disable_root);
- tool_buttons[TOOL_MULTI_EDIT]->set_disabled(EditorNode::get_singleton()->get_editor_selection()->get_selection().size()<2);
+}
-}
void SceneTreeDock::_selection_changed() {
@@ -1415,7 +1375,7 @@ void SceneTreeDock::_create() {
memdelete(n);
- _update_tool_buttons();
+
}
@@ -1430,7 +1390,7 @@ void SceneTreeDock::set_edited_scene(Node* p_scene) {
void SceneTreeDock::set_selected(Node *p_node, bool p_emit_selected ) {
scene_tree->set_selected(p_node,p_emit_selected);
- _update_tool_buttons();
+
}
void SceneTreeDock::import_subscene() {
@@ -1803,50 +1763,23 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
VBoxContainer *vbc = this;
- HBoxContainer *hbc_top = memnew( HBoxContainer );
- vbc->add_child(hbc_top);
-
+ HBoxContainer *filter_hbc = memnew( HBoxContainer );
ToolButton *tb;
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_NEW, false));
tb->set_tooltip("Add/Create a New Node\n("+keycode_get_string(KEY_MASK_CMD|KEY_A)+")");
- hbc_top->add_child(tb);
- tool_buttons[TOOL_NEW]=tb;
+ filter_hbc->add_child(tb);
+ button_add=tb;
tb = memnew( ToolButton );
tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_INSTANCE, false));
- tb->set_tooltip(TTR("Instance a scene file as a Node."));
- hbc_top->add_child(tb);
- tool_buttons[TOOL_INSTANCE]=tb;
+ tb->set_tooltip(TTR("Instance a scene file as a Node. Creates an inherited scene if no root node exists."));
+ filter_hbc->add_child(tb);
+ button_instance=tb;
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_REPLACE, false));
- tb->set_tooltip(TTR("Replace a Node by Another Node Type"));
- hbc_top->add_child(tb);
- tool_buttons[TOOL_REPLACE]=tb;
-
- hbc_top->add_spacer();
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_CONNECT, false));
- tb->set_tooltip(TTR("Edit the Node Connections"));
- hbc_top->add_child(tb);
- tool_buttons[TOOL_CONNECT]=tb;
-
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_GROUP, false));
- tb->set_tooltip(TTR("Edit the Node Groups"));
- hbc_top->add_child(tb);
- tool_buttons[TOOL_GROUP]=tb;
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_SCRIPT, false));
- tb->set_tooltip(TTR("Edit/Create the Node Script"));
- hbc_top->add_child(tb);
- tool_buttons[TOOL_SCRIPT]=tb;
-
- HBoxContainer *filter_hbc = memnew( HBoxContainer );
vbc->add_child(filter_hbc);
filter = memnew( LineEdit );
filter->set_h_size_flags(SIZE_EXPAND_FILL);
@@ -1875,54 +1808,6 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
scene_tree->set_editor_selection(editor_selection);
- HBoxContainer *hbc_bottom = memnew( HBoxContainer );
- vbc->add_child(hbc_bottom);
- hbc_bottom->add_constant_override("separation", 0);
-
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MOVE_UP, false));
- tb->set_tooltip("Move Node Up\n("+keycode_get_string(KEY_MASK_CMD|KEY_UP)+")");
- hbc_bottom->add_child(tb);
- tool_buttons[TOOL_MOVE_UP]=tb;
-
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MOVE_DOWN, false));
- tb->set_tooltip("Move Node Down\n("+keycode_get_string(KEY_MASK_CMD|KEY_DOWN)+")");
- hbc_bottom->add_child(tb);
- tool_buttons[TOOL_MOVE_DOWN]=tb;
-
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_DUPLICATE, false));
- tb->set_tooltip("Duplicate Selected Node(s)\n("+keycode_get_string(KEY_MASK_CMD|KEY_D)+")");
- hbc_bottom->add_child(tb);
- tool_buttons[TOOL_DUPLICATE]=tb;
-
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_REPARENT, false));
- tb->set_tooltip(TTR("Reparent Selected Node(s)"));
- hbc_bottom->add_child(tb);
- tool_buttons[TOOL_REPARENT]=tb;
-
- hbc_bottom->add_spacer();
-
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_NEW_SCENE_FROM, false));
- tb->set_tooltip(TTR("Create New Scene From Node(s)"));
- hbc_bottom->add_child(tb);
- tool_buttons[TOOL_NEW_SCENE_FROM]=tb;
-
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_MULTI_EDIT, false));
- tb->set_tooltip(TTR("Multi-Edit Selected Nodes"));
- hbc_bottom->add_child(tb);
- tool_buttons[TOOL_MULTI_EDIT]=tb;
-
- tb = memnew( ToolButton );
- tb->connect("pressed",this,"_tool_selected",make_binds(TOOL_ERASE, false));
- tb->set_tooltip(TTR("Erase Selected Node(s)"));
- hbc_bottom->add_child(tb);
- tool_buttons[TOOL_ERASE]=tb;
-
create_dialog = memnew( CreateDialog );
create_dialog->set_base_type("Node");
add_child(create_dialog);
@@ -1971,12 +1856,6 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor,Node *p_scene_root,EditorSelec
menu->connect("item_pressed",this,"_tool_selected");
first_enter=true;
- if (!EditorSettings::get_singleton()->get("scenetree_editor/display_old_action_buttons")) {
- for(int i=0;i<TOOL_BUTTON_MAX;i++) {
- tool_buttons[i]->hide();
- }
- }
-
vbc->add_constant_override("separation",4);
}
diff --git a/tools/editor/scene_tree_dock.h b/tools/editor/scene_tree_dock.h
index d917cae64f..0894dc8ffa 100644
--- a/tools/editor/scene_tree_dock.h
+++ b/tools/editor/scene_tree_dock.h
@@ -74,7 +74,9 @@ class SceneTreeDock : public VBoxContainer {
int current_option;
CreateDialog *create_dialog;
- ToolButton *tool_buttons[TOOL_BUTTON_MAX];
+ ToolButton *button_add;
+ ToolButton *button_instance;
+
SceneTreeEditor *scene_tree;
HBoxContainer *tool_hbc;
@@ -121,7 +123,7 @@ class SceneTreeDock : public VBoxContainer {
void _script_created(Ref<Script> p_script);
void _delete_confirm();
- void _update_tool_buttons();
+
void _node_prerenamed(Node* p_node, const String& p_new_name);
diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp
index be1fec904f..7332bbb8b0 100644
--- a/tools/editor/scene_tree_editor.cpp
+++ b/tools/editor/scene_tree_editor.cpp
@@ -207,6 +207,15 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id)
_update_tree();
emit_signal("node_changed");
}
+ } else if (p_id==BUTTON_WARNING) {
+
+ String config_err = n->get_configuration_warning();
+ if (config_err==String())
+ return;
+ config_err=config_err.world_wrap(80);
+ warning->set_text(config_err);
+ warning->popup_centered_minsize();
+
}
}
@@ -276,6 +285,12 @@ 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 (p_node==get_scene_node() && p_node->get_scene_inherited_state().is_valid()) {
item->add_button(0,get_icon("InstanceOptions","EditorIcons"),BUTTON_SUBSCENE);
item->set_tooltip(0,TTR("Inherits: ")+p_node->get_scene_inherited_state()->get_path()+"\nType: "+p_node->get_type());
@@ -558,6 +573,8 @@ void SceneTreeEditor::_notification(int p_what) {
get_tree()->connect("tree_changed",this,"_tree_changed");
get_tree()->connect("node_removed",this,"_node_removed");
+ get_tree()->connect("node_configuration_warning_changed",this,"_warning_changed");
+
instance_menu->set_item_icon(3,get_icon("Load","EditorIcons"));
tree->connect("item_collapsed",this,"_cell_collapsed");
inheritance_menu->set_item_icon(2,get_icon("Load","EditorIcons"));
@@ -574,6 +591,7 @@ void SceneTreeEditor::_notification(int p_what) {
get_tree()->disconnect("node_removed",this,"_node_removed");
tree->disconnect("item_collapsed",this,"_cell_collapsed");
clear_inherit_confirm->disconnect("confirmed",this,"_subscene_option");
+ get_tree()->disconnect("node_configuration_warning_changed",this,"_warning_changed");
}
}
@@ -666,7 +684,7 @@ void SceneTreeEditor::_renamed() {
String new_name=which->get_text(0);
if (new_name.find(".") != -1 || new_name.find("/") != -1) {
- error->set_text("Invalid node name, the following characters are not allowed:\n \".\", \"/\"");
+ error->set_text(TTR("Invalid node name, the following characters are not allowed:\n \".\", \"/\""));
error->popup_centered_minsize();
new_name=n->get_name();
}
@@ -949,6 +967,13 @@ void SceneTreeEditor::_rmb_select(const Vector2& p_pos) {
}
+void SceneTreeEditor::_warning_changed(Node* p_for_node) {
+
+ //should use a timer
+ update_timer->start();
+// print_line("WARNING CHANGED "+String(p_for_node->get_name()));
+
+}
void SceneTreeEditor::_bind_methods() {
@@ -965,6 +990,7 @@ void SceneTreeEditor::_bind_methods() {
ObjectTypeDB::bind_method("_cell_collapsed",&SceneTreeEditor::_cell_collapsed);
ObjectTypeDB::bind_method("_subscene_option",&SceneTreeEditor::_subscene_option);
ObjectTypeDB::bind_method("_rmb_select",&SceneTreeEditor::_rmb_select);
+ ObjectTypeDB::bind_method("_warning_changed",&SceneTreeEditor::_warning_changed);
ObjectTypeDB::bind_method("_node_script_changed",&SceneTreeEditor::_node_script_changed);
ObjectTypeDB::bind_method("_node_visibility_changed",&SceneTreeEditor::_node_visibility_changed);
@@ -973,6 +999,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);
+
ADD_SIGNAL( MethodInfo("node_selected") );
ADD_SIGNAL( MethodInfo("node_renamed") );
ADD_SIGNAL( MethodInfo("node_prerename") );
@@ -1034,6 +1061,11 @@ SceneTreeEditor::SceneTreeEditor(bool p_label,bool p_can_rename, bool p_can_open
error = memnew( AcceptDialog );
add_child(error);
+ warning = memnew( AcceptDialog );
+ add_child(warning);
+ warning->set_title("Node Configuration Warning!");
+
+
show_enabled_subscene=false;
last_hash=0;
@@ -1062,6 +1094,11 @@ SceneTreeEditor::SceneTreeEditor(bool p_label,bool p_can_rename, bool p_can_open
clear_inherit_confirm->get_ok()->set_text(TTR("Clear!"));
add_child(clear_inherit_confirm);
+ update_timer = memnew(Timer);
+ update_timer->connect("timeout",this,"_update_tree");
+ update_timer->set_one_shot(true);
+ update_timer->set_wait_time(0.5);
+ add_child(update_timer);
}
diff --git a/tools/editor/scene_tree_editor.h b/tools/editor/scene_tree_editor.h
index e88922f73e..94be75ea8e 100644
--- a/tools/editor/scene_tree_editor.h
+++ b/tools/editor/scene_tree_editor.h
@@ -49,6 +49,7 @@ class SceneTreeEditor : public Control {
BUTTON_SCRIPT=2,
BUTTON_LOCK=3,
BUTTON_GROUP=4,
+ BUTTON_WARNING=5
};
enum {
@@ -69,6 +70,7 @@ class SceneTreeEditor : public Control {
String filter;
AcceptDialog *error;
+ AcceptDialog *warning;
ConfirmationDialog *clear_inherit_confirm;
int blocked;
@@ -124,6 +126,10 @@ class SceneTreeEditor : public Control {
void _rmb_select(const Vector2& p_pos);
+ void _warning_changed(Node* p_for_node);
+
+ Timer* update_timer;
+
public:
void set_filter(const String& p_filter);