EditQueryIndex

Qualified name: algan.animation\_timeline.timeline.EditQueryIndex

class EditQueryIndex(head, sorted_edit_ids, edit_timestamps, sorted_values, unique_timestamps, keys)[source]

Bases: object

Search structure over one attribute’s edit log, on times’ device.

head/sorted_edit_ids/sorted_values are the CSR form of the edit table: the edits touching row j occupy [head[j], head[j+1]), in execution order (and therefore in non-decreasing edit_timestamps order, which AttributeTimeline.prepare_for_queries() guarantees). Materializing a row’s state at time t is an upper-bound search for t inside that row’s segment.

keys linearizes those per-row searches into a single globally sorted array so one torch.searchsorted() answers all of them: keys[m] = row(m) * n_ranks + rank(timestamp(m)), where rank indexes the sorted unique timestamps. Integer ranks (rather than the timestamps themselves) keep the composite key exact, and the key is sorted because row is non-decreasing across the table and the rank is non-decreasing within every row.

The edit log is immutable while frames are rendered, so this is built once per attribute per render job and cached (AttributeTimeline._prepared_queries()).

Methods

Attributes

head

sorted_edit_ids

edit_timestamps

sorted_values

unique_timestamps

keys