Fixed delete animation frames in AnimatedSprite, issue 10788
This commit is contained in:
parent
0b747c2910
commit
00ccaa5559
1 changed files with 14 additions and 0 deletions
|
@ -244,8 +244,22 @@ void SpriteFramesEditor::_down_pressed() {
|
||||||
|
|
||||||
void SpriteFramesEditor::_delete_pressed() {
|
void SpriteFramesEditor::_delete_pressed() {
|
||||||
|
|
||||||
|
ERR_FAIL_COND(!frames->has_animation(edited_anim));
|
||||||
|
|
||||||
if (tree->get_current() < 0)
|
if (tree->get_current() < 0)
|
||||||
return;
|
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() {
|
void SpriteFramesEditor::_animation_select() {
|
||||||
|
|
Loading…
Reference in a new issue