Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show Show in Filesystem Popup for empty frames in SpriteFrames editor #103050

Merged

Conversation

matheusmdx
Copy link
Contributor

Fix #103048

@matheusmdx matheusmdx changed the title Don't show Show in Filesystem Popup for empty frames in AnimatedSprite2D Don't show Show in Filesystem Popup for empty frames in SpriteFrames editor Feb 19, 2025
@AThousandShips AThousandShips added this to the 4.4 milestone Feb 20, 2025
Copy link
Member

@kleonc kleonc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the crash, as is. 👍

Minor thing, could be included in this PR: _menu_selected is connected to id_pressed, so its argument should be called p_id, not p_index. Also MENU_SHOW_IN_FILESYSTEM should be passed to add_icon_item as the id (third arg).

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"));

void SpriteFramesEditor::_menu_selected(int p_index) {

This works currently but is conceptually wrong and might get broken in case of adding more options.

Also I'd say ERR_FAIL_NULL(frame_texture) in the handler wouldn't hurt:

case MENU_SHOW_IN_FILESYSTEM: {
String path = frames->get_frame_texture(edited_anim, right_clicked_frame)->get_path();

@akien-mga
Copy link
Member

Minor thing, could be included in this PR

I suggest doing those changes in a follow-up PR so this one stays focused on the crash fix for 4.4.

@akien-mga akien-mga merged commit fe799de into godotengine:master Feb 20, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2D Animation Frames: Crash when right-clicking [Show in Filesystem] on an [Inserted Empty] frame
4 participants