|
38 | 38 | #include "editor/editor_settings.h"
|
39 | 39 | #include "editor/editor_string_names.h"
|
40 | 40 | #include "editor/editor_undo_redo_manager.h"
|
| 41 | +#include "editor/filesystem_dock.h" |
41 | 42 | #include "editor/gui/editor_bottom_panel.h"
|
42 | 43 | #include "editor/gui/editor_file_dialog.h"
|
43 | 44 | #include "editor/scene_tree_dock.h"
|
@@ -1309,10 +1310,39 @@ void SpriteFramesEditor::_frame_list_gui_input(const Ref<InputEvent> &p_event) {
|
1309 | 1310 | _zoom_out();
|
1310 | 1311 | // Don't scroll down after zooming out.
|
1311 | 1312 | accept_event();
|
| 1313 | + } else if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::RIGHT) { |
| 1314 | + Point2 pos = mb->get_position(); |
| 1315 | + right_clicked_frame = frame_list->get_item_at_position(pos, true); |
| 1316 | + if (right_clicked_frame != -1) { |
| 1317 | + if (!menu) { |
| 1318 | + menu = memnew(PopupMenu); |
| 1319 | + add_child(menu); |
| 1320 | + menu->connect(SceneStringName(id_pressed), callable_mp(this, &SpriteFramesEditor::_menu_selected)); |
| 1321 | + menu->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")), TTRC("Show in FileSystem")); |
| 1322 | + } |
| 1323 | + |
| 1324 | + menu->set_position(get_screen_position() + get_local_mouse_position()); |
| 1325 | + menu->popup(); |
| 1326 | + } |
1312 | 1327 | }
|
1313 | 1328 | }
|
1314 | 1329 | }
|
1315 | 1330 |
|
| 1331 | +void SpriteFramesEditor::_menu_selected(int p_index) { |
| 1332 | + switch (p_index) { |
| 1333 | + case MENU_SHOW_IN_FILESYSTEM: { |
| 1334 | + String path = frames->get_frame_texture(edited_anim, right_clicked_frame)->get_path(); |
| 1335 | + // Check if the file is an atlas resource, if it is find the source texture. |
| 1336 | + Ref<AtlasTexture> at = frames->get_frame_texture(edited_anim, right_clicked_frame); |
| 1337 | + while (at.is_valid() && at->get_atlas().is_valid()) { |
| 1338 | + path = at->get_atlas()->get_path(); |
| 1339 | + at = at->get_atlas(); |
| 1340 | + } |
| 1341 | + FileSystemDock::get_singleton()->navigate_to_path(path); |
| 1342 | + } break; |
| 1343 | + } |
| 1344 | +} |
| 1345 | + |
1316 | 1346 | void SpriteFramesEditor::_frame_list_item_selected(int p_index, bool p_selected) {
|
1317 | 1347 | if (updating) {
|
1318 | 1348 | return;
|
|
0 commit comments