Panda3D
|
This object records any data generated by a particular MouseAndKeyboard node on the datagraph for a session for eventual playback via a DataGraphPlayback (and a PlaybackController). More...
#include "mouseRecorder.h"
Public Member Functions | |
MouseRecorder (const string &name) | |
virtual TypeHandle | force_init_type () |
virtual TypeHandle | get_type () const |
virtual void | output (ostream &out) const |
Outputs the Namable. | |
virtual void | play_frame (DatagramIterator &scan, BamReader *manager) |
Reloads the most recent data collected from the indicated datagram. | |
virtual void | record_frame (BamWriter *manager, Datagram &dg) |
Records the most recent data collected into the indicated datagram, and returns true if there is any interesting data worth recording, or false if the datagram is meaningless. | |
virtual void | write (ostream &out, int indent_level=0) 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. | |
virtual void | write_recorder (BamWriter *manager, Datagram &dg) |
Writes the contents of this object to the datagram for encoding in the session file. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
static void | register_with_read_factory () |
Tells the BamReader how to create objects of type Lens. | |
Protected Member Functions | |
virtual void | do_transmit_data (DataGraphTraverser *trav, const DataNodeTransmit &input, DataNodeTransmit &output) |
The virtual implementation of transmit_data(). | |
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 MouseRecorder. | |
void | fillin_recorder (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 MouseRecorder. | |
Static Protected Member Functions | |
static TypedWritable * | make_from_bam (const FactoryParams ¶ms) |
This function is called by the BamReader's factory when a new object of type Lens is encountered in the Bam file. | |
static RecorderBase * | make_recorder (const FactoryParams ¶ms) |
This is similar to make_from_bam(), but it is designed for loading the RecorderBase object from the session log created by a RecorderController. |
This object records any data generated by a particular MouseAndKeyboard node on the datagraph for a session for eventual playback via a DataGraphPlayback (and a PlaybackController).
To use it, make it a child of the node you wish to record. It also serves as a pass-through, so that additional child nodes may be parented directly to it.
Definition at line 38 of file mouseRecorder.h.
void MouseRecorder::do_transmit_data | ( | DataGraphTraverser * | trav, |
const DataNodeTransmit & | input, | ||
DataNodeTransmit & | output | ||
) | [protected, virtual] |
The virtual implementation of transmit_data().
This function receives an array of input parameters and should generate an array of output parameters. The input parameters may be accessed with the index numbers returned by the define_input() calls that were made earlier (presumably in the constructor); likewise, the output parameters should be set with the index numbers returned by the define_output() calls.
Reimplemented from DataNode.
Definition at line 130 of file mouseRecorder.cxx.
References DataNodeTransmit::get_data(), EventParameter::get_ptr(), EventStoreValue< Type >::get_value(), DataNodeTransmit::has_data(), RecorderBase::is_playing(), RecorderBase::is_recording(), and DataNodeTransmit::set_data().
void MouseRecorder::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 MouseRecorder.
Reimplemented from DataNode.
Definition at line 279 of file mouseRecorder.cxx.
Referenced by make_from_bam().
void MouseRecorder::fillin_recorder | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected] |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new MouseRecorder.
Reimplemented from RecorderBase.
Definition at line 291 of file mouseRecorder.cxx.
Referenced by make_recorder().
TypedWritable * MouseRecorder::make_from_bam | ( | const FactoryParams & | params | ) | [static, protected] |
This function is called by the BamReader's factory when a new object of type Lens is encountered in the Bam file.
It should create the Lens and extract its information from the file.
Reimplemented from PandaNode.
Definition at line 241 of file mouseRecorder.cxx.
References fillin().
Referenced by register_with_read_factory().
RecorderBase * MouseRecorder::make_recorder | ( | const FactoryParams & | params | ) | [static, protected] |
This is similar to make_from_bam(), but it is designed for loading the RecorderBase object from the session log created by a RecorderController.
Definition at line 260 of file mouseRecorder.cxx.
References fillin_recorder().
Referenced by register_with_read_factory().
void MouseRecorder::output | ( | ostream & | out | ) | const [virtual] |
Outputs the Namable.
This function simply writes the name to the output stream; most Namable derivatives will probably redefine this.
Reimplemented from PandaNode.
Definition at line 102 of file mouseRecorder.cxx.
void MouseRecorder::play_frame | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [virtual] |
Reloads the most recent data collected from the indicated datagram.
Reimplemented from RecorderBase.
Definition at line 84 of file mouseRecorder.cxx.
References ButtonEventList::fillin(), DatagramIterator::get_bool(), RecorderBase::is_playing(), and LVecBase2f::read_datagram().
void MouseRecorder::record_frame | ( | BamWriter * | manager, |
Datagram & | dg | ||
) | [virtual] |
Records the most recent data collected into the indicated datagram, and returns true if there is any interesting data worth recording, or false if the datagram is meaningless.
Reimplemented from RecorderBase.
Definition at line 65 of file mouseRecorder.cxx.
References Datagram::add_bool(), RecorderBase::is_recording(), and LVecBase2f::write_datagram().
void MouseRecorder::register_with_read_factory | ( | ) | [static] |
Tells the BamReader how to create objects of type Lens.
Reimplemented from PandaNode.
Definition at line 200 of file mouseRecorder.cxx.
References RecorderController::get_factory(), BamReader::get_factory(), make_from_bam(), make_recorder(), and Factory< Type >::register_factory().
void MouseRecorder::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 DataNode.
Definition at line 212 of file mouseRecorder.cxx.
void MouseRecorder::write_recorder | ( | BamWriter * | manager, |
Datagram & | dg | ||
) | [virtual] |
Writes the contents of this object to the datagram for encoding in the session file.
This is very similar to write_datagram() for TypedWritable objects, but it is used specifically to write the Recorder object when generating the session file. In many cases, it will be the same as write_datagram().
Reimplemented from RecorderBase.
Definition at line 227 of file mouseRecorder.cxx.