mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 06:03:09 +00:00
Merge pull request #84882 from Invertex/select-instance-asset
Add "Show In FileSystem" to the Scene hierarchy right-click
This commit is contained in:
commit
8f33b4e83a
@ -1192,7 +1192,7 @@ void EditorAudioBuses::_server_save() {
|
||||
}
|
||||
|
||||
void EditorAudioBuses::_select_layout() {
|
||||
FileSystemDock::get_singleton()->select_file(edited_path);
|
||||
FileSystemDock::get_singleton()->navigate_to_path(edited_path);
|
||||
}
|
||||
|
||||
void EditorAudioBuses::_save_as_layout() {
|
||||
|
@ -238,7 +238,7 @@ void EditorResourcePicker::_update_menu_items() {
|
||||
|
||||
if (edited_resource->get_path().is_resource_file()) {
|
||||
edit_menu->add_separator();
|
||||
edit_menu->add_item(TTR("Show in FileSystem"), OBJ_MENU_SHOW_IN_FILE_SYSTEM);
|
||||
edit_menu->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")), TTR("Show in FileSystem"), OBJ_MENU_SHOW_IN_FILE_SYSTEM);
|
||||
}
|
||||
}
|
||||
|
||||
@ -426,16 +426,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
|
||||
} break;
|
||||
|
||||
case OBJ_MENU_SHOW_IN_FILE_SYSTEM: {
|
||||
FileSystemDock *file_system_dock = FileSystemDock::get_singleton();
|
||||
file_system_dock->navigate_to_path(edited_resource->get_path());
|
||||
|
||||
// Ensure that the FileSystem dock is visible.
|
||||
if (file_system_dock->get_window() == get_tree()->get_root()) {
|
||||
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
|
||||
tab_container->set_current_tab(tab_container->get_tab_idx_from_control(file_system_dock));
|
||||
} else {
|
||||
file_system_dock->get_window()->grab_focus();
|
||||
}
|
||||
FileSystemDock::get_singleton()->navigate_to_path(edited_resource->get_path());
|
||||
} break;
|
||||
|
||||
default: {
|
||||
|
@ -756,6 +756,14 @@ void FileSystemDock::_navigate_to_path(const String &p_path, bool p_select_in_fa
|
||||
void FileSystemDock::navigate_to_path(const String &p_path) {
|
||||
file_list_search_box->clear();
|
||||
_navigate_to_path(p_path);
|
||||
|
||||
// Ensure that the FileSystem dock is visible.
|
||||
if (get_window() == get_tree()->get_root()) {
|
||||
TabContainer *tab_container = (TabContainer *)get_parent_control();
|
||||
tab_container->set_current_tab(tab_container->get_tab_idx_from_control((Control *)this));
|
||||
} else {
|
||||
get_window()->grab_focus();
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemDock::_file_list_thumbnail_done(const String &p_path, const Ref<Texture2D> &p_preview, const Ref<Texture2D> &p_small_preview, const Variant &p_udata) {
|
||||
|
@ -165,7 +165,7 @@ void EditorSceneTabs::_update_context_menu() {
|
||||
|
||||
if (tab_id >= 0) {
|
||||
scene_tabs_context_menu->add_separator();
|
||||
scene_tabs_context_menu->add_item(TTR("Show in FileSystem"), EditorNode::FILE_SHOW_IN_FILESYSTEM);
|
||||
scene_tabs_context_menu->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")), TTR("Show in FileSystem"), EditorNode::FILE_SHOW_IN_FILESYSTEM);
|
||||
_disable_menu_option_if(EditorNode::FILE_SHOW_IN_FILESYSTEM, !ResourceLoader::exists(EditorNode::get_editor_data().get_scene_path(tab_id)));
|
||||
scene_tabs_context_menu->add_item(TTR("Play This Scene"), EditorNode::FILE_RUN_SCENE);
|
||||
_disable_menu_option_if(EditorNode::FILE_RUN_SCENE, no_root_node);
|
||||
|
1
editor/icons/ShowInFileSystem.svg
Normal file
1
editor/icons/ShowInFileSystem.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M1 1v2.25h6v4.5h3v4.5h5V10h-2.75V7.75H15V5.5H9.25V3.25H15V1z" fill="#e0e0e0"/><path d="M5.04 8.04c-1.534 0-3.475 1.169-4.173 3.423a.6.6 0 0 0 0 .33c.67 2.374 2.673 3.447 4.173 3.447s3.502-1.073 4.177-3.435a.6.6 0 0 0 0-.33C8.557 9.201 6.572 8.04 5.04 8.04zm0 1.2a2.4 2.4 0 0 1 0 4.8 2.4 2.4 0 0 1 0-4.8zm0 1.2a1.2 1.2 0 0 0 0 2.4 1.2 1.2 0 0 0 0-2.4z" fill="#5fb2ff"/></svg>
|
After Width: | Height: | Size: 467 B |
@ -1427,11 +1427,7 @@ void ScriptEditor::_menu_option(int p_option) {
|
||||
path = path.get_slice("::", 0); // Show the scene instead.
|
||||
}
|
||||
|
||||
FileSystemDock *file_system_dock = FileSystemDock::get_singleton();
|
||||
file_system_dock->navigate_to_path(path);
|
||||
// Ensure that the FileSystem dock is visible.
|
||||
TabContainer *dock_tab_container = (TabContainer *)file_system_dock->get_parent_control();
|
||||
dock_tab_container->set_current_tab(dock_tab_container->get_tab_idx_from_control(file_system_dock));
|
||||
FileSystemDock::get_singleton()->navigate_to_path(path);
|
||||
}
|
||||
} break;
|
||||
case CLOSE_DOCS: {
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "editor/editor_settings.h"
|
||||
#include "editor/editor_string_names.h"
|
||||
#include "editor/editor_undo_redo_manager.h"
|
||||
#include "editor/filesystem_dock.h"
|
||||
#include "editor/gui/editor_file_dialog.h"
|
||||
#include "editor/inspector_dock.h"
|
||||
#include "editor/multi_node_edit.h"
|
||||
@ -148,6 +149,8 @@ void SceneTreeDock::shortcut_input(const Ref<InputEvent> &p_event) {
|
||||
_tool_selected(TOOL_ERASE, true);
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/copy_node_path", p_event)) {
|
||||
_tool_selected(TOOL_COPY_NODE_PATH);
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/show_in_file_system", p_event)) {
|
||||
_tool_selected(TOOL_SHOW_IN_FILE_SYSTEM);
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/toggle_unique_name", p_event)) {
|
||||
_tool_selected(TOOL_TOGGLE_SCENE_UNIQUE_NAME);
|
||||
} else if (ED_IS_SHORTCUT("scene_tree/delete", p_event)) {
|
||||
@ -1016,6 +1019,16 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case TOOL_SHOW_IN_FILE_SYSTEM: {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
List<Node *>::Element *e = selection.front();
|
||||
if (e) {
|
||||
const Node *node = e->get();
|
||||
if (node) {
|
||||
FileSystemDock::get_singleton()->navigate_to_path(node->get_scene_file_path());
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case TOOL_OPEN_DOCUMENTATION: {
|
||||
List<Node *> selection = editor_selection->get_selected_node_list();
|
||||
for (int i = 0; i < selection.size(); i++) {
|
||||
@ -3274,6 +3287,11 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) {
|
||||
}
|
||||
#endif // MODULE_REGEX_ENABLED
|
||||
menu->add_separator();
|
||||
|
||||
if (full_selection.size() == 1 && !selection[0]->get_scene_file_path().is_empty()) {
|
||||
menu->add_icon_shortcut(get_editor_theme_icon(SNAME("ShowInFileSystem")), ED_GET_SHORTCUT("scene_tree/show_in_file_system"), TOOL_SHOW_IN_FILE_SYSTEM);
|
||||
}
|
||||
|
||||
menu->add_icon_item(get_editor_theme_icon(SNAME("Help")), TTR("Open Documentation"), TOOL_OPEN_DOCUMENTATION);
|
||||
|
||||
if (profile_allow_editing) {
|
||||
@ -3975,6 +3993,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec
|
||||
ED_SHORTCUT("scene_tree/make_root", TTR("Make Scene Root"));
|
||||
ED_SHORTCUT("scene_tree/save_branch_as_scene", TTR("Save Branch as Scene"));
|
||||
ED_SHORTCUT("scene_tree/copy_node_path", TTR("Copy Node Path"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::SHIFT | Key::C);
|
||||
ED_SHORTCUT("scene_tree/show_in_file_system", TTR("Show In FileSystem"));
|
||||
ED_SHORTCUT("scene_tree/toggle_unique_name", TTR("Toggle Access as Unique Name"));
|
||||
ED_SHORTCUT("scene_tree/delete_no_confirm", TTR("Delete (No Confirm)"), KeyModifierMask::SHIFT | Key::KEY_DELETE);
|
||||
ED_SHORTCUT("scene_tree/delete", TTR("Delete"), Key::KEY_DELETE);
|
||||
|
@ -79,6 +79,7 @@ class SceneTreeDock : public VBoxContainer {
|
||||
TOOL_MULTI_EDIT,
|
||||
TOOL_ERASE,
|
||||
TOOL_COPY_NODE_PATH,
|
||||
TOOL_SHOW_IN_FILE_SYSTEM,
|
||||
TOOL_OPEN_DOCUMENTATION,
|
||||
TOOL_AUTO_EXPAND,
|
||||
TOOL_SCENE_EDITABLE_CHILDREN,
|
||||
|
Loading…
Reference in New Issue
Block a user