mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2025-01-03 17:39:36 +01:00
Make sure that the FileSystem is made visible properly when needed in both it's normal and it's bottom bar mode.
This commit is contained in:
parent
e1f64a84ad
commit
3b5bd395cb
@ -6960,6 +6960,7 @@ EditorNode::EditorNode() {
|
||||
if (filesystem_dock_wide) {
|
||||
filesystem_dock->set_custom_minimum_size(Size2(0, 230 * EDSCALE));
|
||||
ToolButton *fs_button = add_bottom_panel_item(TTR("FileSystem"), filesystem_dock);
|
||||
filesystem_dock->set_bottom_panel_tool_button(fs_button);
|
||||
fs_button->set_shortcut(ED_SHORTCUT("editor/toggle_filesystem_panel", TTR("Toggle FileSystem Panel"), KEY_MASK_CMD | KEY_MASK_ALT | KEY_QUOTELEFT));
|
||||
}
|
||||
|
||||
|
@ -396,10 +396,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) {
|
||||
case OBJ_MENU_SHOW_IN_FILE_SYSTEM: {
|
||||
FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock();
|
||||
file_system_dock->navigate_to_path(edited_resource->get_path());
|
||||
|
||||
// Ensure that the FileSystem dock is visible.
|
||||
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
|
||||
tab_container->set_current_tab(file_system_dock->get_index());
|
||||
file_system_dock->ensure_visible();
|
||||
} break;
|
||||
|
||||
default: {
|
||||
|
@ -73,6 +73,7 @@
|
||||
#include "scene/gui/popup_menu.h"
|
||||
#include "scene/gui/progress_bar.h"
|
||||
#include "scene/gui/scroll_bar.h"
|
||||
#include "scene/gui/tab_container.h"
|
||||
#include "scene/gui/tool_button.h"
|
||||
#include "scene/gui/tree.h"
|
||||
#include "scene/main/node.h"
|
||||
@ -2094,6 +2095,24 @@ void FileSystemDock::remove_custom_popup_creation_entry(const int id) {
|
||||
}
|
||||
}
|
||||
|
||||
void FileSystemDock::ensure_visible() {
|
||||
if (display_mode == DISPLAY_MODE_WIDE) {
|
||||
if (bottom_panel_tool_button) {
|
||||
bottom_panel_tool_button->set_pressed(true);
|
||||
}
|
||||
} else {
|
||||
// Ensure that the FileSystem dock is visible.
|
||||
TabContainer *tab_container = (TabContainer *)get_parent_control();
|
||||
|
||||
if (tab_container) {
|
||||
tab_container->set_current_tab(get_position_in_parent());
|
||||
}
|
||||
}
|
||||
}
|
||||
void FileSystemDock::set_bottom_panel_tool_button(ToolButton *fs_button) {
|
||||
bottom_panel_tool_button = fs_button;
|
||||
}
|
||||
|
||||
Variant FileSystemDock::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
||||
bool all_favorites = true;
|
||||
bool all_not_favorites = true;
|
||||
@ -2853,6 +2872,7 @@ void FileSystemDock::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("can_drop_data_fw", "point", "data", "from"), &FileSystemDock::can_drop_data_fw);
|
||||
ClassDB::bind_method(D_METHOD("drop_data_fw", "point", "data", "from"), &FileSystemDock::drop_data_fw);
|
||||
ClassDB::bind_method(D_METHOD("navigate_to_path", "path"), &FileSystemDock::navigate_to_path);
|
||||
ClassDB::bind_method(D_METHOD("ensure_visible"), &FileSystemDock::ensure_visible);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_preview_invalidated"), &FileSystemDock::_preview_invalidated);
|
||||
ClassDB::bind_method(D_METHOD("_file_multi_selected"), &FileSystemDock::_file_multi_selected);
|
||||
@ -2876,6 +2896,9 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
|
||||
editor = p_editor;
|
||||
path = "res://";
|
||||
|
||||
file_sort = FILE_SORT_NAME;
|
||||
bottom_panel_tool_button = NULL;
|
||||
|
||||
// `KEY_MASK_CMD | KEY_C` conflicts with other editor shortcuts.
|
||||
ED_SHORTCUT("filesystem_dock/copy_path", TTR("Copy Path"), KEY_MASK_CMD | KEY_MASK_SHIFT | KEY_C);
|
||||
ED_SHORTCUT("filesystem_dock/duplicate", TTR("Duplicate..."), KEY_MASK_CMD | KEY_D);
|
||||
|
@ -69,6 +69,7 @@ class TextureRect;
|
||||
class Tree;
|
||||
class TreeItem;
|
||||
class DirectoryCreateDialog;
|
||||
class ToolButton;
|
||||
|
||||
class FileSystemDock : public VBoxContainer {
|
||||
GDCLASS(FileSystemDock, VBoxContainer);
|
||||
@ -122,7 +123,9 @@ private:
|
||||
FILE_NEW_CUSTOM_ENTRY_START,
|
||||
};
|
||||
|
||||
FileSortOption file_sort = FILE_SORT_NAME;
|
||||
FileSortOption file_sort;
|
||||
|
||||
ToolButton *bottom_panel_tool_button;
|
||||
|
||||
VBoxContainer *scanning_vb;
|
||||
ProgressBar *scanning_progress;
|
||||
@ -369,6 +372,9 @@ public:
|
||||
int add_custom_popup_creation_entry(const String &entry_text, const String &theme_icon_name = "", const String &theme_icon_category = "");
|
||||
void remove_custom_popup_creation_entry(const int id);
|
||||
|
||||
void ensure_visible();
|
||||
void set_bottom_panel_tool_button(ToolButton *fs_button);
|
||||
|
||||
FileSystemDock(EditorNode *p_editor);
|
||||
~FileSystemDock();
|
||||
};
|
||||
|
@ -279,9 +279,7 @@ void CustomPropertyEditor::_menu_option(int p_which) {
|
||||
RES r = v;
|
||||
FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock();
|
||||
file_system_dock->navigate_to_path(r->get_path());
|
||||
// Ensure that the FileSystem dock is visible.
|
||||
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
|
||||
tab_container->set_current_tab(file_system_dock->get_position_in_parent());
|
||||
file_system_dock->ensure_visible();
|
||||
} break;
|
||||
default: {
|
||||
if (p_which >= CONVERT_BASE_ID) {
|
||||
|
@ -1151,9 +1151,7 @@ void EditorScriptEditor::_menu_option(int p_option) {
|
||||
|
||||
FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock();
|
||||
file_system_dock->navigate_to_path(path);
|
||||
// Ensure that the FileSystem dock is visible.
|
||||
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
|
||||
tab_container->set_current_tab(file_system_dock->get_position_in_parent());
|
||||
file_system_dock->ensure_visible();
|
||||
}
|
||||
} break;
|
||||
case CLOSE_DOCS: {
|
||||
|
Loading…
Reference in New Issue
Block a user