diff options
author | Geequlim <geequlim@gmail.com> | 2016-05-18 15:37:59 +0800 |
---|---|---|
committer | Geequlim <geequlim@gmail.com> | 2016-05-18 15:48:40 +0800 |
commit | 5ad648097930e46df3d23f514e8bc08fa00b31f5 (patch) | |
tree | 76846c3698c4d05a347881f1e5f4ac750542b512 /tools/editor | |
parent | 926495d8eb11de2878319ba54f30812fa1637d72 (diff) |
Add 'Show In System' option into filesystem RMB menu
Diffstat (limited to 'tools/editor')
-rw-r--r-- | tools/editor/scenes_dock.cpp | 17 | ||||
-rw-r--r-- | tools/editor/scenes_dock.h | 3 |
2 files changed, 18 insertions, 2 deletions
diff --git a/tools/editor/scenes_dock.cpp b/tools/editor/scenes_dock.cpp index e00f470bc4..a068bdf58b 100644 --- a/tools/editor/scenes_dock.cpp +++ b/tools/editor/scenes_dock.cpp @@ -944,6 +944,7 @@ void ScenesDock::_file_option(int p_option) { switch(p_option) { + case FILE_SHOW_IN_EXPLORER: case FILE_OPEN: { int idx=-1; for(int i=0;i<files->get_item_count();i++) { @@ -959,6 +960,17 @@ void ScenesDock::_file_option(int p_option) { String path = files->get_item_metadata(idx); + if (p_option == FILE_SHOW_IN_EXPLORER) { + String dir = DirAccess::get_full_path("res://", DirAccess::ACCESS_FILESYSTEM); + const int res_begin = String("res://").length(); + const int last_sep = path.find_last("/"); + if (last_sep > res_begin) { + dir += "/"; + dir += path.substr(res_begin, last_sep - res_begin); + } + OS::get_singleton()->shell_open(String("file://")+dir); + return; + } if (path.ends_with("/")) { if (path!="res://") { @@ -1416,6 +1428,10 @@ void ScenesDock::_files_list_rmb_select(int p_item,const Vector2& p_pos) { file_options->add_item(TTR("Delete"),FILE_REMOVE); //file_options->add_item(TTR("Info"),FILE_INFO); + + file_options->add_separator(); + file_options->add_item(TTR("Show In System"),FILE_SHOW_IN_EXPLORER); + file_options->set_pos(files->get_global_pos() + p_pos); file_options->popup(); @@ -1635,4 +1651,3 @@ ScenesDock::ScenesDock(EditorNode *p_editor) { ScenesDock::~ScenesDock() { } - diff --git a/tools/editor/scenes_dock.h b/tools/editor/scenes_dock.h index 327e5a25f0..42c1374be1 100644 --- a/tools/editor/scenes_dock.h +++ b/tools/editor/scenes_dock.h @@ -62,7 +62,8 @@ class ScenesDock : public VBoxContainer { FILE_MOVE, FILE_REMOVE, FILE_REIMPORT, - FILE_INFO + FILE_INFO, + FILE_SHOW_IN_EXPLORER }; |