Panda3D
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends

SliderTable Class Reference

Stores the total set of VertexSliders that the vertices in a particular GeomVertexData object might depend on. More...

#include "sliderTable.h"

Inheritance diagram for SliderTable:
TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject MemoryBase MemoryBase

List of all members.

Classes

class  CData
class  SliderDef

Public Member Functions

 SliderTable (const SliderTable &copy)
int add_slider (const VertexSlider *slider, const SparseArray &rows)
 Adds a new slider to the table, and returns the index number of the new slider.
virtual int complete_pointers (TypedWritable **plist, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
const SparseArrayfind_sliders (const InternalName *name) const
 Returns a list of slider indices that represent the list of sliders with the indicated name, or an empty SparseArray if no slider in the table has that name.
virtual TypeHandle force_init_type ()
UpdateSeq get_modified (Thread *current_thread) const
 Returns a sequence number that's guaranteed to change at least when any VertexSliders in the table change.
int get_num_sliders () const
 Returns the number of sliders in the table.
const VertexSliderget_slider (int n) const
 Returns the nth slider in the table.
const SparseArrayget_slider_rows (int n) const
 Returns the set of rows (vertices) governed by the nth slider in the table.
virtual TypeHandle get_type () const
bool has_slider (const InternalName *name) const
 Returns true if the table has at least one slider by the indicated name, false otherwise.
bool is_empty () const
 Returns true if the table has no sliders, false if it has at least one.
bool is_registered () const
 Returns true if this table has been registered.
 MAKE_SEQ (get_sliders, get_num_sliders, get_slider)
void operator= (const SliderTable &copy)
void remove_slider (int n)
 Removes the nth slider.
void set_slider (int n, const VertexSlider *slider)
 Replaces the nth slider.
void set_slider_rows (int n, const SparseArray &rows)
 Replaces the rows affected by the nth slider.
void write (ostream &out) const
virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file.

Static Public Member Functions

static CPT (SliderTable) register_table(const SliderTable *table)
static TypeHandle get_class_type ()
static void init_type ()
static void register_with_read_factory ()
 Tells the BamReader how to create objects of type SliderTable.

Protected Member Functions

void fillin (DatagramIterator &scan, BamReader *manager)
 This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new SliderTable.

Static Protected Member Functions

static TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type SliderTable is encountered in the Bam file.

Friends

class VertexSlider

Detailed Description

Stores the total set of VertexSliders that the vertices in a particular GeomVertexData object might depend on.

This is similar to a TransformTable, but it stores VertexSliders instead of VertexTransforms, and it stores them by name instead of by index number. Also, it is only used when animating vertices on the CPU, since GPU's don't support morphs at this point in time.

Definition at line 42 of file sliderTable.h.


Member Function Documentation

int SliderTable::add_slider ( const VertexSlider slider,
const SparseArray rows 
)

Adds a new slider to the table, and returns the index number of the new slider.

Only valid for unregistered tables.

Definition at line 130 of file sliderTable.cxx.

References VertexSlider::get_name().

int SliderTable::complete_pointers ( TypedWritable **  p_list,
BamReader manager 
) [virtual]

Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

Returns the number of pointers processed.

Reimplemented from TypedWritable.

Definition at line 233 of file sliderTable.cxx.

void SliderTable::fillin ( DatagramIterator scan,
BamReader manager 
) [protected, virtual]

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new SliderTable.

Reimplemented from TypedWritable.

Definition at line 275 of file sliderTable.cxx.

References BamReader::get_file_minor_ver(), DatagramIterator::get_uint16(), BamReader::read_cdata(), and BamReader::read_pointer().

const SparseArray & SliderTable::find_sliders ( const InternalName name) const [inline]

Returns a list of slider indices that represent the list of sliders with the indicated name, or an empty SparseArray if no slider in the table has that name.

Definition at line 101 of file sliderTable.I.

Referenced by has_slider().

UpdateSeq SliderTable::get_modified ( Thread current_thread) const [inline]

Returns a sequence number that's guaranteed to change at least when any VertexSliders in the table change.

(However, this is only true for a registered table. An unregistered table may or may not reflect an update here when a VertexSlider changes.)

Definition at line 143 of file sliderTable.I.

int SliderTable::get_num_sliders ( ) const [inline]

Returns the number of sliders in the table.

Definition at line 66 of file sliderTable.I.

const VertexSlider * SliderTable::get_slider ( int  n) const [inline]

Returns the nth slider in the table.

Definition at line 76 of file sliderTable.I.

const SparseArray & SliderTable::get_slider_rows ( int  n) const [inline]

Returns the set of rows (vertices) governed by the nth slider in the table.

Definition at line 88 of file sliderTable.I.

bool SliderTable::has_slider ( const InternalName name) const [inline]

Returns true if the table has at least one slider by the indicated name, false otherwise.

Definition at line 117 of file sliderTable.I.

References find_sliders().

bool SliderTable::is_empty ( ) const [inline]

Returns true if the table has no sliders, false if it has at least one.

Definition at line 128 of file sliderTable.I.

bool SliderTable::is_registered ( ) const [inline]

Returns true if this table has been registered.

Once it has been registered, the set of sliders in a SliderTable may not be further modified; but it must be registered before it can be assigned to a Geom.

Definition at line 26 of file sliderTable.I.

Referenced by GeomVertexData::set_slider_table().

TypedWritable * SliderTable::make_from_bam ( const FactoryParams params) [static, protected]

This function is called by the BamReader's factory when a new object of type SliderTable is encountered in the Bam file.

It should create the SliderTable and extract its information from the file.

Definition at line 256 of file sliderTable.cxx.

Referenced by register_with_read_factory().

void SliderTable::register_with_read_factory ( ) [static]

Tells the BamReader how to create objects of type SliderTable.

Definition at line 200 of file sliderTable.cxx.

References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().

void SliderTable::remove_slider ( int  n)

Removes the nth slider.

Only valid for unregistered tables.

Definition at line 114 of file sliderTable.cxx.

void SliderTable::set_slider ( int  n,
const VertexSlider slider 
)

Replaces the nth slider.

Only valid for unregistered tables.

Definition at line 78 of file sliderTable.cxx.

References VertexSlider::get_name().

void SliderTable::set_slider_rows ( int  n,
const SparseArray rows 
)

Replaces the rows affected by the nth slider.

Only valid for unregistered tables.

Definition at line 97 of file sliderTable.cxx.

void SliderTable::write_datagram ( BamWriter manager,
Datagram dg 
) [virtual]

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from TypedWritable.

Definition at line 211 of file sliderTable.cxx.

References Datagram::add_uint16(), BamWriter::write_cdata(), and BamWriter::write_pointer().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations