mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
modified replace_prefix to vector
This commit is contained in:
parent
15ca886f50
commit
0faf866c57
@ -42,8 +42,7 @@
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
MayaCopy::
|
MayaCopy::
|
||||||
MayaCopy() {
|
MayaCopy() {
|
||||||
_replace_prefix = "none";
|
_curr_idx = 0;
|
||||||
|
|
||||||
set_program_description
|
set_program_description
|
||||||
("mayacopy copies one or more Maya .mb files into a "
|
("mayacopy copies one or more Maya .mb files into a "
|
||||||
"CVS source hierarchy. "
|
"CVS source hierarchy. "
|
||||||
@ -66,9 +65,9 @@ MayaCopy() {
|
|||||||
|
|
||||||
add_option
|
add_option
|
||||||
("rp", "replace_prefix", 80,
|
("rp", "replace_prefix", 80,
|
||||||
"use this prefix when replacing reference with the recently copied file from the "
|
"use these prefixes when replacing reference with the recently copied file from the "
|
||||||
"source filename before it is copied into the tree.",
|
"source filename before it is copied into the tree.",
|
||||||
&CVSCopy::dispatch_string, NULL, &_replace_prefix);
|
&CVSCopy::dispatch_vector_string, NULL, &_replace_prefix);
|
||||||
|
|
||||||
add_path_replace_options();
|
add_path_replace_options();
|
||||||
}
|
}
|
||||||
@ -191,12 +190,13 @@ copy_maya_file(const Filename &source, const Filename &dest,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (num_refs != 0) {
|
if (num_refs != 0) {
|
||||||
if (_replace_prefix.find("none") != string::npos) {
|
if (_replace_prefix.empty()) {
|
||||||
// try to put the first word of the file name as the replace prefix
|
// try to put the first word of the file name as the replace prefix
|
||||||
size_t idx = source.get_basename().find("_",0);
|
size_t idx = source.get_basename().find("_",0);
|
||||||
if (idx != string::npos) {
|
if (idx != string::npos) {
|
||||||
string st = source.get_basename().substr(0, idx);
|
string st = source.get_basename().substr(0, idx);
|
||||||
_replace_prefix = st;
|
_replace_prefix.push_back(st);
|
||||||
|
maya_cat.info() << "replace_prefix = " << st << endl;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
maya_cat.error()
|
maya_cat.error()
|
||||||
@ -206,8 +206,8 @@ copy_maya_file(const Filename &source, const Filename &dest,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int ref_index;
|
unsigned int ref_index;
|
||||||
|
maya_cat.info() << "num_refs = " << num_refs << endl;
|
||||||
for (ref_index = 0; ref_index < num_refs; ref_index++) {
|
for (ref_index = 0; ref_index < num_refs; ref_index++) {
|
||||||
// one thing we need to do is rename the path to the base file
|
// one thing we need to do is rename the path to the base file
|
||||||
// that it is referencing to. This will guarantee that the
|
// that it is referencing to. This will guarantee that the
|
||||||
@ -217,16 +217,17 @@ copy_maya_file(const Filename &source, const Filename &dest,
|
|||||||
// removeReference and reference didn't work for the animations
|
// removeReference and reference didn't work for the animations
|
||||||
// file -loadReference "mtpRN" -type "mayaBinary" -options "v=0"
|
// file -loadReference "mtpRN" -type "mayaBinary" -options "v=0"
|
||||||
// "m_t_pear_zero.mb";
|
// "m_t_pear_zero.mb";
|
||||||
|
string lookup = refs[ref_index].asChar();
|
||||||
Filename filename =
|
Filename filename =
|
||||||
_path_replace->convert_path(Filename::from_os_specific(refs[ref_index].asChar()));
|
_path_replace->convert_path(Filename::from_os_specific(refs[ref_index].asChar()));
|
||||||
|
|
||||||
CVSSourceTree::FilePath path =
|
CVSSourceTree::FilePath path =
|
||||||
_tree.choose_directory(filename.get_basename(), dir, _force, _interactive);
|
_tree.choose_directory(filename.get_basename(), dir, _force, _interactive);
|
||||||
Filename new_filename = path.get_rel_from(dir);
|
Filename new_filename = path.get_rel_from(dir);
|
||||||
string execString = "file -loadReference \"" + _replace_prefix + "RN\" -type \"mayaBinary\" -options \"v=0\" \"" + new_filename.to_os_generic() + "\";";
|
string execString = "file -loadReference \"" + _replace_prefix[_curr_idx++] + "RN\" -type \"mayaBinary\" -options \"v=0\" \"" + new_filename.to_os_generic() + "\";";
|
||||||
maya_cat.info() << "executing command: " << execString << "\n";
|
maya_cat.info() << "executing command: " << execString << "\n";
|
||||||
//MGlobal::executeCommand("file -loadReference \"mtpRN\" -type \"mayaBinary\" -options \"v=0\" \"m_t_pear_zero.mb\";");
|
//MGlobal::executeCommand("file -loadReference \"mtpRN\" -type \"mayaBinary\" -options \"v=0\" \"m_t_pear_zero.mb\";");
|
||||||
MGlobal::executeCommand(MString(execString.c_str()));
|
status = MGlobal::executeCommand(MString(execString.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all the shaders so we can determine the set of textures.
|
// Get all the shaders so we can determine the set of textures.
|
||||||
|
@ -72,7 +72,8 @@ private:
|
|||||||
bool collect_shader_for_node(const MDagPath &dag_path);
|
bool collect_shader_for_node(const MDagPath &dag_path);
|
||||||
|
|
||||||
bool _keep_ver;
|
bool _keep_ver;
|
||||||
string _replace_prefix;
|
int _curr_idx;
|
||||||
|
vector_string _replace_prefix;
|
||||||
|
|
||||||
PT(MayaApi) _maya;
|
PT(MayaApi) _maya;
|
||||||
MayaShaders _shaders;
|
MayaShaders _shaders;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user