Repository: godotengine/godot
File: editor/plugins/sprite_frames_editor_plugin.cpp (C++)

Code before:
	float duration = 1.0;

	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	undo_redo->create_action(TTR("Paste Frame(s)"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());

	int undo_index = frames->get_frame_count(edited_anim);

	for (int index = 0; index < p_clipboard_frames->frames.size(); index++) {
		const ClipboardSpriteFrames::Frame *frame = &p_clipboard_frames->frames[index];
		texture = frame->texture;
		duration = frame->duration;

		undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, texture, duration);
		undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, undo_index);
	}

	undo_redo->add_do_method(this, "_update_library");
	undo_redo->add_undo_method(this, "_update_library");
	undo_redo->commit_action();
}

void SpriteFramesEditor::_paste_texture(const Ref<Texture2D> &p_texture) {
	float duration = 1.0;

	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	undo_redo->create_action(TTR("Paste Texture"), UndoRedo::MERGE_DISABLE, EditorNode::get_singleton()->get_edited_scene());

	int undo_index = frames->get_frame_count(edited_anim);

	undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, p_texture, duration);
	undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, undo_index);

	undo_redo->add_do_method(this, "_update_library");
	undo_redo->add_undo_method(this, "_update_library");
	undo_redo->commit_action();
}

void SpriteFramesEditor::_copy_pressed() {
	ERR_FAIL_COND(!frames->has_animation(edited_anim));

	Vector<int> selected_items = frame_list->get_selected_items();

	if (selected_items.is_empty()) {
		return;
	}

	Ref<ClipboardSpriteFrames> clipboard_frames = memnew(ClipboardSpriteFrames);

	for (int index = 0; index < selected_items.size(); index++) {
		int frame_index = selected_items[index];


Review comment (bug):
```suggestion
	undo_redo->create_action(TTR("Paste Texture"), UndoRedo::MERGE_DISABLE, frames.ptr());
```
Same.
I see originally it was different, but that was wrong.

Code after:

	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	undo_redo->create_action(TTR("Paste Frame(s)"), UndoRedo::MERGE_DISABLE, frames.ptr());

	int undo_index = frames->get_frame_count(edited_anim);

	for (int index = 0; index < p_clipboard_frames->frames.size(); index++) {
		const ClipboardSpriteFrames::Frame &frame = p_clipboard_frames->frames[index];
		texture = frame.texture;
		duration = frame.duration;

		undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, texture, duration);
		undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, undo_index);
	}

	undo_redo->add_do_method(this, "_update_library");
	undo_redo->add_undo_method(this, "_update_library");
	undo_redo->commit_action();
}

void SpriteFramesEditor::_paste_texture(const Ref<Texture2D> &p_texture) {
	float duration = 1.0;

	EditorUndoRedoManager *undo_redo = EditorUndoRedoManager::get_singleton();
	undo_redo->create_action(TTR("Paste Texture"), UndoRedo::MERGE_DISABLE, frames.ptr());

	int undo_index = frames->get_frame_count(edited_anim);

	undo_redo->add_do_method(frames.ptr(), "add_frame", edited_anim, p_texture, duration);
	undo_redo->add_undo_method(frames.ptr(), "remove_frame", edited_anim, undo_index);

	undo_redo->add_do_method(this, "_update_library");
	undo_redo->add_undo_method(this, "_update_library");
	undo_redo->commit_action();
}

void SpriteFramesEditor::_copy_pressed() {
	ERR_FAIL_COND(!frames->has_animation(edited_anim));

	Vector<int> selected_items = frame_list->get_selected_items();

	if (selected_items.is_empty()) {
		return;
	}

	Ref<ClipboardSpriteFrames> clipboard_frames = memnew(ClipboardSpriteFrames);

	for (const int &frame_index : selected_items) {
		Ref<Texture2D> texture = frames->get_frame_texture(edited_anim, frame_index);
		if (texture.is_null()) {
			continue;