Panda3D
eggRename.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file eggRename.cxx
10  * @author masad
11  * @date 2005-04-22
12  */
13 
14 #include "eggRename.h"
15 
16 /**
17  *
18  */
19 EggRename::
20 EggRename() {
21  set_program_brief("rename nodes in .egg files");
22  set_program_description
23  ("egg-rename reads one or more egg files and writes back with modified"
24  "node names. ie. suppressing prefix from all the nodes' names. ");
25 
26  add_option
27  ("strip_prefix", "name", 0,
28  "strips out the prefix that is put on all nodes, by maya ext. ref",
29  &EggRename::dispatch_vector_string, nullptr, &_strip_prefix);
30 }
31 
32 /**
33  *
34  */
35 void EggRename::
36 run() {
37  if (!_strip_prefix.empty()) {
38  nout << "Stripping prefix from nodes.\n";
39  int num_renamed = 0;
40  int num_egg_files = 0;
41  Eggs::iterator ei;
42  for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
43  num_renamed += (*ei)->rename_nodes(_strip_prefix, true);
44  ++num_egg_files;
45  }
46  nout << " (" << num_renamed << " renamed.)\n";
47  }
48 
49  write_eggs();
50 }
51 
52 
53 int main(int argc, char *argv[]) {
54  EggRename prog;
55  prog.parse_command_line(argc, argv);
56  prog.run();
57  return 0;
58 }
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_...
A program to read an egg file and write an equivalent egg file, with stripping prefix for now,...
Definition: eggRename.h:25
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.