Panda3D
 All Classes Functions Variables Enumerations
eggFilter.cxx
1 // Filename: eggFilter.cxx
2 // Created by: drose (14Feb00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "eggFilter.h"
16 
17 ////////////////////////////////////////////////////////////////////
18 // Function: EggFilter::Constructor
19 // Access: Public
20 // Description:
21 ////////////////////////////////////////////////////////////////////
22 EggFilter::
23 EggFilter(bool allow_last_param, bool allow_stdout) :
24  EggWriter(allow_last_param, allow_stdout)
25 {
26  // The default path store for programs that read egg files and write
27  // them again is PS_relative.
28  _path_replace->_path_store = PS_relative;
29 
30  clear_runlines();
31  if (allow_last_param) {
32  add_runline("[opts] input.egg output.egg");
33  }
34  add_runline("[opts] -o output.egg input.egg");
35  if (allow_stdout) {
36  add_runline("[opts] input.egg >output.egg");
37  }
38 
39  redescribe_option
40  ("cs",
41  "Specify the coordinate system of the resulting egg file. This may be "
42  "one of 'y-up', 'z-up', 'y-up-left', or 'z-up-left'. The default "
43  "is the same coordinate system as the input egg file. If this is "
44  "different from the input egg file, a conversion will be performed.");
45 }
46 
47 
48 ////////////////////////////////////////////////////////////////////
49 // Function: EggFilter::handle_args
50 // Access: Protected, Virtual
51 // Description: Does something with the additional arguments on the
52 // command line (after all the -options have been
53 // parsed). Returns true if the arguments are good,
54 // false otherwise.
55 ////////////////////////////////////////////////////////////////////
56 bool EggFilter::
57 handle_args(ProgramBase::Args &args) {
58  if (!check_last_arg(args, 1)) {
59  return false;
60  }
61 
62  if (!_got_path_directory && _got_output_filename) {
63  // Put in the name of the output directory.
64  _path_replace->_path_directory = _output_filename.get_dirname();
65  }
66 
67  return EggReader::handle_args(args);
68 }
69 
70 ////////////////////////////////////////////////////////////////////
71 // Function: EggFilter::post_command_line
72 // Access: Protected, Virtual
73 // Description:
74 ////////////////////////////////////////////////////////////////////
75 bool EggFilter::
76 post_command_line() {
77  // writer first, so we can fiddle with the _path_replace options if
78  // necessary.
79  return EggWriter::post_command_line() && EggReader::post_command_line();
80 }
This is the base class for a program that generates an egg file output, but doesn't read any for inpu...
Definition: eggWriter.h:30