diff options
author | Yuri Sizov <11782833+YuriSizov@users.noreply.github.com> | 2023-02-06 14:24:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-06 14:24:04 +0300 |
commit | 54b7685761f711260a9b9be26b6886040c266546 (patch) | |
tree | 3a5c196b4432db3f1b35eabcc3a12ec15adc6149 /editor | |
parent | e08aa365160ee68a78b75660c28dfcd41608d981 (diff) | |
parent | 0069131546b2a00bf4dbbbff1b8e39bbf5d55462 (diff) |
Merge pull request #72783 from TokageItLab/fix-sprite-ghost
Fix ghost SpriteFramesEditor cause crash
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 14b5f7cefb..c41bf4b8cc 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -1171,32 +1171,29 @@ void SpriteFramesEditor::edit(Ref<SpriteFrames> p_frames) { if (!p_frames.is_valid()) { frames.unref(); + hide(); return; } frames = p_frames; read_only = EditorNode::get_singleton()->is_resource_read_only(p_frames); - if (p_frames.is_valid()) { - if (!p_frames->has_animation(edited_anim)) { - List<StringName> anim_names; - frames->get_animation_list(&anim_names); - anim_names.sort_custom<StringName::AlphCompare>(); - if (anim_names.size()) { - edited_anim = anim_names.front()->get(); - } else { - edited_anim = StringName(); - } + if (!p_frames->has_animation(edited_anim)) { + List<StringName> anim_names; + frames->get_animation_list(&anim_names); + anim_names.sort_custom<StringName::AlphCompare>(); + if (anim_names.size()) { + edited_anim = anim_names.front()->get(); + } else { + edited_anim = StringName(); } - - _update_library(); - // Clear zoom and split sheet texture - split_sheet_preview->set_texture(Ref<Texture2D>()); - _zoom_reset(); - } else { - hide(); } + _update_library(); + // Clear zoom and split sheet texture + split_sheet_preview->set_texture(Ref<Texture2D>()); + _zoom_reset(); + add_anim->set_disabled(read_only); delete_anim->set_disabled(read_only); anim_speed->set_editable(!read_only); |