maya2egg, mayacopy

This commit is contained in:
David Rose 2003-02-05 00:21:53 +00:00
parent 3dfa9c5a58
commit 2f7a5c0e81
5 changed files with 66 additions and 3 deletions

View File

@ -127,7 +127,7 @@ import(const Filename &source, void *extra_data,
return (CVSSourceDirectory *)NULL;
}
string basename = source.get_basename();
string basename = filter_filename(source.get_basename());
CVSSourceDirectory *dir =
_tree.choose_directory(basename, suggested_dir, _force, _interactive);
@ -404,6 +404,20 @@ protect_from_shell(const string &source) {
return result;
}
////////////////////////////////////////////////////////////////////
// Function: CVSCopy::filter_filename
// Access: Protected, Virtual
// Description: Given a source filename (including the basename only,
// without a dirname), return the appropriate
// corresponding filename within the source directory.
// This may be used by derived classes to, for instance,
// strip a version number from the filename.
////////////////////////////////////////////////////////////////////
string CVSCopy::
filter_filename(const string &source) {
return source;
}
////////////////////////////////////////////////////////////////////
// Function: CVSCopy::scan_hierarchy
// Access: Private

View File

@ -58,6 +58,8 @@ protected:
bool cvs_add(const Filename &filename);
static string protect_from_shell(const string &source);
virtual string filter_filename(const string &source);
private:
bool scan_hierarchy();
bool scan_for_root(const string &dirname);

View File

@ -1148,8 +1148,9 @@ make_polyset(const MDagPath &dag_path, const MFnMesh &mesh,
MStatus status;
string name = mesh.name().asChar();
MObject mesh_object = mesh.object();
bool double_sided = false;
get_bool_attribute(mesh.object(), "doubleSided", double_sided);
get_bool_attribute(mesh_object, "doubleSided", double_sided);
if (mayaegg_cat.is_spam()) {
mayaegg_cat.spam()
@ -1465,8 +1466,18 @@ r_get_egg_group(const string &name, const MDagPath &dag_path,
}
// Check for an object type setting, from Oliver's plug-in.
MObject dag_object = dag_path.node();
string object_type;
if (get_enum_attribute(dag_path.node(), "eggObjectTypes", object_type)) {
if (get_enum_attribute(dag_object, "eggObjectTypes", object_type)) {
egg_group->add_object_type(object_type);
}
if (get_enum_attribute(dag_object, "eggObjectTypes1", object_type)) {
egg_group->add_object_type(object_type);
}
if (get_enum_attribute(dag_object, "eggObjectTypes2", object_type)) {
egg_group->add_object_type(object_type);
}
if (get_enum_attribute(dag_object, "eggObjectTypes3", object_type)) {
egg_group->add_object_type(object_type);
}
}

View File

@ -54,6 +54,12 @@ MayaCopy() {
clear_runlines();
add_runline("[opts] file.mb [file.mb ... ]");
add_option
("keepver", "", 0,
"Don't attempt to strip the Maya version number from the tail of the "
"source filename before it is copied into the tree.",
&CVSCopy::dispatch_none, &_keep_ver);
}
////////////////////////////////////////////////////////////////////
@ -105,6 +111,32 @@ copy_file(const Filename &source, const Filename &dest,
return false;
}
////////////////////////////////////////////////////////////////////
// Function: MayaCopy::filter_filename
// Access: Protected, Virtual
// Description: Given a source filename (including the basename only,
// without a dirname), return the appropriate
// corresponding filename within the source directory.
// This may be used by derived classes to, for instance,
// strip a version number from the filename.
////////////////////////////////////////////////////////////////////
string MayaCopy::
filter_filename(const string &source) {
if (_keep_ver) {
return source;
}
size_t dot = source.rfind('.');
size_t underscore = source.rfind("_v", dot);
if (underscore == string::npos) {
// No version number appears to be present.
return source;
}
return source.substr(0, underscore) + source.substr(dot);
}
////////////////////////////////////////////////////////////////////
// Function: MayaCopy::copy_maya_file
// Access: Private

View File

@ -47,6 +47,8 @@ protected:
CVSSourceDirectory *dir, void *extra_data,
bool new_file);
virtual string filter_filename(const string &source);
private:
enum FileType {
FT_maya,
@ -67,6 +69,8 @@ private:
bool collect_shaders();
bool collect_shader_for_node(const MDagPath &dag_path);
bool _keep_ver;
PT(MayaApi) _maya;
MayaShaders _shaders;
};