瀏覽代碼

support -ma

David Rose 19 年之前
父節點
當前提交
545cb6d164
共有 2 個文件被更改,包括 15 次插入4 次删除
  1. 14 4
      pandatool/src/mayaprogs/mayaCopy.cxx
  2. 1 0
      pandatool/src/mayaprogs/mayaCopy.h

+ 14 - 4
pandatool/src/mayaprogs/mayaCopy.cxx

@@ -77,6 +77,11 @@ MayaCopy() {
      "This option omits the textures and references of the models to be re-mayacopied",
      &CVSCopy::dispatch_none, &_omit_tex);
 
+  add_option
+    ("ma", "", 0,
+     "Write a .ma file instead of a .mb file (regardless of input type)",
+     &CVSCopy::dispatch_none, &_maya_ascii);
+
   add_path_replace_options();
 }
 
@@ -155,10 +160,15 @@ filter_filename(const string &source) {
     underscore = string::npos;
 
   string extension = source.substr(dot);
-  if (extension == ".ma") {
-    // By convention, we always write out Maya binary files (even if
-    // we receive a Maya ascii file for input).
-    extension = ".mb";
+  if (extension == ".ma" || extension == ".mb") {
+    // If we are reading a Maya file (as opposed to a texture image),
+    // then we always write ".mb" files out (unless -ma was specified
+    // on the command line).
+    if (_maya_ascii) {
+      extension = ".ma";
+    } else {
+      extension = ".mb";
+    }
   }
 
   if (underscore == string::npos) {

+ 1 - 0
pandatool/src/mayaprogs/mayaCopy.h

@@ -74,6 +74,7 @@ private:
   bool _keep_ver;
   bool _omit_tex;
   int _curr_idx;
+  bool _maya_ascii;
   /*
   vector_string _replace_prefix;
   */