summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2023-01-04 18:44:57 +0100
committerkobewi <kobewi4e@gmail.com>2023-01-08 23:25:13 +0100
commit6d65d886f202d094f17cec32fabcdd595dcd9799 (patch)
tree634f803c716a682e845e23dc14d345973f9c26e8
parentbb08997b8725780670be30afa96354e7c38586fd (diff)
Add Show in FileSystem option in the inspector
-rw-r--r--editor/inspector_dock.cpp11
-rw-r--r--editor/inspector_dock.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp
index 99d4e59bfe..4cd8976e80 100644
--- a/editor/inspector_dock.cpp
+++ b/editor/inspector_dock.cpp
@@ -35,6 +35,7 @@
#include "editor/editor_scale.h"
#include "editor/editor_settings.h"
#include "editor/editor_undo_redo_manager.h"
+#include "editor/filesystem_dock.h"
#include "editor/plugins/script_editor_plugin.h"
InspectorDock *InspectorDock::singleton = nullptr;
@@ -86,6 +87,11 @@ void InspectorDock::_menu_option_confirm(int p_option, bool p_confirmed) {
case RESOURCE_EDIT_CLIPBOARD: {
_paste_resource();
} break;
+ case RESOURCE_SHOW_IN_FILESYSTEM: {
+ Ref<Resource> current_res = _get_current_resource();
+ ERR_FAIL_COND(current_res.is_null());
+ FileSystemDock::get_singleton()->navigate_to_path(current_res->get_path());
+ } break;
case OBJECT_REQUEST_HELP: {
if (current) {
@@ -291,6 +297,10 @@ void InspectorDock::_prepare_resource_extra_popup() {
Ref<Resource> r = EditorSettings::get_singleton()->get_resource_clipboard();
PopupMenu *popup = resource_extra_button->get_popup();
popup->set_item_disabled(popup->get_item_index(RESOURCE_EDIT_CLIPBOARD), r.is_null());
+
+ Ref<Resource> current_res = _get_current_resource();
+ ERR_FAIL_COND(current_res.is_null());
+ popup->set_item_disabled(popup->get_item_index(RESOURCE_SHOW_IN_FILESYSTEM), current_res->is_built_in());
}
Ref<Resource> InspectorDock::_get_current_resource() const {
@@ -655,6 +665,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) {
resource_extra_button->get_popup()->add_icon_shortcut(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")), ED_SHORTCUT("property_editor/copy_resource", TTR("Copy Resource")), RESOURCE_COPY);
resource_extra_button->get_popup()->set_item_disabled(1, true);
resource_extra_button->get_popup()->add_separator();
+ resource_extra_button->get_popup()->add_shortcut(ED_SHORTCUT("property_editor/show_in_filesystem", TTR("Show in FileSystem")), RESOURCE_SHOW_IN_FILESYSTEM);
resource_extra_button->get_popup()->add_shortcut(ED_SHORTCUT("property_editor/unref_resource", TTR("Make Resource Built-In")), RESOURCE_MAKE_BUILT_IN);
resource_extra_button->get_popup()->set_item_disabled(3, true);
resource_extra_button->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_menu_option));
diff --git a/editor/inspector_dock.h b/editor/inspector_dock.h
index 2ac82eb451..c2c1b55fb1 100644
--- a/editor/inspector_dock.h
+++ b/editor/inspector_dock.h
@@ -51,6 +51,7 @@ class InspectorDock : public VBoxContainer {
RESOURCE_LOAD,
RESOURCE_SAVE,
RESOURCE_SAVE_AS,
+ RESOURCE_SHOW_IN_FILESYSTEM,
RESOURCE_MAKE_BUILT_IN,
RESOURCE_COPY,
RESOURCE_EDIT_CLIPBOARD,