RowRanges

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

class RowRanges(pairs, tensor=None)[source]

Bases: object

A set of attribute-buffer rows stored as ordered [begin, end) runs.

Every mob’s rows are allocated as one contiguous block (AttributeTimeline.add()), so the union of a subtree’s rows is usually a handful of runs. Storing runs instead of one index per row keeps the per-mob descendant caches O(runs) rather than O(rows), and a single-run set lets the attribute buffers be read and written through plain slices instead of index gathers/scatters (see AttributeTimeline.get() / AttributeTimeline.modify()).

pairs may be None for an uncompressible index set, in which case the materialized tensor() is the only representation. Adjacent runs are merged by the builders; duplicate or out-of-order runs are kept verbatim so the materialized tensor always equals the uncompressed concatenation.

Methods

from_contiguous_blocks

Build from per-mob index tensors, each of which is a contiguous arange (how AttributeTimeline.add allocates).

from_runs

Build from a list of already-known (begin, end) integer runs (e.g. each mob's cached single-run range).

tensor

Attributes

pairs

numel

static from_contiguous_blocks(inds_list)[source]

Build from per-mob index tensors, each of which is a contiguous arange (how AttributeTimeline.add allocates). Returns None when a block is not contiguous (caller falls back to plain concatenation).

static from_runs(runs)[source]

Build from a list of already-known (begin, end) integer runs (e.g. each mob’s cached single-run range). Coalesces adjacent runs, equivalent to from_contiguous_blocks() but without any per-row tensor indexing/conversion. runs must contain no empty runs.