Skip to content

Commit

Permalink
Minor adjusts in the 'Show in Filesystem' code in SpriteFrames editor
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusmdx committed Feb 20, 2025
1 parent 63f7e4d commit f4cae96
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions editor/plugins/sprite_frames_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ void SpriteFramesEditor::_frame_list_gui_input(const Ref<InputEvent> &p_event) {
menu = memnew(PopupMenu);
add_child(menu);
menu->connect(SceneStringName(id_pressed), callable_mp(this, &SpriteFramesEditor::_menu_selected));
menu->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")), TTRC("Show in FileSystem"));
menu->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")), TTRC("Show in FileSystem"), MENU_SHOW_IN_FILESYSTEM);
}

menu->set_position(get_screen_position() + get_local_mouse_position());
Expand All @@ -1336,10 +1336,12 @@ void SpriteFramesEditor::_frame_list_gui_input(const Ref<InputEvent> &p_event) {
}
}

void SpriteFramesEditor::_menu_selected(int p_index) {
switch (p_index) {
void SpriteFramesEditor::_menu_selected(int p_id) {
switch (p_id) {
case MENU_SHOW_IN_FILESYSTEM: {
String path = frames->get_frame_texture(edited_anim, right_clicked_frame)->get_path();
Ref<Texture2D> frames_texture = frames->get_frame_texture(edited_anim, right_clicked_frame);
ERR_FAIL_COND(frames_texture.is_null());
String path = frames_texture->get_path();
// Check if the file is an atlas resource, if it is find the source texture.
Ref<AtlasTexture> at = frames->get_frame_texture(edited_anim, right_clicked_frame);
while (at.is_valid() && at->get_atlas().is_valid()) {
Expand Down

0 comments on commit f4cae96

Please sign in to comment.