summaryrefslogtreecommitdiff
path: root/tools/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/editor_node.cpp')
-rw-r--r--tools/editor/editor_node.cpp85
1 files changed, 75 insertions, 10 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 22acfd4d07..4e22592880 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -2012,6 +2012,11 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
+ case SCENE_TAB_CLOSE: {
+ _remove_scene(tab_closing);
+ _update_scene_tabs();
+ current_option = -1;
+ } break;
case FILE_SAVE_SCENE: {
@@ -2023,7 +2028,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
return;
};
// fallthrough to save_as
- };
+ } break;
case FILE_SAVE_AS_SCENE: {
Node *scene = editor_data.get_edited_scene_root();
@@ -2957,23 +2962,23 @@ void EditorNode::_remove_edited_scene() {
_update_title();
_update_scene_tabs();
- if (editor_data.get_edited_scene_count()==1) {
- //make new scene appear saved
- set_current_version(editor_data.get_undo_redo().get_version());
- unsaved_cache=false;
- }
+// if (editor_data.get_edited_scene_count()==1) {
+// //make new scene appear saved
+// set_current_version(editor_data.get_undo_redo().get_version());
+// unsaved_cache=false;
+// }
}
void EditorNode::_remove_scene(int index) {
// printf("Attempting to remove scene %d (current is %d)\n", index, editor_data.get_edited_scene());
+
if (editor_data.get_edited_scene() == index) {
//Scene to remove is current scene
_remove_edited_scene();
}
else {
- // Scene to remove is not active scene.");
+ // Scene to remove is not active scene
editor_data.remove_scene(index);
- editor_data.get_undo_redo().clear_history();
}
}
@@ -4019,6 +4024,8 @@ void EditorNode::_bind_methods() {
ObjectTypeDB::bind_method("_prepare_history",&EditorNode::_prepare_history);
ObjectTypeDB::bind_method("_select_history",&EditorNode::_select_history);
+ ObjectTypeDB::bind_method("_toggle_search_bar",&EditorNode::_toggle_search_bar);
+ ObjectTypeDB::bind_method("_clear_search_box",&EditorNode::_clear_search_box);
ObjectTypeDB::bind_method(_MD("add_editor_import_plugin", "plugin"), &EditorNode::add_editor_import_plugin);
ObjectTypeDB::bind_method(_MD("remove_editor_import_plugin", "plugin"), &EditorNode::remove_editor_import_plugin);
@@ -4467,8 +4474,19 @@ void EditorNode::_scene_tab_script_edited(int p_tab) {
}
void EditorNode::_scene_tab_closed(int p_tab) {
- _remove_scene(p_tab);
- _update_scene_tabs();
+ current_option = SCENE_TAB_CLOSE;
+ tab_closing = p_tab;
+ if (unsaved_cache) {
+ confirmation->get_ok()->set_text("Yes");
+ //confirmation->get_cancel()->show();
+ confirmation->set_text("Close scene? (Unsaved changes will be lost)");
+ confirmation->popup_centered_minsize();
+ }
+ else {
+ _remove_scene(p_tab);
+ //_update_scene_tabs();
+ }
+
}
@@ -4501,6 +4519,30 @@ void EditorNode::_scene_tab_changed(int p_tab) {
}
+void EditorNode::_toggle_search_bar(bool p_pressed) {
+
+ property_editor->set_use_filter(p_pressed);
+
+ if (p_pressed) {
+
+ search_bar->show();
+ search_box->grab_focus();
+ search_box->select_all();
+ } else {
+
+ search_bar->hide();
+ }
+}
+
+void EditorNode::_clear_search_box() {
+
+ if (search_box->get_text()=="")
+ return;
+
+ search_box->clear();
+ property_editor->update_tree();
+}
+
EditorNode::EditorNode() {
EditorHelp::generate_doc(); //before any editor classes are crated
@@ -5306,6 +5348,12 @@ EditorNode::EditorNode() {
editor_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
prop_editor_hb->add_child(editor_path);
+ search_button = memnew( ToolButton );
+ search_button->set_toggle_mode(true);
+ search_button->set_pressed(false);
+ search_button->set_icon(gui_base->get_icon("Zoom","EditorIcons"));
+ prop_editor_hb->add_child(search_button);
+ search_button->connect("toggled",this,"_toggle_search_bar");
object_menu = memnew( MenuButton );
object_menu->set_icon(gui_base->get_icon("Tools","EditorIcons"));
@@ -5317,6 +5365,22 @@ EditorNode::EditorNode() {
create_dialog->set_base_type("Resource");
create_dialog->connect("create",this,"_resource_created");
+ search_bar = memnew( HBoxContainer );
+ search_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ prop_editor_base->add_child(search_bar);
+ search_bar->hide();
+
+ l = memnew( Label("Search: ") );
+ search_bar->add_child(l);
+
+ search_box = memnew( LineEdit );
+ search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
+ search_bar->add_child(search_box);
+
+ ToolButton *clear_button = memnew( ToolButton );
+ clear_button->set_icon(gui_base->get_icon("Close","EditorIcons"));
+ search_bar->add_child(clear_button);
+ clear_button->connect("pressed",this,"_clear_search_box");
property_editor = memnew( PropertyEditor );
property_editor->set_autoclear(true);
@@ -5325,6 +5389,7 @@ EditorNode::EditorNode() {
property_editor->set_use_doc_hints(true);
property_editor->hide_top_label();
+ property_editor->register_text_enter(search_box);
prop_editor_base->add_child( property_editor );
property_editor->set_undo_redo(&editor_data.get_undo_redo());