Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
SomethingToEggConverter Class Referenceabstract

This is a base class for a family of converter classes that manage a conversion from some file type to egg format. More...

#include "somethingToEggConverter.h"

Inheritance diagram for SomethingToEggConverter:
DAEToEggConverter DXFToEggConverter FltToEggConverter LwoToEggConverter MayaToEggConverter ObjToEggConverter VRMLToEggConverter XFileToEggConverter

Public Member Functions

 SomethingToEggConverter (const SomethingToEggConverter &copy)
 
void clear_egg_data ()
 Sets the EggData to NULL and makes the converter invalid.
 
void clear_end_frame ()
 Removes the value previously set by set_end_frame().
 
void clear_error ()
 Resets the error flag to the no-error state.
 
void clear_frame_inc ()
 Removes the value previously set by set_frame_inc().
 
void clear_input_frame_rate ()
 Removes the value previously set by set_input_frame_rate().
 
void clear_neutral_frame ()
 Removes the value previously set by set_neutral_frame().
 
void clear_output_frame_rate ()
 Removes the value previously set by set_output_frame_rate().
 
void clear_start_frame ()
 Removes the value previously set by set_start_frame().
 
virtual bool convert_file (const Filename &filename)=0
 
Filename convert_model_path (const Filename &orig_filename)
 Converts the indicated model filename to a relative or absolute or whatever filename, according to _path_replace.
 
virtual std::string get_additional_extensions () const
 Returns a space-separated list of extension, in addition to the one returned by get_extension(), that are recognized by this converter.
 
AnimationConvert get_animation_convert () const
 Returns how source animation will be converted into egg structures.
 
const std::string & get_character_name () const
 Returns the name of the character generated.
 
EggDataget_egg_data ()
 Returns the EggData structure.
 
double get_end_frame () const
 Returns the value set by a previous call to set_end_frame().
 
virtual std::string get_extension () const =0
 
double get_frame_inc () const
 Returns the value set by a previous call to set_frame_inc().
 
double get_input_frame_rate () const
 Returns the value set by a previous call to set_input_frame_rate().
 
virtual DistanceUnit get_input_units ()
 This may be called after convert_file() has been called and returned true, indicating a successful conversion.
 
bool get_merge_externals () const
 Returns the current state of the merge_externals flag.
 
virtual std::string get_name () const =0
 
double get_neutral_frame () const
 Returns the value set by a previous call to set_neutral_frame().
 
double get_output_frame_rate () const
 Returns the value set by a previous call to set_output_frame_rate().
 
PathReplaceget_path_replace ()
 Returns a pointer to the PathReplace object associated with this converter.
 
const PathReplaceget_path_replace () const
 Returns a pointer to the PathReplace object associated with this converter.
 
double get_start_frame () const
 Returns the value set by a previous call to set_start_frame().
 
bool had_error () const
 Returns true if an error was detected during the conversion process (unless _allow_errors is true), false otherwise.
 
bool handle_external_reference (EggGroupNode *egg_parent, const Filename &ref_filename)
 Handles an external reference in the source file.
 
bool has_end_frame () const
 Returns true if the ending frame has been explicitly specified via set_end_frame(), or false if the ending frame should be implicit based on the source.
 
bool has_frame_inc () const
 Returns true if the frame increment has been explicitly specified via set_frame_inc(), or false if the ending frame should be implicit based on the source.
 
bool has_input_frame_rate () const
 Returns true if the frame rate has been explicitly specified via set_input_frame_rate(), or false otherwise.
 
bool has_neutral_frame () const
 Returns true if the neutral frame has been explicitly specified via set_neutral_frame(), or false otherwise.
 
bool has_output_frame_rate () const
 Returns true if the frame rate has been explicitly specified via set_output_frame_rate(), or false otherwise.
 
bool has_start_frame () const
 Returns true if the starting frame has been explicitly specified via set_start_frame(), or false if the starting frame should be implicit based on the source.
 
virtual SomethingToEggConvertermake_copy ()=0
 
