Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/eggbase/eggToSomething.cxx

Go to the documentation of this file.
00001 // Filename: eggToSomething.cxx
00002 // Created by:  drose (15Feb00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #include "eggToSomething.h"
00020 
00021 ////////////////////////////////////////////////////////////////////
00022 //     Function: EggToSomething::Constructor
00023 //       Access: Public
00024 //  Description: The first parameter to the constructor should be the
00025 //               one-word name of the file format that is to be read,
00026 //               for instance "OpenFlight" or "Alias".  It's just used
00027 //               in printing error messages and such.
00028 ////////////////////////////////////////////////////////////////////
00029 EggToSomething::
00030 EggToSomething(const string &format_name,
00031                const string &preferred_extension,
00032                bool allow_last_param, bool allow_stdout) :
00033   EggConverter(format_name, preferred_extension, allow_last_param,
00034                allow_stdout)
00035 {
00036   clear_runlines();
00037   if (_allow_last_param) {
00038     add_runline("[opts] input.egg output" + _preferred_extension);
00039   }
00040   add_runline("[opts] -o output" + _preferred_extension + " input.egg");
00041   if (_allow_stdout) {
00042     add_runline("[opts] input.egg >output" + _preferred_extension);
00043   }
00044 
00045   string o_description;
00046 
00047   if (_allow_stdout) {
00048     if (_allow_last_param) {
00049       o_description =
00050         "Specify the filename to which the resulting " + format_name +
00051         " file will be written.  "
00052         "If this option is omitted, the last parameter name is taken to be the "
00053         "name of the output file, or standard output is used if there are no "
00054         "other parameters.";
00055     } else {
00056       o_description =
00057         "Specify the filename to which the resulting " + format_name +
00058         " file will be written.  "
00059         "If this option is omitted, the " + format_name +
00060         " file is written to standard output.";
00061     }
00062   } else {
00063     if (_allow_last_param) {
00064       o_description =
00065         "Specify the filename to which the resulting " + format_name +
00066         " file will be written.  "
00067         "If this option is omitted, the last parameter name is taken to be the "
00068         "name of the output file.";
00069     } else {
00070       o_description =
00071         "Specify the filename to which the resulting " + format_name +
00072         " file will be written.";
00073     }
00074   }
00075 
00076   redescribe_option("o", o_description);
00077 
00078   redescribe_option
00079     ("cs",
00080      "Specify the coordinate system of the resulting " + _format_name +
00081      " file.  This may be "
00082      "one of 'y-up', 'z-up', 'y-up-left', or 'z-up-left'.  The default "
00083      "is the same coordinate system as the input egg file.  If this is "
00084      "different from the input egg file, a conversion will be performed.");
00085 }
00086 
00087 ////////////////////////////////////////////////////////////////////
00088 //     Function: EggToSomething::handle_args
00089 //       Access: Protected, Virtual
00090 //  Description: Does something with the additional arguments on the
00091 //               command line (after all the -options have been
00092 //               parsed).  Returns true if the arguments are good,
00093 //               false otherwise.
00094 ////////////////////////////////////////////////////////////////////
00095 bool EggToSomething::
00096 handle_args(ProgramBase::Args &args) {
00097   if (!check_last_arg(args, 1)) {
00098     return false;
00099   }
00100 
00101   return EggConverter::handle_args(args);
00102 }

Generated on Fri May 2 03:18:36 2003 for Panda-Tool by doxygen1.3