AnimPreloadTable

class AnimPreloadTable

Bases: CopyOnWriteObject

This table records data about a list of animations for a particular model, such as number of frames and frame rate. It’s used for implementating asynchronous binding.

This table is normally built by an offline tool, such as egg-optchar.

Inheritance diagram

Inheritance diagram of AnimPreloadTable

AnimPreloadTable(void)
void add_anim(std::string const &basename, PN_stdfloat base_frame_rate, int num_frames)

Adds a new animation record to the table. If there is already a record of this name, no operation is performed (the original record is unchanged). See find_anim(). This will invalidate existing index numbers.

void add_anims_from(AnimPreloadTable const *other)

Copies the animation records from the other table into this one. If a given record name exists in both tables, the record in this one supercedes.

void clear_anims(void)

Removes all animation records from the table.

int find_anim(std::string const &basename) const

Returns the index number in the table of the animation record with the indicated name, or -1 if the name is not present. By convention, the basename is the filename of the egg or bam file, without the directory part and without the extension. That is, it is Filename::get_basename_wo_extension().

PN_stdfloat get_base_frame_rate(int n) const

Returns the frame rate stored for the nth animation record.

std::string get_basename(int n) const

Returns the basename stored for the nth animation record. See find_anim().

static TypeHandle get_class_type(void)
int get_num_anims(void) const

Returns the number of animation records in the table.

int get_num_frames(int n) const

Returns the number of frames stored for the nth animation record.

virtual void output(std::ostream &out) const
void remove_anim(int n)

Removes the nth animation records from the table. This renumbers indexes for following animations.

virtual void write(std::ostream &out, int indent_level) const