Panda3D
|
This is the general base class for a file-converter program that reads some model file format and generates an egg file. More...
#include "somethingToEgg.h"
Public Member Functions | |
SomethingToEgg (const string &format_name, const string &preferred_extension=string(), bool allow_last_param=true, bool allow_stdout=true) | |
The first parameter to the constructor should be the one-word name of the file format that is to be read, for instance "OpenFlight" or "Alias". | |
void | add_animation_options () |
Adds options appropriate to animation packages. | |
void | add_merge_externals_options () |
Adds -f. | |
void | add_units_options () |
Adds -ui and -uo as valid options for this program. | |
Protected Member Functions | |
void | apply_parameters (SomethingToEggConverter &converter) |
Copies the relevant parameters specified by the user on the command line (if add_path_replace_options(), add_path_store_options(), or add_animation_options() was used) to the converter. | |
void | apply_units_scale (EggData *data) |
Applies the scale indicated by the input and output units to the indicated egg file. | |
virtual bool | handle_args (Args &args) |
Does something with the additional arguments on the command line (after all the -options have been parsed). | |
virtual bool | post_command_line () |
This is called after the command line has been completely processed, and it gives the program a chance to do some last-minute processing and validation of the options and arguments. | |
virtual void | post_process_egg_file () |
Performs any processing of the egg file that is appropriate before writing it out. | |
Static Protected Member Functions | |
static bool | dispatch_animation_convert (const string &opt, const string &arg, void *var) |
Dispatch function to set the given animation convert mode according to the specified parameter. | |
Protected Attributes | |
bool | _allow_errors |
AnimationConvert | _animation_convert |
string | _character_name |
double | _end_frame |
double | _frame_inc |
bool | _got_end_frame |
bool | _got_frame_inc |
bool | _got_input_frame_rate |
bool | _got_neutral_frame |
bool | _got_output_frame_rate |
bool | _got_start_frame |
Filename | _input_filename |
double | _input_frame_rate |
DistanceUnit | _input_units |
bool | _merge_externals |
double | _neutral_frame |
bool | _noexist |
double | _output_frame_rate |
DistanceUnit | _output_units |
double | _start_frame |
This is the general base class for a file-converter program that reads some model file format and generates an egg file.
Definition at line 32 of file somethingToEgg.h.
SomethingToEgg::SomethingToEgg | ( | const string & | format_name, |
const string & | preferred_extension = string() , |
||
bool | allow_last_param = true , |
||
bool | allow_stdout = true |
||
) |
The first parameter to the constructor should be the one-word name of the file format that is to be read, for instance "OpenFlight" or "Alias".
It's just used in printing error messages and such.
Definition at line 29 of file somethingToEgg.cxx.
References ProgramBase::add_option(), ProgramBase::add_runline(), ProgramBase::clear_runlines(), ProgramBase::dispatch_none(), ProgramBase::redescribe_option(), and ProgramBase::remove_option().
Adds options appropriate to animation packages.
Definition at line 116 of file somethingToEgg.cxx.
References ProgramBase::add_option(), dispatch_animation_convert(), ProgramBase::dispatch_double(), and ProgramBase::dispatch_string().
Adds -f.
Definition at line 180 of file somethingToEgg.cxx.
References ProgramBase::add_option(), and ProgramBase::dispatch_none().
void SomethingToEgg::add_units_options | ( | ) |
Adds -ui and -uo as valid options for this program.
If the user specifies -uo and -ui, or just -uo and the program specifies -ui by setting _input_units, the indicated units conversion will be automatically applied before writing out the egg file.
Definition at line 94 of file somethingToEgg.cxx.
References ProgramBase::add_option(), and ProgramBase::dispatch_units().
void SomethingToEgg::apply_parameters | ( | SomethingToEggConverter & | converter | ) | [protected] |
Copies the relevant parameters specified by the user on the command line (if add_path_replace_options(), add_path_store_options(), or add_animation_options() was used) to the converter.
Definition at line 214 of file somethingToEgg.cxx.
References SomethingToEggConverter::set_animation_convert(), SomethingToEggConverter::set_character_name(), SomethingToEggConverter::set_end_frame(), SomethingToEggConverter::set_frame_inc(), SomethingToEggConverter::set_input_frame_rate(), SomethingToEggConverter::set_neutral_frame(), SomethingToEggConverter::set_output_frame_rate(), SomethingToEggConverter::set_path_replace(), and SomethingToEggConverter::set_start_frame().
void SomethingToEgg::apply_units_scale | ( | EggData * | data | ) | [protected] |
Applies the scale indicated by the input and output units to the indicated egg file.
This is normally done automatically when the file is written out.
Definition at line 195 of file somethingToEgg.cxx.
References LMatrix4d::scale_mat(), and EggNode::transform().
Referenced by post_process_egg_file().
bool SomethingToEgg::dispatch_animation_convert | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected] |
Dispatch function to set the given animation convert mode according to the specified parameter.
var is a pointer to an AnimationConvert variable.
Definition at line 347 of file somethingToEgg.cxx.
Referenced by add_animation_options().
bool SomethingToEgg::handle_args | ( | Args & | args | ) | [protected, virtual] |
Does something with the additional arguments on the command line (after all the -options have been parsed).
Returns true if the arguments are good, false otherwise.
Reimplemented from EggFilter.
Definition at line 247 of file somethingToEgg.cxx.
References Filename::from_os_specific(), Filename::get_dirname(), Filename::get_extension(), and WithOutputFile::verify_output_file_safe().
bool SomethingToEgg::post_command_line | ( | ) | [protected, virtual] |
This is called after the command line has been completely processed, and it gives the program a chance to do some last-minute processing and validation of the options and arguments.
It should return true if everything is fine, false if there is an error.
Reimplemented from EggFilter.
Definition at line 309 of file somethingToEgg.cxx.
References Filename::get_dirname(), and ConfigVariableSearchPath::prepend_directory().
void SomethingToEgg::post_process_egg_file | ( | ) | [protected, virtual] |
Performs any processing of the egg file that is appropriate before writing it out.
This includes any normal adjustments the user requested via -np, etc.
Normally, you should not need to call this function directly; write_egg_file() calls it for you. You should call this only if you do not use write_egg_file() to write out the resulting egg file.
Reimplemented from EggWriter.
Definition at line 334 of file somethingToEgg.cxx.
References apply_units_scale().