Jazz2::Editor::SetAnimationCommand class

Changes the timing and the frames of an animated tile, the number of animated tiles stays the same.

Base classes

class EditCommand
Undoable change of a level being edited.

Constructors, destructors, conversion operators

SetAnimationCommand(const LevelDocument& document, std::int32_t index, DocumentAnimation animation, String name)
Creates a change from the current state of the animated tile to the given one.

Public functions

void Do(LevelDocument& document, DocumentChanges& changes) override
Applies the change to the document, again after it was undone.
void Undo(LevelDocument& document, DocumentChanges& changes) override
Reverts the change.
auto TryMerge(EditCommand& next) -> bool override
Merges a change of the same animated tile by the same name, as made while a value is dragged.
auto CanMerge(EditCommand& next) -> bool override
Returns true if TryMerge() would take over next, without taking it over.
auto GetName() const -> String override
Returns the name shown in the history.
auto GetMemoryUsage() const -> std::size_t override
Returns the memory the command takes.

Function documentation

bool Jazz2::Editor::SetAnimationCommand::CanMerge(EditCommand& next) override

Returns true if TryMerge() would take over next, without taking it over.

A transaction is merged only if all of its changes can be, it asks each of them first. A command that merges has to say the same here as its TryMerge() does.