Browse Source

Replace the -show in filesystem- button by a RMB entry

groud 7 years ago
parent
commit
d7b638ed32
4 changed files with 11 additions and 20 deletions
  1. 9 0
      editor/editor_node.cpp
  2. 1 0
      editor/editor_node.h
  3. 1 18
      editor/filesystem_dock.cpp
  4. 0 2
      editor/filesystem_dock.h

+ 9 - 0
editor/editor_node.cpp

@@ -2045,6 +2045,14 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
 			emit_signal("stop_pressed");
 
 		} break;
+
+		case FILE_SHOW_IN_FILESYSTEM: {
+			String path = editor_data.get_scene_path(editor_data.get_edited_scene());
+			if (path != String()) {
+				filesystem_dock->navigate_to_path(path);
+			}
+		} break;
+
 		case RUN_PLAY_SCENE: {
 
 			_save_default_environment();
@@ -3901,6 +3909,7 @@ void EditorNode::_scene_tab_input(const Ref<InputEvent> &p_input) {
 			scene_tabs_context_menu->add_shortcut(ED_GET_SHORTCUT("editor/save_all_scenes"), FILE_SAVE_ALL_SCENES);
 			if (scene_tabs->get_hovered_tab() >= 0) {
 				scene_tabs_context_menu->add_separator();
+				scene_tabs_context_menu->add_item(TTR("Show in filesystem"), FILE_SHOW_IN_FILESYSTEM);
 				scene_tabs_context_menu->add_item(TTR("Play This Scene"), RUN_PLAY_SCENE);
 				scene_tabs_context_menu->add_item(TTR("Close Tab"), FILE_CLOSE);
 			}

+ 1 - 0
editor/editor_node.h

@@ -125,6 +125,7 @@ private:
 		FILE_SAVE_ALL_SCENES,
 		FILE_SAVE_BEFORE_RUN,
 		FILE_SAVE_AND_RUN,
+		FILE_SHOW_IN_FILESYSTEM,
 		FILE_IMPORT_SUBSCENE,
 		FILE_EXPORT_PROJECT,
 		FILE_EXPORT_MESH_LIBRARY,

+ 1 - 18
editor/filesystem_dock.cpp

@@ -97,6 +97,7 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
 			file_item->set_metadata(0, file_metadata);
 			if (path == file_metadata) {
 				file_item->select(0);
+				file_item->set_as_cursor(0);
 			}
 			Array udata;
 			udata.push_back(tree_update_id);
@@ -263,7 +264,6 @@ void FileSystemDock::_notification(int p_what) {
 
 			button_hist_next->set_icon(get_icon("Forward", ei));
 			button_hist_prev->set_icon(get_icon("Back", ei));
-			button_show->set_icon(get_icon("GuiVisibilityVisible", "EditorIcons"));
 			file_list_popup->connect("id_pressed", this, "_file_list_rmb_option");
 			tree_popup->connect("id_pressed", this, "_tree_rmb_option");
 
@@ -368,15 +368,6 @@ void FileSystemDock::_tree_multi_selected(Object *p_item, int p_column, bool p_s
 	}
 }
 
-void FileSystemDock::_show_current_scene_file() {
-
-	int index = EditorNode::get_editor_data().get_edited_scene();
-	String path = EditorNode::get_editor_data().get_scene_path(index);
-	if (path != String()) {
-		navigate_to_path(path);
-	}
-}
-
 String FileSystemDock::get_selected_path() const {
 	if (path.ends_with("/"))
 		return path;
@@ -2061,7 +2052,6 @@ void FileSystemDock::_bind_methods() {
 
 	ClassDB::bind_method(D_METHOD("_update_tree"), &FileSystemDock::_update_tree);
 	ClassDB::bind_method(D_METHOD("_rescan"), &FileSystemDock::_rescan);
-	ClassDB::bind_method(D_METHOD("_show_current_scene_file"), &FileSystemDock::_show_current_scene_file);
 	//ClassDB::bind_method(D_METHOD("_instance_pressed"),&ScenesDock::_instance_pressed);
 
 	ClassDB::bind_method(D_METHOD("_tree_rmb_option", "option"), &FileSystemDock::_tree_rmb_option);
@@ -2145,13 +2135,6 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
 
 	//toolbar_hbc->add_spacer();
 
-	button_show = memnew(Button);
-	button_show->set_flat(true);
-	button_show->connect("pressed", this, "_show_current_scene_file");
-	toolbar_hbc->add_child(button_show);
-	button_show->set_focus_mode(FOCUS_NONE);
-	button_show->set_tooltip(TTR("Show current scene file."));
-
 	//Control *spacer = memnew( Control);
 
 	/*

+ 0 - 2
editor/filesystem_dock.h

@@ -112,7 +112,6 @@ private:
 	Button *button_file_list_display_mode;
 	Button *button_hist_next;
 	Button *button_hist_prev;
-	Button *button_show;
 	LineEdit *current_path;
 	LineEdit *search_box;
 	TextureRect *search_icon;
@@ -227,7 +226,6 @@ private:
 	void _set_scanning_mode();
 	void _rescan();
 
-	void _show_current_scene_file();
 	void _search_changed(const String &p_text);
 
 	void _file_and_folders_fill_popup(PopupMenu *p_popup, Vector<String> p_paths);