Panda3D
|
Public Types | |
typedef pdeque< string > | Args |
Public Member Functions | |
void | add_animation_options () |
Adds options appropriate to animation packages. | |
void | add_delod_options (double default_delod=-1.0) |
Adds -delod as a valid option for this program. | |
void | add_merge_externals_options () |
Adds -f. | |
void | add_normals_options () |
Adds -no, -np, etc. | |
void | add_texture_options () |
Adds -td, -te, etc. | |
void | add_transform_options () |
Adds -TS, -TT, etc. | |
void | add_units_options () |
Adds -ui and -uo as valid options for this program. | |
virtual EggReader * | as_reader () |
Returns this object as an EggReader pointer, if it is in fact an EggReader, or NULL if it is not. | |
virtual EggWriter * | as_writer () |
Returns this object as an EggWriter pointer, if it is in fact an EggWriter, or NULL if it is not. | |
virtual EggWriter * | as_writer () |
Returns this object as an EggWriter pointer, if it is in fact an EggWriter, or NULL if it is not. | |
void | close_output () |
Closes the output stream previously opened by get_output(). | |
string | get_exec_command () const |
Returns the command that invoked this program, as a shell-friendly string, suitable for pasting into the comments of output files. | |
ostream & | get_output () |
Returns an output stream that corresponds to the user's intended egg file output--either stdout, or the named output file. | |
Filename | get_output_filename () const |
If has_output_filename() returns true, this is the filename that the user specified. | |
bool | has_output_filename () const |
Returns true if the user specified an output filename, false otherwise (e.g. | |
virtual void | parse_command_line (int argc, char *argv[]) |
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_args(). | |
virtual void | pre_process_egg_file () |
Performs any processing of the egg file that is appropriate after reading it in. | |
void | run () |
void | show_description () |
Writes the program description to stderr. | |
void | show_options () |
Describes each of the available options to stderr. | |
void | show_text (const string &text) |
Formats the indicated text to stderr with the known _terminal_width. | |
void | show_text (const string &prefix, int indent_width, string text) |
Formats the indicated text and its prefix for output to stderr with the known _terminal_width. | |
void | show_usage () |
Writes the usage line(s) to stderr. | |
void | write_egg_file () |
Writes out the egg file as the normal result of the program. | |
Static Public Member Functions | |
static void | convert_paths (EggNode *node, PathReplace *path_replace, const DSearchPath &additional_path) |
Recursively walks the egg hierarchy. | |
Public Attributes | |
Args | _program_args |
Filename | _program_name |
Protected Types | |
enum | NormalsMode { NM_strip, NM_polygon, NM_vertex, NM_preserve } |
typedef bool(* | OptionDispatchFunction )(const string &opt, const string &parm, void *data) |
typedef bool(* | OptionDispatchMethod )(ProgramBase *self, const string &opt, const string &parm, void *data) |
Protected Member Functions | |
void | add_option (const string &option, const string &parm_name, int index_group, const string &description, OptionDispatchFunction option_function, bool *bool_var=(bool *) NULL, void *option_data=(void *) NULL) |
Adds (or redefines) a command line option. | |
void | add_option (const string &option, const string &parm_name, int index_group, const string &description, OptionDispatchMethod option_method, bool *bool_var=(bool *) NULL, void *option_data=(void *) NULL) |
void | add_path_replace_options () |
Adds -pr etc. | |
void | add_path_store_options () |
Adds -ps etc. | |
void | add_runline (const string &runline) |
Adds an additional line to the list of lines that will be displayed to describe briefly how the program is to be run. | |
void | append_command_comment (EggData *_data) |
Inserts a comment into the beginning of the indicated egg file corresponding to the command line that invoked this program. | |
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. | |
bool | check_last_arg (ProgramBase::Args &args, int minimum_args) |
Checks if the last filename on the argument list is a file with the expected extension (if _allow_last_param was set true), and removes it from the argument list if it is. | |
void | clear_options () |
Removes all of the options that were previously added, presumably before adding some new ones. | |
void | clear_runlines () |
Removes all of the runlines that were previously added, presumably before adding some new ones. | |
bool | do_reader_options () |
Postprocesses the egg file as the user requested according to whatever command-line options are in effect. | |
virtual bool | handle_args (Args &args) |
Does something with the additional arguments on the command line (after all the -options have been parsed). | |
bool | ns_dispatch_normals (const string &opt, const string &arg, void *mode) |
Accepts one of -no, -np, etc. | |
bool | ns_dispatch_rotate_axis (const string &opt, const string &arg, void *var) |
Handles -TA, which specifies a rotate transform about an arbitrary axis. | |
bool | ns_dispatch_rotate_xyz (const string &opt, const string &arg, void *var) |
Handles -TR, which specifies a rotate transform about the three cardinal axes. | |
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. | |
PT (PathReplace) _path_replace | |
PT (EggData) _data | |
bool | redescribe_option (const string &option, const string &description) |
Changes the description associated with a previously-defined option. | |
bool | remove_option (const string &option) |
Removes a previously-defined option. | |
void | set_binary_output (bool binary_output) |
Changes the flag specifying whether the output file is to be opened in binary mode or not. | |
void | set_program_description (const string &description) |
Sets the description of the program that will be reported by show_usage(). | |
bool | verify_output_file_safe () const |
This is called when the output file is given as the last parameter on the command line. | |
Static Protected Member Functions | |
static void | append_command_comment (EggData *_data, const string &comment) |
Inserts a comment into the beginning of the indicated egg file corresponding to the command line that invoked this program. | |
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. | |
static bool | dispatch_color (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes a color, as l or l,a or r,g,b or r,g,b,a. | |
static bool | dispatch_coordinate_system (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a coordinate system string. | |
static bool | dispatch_count (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes no parameters, but whose presence on the command line increments an integer counter for each time it appears. | |
static bool | dispatch_double (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a double. | |
static bool | dispatch_double_pair (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes a pair of double parameters. | |
static bool | dispatch_double_quad (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes a quad of double parameters. | |
static bool | dispatch_double_triple (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes a triple of double parameters. | |
static bool | dispatch_false (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes no parameters, and when it is present sets a bool variable to the 'false' value. | |
static bool | dispatch_filename (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a filename. | |
static bool | dispatch_image_type (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to indicate an image file type, like rgb, bmp, jpg, etc. | |
static bool | dispatch_int (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as an integer. | |
static bool | dispatch_int_pair (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes a pair of integer parameters. | |
static bool | dispatch_none (const string &opt, const string &arg, void *) |
Standard dispatch function for an option that takes no parameters, and does nothing special. | |
static bool | dispatch_normals (ProgramBase *self, const string &opt, const string &arg, void *mode) |
Accepts one of -no, -np, etc. | |
static bool | dispatch_path_replace (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a single component of a path replace request. | |
static bool | dispatch_path_store (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a path store string. | |
static bool | dispatch_rotate_axis (ProgramBase *self, const string &opt, const string &arg, void *var) |
Handles -TA, which specifies a rotate transform about an arbitrary axis. | |
static bool | dispatch_rotate_xyz (ProgramBase *self, const string &opt, const string &arg, void *var) |
Handles -TR, which specifies a rotate transform about the three cardinal axes. | |
static bool | dispatch_scale (const string &opt, const string &arg, void *var) |
Handles -TS, which specifies a scale transform. | |
static bool | dispatch_search_path (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a single directory name to add to a search path. | |
static bool | dispatch_string (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a string. | |
static bool | dispatch_transform_type (const string &opt, const string &arg, void *var) |
Dispatches a parameter that expects a MayaToEggConverter::TransformType option. | |
static bool | dispatch_translate (const string &opt, const string &arg, void *var) |
Handles -TT, which specifies a translate transform. | |
static bool | dispatch_true (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes no parameters, and when it is present sets a bool variable to the 'true' value. | |
static bool | dispatch_units (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a unit of distance measurement. | |
static bool | dispatch_vector_string (const string &opt, const string &arg, void *var) |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a string. | |
static bool | dispatch_vector_string_comma (const string &opt, const string &arg, void *var) |
Similar to dispatch_vector_string, but a comma is allowed to separate multiple tokens in one argument, without having to repeat the argument for each token. | |
static void | format_text (ostream &out, bool &last_newline, const string &prefix, int indent_width, const string &text, int line_width) |
Word-wraps the indicated text to the indicated output stream. | |
static bool | handle_help_option (const string &opt, const string &arg, void *) |
Called when the user enters '-h', this describes how to use the program and then exits. | |
Protected Attributes | |
bool | _allow_errors |
bool | _allow_last_param |
bool | _allow_stdout |
AnimationConvert | _animation_convert |
bool | _binary_output |
string | _character_name |
CoordinateSystem | _coordinate_system |
double | _end_frame |
vector_string | _excludes |
bool | _force_complete |
vector_string | _force_joints |
string | _format_name |
double | _frame_inc |
bool | _got_coordinate_system |
bool | _got_end_frame |
bool | _got_frame_inc |
bool | _got_input_frame_rate |
bool | _got_neutral_frame |
bool | _got_output_filename |
bool | _got_output_frame_rate |
bool | _got_path_directory |
bool | _got_path_store |
bool | _got_start_frame |
bool | _got_tbnall |
bool | _got_tbnauto |
bool | _got_transform |
vector_string | _ignore_sliders |
Filename | _input_filename |
double | _input_frame_rate |
DistanceUnit | _input_units |
bool | _keep_all_uvsets |
bool | _legacy_shader |
bool | _merge_externals |
double | _neutral_frame |
bool | _noabs |
bool | _noexist |
NormalsMode | _normals_mode |
double | _normals_threshold |
Filename | _output_filename |
double | _output_frame_rate |
DistanceUnit | _output_units |
bool | _polygon_output |
double | _polygon_tolerance |
string | _preferred_extension |
bool | _respect_maya_double_sided |
bool | _round_uvs |
double | _start_frame |
vector_string | _subroots |
vector_string | _subsets |
bool | _suppress_vertex_color |
vector_string | _tbn_names |
bool | _texture_copy |
Filename | _texture_out_dir |
LMatrix4d | _transform |
MayaToEggConverter::TransformType | _transform_type |
int | _verbose |
Definition at line 26 of file mayaToEgg.h.
void SomethingToEgg::add_animation_options | ( | ) | [inherited] |
Adds options appropriate to animation packages.
Definition at line 116 of file somethingToEgg.cxx.
References ProgramBase::add_option(), SomethingToEgg::dispatch_animation_convert(), ProgramBase::dispatch_double(), and ProgramBase::dispatch_string().
void EggReader::add_delod_options | ( | double | default_delod = -1.0 | ) | [inherited] |
Adds -delod as a valid option for this program.
Note that if you call this function to add these options, you must call do_reader_options() at the appropriate point before or during processing to execute the options if the user specified them.
Definition at line 114 of file eggReader.cxx.
References ProgramBase::add_option(), and ProgramBase::dispatch_double().
void SomethingToEgg::add_merge_externals_options | ( | ) | [inherited] |
Adds -f.
Definition at line 180 of file somethingToEgg.cxx.
References ProgramBase::add_option(), and ProgramBase::dispatch_none().
void EggBase::add_normals_options | ( | ) | [inherited] |
Adds -no, -np, etc.
as valid options for this program. If the user specifies one of the options on the command line, the normals will be adjusted when the egg file is written out.
Definition at line 62 of file eggBase.cxx.
References ProgramBase::add_option(), ProgramBase::dispatch_none(), EggBase::dispatch_normals(), and ProgramBase::dispatch_vector_string().
void ProgramBase::add_option | ( | const string & | option, |
const string & | parm_name, | ||
int | index_group, | ||
const string & | description, | ||
OptionDispatchFunction | option_function, | ||
bool * | bool_var = (bool *)NULL , |
||
void * | option_data = (void *)NULL |
||
) | [protected, inherited] |
Adds (or redefines) a command line option.
This is another variant on add_option(), above, except that it receives a pointer to a "method", which is really just another static (or global) function, whose first parameter is a ProgramBase *.
When parse_command_line() is executed it will look for these options (followed by a hyphen) on the command line; when a particular option is found it will call the indicated option_function, supplying the provided option_data. This allows the user to define a function that does some special behavior for any given option, or to use any of a number of generic pre-defined functions to fill in data for each option.
Each option may or may not take a parameter. If parm_name is nonempty, it is assumed that the option does take a parameter (and parm_name contains the name that will be printed by show_options()). This parameter will be supplied as the second parameter to the dispatch function. If parm_name is empty, it is assumed that the option does not take a parameter. There is no provision for optional parameters.
The options are listed first in order by their index_group number, and then in the order that add_option() was called. This provides a mechanism for listing the options defined in derived classes before those of the base classes.
We can't easily add a variant that accepts a real method, because the C++ syntax for methods requires us to know exactly what class object the method is defined for, and we want to support adding pointers for methods that are defined in other classes. So we have this hacky thing, which requires the "method" to be declared static, and receive its this pointer explicitly, as the first argument.
Definition at line 535 of file programBase.cxx.
Referenced by SomethingToEgg::add_animation_options(), EggReader::add_delod_options(), SomethingToEgg::add_merge_externals_options(), EggBase::add_normals_options(), ProgramBase::add_path_replace_options(), ProgramBase::add_path_store_options(), EggReader::add_texture_options(), EggBase::add_transform_options(), SomethingToEgg::add_units_options(), EggToSomething::add_units_options(), EggWriter::EggWriter(), ImageWriter::ImageWriter(), and SomethingToEgg::SomethingToEgg().
void ProgramBase::add_path_replace_options | ( | ) | [protected, inherited] |
Adds -pr etc.
as valid options for this program. These are appropriate for a model converter or model reader type program, and specify how to locate possibly-invalid pathnames in the source model file.
Definition at line 642 of file programBase.cxx.
References ProgramBase::add_option(), ProgramBase::dispatch_path_replace(), and ProgramBase::dispatch_search_path().
void ProgramBase::add_path_store_options | ( | ) | [protected, inherited] |
Adds -ps etc.
as valid options for this program. These are appropriate for a model converter type program, and specify how to represent filenames in the output file.
Definition at line 683 of file programBase.cxx.
References ProgramBase::add_option(), ProgramBase::dispatch_filename(), and ProgramBase::dispatch_path_store().
void ProgramBase::add_runline | ( | const string & | runline | ) | [protected, inherited] |
Adds an additional line to the list of lines that will be displayed to describe briefly how the program is to be run.
Each line should be something like "[opts] arg1 arg2", that is, it does *not* include the name of the program, but it includes everything that should be printed after the name of the program.
Normally there is only one runline for a given program, but it is possible to define more than one.
Definition at line 487 of file programBase.cxx.
Referenced by EggToSomething::EggToSomething(), EggWriter::EggWriter(), ImageWriter::ImageWriter(), and SomethingToEgg::SomethingToEgg().
void EggReader::add_texture_options | ( | ) | [inherited] |
Adds -td, -te, etc.
as valid options for this program. If the user specifies one of the options on the command line, the textures will be copied and converted as each egg file is read.
Note that if you call this function to add these options, you must call do_reader_options() at the appropriate point before or during processing to execute the options if the user specified them.
Definition at line 77 of file eggReader.cxx.
References ProgramBase::add_option(), ProgramBase::dispatch_filename(), ProgramBase::dispatch_image_type(), and ProgramBase::dispatch_string().
void EggBase::add_transform_options | ( | ) | [inherited] |
Adds -TS, -TT, etc.
as valid options for this program. If the user specifies one of the options on the command line, the data will be transformed when the egg file is written out.
Definition at line 121 of file eggBase.cxx.
References ProgramBase::add_option(), EggBase::dispatch_rotate_axis(), EggBase::dispatch_rotate_xyz(), EggBase::dispatch_scale(), and EggBase::dispatch_translate().
void SomethingToEgg::add_units_options | ( | ) | [inherited] |
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 EggBase::append_command_comment | ( | EggData * | data | ) | [protected, inherited] |
Inserts a comment into the beginning of the indicated egg file corresponding to the command line that invoked this program.
Normally this function is called automatically when appropriate by EggWriter, and it's not necessary to call it explicitly.
Definition at line 204 of file eggBase.cxx.
References ProgramBase::get_exec_command().
Referenced by EggWriter::post_command_line(), and EggMultiFilter::post_command_line().
void EggBase::append_command_comment | ( | EggData * | data, |
const string & | comment | ||
) | [static, protected, inherited] |
Inserts a comment into the beginning of the indicated egg file corresponding to the command line that invoked this program.
Normally this function is called automatically when appropriate by EggWriter, and it's not necessary to call it explicitly.
Definition at line 220 of file eggBase.cxx.
void SomethingToEgg::apply_parameters | ( | SomethingToEggConverter & | converter | ) | [protected, inherited] |
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, inherited] |
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 SomethingToEgg::post_process_egg_file().
EggReader * EggReader::as_reader | ( | ) | [virtual, inherited] |
Returns this object as an EggReader pointer, if it is in fact an EggReader, or NULL if it is not.
This is intended to work around the C++ limitation that prevents downcasts past virtual inheritance. Since both EggReader and EggWriter inherit virtually from EggSingleBase, we need functions like this to downcast to the appropriate pointer.
Reimplemented from EggSingleBase.
Definition at line 150 of file eggReader.cxx.
EggWriter * EggSingleBase::as_writer | ( | ) | [virtual, inherited] |
Returns this object as an EggWriter pointer, if it is in fact an EggWriter, or NULL if it is not.
This is intended to work around the C++ limitation that prevents downcasts past virtual inheritance. Since both EggReader and EggWriter inherit virtually from EggSingleBase, we need functions like this to downcast to the appropriate pointer.
Reimplemented in EggWriter.
Definition at line 65 of file eggSingleBase.cxx.
EggWriter * EggWriter::as_writer | ( | ) | [virtual, inherited] |
Returns this object as an EggWriter pointer, if it is in fact an EggWriter, or NULL if it is not.
This is intended to work around the C++ limitation that prevents downcasts past virtual inheritance. Since both EggReader and EggWriter inherit virtually from EggSingleBase, we need functions like this to downcast to the appropriate pointer.
Reimplemented from EggSingleBase.
Definition at line 108 of file eggWriter.cxx.
bool WithOutputFile::check_last_arg | ( | ProgramBase::Args & | args, |
int | minimum_args | ||
) | [protected, inherited] |
Checks if the last filename on the argument list is a file with the expected extension (if _allow_last_param was set true), and removes it from the argument list if it is.
Returns true if the arguments are good, false if something is invalid.
minimum_args is the number of arguments we know must be input parameters and therefore cannot be interpreted as output filenames.
Definition at line 169 of file withOutputFile.cxx.
References Filename::from_os_specific(), Filename::get_extension(), and WithOutputFile::verify_output_file_safe().
Referenced by XFileTrans::handle_args(), VRMLTrans::handle_args(), ImageWriter::handle_args(), ImageFilter::handle_args(), FltTrans::handle_args(), EggTextureCards::handle_args(), EggWriter::handle_args(), EggToSomething::handle_args(), and EggFilter::handle_args().
void ProgramBase::clear_options | ( | ) | [protected, inherited] |
Removes all of the options that were previously added, presumably before adding some new ones.
Normally you wouldn't want to do this unless you want to completely replace all of the options defined by base classes.
Definition at line 501 of file programBase.cxx.
void ProgramBase::clear_runlines | ( | ) | [protected, inherited] |
Removes all of the runlines that were previously added, presumably before adding some new ones.
Definition at line 469 of file programBase.cxx.
Referenced by EggToSomething::EggToSomething(), EggWriter::EggWriter(), ImageWriter::ImageWriter(), and SomethingToEgg::SomethingToEgg().
void WithOutputFile::close_output | ( | ) | [inherited] |
Closes the output stream previously opened by get_output().
A subsequent call to get_output() will open a new stream.
Definition at line 117 of file withOutputFile.cxx.
void EggBase::convert_paths | ( | EggNode * | node, |
PathReplace * | path_replace, | ||
const DSearchPath & | additional_path | ||
) | [static, inherited] |
Recursively walks the egg hierarchy.
Any filenames encountered are replaced according to the indicated PathReplace.
Definition at line 156 of file eggBase.cxx.
References PathReplace::full_convert_path(), EggTexture::get_alpha_filename(), EggFilenameNode::get_filename(), EggTexture::has_alpha_filename(), TypedObject::is_of_type(), EggTexture::set_alpha_filename(), EggTexture::set_alpha_fullpath(), and EggFilenameNode::set_fullpath().
Referenced by EggReader::handle_args().
bool SomethingToEgg::dispatch_animation_convert | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
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 SomethingToEgg::add_animation_options().
bool ProgramBase::dispatch_color | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes a color, as l or l,a or r,g,b or r,g,b,a.
The data pointer is to an array of four floats, e.g. a Colorf.
Definition at line 953 of file programBase.cxx.
bool ProgramBase::dispatch_coordinate_system | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a coordinate system string.
The data pointer is to a CoordinateSystem variable.
Definition at line 1114 of file programBase.cxx.
bool ProgramBase::dispatch_count | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes no parameters, but whose presence on the command line increments an integer counter for each time it appears.
-v is often an option that works this way. The data pointer is to an int counter variable.
Definition at line 775 of file programBase.cxx.
bool ProgramBase::dispatch_double | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a double.
The data pointer is to an double variable.
Definition at line 840 of file programBase.cxx.
Referenced by SomethingToEgg::add_animation_options(), and EggReader::add_delod_options().
bool ProgramBase::dispatch_double_pair | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes a pair of double parameters.
The data pointer is to an array of two doubles.
Definition at line 860 of file programBase.cxx.
bool ProgramBase::dispatch_double_quad | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes a quad of double parameters.
The data pointer is to an array of four doubles.
Definition at line 921 of file programBase.cxx.
bool ProgramBase::dispatch_double_triple | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes a triple of double parameters.
The data pointer is to an array of three doubles.
Definition at line 890 of file programBase.cxx.
bool ProgramBase::dispatch_false | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes no parameters, and when it is present sets a bool variable to the 'false' value.
This is another way to handle a boolean flag. See also dispatch_none() and dispatch_true().
The data pointer is to a bool variable.
Definition at line 759 of file programBase.cxx.
bool ProgramBase::dispatch_filename | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a filename.
The data pointer is to a Filename variable.
Definition at line 1070 of file programBase.cxx.
References Filename::from_os_specific().
Referenced by ProgramBase::add_path_store_options(), EggReader::add_texture_options(), EggWriter::EggWriter(), and ImageWriter::ImageWriter().
bool ProgramBase::dispatch_image_type | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to indicate an image file type, like rgb, bmp, jpg, etc.
The data pointer is to a PNMFileType pointer.
Definition at line 1159 of file programBase.cxx.
References PNMFileTypeRegistry::get_global_ptr(), PNMFileTypeRegistry::get_type_from_extension(), and PNMFileTypeRegistry::write().
Referenced by EggReader::add_texture_options().
bool ProgramBase::dispatch_int | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as an integer.
The data pointer is to an int variable.
Definition at line 790 of file programBase.cxx.
bool ProgramBase::dispatch_int_pair | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes a pair of integer parameters.
The data pointer is to an array of two integers.
Definition at line 810 of file programBase.cxx.
bool ProgramBase::dispatch_none | ( | const string & | opt, |
const string & | arg, | ||
void * | |||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes no parameters, and does nothing special.
Typically this would be used for a boolean flag, whose presence means something and whose absence means something else. Use the bool_var parameter to add_option() to determine whether the option appears on the command line or not.
Definition at line 725 of file programBase.cxx.
Referenced by SomethingToEgg::add_merge_externals_options(), EggBase::add_normals_options(), and SomethingToEgg::SomethingToEgg().
bool EggBase::dispatch_normals | ( | ProgramBase * | self, |
const string & | opt, | ||
const string & | arg, | ||
void * | mode | ||
) | [static, protected, inherited] |
Accepts one of -no, -np, etc.
and sets _normals_mode as indicated. The void * argument is a pointer to a NormalsMode variable that indicates which switch was passed.
Definition at line 233 of file eggBase.cxx.
References EggBase::ns_dispatch_normals().
Referenced by EggBase::add_normals_options().
bool ProgramBase::dispatch_path_replace | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a single component of a path replace request.
The data pointer is to a PathReplace variable.
Definition at line 1185 of file programBase.cxx.
References PathReplace::add_pattern().
Referenced by ProgramBase::add_path_replace_options().
bool ProgramBase::dispatch_path_store | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a path store string.
The data pointer is to a PathStore variable.
Definition at line 1207 of file programBase.cxx.
Referenced by ProgramBase::add_path_store_options().
bool EggBase::dispatch_rotate_axis | ( | ProgramBase * | self, |
const string & | opt, | ||
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Handles -TA, which specifies a rotate transform about an arbitrary axis.
Var is an LMatrix4d.
Definition at line 358 of file eggBase.cxx.
References EggBase::ns_dispatch_rotate_axis().
Referenced by EggBase::add_transform_options().
bool EggBase::dispatch_rotate_xyz | ( | ProgramBase * | self, |
const string & | opt, | ||
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Handles -TR, which specifies a rotate transform about the three cardinal axes.
Var is an LMatrix4d.
Definition at line 307 of file eggBase.cxx.
References EggBase::ns_dispatch_rotate_xyz().
Referenced by EggBase::add_transform_options().
bool EggBase::dispatch_scale | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Handles -TS, which specifies a scale transform.
Var is an LMatrix4d.
Definition at line 268 of file eggBase.cxx.
References LMatrix4d::scale_mat().
Referenced by EggBase::add_transform_options().
bool ProgramBase::dispatch_search_path | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a single directory name to add to a search path.
The data pointer is to a DSearchPath variable. This kind of option may appear multiple times on the command line; each time, the new directory is appended.
Definition at line 1093 of file programBase.cxx.
References DSearchPath::append_directory(), and Filename::from_os_specific().
Referenced by ProgramBase::add_path_replace_options().
bool ProgramBase::dispatch_string | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a string.
The data pointer is to a string variable.
Definition at line 1011 of file programBase.cxx.
Referenced by SomethingToEgg::add_animation_options(), and EggReader::add_texture_options().
bool MayaToEgg::dispatch_transform_type | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected] |
Dispatches a parameter that expects a MayaToEggConverter::TransformType option.
Definition at line 322 of file mayaToEgg.cxx.
References MayaToEggConverter::string_transform_type().
bool EggBase::dispatch_translate | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Handles -TT, which specifies a translate transform.
Var is an LMatrix4d.
Definition at line 406 of file eggBase.cxx.
References LMatrix4d::translate_mat().
Referenced by EggBase::add_transform_options().
bool ProgramBase::dispatch_true | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes no parameters, and when it is present sets a bool variable to the 'true' value.
This is another way to handle a boolean flag. See also dispatch_none() and dispatch_false().
The data pointer is to a bool variable.
Definition at line 741 of file programBase.cxx.
bool ProgramBase::dispatch_units | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a unit of distance measurement.
The data pointer is to a DistanceUnit variable.
Definition at line 1137 of file programBase.cxx.
Referenced by SomethingToEgg::add_units_options(), and EggToSomething::add_units_options().
bool ProgramBase::dispatch_vector_string | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Standard dispatch function for an option that takes one parameter, which is to be interpreted as a string.
This is different from dispatch_string in that the parameter may be repeated multiple times, and each time the string value is appended to a vector.
The data pointer is to a vector_string variable.
Definition at line 1031 of file programBase.cxx.
Referenced by EggBase::add_normals_options().
bool ProgramBase::dispatch_vector_string_comma | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [static, protected, inherited] |
Similar to dispatch_vector_string, but a comma is allowed to separate multiple tokens in one argument, without having to repeat the argument for each token.
The data pointer is to a vector_string variable.
Definition at line 1048 of file programBase.cxx.
bool EggReader::do_reader_options | ( | ) | [protected, inherited] |
Postprocesses the egg file as the user requested according to whatever command-line options are in effect.
Returns true if everything is done correctly, false if there was some problem.
Definition at line 248 of file eggReader.cxx.
void ProgramBase::format_text | ( | ostream & | out, |
bool & | last_newline, | ||
const string & | prefix, | ||
int | indent_width, | ||
const string & | text, | ||
int | line_width | ||
) | [static, protected, inherited] |
Word-wraps the indicated text to the indicated output stream.
The first line is prefixed with the indicated prefix, then tabbed over to indent_width where the text actually begins. A newline is inserted at or before column line_width. Each subsequent line begins with indent_width spaces.
An embedded newline character ('
') forces a line break, while an embedded carriage-return character (''), or two or more consecutive newlines, marks a paragraph break, which is usually printed as a blank line. Redundant newline and carriage-return characters are generally ignored.
The flag last_newline should be initialized to false for the first call to format_text, and then preserved for future calls; it tracks the state of trailing newline characters between calls so we can correctly identify doubled newlines.
Definition at line 1263 of file programBase.cxx.
Referenced by ProgramBase::show_text().
string ProgramBase::get_exec_command | ( | ) | const [inherited] |
Returns the command that invoked this program, as a shell-friendly string, suitable for pasting into the comments of output files.
Definition at line 367 of file programBase.cxx.
References Filename::get_basename_wo_extension().
Referenced by EggBase::append_command_comment().
ostream & WithOutputFile::get_output | ( | ) | [inherited] |
Returns an output stream that corresponds to the user's intended egg file output--either stdout, or the named output file.
Definition at line 58 of file withOutputFile.cxx.
References Filename::get_extension(), Filename::make_dir(), Filename::open_write(), Filename::set_binary(), and Filename::set_text().
Referenced by DXFPoints::done_entity(), and EggWriter::write_egg_file().
Filename WithOutputFile::get_output_filename | ( | ) | const [inherited] |
If has_output_filename() returns true, this is the filename that the user specified.
Otherwise, it returns the empty string.
Definition at line 148 of file withOutputFile.cxx.
Referenced by ImageWriter::write_image().
bool SomethingToEgg::handle_args | ( | Args & | args | ) | [protected, virtual, inherited] |
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 ProgramBase::handle_help_option | ( | const string & | opt, |
const string & | arg, | ||
void * | data | ||
) | [static, protected, inherited] |
Called when the user enters '-h', this describes how to use the program and then exits.
Definition at line 1228 of file programBase.cxx.
References ProgramBase::show_description(), ProgramBase::show_options(), and ProgramBase::show_usage().
bool WithOutputFile::has_output_filename | ( | ) | const [inherited] |
Returns true if the user specified an output filename, false otherwise (e.g.
the output file is implicitly stdout).
Definition at line 136 of file withOutputFile.cxx.
bool EggBase::ns_dispatch_normals | ( | const string & | opt, |
const string & | arg, | ||
void * | mode | ||
) | [protected, inherited] |
Accepts one of -no, -np, etc.
and sets _normals_mode as indicated. The void * argument is a pointer to a NormalsMode variable that indicates which switch was passed.
Definition at line 247 of file eggBase.cxx.
Referenced by EggBase::dispatch_normals().
bool EggBase::ns_dispatch_rotate_axis | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [protected, inherited] |
Handles -TA, which specifies a rotate transform about an arbitrary axis.
Var is an LMatrix4d.
Definition at line 370 of file eggBase.cxx.
References LMatrix4d::rotate_mat().
Referenced by EggBase::dispatch_rotate_axis().
bool EggBase::ns_dispatch_rotate_xyz | ( | const string & | opt, |
const string & | arg, | ||
void * | var | ||
) | [protected, inherited] |
Handles -TR, which specifies a rotate transform about the three cardinal axes.
Var is an LMatrix4d.
Definition at line 319 of file eggBase.cxx.
References LMatrix4d::rotate_mat().
Referenced by EggBase::dispatch_rotate_xyz().
void ProgramBase::parse_command_line | ( | int | argc, |
char * | argv[] | ||
) | [virtual, inherited] |
Dispatches on each of the options on the command line, and passes the remaining parameters to handle_args().
If an error on the command line is detected, will automatically call show_usage() and exit(1).
Definition at line 208 of file programBase.cxx.
References Filename::from_os_specific(), ProgramBase::handle_args(), ProgramBase::post_command_line(), and ProgramBase::show_usage().
Referenced by MayaToEggServer::poll().
bool SomethingToEgg::post_command_line | ( | ) | [protected, virtual, inherited] |
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, inherited] |
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 SomethingToEgg::apply_units_scale().
void EggReader::pre_process_egg_file | ( | ) | [virtual, inherited] |
Performs any processing of the egg file that is appropriate after reading it in.
Normally, you should not need to call this function directly; it is called automatically at startup.
Reimplemented in EggToSomething.
Definition at line 164 of file eggReader.cxx.
Referenced by EggReader::handle_args().
bool ProgramBase::redescribe_option | ( | const string & | option, |
const string & | description | ||
) | [protected, inherited] |
Changes the description associated with a previously-defined option.
Returns true if the option was changed, false if it hadn't been defined.
Definition at line 607 of file programBase.cxx.
Referenced by EggToSomething::EggToSomething(), EggWriter::EggWriter(), and SomethingToEgg::SomethingToEgg().
bool ProgramBase::remove_option | ( | const string & | option | ) | [protected, inherited] |
Removes a previously-defined option.
Returns true if the option was removed, false if it hadn't existed.
Definition at line 623 of file programBase.cxx.
Referenced by SomethingToEgg::SomethingToEgg().
void WithOutputFile::set_binary_output | ( | bool | binary_output | ) | [inline, protected, inherited] |
Changes the flag specifying whether the output file is to be opened in binary mode or not.
Definition at line 23 of file withOutputFile.I.
void ProgramBase::set_program_description | ( | const string & | description | ) | [protected, inherited] |
Sets the description of the program that will be reported by show_usage().
The description should be one long string of text. Embedded newline characters are interpreted as paragraph breaks and printed as blank lines.
Definition at line 458 of file programBase.cxx.
void ProgramBase::show_description | ( | ) | [inherited] |
Writes the program description to stderr.
Definition at line 137 of file programBase.cxx.
Referenced by ProgramBase::handle_help_option().
void ProgramBase::show_options | ( | ) | [inherited] |
Describes each of the available options to stderr.
Definition at line 164 of file programBase.cxx.
References ProgramBase::show_text().
Referenced by ProgramBase::handle_help_option().
void ProgramBase::show_text | ( | const string & | text | ) | [inline, inherited] |
Formats the indicated text to stderr with the known _terminal_width.
Definition at line 23 of file programBase.I.
Referenced by ProgramBase::show_options(), and ProgramBase::show_usage().
void ProgramBase::show_text | ( | const string & | prefix, |
int | indent_width, | ||
string | text | ||
) | [inherited] |
Formats the indicated text and its prefix for output to stderr with the known _terminal_width.
Definition at line 188 of file programBase.cxx.
References ProgramBase::format_text().
void ProgramBase::show_usage | ( | ) | [inherited] |
Writes the usage line(s) to stderr.
Definition at line 147 of file programBase.cxx.
References Filename::get_basename_wo_extension(), and ProgramBase::show_text().
Referenced by ProgramBase::handle_help_option(), and ProgramBase::parse_command_line().
bool WithOutputFile::verify_output_file_safe | ( | ) | const [protected, inherited] |
This is called when the output file is given as the last parameter on the command line.
Since this is a fairly dangerous way to specify the output file (it's easy to accidentally overwrite an input file this way), the convention is to disallow this syntax if the output file already exists.
This function will test if the output file exists, and issue a warning message if it does, returning false. If all is well, it will return true.
Definition at line 215 of file withOutputFile.cxx.
Referenced by WithOutputFile::check_last_arg(), and SomethingToEgg::handle_args().
void EggWriter::write_egg_file | ( | ) | [inherited] |
Writes out the egg file as the normal result of the program.
This calls post_process_egg_file() to perform any last minute processing (like normal computation) and then writes out the file to the output stream returned by get_output().
Definition at line 188 of file eggWriter.cxx.
References WithOutputFile::get_output(), and EggWriter::post_process_egg_file().