Panda3D
Public Member Functions | List of all members
EggWriter Class Reference

This is the base class for a program that generates an egg file output, but doesn't read any for input. More...

#include "eggWriter.h"

Inheritance diagram for EggWriter:
EggSingleBase WithOutputFile EggBase ProgramBase EggFilter EggMakeFont EggMakeSomething EggTextureCards EggConverter EggCrop EggQtess EggTrans EggMakeTube EggToSomething SomethingToEgg EggToBam EggToC EggToDAE EggToDXF EggToFlt EggToMaya EggToObj EggToX BamToEgg DAEToEgg DXFToEgg FltToEgg LwoToEgg MayaToEgg MayaToEggClient MayaToEggServer ObjToEgg VRMLToEgg XFileToEgg

Public Member Functions

 EggWriter (bool allow_last_param=false, bool allow_stdout=true)
 Egg-writing type programs may specify their output file using either the last-filename convention, the -o convention, and/or implicitly writing the result to standard output. More...
 
virtual EggWriteras_writer ()
 Returns this object as an EggWriter pointer, if it is in fact an EggWriter, or NULL if it is not. More...
 
virtual void post_process_egg_file ()
 Performs any processing of the egg file that is appropriate before writing it out. More...
 
void write_egg_file ()
 Writes out the egg file as the normal result of the program. More...
 
- Public Member Functions inherited from EggSingleBase
virtual EggReaderas_reader ()
 Returns this object as an EggReader pointer, if it is in fact an EggReader, or NULL if it is not. More...
 
- Public Member Functions inherited from EggBase
void add_normals_options ()
 Adds -no, -np, etc. More...
 
void add_points_options ()
 Adds -points as a valid option for this program. More...
 
void add_transform_options ()
 Adds -TS, -TT, etc. More...
 
- Public Member Functions inherited from ProgramBase
 ProgramBase (const std::string &name=std::string())
 
std::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. More...
 
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(). More...
 
void show_description ()
 Writes the program description to stderr. More...
 
void show_options ()
 Describes each of the available options to stderr. More...
 
void show_text (const std::string &text)
 Formats the indicated text to stderr with the known _terminal_width. More...
 
void show_text (const std::string &prefix, int indent_width, std::string text)
 Formats the indicated text and its prefix for output to stderr with the known _terminal_width. More...
 
void show_usage ()
 Writes the usage line(s) to stderr. More...
 
void write_man_page (std::ostream &out)
 Generates a man page in nroff syntax based on the description and options. More...
 
- Public Member Functions inherited from WithOutputFile
 WithOutputFile (bool allow_last_param, bool allow_stdout, bool binary_output)
 
void close_output ()
 Closes the output stream previously opened by get_output(). More...
 
std::ostream & get_output ()
 Returns an output stream that corresponds to the user's intended egg file output–either stdout, or the named output file. More...
 
Filename get_output_filename () const
 If has_output_filename() returns true, this is the filename that the user specified. More...
 
bool has_output_filename () const
 Returns true if the user specified an output filename, false otherwise (e.g. More...
 

Additional Inherited Members

- Public Types inherited from ProgramBase
typedef pdeque< std::string > Args
 
- Static Public Member Functions inherited from EggBase
static void convert_paths (EggNode *node, PathReplace *path_replace, const DSearchPath &additional_path)
 Recursively walks the egg hierarchy. More...
 
- Public Attributes inherited from ProgramBase
Args _program_args
 
Filename _program_name
 

Detailed Description

This is the base class for a program that generates an egg file output, but doesn't read any for input.

Definition at line 28 of file eggWriter.h.

Constructor & Destructor Documentation

◆ EggWriter()

EggWriter::EggWriter ( bool  allow_last_param = false,
bool  allow_stdout = true 
)

Egg-writing type programs may specify their output file using either the last-filename convention, the -o convention, and/or implicitly writing the result to standard output.

Not all interfaces are appropriate for all applications; some may be confusing or dangerous.

The calling application should pass allow_last_param true to allow the user to specify the output filename as the last parameter on the command line (the most dangerous, but convenient, method), and allow_stdout true to allow the user to omit the output filename altogether and have the output implicitly go to standard output (not terribly dangerous, but inappropriate when writing binary file formats).

Definition at line 34 of file eggWriter.cxx.

Member Function Documentation

◆ as_writer()

EggWriter * EggWriter::as_writer ( )
virtual

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 98 of file eggWriter.cxx.

◆ post_process_egg_file()

void EggWriter::post_process_egg_file ( )
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.

Definition at line 112 of file eggWriter.cxx.

Referenced by write_egg_file().

◆ write_egg_file()

void EggWriter::write_egg_file ( )

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 177 of file eggWriter.cxx.

References WithOutputFile::get_output(), and post_process_egg_file().


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