Record
Represents a record that can be recorded to the HistoryApi.
Description
There is no actual Record class, this page simply serves as a blueprint for implementing a record.
A Record represents an entry in the HistoryApi. It is required to implement undo ( ) and redo ( ) methods which are supposed to undo/ redo a change to the map. A record may also provide a record_type ( ) method that returns a key for differentiating different record types. The records script is used as its record type if no other type is provided. Should a specific record type be added to the history more times than max_count ( ) allows, then the oldest record of that type (and all other older records) will be dropped. Should a record implement a dropped ( HistoryType type ) method it will be called when it is dropped, where type denotes whether the record was dropped from the undo or redo history.
Methods
void | dropped ( HistoryType type ) |
int | idle_frames ( ) |
int | max_count ( ) |
Variant | record_type ( ) |
bool | redo ( ) |
bool | undo ( ) |
Method Descriptions
bool undo ( ):
Called by the HistoryApi to start the undo process of the Record.
bool redo ( ):
Called by the HistoryApi to start the redo process of the Record.
void dropped ( HistoryType type ):
Called by the HistoryApi when the Record is dropped from the history, either due to exceeding the length of the history or due to being in the redo history when a new Record is recorded. The supplied HistoryType denotes whether the record was in the undo or redo history at time of dropping.
int max_count ( ):
Called by the HistoryApi to determine the maximum amount of records of this type that can be recorded before the oldest records will be discarded from the history.
Variant record_type ( ):
Called by the HistoryApi. It's return value is used as a key to to compare max_count ( ) against. Different types of records may implement this method incase they want to share the same maximum history records.
int idle_frames ( ):
In case a Record needs a certain amount of frames to fully process its undo or redo method a Record may implement this method to denote a certain amount of idle frames to wait before emitting undo_end or redo_end.