mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
added eggRename tool
This commit is contained in:
parent
212fbc6c6b
commit
7cb711d9bc
@ -253,7 +253,7 @@ run() {
|
||||
// Also quantize the animation channels, if the user so requested.
|
||||
quantize_channels();
|
||||
|
||||
// Finally, flag all the groups as the user requested.
|
||||
// flag all the groups as the user requested.
|
||||
if (!_flag_groups.empty()) {
|
||||
Eggs::iterator ei;
|
||||
for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
|
||||
@ -1346,7 +1346,6 @@ rename_primitives(EggGroupNode *egg_group, const string &name) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
EggOptchar prog;
|
||||
prog.parse_command_line(argc, argv);
|
||||
|
@ -7,6 +7,14 @@
|
||||
dtoolutil:c dtoolbase:c prc:c dconfig:c dtoolconfig:m dtool:m pystub
|
||||
#define UNIX_SYS_LIBS m
|
||||
|
||||
#begin bin_target
|
||||
#define TARGET egg-rename
|
||||
|
||||
#define SOURCES \
|
||||
eggRename.cxx eggRename.h
|
||||
|
||||
#end bin_target
|
||||
|
||||
#begin bin_target
|
||||
#define TARGET egg-trans
|
||||
|
||||
|
66
pandatool/src/eggprogs/eggRename.cxx
Executable file
66
pandatool/src/eggprogs/eggRename.cxx
Executable file
@ -0,0 +1,66 @@
|
||||
// Filename: eggRename.cxx
|
||||
// Created by: masad (22Apr05)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "eggRename.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggRename::Constructor
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
EggRename::
|
||||
EggRename() {
|
||||
set_program_description
|
||||
("egg-rename reads one or more egg files and writes back with modified"
|
||||
"node names. ie. suppressing prefix from all the nodes' names. ");
|
||||
|
||||
add_option
|
||||
("strip_prefix", "name", 0,
|
||||
"strips out the prefix that is put on all nodes, by maya ext. ref",
|
||||
&EggRename::dispatch_vector_string, NULL, &_strip_prefix);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: EggRename::run
|
||||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void EggRename::
|
||||
run() {
|
||||
if (!_strip_prefix.empty()) {
|
||||
nout << "Stripping prefix from nodes.\n";
|
||||
int num_renamed = 0;
|
||||
int num_egg_files = 0;
|
||||
Eggs::iterator ei;
|
||||
for (ei = _eggs.begin(); ei != _eggs.end(); ++ei) {
|
||||
num_renamed += (*ei)->rename_nodes(_strip_prefix, true);
|
||||
++num_egg_files;
|
||||
}
|
||||
nout << " (" << num_renamed << " renamed.)\n";
|
||||
}
|
||||
|
||||
write_eggs();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
EggRename prog;
|
||||
prog.parse_command_line(argc, argv);
|
||||
prog.run();
|
||||
return 0;
|
||||
}
|
42
pandatool/src/eggprogs/eggRename.h
Executable file
42
pandatool/src/eggprogs/eggRename.h
Executable file
@ -0,0 +1,42 @@
|
||||
// Filename: eggRename.h
|
||||
// Created by: masad (22Apr05)
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PANDA 3D SOFTWARE
|
||||
// Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
|
||||
//
|
||||
// All use of this software is subject to the terms of the Panda 3d
|
||||
// Software license. You should have received a copy of this license
|
||||
// along with this source code; you will also find a current copy of
|
||||
// the license at http://etc.cmu.edu/panda3d/docs/license/ .
|
||||
//
|
||||
// To contact the maintainers of this program write to
|
||||
// panda3d-general@lists.sourceforge.net .
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef EGGRENAME_H
|
||||
#define EGGRENAME_H
|
||||
|
||||
#include "pandatoolbase.h"
|
||||
|
||||
#include "eggMultiFilter.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : EggTrans
|
||||
// Description : A program to read an egg file and write an equivalent
|
||||
// egg file, with stripping prefix for now, but more
|
||||
// along the way.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
class EggRename : public EggMultiFilter {
|
||||
public:
|
||||
EggRename();
|
||||
|
||||
void run();
|
||||
|
||||
vector_string _strip_prefix;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user