virtual PT (PandaNode) convert_to_node(const LoaderOptions &options
 
void set_animation_convert (AnimationConvert animation_convert)
 Specifies how source animation will be converted into egg structures.
 
void set_character_name (const std::string &character_name)
 Specifies the name of the character generated.
 
void set_egg_data (EggData *egg_data)
 Sets the egg data that will be filled in when convert_file() is called.
 
void set_end_frame (double end_frame)
 Specifies the ending frame of the animation to convert, in the units specified by set_input_frame_rate().
 
void set_frame_inc (double frame_inc)
 Specifies the increment between frames to extract.
 
void set_input_frame_rate (double input_frame_rate)
 Specifies the number of frames per second that is represented by the "frame" unit in the animation package.
 
void set_merge_externals (bool merge_externals)
 Sets the merge_externals flag.
 
void set_neutral_frame (double neutral_frame)
 Specifies the frame of animation to represent the neutral pose of the model.
 
void set_output_frame_rate (double output_frame_rate)
 Specifies the number of frames per second that the resulting animation should be played at.
 
void set_path_replace (PathReplace *path_replace)
 Replaces the PathReplace object (which specifies how to mangle paths from the source to the destination egg file) with a new one.
 
void set_start_frame (double start_frame)
 Specifies the starting frame of the animation to convert, in the units specified by set_input_frame_rate().
 
virtual bool supports_compressed () const
 Returns true if this file type can transparently load compressed files (with a .pz extension), false otherwise.
 
virtual bool supports_convert_to_node (const LoaderOptions &options) const
 Returns true if this converter can directly convert the model type to internal Panda memory structures, given the indicated options, or false otherwise.
 

Static Public Member Functions

static double get_default_frame_rate ()
 Returns the default frame rate if nothing is specified for input_frame_rate or output_frame_rate, and the animation package does not have an implicit frame rate.
 

Public Attributes

bool _allow_errors
 
virtual const Filenamefilename
 

Detailed Description

This is a base class for a family of converter classes that manage a conversion from some file type to egg format.

Classes of this type can be used to implement xxx2egg converter programs, as well as LoaderFileTypeXXX run-time loaders.

Definition at line 38 of file somethingToEggConverter.h.

Constructor & Destructor Documentation

◆ SomethingToEggConverter() [1/2]

SomethingToEggConverter::SomethingToEggConverter ( )

Definition at line 22 of file somethingToEggConverter.cxx.

◆ SomethingToEggConverter() [2/2]

SomethingToEggConverter::SomethingToEggConverter ( const SomethingToEggConverter & copy)

Definition at line 43 of file somethingToEggConverter.cxx.

◆ ~SomethingToEggConverter()

SomethingToEggConverter::~SomethingToEggConverter ( )
virtual

Definition at line 56 of file somethingToEggConverter.cxx.

Member Function Documentation

◆ clear_egg_data()

void SomethingToEggConverter::clear_egg_data ( )
inline

Sets the EggData to NULL and makes the converter invalid.

Definition at line 371 of file somethingToEggConverter.I.

References set_egg_data().

◆ clear_end_frame()

void SomethingToEggConverter::clear_end_frame ( )
inline

Removes the value previously set by set_end_frame().

Definition at line 173 of file somethingToEggConverter.I.

◆ clear_error()

void SomethingToEggConverter::clear_error ( )
inline

◆ clear_frame_inc()

void SomethingToEggConverter::clear_frame_inc ( )
inline

Removes the value previously set by set_frame_inc().

Definition at line 215 of file somethingToEggConverter.I.

◆ clear_input_frame_rate()

void SomethingToEggConverter::clear_input_frame_rate ( )
inline

Removes the value previously set by set_input_frame_rate().

Definition at line 294 of file somethingToEggConverter.I.

◆ clear_neutral_frame()

void SomethingToEggConverter::clear_neutral_frame ( )
inline

Removes the value previously set by set_neutral_frame().

Definition at line 253 of file somethingToEggConverter.I.

◆ clear_output_frame_rate()

void SomethingToEggConverter::clear_output_frame_rate ( )
inline

Removes the value previously set by set_output_frame_rate().

Definition at line 333 of file somethingToEggConverter.I.

◆ clear_start_frame()

void SomethingToEggConverter::clear_start_frame ( )
inline

Removes the value previously set by set_start_frame().

Definition at line 132 of file somethingToEggConverter.I.

◆ convert_file()

virtual bool SomethingToEggConverter::convert_file ( const Filename & filename)
pure virtual

◆ convert_model_path()

Filename SomethingToEggConverter::convert_model_path ( const Filename & orig_filename)
inline

Converts the indicated model filename to a relative or absolute or whatever filename, according to _path_replace.

Definition at line 388 of file somethingToEggConverter.I.

Referenced by XFileMaterial::apply_to_egg(), and CLwoSurface::check_texture().

◆ get_additional_extensions()

std::string SomethingToEggConverter::get_additional_extensions ( ) const
virtual

Returns a space-separated list of extension, in addition to the one returned by get_extension(), that are recognized by this converter.

Reimplemented in MayaToEggConverter.

Definition at line 74 of file somethingToEggConverter.cxx.

Referenced by LoaderFileTypePandatool::get_additional_extensions().

◆ get_animation_convert()

AnimationConvert SomethingToEggConverter::get_animation_convert ( ) const
inline

Returns how source animation will be converted into egg structures.

Definition at line 74 of file somethingToEggConverter.I.

Referenced by DAEToEggConverter::convert_file(), MayaToEggConverter::convert_maya(), and MayaNodeTree::get_egg_group().

◆ get_character_name()

const std::string & SomethingToEggConverter::get_character_name ( ) const
inline

Returns the name of the character generated.

See set_character_name().

Definition at line 92 of file somethingToEggConverter.I.

◆ get_default_frame_rate()

double SomethingToEggConverter::get_default_frame_rate ( )
inlinestatic

Returns the default frame rate if nothing is specified for input_frame_rate or output_frame_rate, and the animation package does not have an implicit frame rate.

Definition at line 344 of file somethingToEggConverter.I.

◆ get_egg_data()

EggData * SomethingToEggConverter::get_egg_data ( )
inline

◆ get_end_frame()

double SomethingToEggConverter::get_end_frame ( ) const
inline

Returns the value set by a previous call to set_end_frame().

It is an error to call this if has_end_frame() returns false.

Definition at line 164 of file somethingToEggConverter.I.

References has_end_frame().

Referenced by MayaToEggConverter::convert_maya().

◆ get_extension()

virtual std::string SomethingToEggConverter::get_extension ( ) const
pure virtual

◆ get_frame_inc()

double SomethingToEggConverter::get_frame_inc ( ) const
inline

Returns the value set by a previous call to set_frame_inc().

It is an error to call this if has_frame_inc() returns false.

Definition at line 206 of file somethingToEggConverter.I.

References has_frame_inc().

Referenced by MayaToEggConverter::convert_maya().

◆ get_input_frame_rate()

double SomethingToEggConverter::get_input_frame_rate ( ) const
inline

Returns the value set by a previous call to set_input_frame_rate().

It is an error to call this if has_input_frame_rate() returns false.

Definition at line 285 of file somethingToEggConverter.I.

References has_input_frame_rate().

Referenced by MayaToEggConverter::convert_maya().

◆ get_input_units()

DistanceUnit SomethingToEggConverter::get_input_units ( )
virtual

This may be called after convert_file() has been called and returned true, indicating a successful conversion.

It will return the distance units represented by the converted egg file, if known, or DU_invalid if not known.

Reimplemented in DAEToEggConverter, FltToEggConverter, and MayaToEggConverter.

Definition at line 106 of file somethingToEggConverter.cxx.

◆ get_merge_externals()

bool SomethingToEggConverter::get_merge_externals ( ) const
inline

Returns the current state of the merge_externals flag.

See set_merge_externals().

Definition at line 363 of file somethingToEggConverter.I.

◆ get_name()

virtual std::string SomethingToEggConverter::get_name ( ) const
pure virtual

◆ get_neutral_frame()

double SomethingToEggConverter::get_neutral_frame ( ) const
inline

Returns the value set by a previous call to set_neutral_frame().

It is an error to call this if has_neutral_frame() returns false.

Definition at line 244 of file somethingToEggConverter.I.

References has_neutral_frame().

◆ get_output_frame_rate()

double SomethingToEggConverter::get_output_frame_rate ( ) const
inline

Returns the value set by a previous call to set_output_frame_rate().

It is an error to call this if has_output_frame_rate() returns false.

Definition at line 324 of file somethingToEggConverter.I.

References has_output_frame_rate().

Referenced by MayaToEggConverter::convert_maya().

◆ get_path_replace() [1/2]

PathReplace * SomethingToEggConverter::get_path_replace ( )
inline

Returns a pointer to the PathReplace object associated with this converter.

If the converter is non-const, this returns a non-const pointer, which can be adjusted.

Definition at line 46 of file somethingToEggConverter.I.

◆ get_path_replace() [2/2]

const PathReplace * SomethingToEggConverter::get_path_replace ( ) const
inline

Returns a pointer to the PathReplace object associated with this converter.

If the converter is non-const, this returns a non-const pointer, which can be adjusted.

Definition at line 56 of file somethingToEggConverter.I.

◆ get_start_frame()

double SomethingToEggConverter::get_start_frame ( ) const
inline

Returns the value set by a previous call to set_start_frame().

It is an error to call this if has_start_frame() returns false.

Definition at line 123 of file somethingToEggConverter.I.

References has_start_frame().

Referenced by MayaToEggConverter::convert_maya().

◆ had_error()

bool SomethingToEggConverter::had_error ( ) const
inline

Returns true if an error was detected during the conversion process (unless _allow_errors is true), false otherwise.

Definition at line 27 of file somethingToEggConverter.I.

Referenced by DXFToEggConverter::convert_file(), ObjToEggConverter::convert_file(), VRMLToEggConverter::convert_file(), XFileToEggConverter::convert_file(), FltToEggConverter::convert_flt(), LwoToEggConverter::convert_lwo(), MayaToEggConverter::convert_maya(), and PT().

◆ handle_external_reference()

bool SomethingToEggConverter::handle_external_reference ( EggGroupNode * egg_parent,
const Filename & ref_filename )

Handles an external reference in the source file.

If the merge_externals flag is true (see set_merge_externals()), this causes the named file to be read in and converted, and the converted egg geometry is parented to egg_parent. Otherwise, only a reference to a similarly named egg file is parented to egg_parent.

The parameters orig_filename and searchpath are as those passed to convert_model_path().

Returns true on success, false on failure.

Definition at line 134 of file somethingToEggConverter.cxx.

References EggGroupNode::add_child(), get_egg_data(), EggData::set_coordinate_system, set_egg_data(), Filename::set_extension(), and EggGroupNode::steal_children().

◆ has_end_frame()

bool SomethingToEggConverter::has_end_frame ( ) const
inline

Returns true if the ending frame has been explicitly specified via set_end_frame(), or false if the ending frame should be implicit based on the source.

Definition at line 155 of file somethingToEggConverter.I.

Referenced by MayaToEggConverter::convert_maya(), and get_end_frame().

◆ has_frame_inc()

bool SomethingToEggConverter::has_frame_inc ( ) const
inline

Returns true if the frame increment has been explicitly specified via set_frame_inc(), or false if the ending frame should be implicit based on the source.

Definition at line 197 of file somethingToEggConverter.I.

Referenced by MayaToEggConverter::convert_maya(), and get_frame_inc().

◆ has_input_frame_rate()

bool SomethingToEggConverter::has_input_frame_rate ( ) const
inline

Returns true if the frame rate has been explicitly specified via set_input_frame_rate(), or false otherwise.

Definition at line 276 of file somethingToEggConverter.I.

Referenced by MayaToEggConverter::convert_maya(), and get_input_frame_rate().

◆ has_neutral_frame()

bool SomethingToEggConverter::has_neutral_frame ( ) const
inline

Returns true if the neutral frame has been explicitly specified via set_neutral_frame(), or false otherwise.

Definition at line 235 of file somethingToEggConverter.I.

Referenced by get_neutral_frame().

◆ has_output_frame_rate()

bool SomethingToEggConverter::has_output_frame_rate ( ) const
inline

Returns true if the frame rate has been explicitly specified via set_output_frame_rate(), or false otherwise.

Definition at line 315 of file somethingToEggConverter.I.

Referenced by MayaToEggConverter::convert_maya(), and get_output_frame_rate().

◆ has_start_frame()

bool SomethingToEggConverter::has_start_frame ( ) const
inline

Returns true if the starting frame has been explicitly specified via set_start_frame(), or false if the starting frame should be implicit based on the source.

Definition at line 114 of file somethingToEggConverter.I.

Referenced by MayaToEggConverter::convert_maya(), and get_start_frame().

◆ make_copy()

virtual SomethingToEggConverter * SomethingToEggConverter::make_copy ( )
pure virtual

◆ set_animation_convert()

void SomethingToEggConverter::set_animation_convert ( AnimationConvert animation_convert)
inline

Specifies how source animation will be converted into egg structures.

The default is AC_none, which means animation tables will be ignored. This is only meaningful for converters that understand animation.

Definition at line 66 of file somethingToEggConverter.I.

◆ set_character_name()

void SomethingToEggConverter::set_character_name ( const std::string & character_name)
inline

Specifies the name of the character generated.

This name should match between all the model and channel egg files for a particular character and its associated animations.

Definition at line 84 of file somethingToEggConverter.I.

◆ set_egg_data()

void SomethingToEggConverter::set_egg_data ( EggData * egg_data)

Sets the egg data that will be filled in when convert_file() is called.

This must be called before convert_file().

Definition at line 65 of file somethingToEggConverter.cxx.

Referenced by clear_egg_data(), and handle_external_reference().

◆ set_end_frame()

void SomethingToEggConverter::set_end_frame ( double end_frame)
inline

Specifies the ending frame of the animation to convert, in the units specified by set_input_frame_rate().

If this is unspecified, the ending frame is taken from the source, for instance from the last frame of the animation slider.

Definition at line 144 of file somethingToEggConverter.I.

◆ set_frame_inc()

void SomethingToEggConverter::set_frame_inc ( double frame_inc)
inline

Specifies the increment between frames to extract.

This is the amount to increment the time slider (in units of internal_frame_rate) between extracting each frame. If this is not specified, the default is taken from the animation package, or 1.0 if the animation package does not specified a frame increment.

Definition at line 186 of file somethingToEggConverter.I.

◆ set_input_frame_rate()

void SomethingToEggConverter::set_input_frame_rate ( double input_frame_rate)
inline

Specifies the number of frames per second that is represented by the "frame" unit in the animation package.

If this is omitted, it is taken from whatever the file header indicates. Some animation packages do not encode a frame rate, in which case the default if this is omitted is the same as the output frame rate.

Definition at line 266 of file somethingToEggConverter.I.

◆ set_merge_externals()

void SomethingToEggConverter::set_merge_externals ( bool merge_externals)
inline

Sets the merge_externals flag.

When this is true, external references within the source file are read in and merged directly; otherwise, only a reference to a similarly-named egg file is inserted.

Definition at line 354 of file somethingToEggConverter.I.

◆ set_neutral_frame()

void SomethingToEggConverter::set_neutral_frame ( double neutral_frame)
inline

Specifies the frame of animation to represent the neutral pose of the model.

Definition at line 225 of file somethingToEggConverter.I.

◆ set_output_frame_rate()

void SomethingToEggConverter::set_output_frame_rate ( double output_frame_rate)
inline

Specifies the number of frames per second that the resulting animation should be played at.

If this is omitted, it is taken to be the same as the input frame rate.

Definition at line 305 of file somethingToEggConverter.I.

◆ set_path_replace()

void SomethingToEggConverter::set_path_replace ( PathReplace * path_replace)
inline

Replaces the PathReplace object (which specifies how to mangle paths from the source to the destination egg file) with a new one.

Definition at line 36 of file somethingToEggConverter.I.

◆ set_start_frame()

void SomethingToEggConverter::set_start_frame ( double start_frame)
inline

Specifies the starting frame of the animation to convert, in the units specified by set_input_frame_rate().

If this is unspecified, the starting frame is taken from the source, for instance from the first frame of the animation slider.

Definition at line 103 of file somethingToEggConverter.I.

◆ supports_compressed()

bool SomethingToEggConverter::supports_compressed ( ) const
virtual

Returns true if this file type can transparently load compressed files (with a .pz extension), false otherwise.

Reimplemented in DXFToEggConverter, FltToEggConverter, LwoToEggConverter, ObjToEggConverter, VRMLToEggConverter, and XFileToEggConverter.

Definition at line 83 of file somethingToEggConverter.cxx.

Referenced by LoaderFileTypePandatool::supports_compressed().

◆ supports_convert_to_node()

bool SomethingToEggConverter::supports_convert_to_node ( const LoaderOptions & options) const
virtual

Returns true if this converter can directly convert the model type to internal Panda memory structures, given the indicated options, or false otherwise.

If this returns true, then convert_to_node() may be called to perform the conversion, which may be faster than calling convert_file() if the ultimate goal is a PandaNode anyway.

Reimplemented in ObjToEggConverter.

Definition at line 95 of file somethingToEggConverter.cxx.

Member Data Documentation

◆ _allow_errors

bool SomethingToEggConverter::_allow_errors

Definition at line 116 of file somethingToEggConverter.h.

◆ filename

virtual const Filename& SomethingToEggConverter::filename

Definition at line 107 of file somethingToEggConverter.h.


The documentation for this class was generated from the following files: