diff options
| author | Paulb23 | 2017-09-02 17:35:42 +0100 |
|---|---|---|
| committer | Paulb23 | 2017-09-02 17:35:42 +0100 |
| commit | 00ccaa5559c065bc2ce3bda1b748da8b036301fb (patch) | |
| tree | 0265b17504c9528e0f73bcf53d5033051824d765 /editor/plugins/sprite_frames_editor_plugin.cpp | |
| parent | 0b747c29106e0e02f8c9b674cde418a7d270d987 (diff) | |
| download | godot-00ccaa5559c065bc2ce3bda1b748da8b036301fb.tar.gz godot-00ccaa5559c065bc2ce3bda1b748da8b036301fb.tar.zst godot-00ccaa5559c065bc2ce3bda1b748da8b036301fb.zip | |
Diffstat (limited to 'editor/plugins/sprite_frames_editor_plugin.cpp')
| -rw-r--r-- | editor/plugins/sprite_frames_editor_plugin.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index c2c26bfe6..7b40f6908 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -244,8 +244,22 @@ void SpriteFramesEditor::_down_pressed() { void SpriteFramesEditor::_delete_pressed() { + ERR_FAIL_COND(!frames->has_animation(edited_anim)); + if (tree->get_current() < 0) return; + + int to_delete = tree->get_current(); + if (to_delete < 0 || to_delete >= frames->get_frame_count(edited_anim)) { + return; + } + + undo_redo->create_action(TTR("Delete Resource")); + undo_redo->add_do_method(frames, "remove_frame", edited_anim, to_delete); + undo_redo->add_undo_method(frames, "add_frame", edited_anim, frames->get_frame(edited_anim, to_delete), to_delete); + undo_redo->add_do_method(this, "_update_library"); + undo_redo->add_undo_method(this, "_update_library"); + undo_redo->commit_action(); } void SpriteFramesEditor::_animation_select() { |
