00001 // Filename: eggFilter.cxx 00002 // Created by: drose (14Feb00) 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 "eggFilter.h" 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Function: EggFilter::Constructor 00023 // Access: Public 00024 // Description: 00025 //////////////////////////////////////////////////////////////////// 00026 EggFilter:: 00027 EggFilter(bool allow_last_param, bool allow_stdout) : 00028 EggWriter(allow_last_param, allow_stdout) 00029 { 00030 clear_runlines(); 00031 if (allow_last_param) { 00032 add_runline("[opts] input.egg output.egg"); 00033 } 00034 add_runline("[opts] -o output.egg input.egg"); 00035 if (allow_stdout) { 00036 add_runline("[opts] input.egg >output.egg"); 00037 } 00038 00039 redescribe_option 00040 ("cs", 00041 "Specify the coordinate system of the resulting egg file. This may be " 00042 "one of 'y-up', 'z-up', 'y-up-left', or 'z-up-left'. The default " 00043 "is the same coordinate system as the input egg file. If this is " 00044 "different from the input egg file, a conversion will be performed."); 00045 } 00046 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function: EggFilter::handle_args 00050 // Access: Protected, Virtual 00051 // Description: Does something with the additional arguments on the 00052 // command line (after all the -options have been 00053 // parsed). Returns true if the arguments are good, 00054 // false otherwise. 00055 //////////////////////////////////////////////////////////////////// 00056 bool EggFilter:: 00057 handle_args(ProgramBase::Args &args) { 00058 if (!check_last_arg(args, 1)) { 00059 return false; 00060 } 00061 00062 if (!_got_path_directory && _got_output_filename) { 00063 // Put in the name of the output directory. 00064 _path_replace->_path_directory = _output_filename.get_dirname(); 00065 } 00066 00067 return EggReader::handle_args(args); 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: EggFilter::post_command_line 00072 // Access: Protected, Virtual 00073 // Description: 00074 //////////////////////////////////////////////////////////////////// 00075 bool EggFilter:: 00076 post_command_line() { 00077 // writer first, so we can fiddle with the _path_replace options if 00078 // necessary. 00079 return EggWriter::post_command_line() && EggReader::post_command_line(); 00080 }