Преглед на файлове

Merge pull request #1116 from yushli/master

add save as JSON option
Lasse Öörni преди 10 години
родител
ревизия
65c6529f7f
променени са 1 файла, в които са добавени 14 реда и са изтрити 6 реда
  1. 14 6
      Source/Tools/AssetImporter/AssetImporter.cpp

+ 14 - 6
Source/Tools/AssetImporter/AssetImporter.cpp

@@ -98,6 +98,7 @@ String outPath_;
 bool useSubdirs_ = true;
 bool localIDs_ = false;
 bool saveBinary_ = false;
+bool saveJson_ = false;
 bool createZone_ = true;
 bool noAnimations_ = false;
 bool noHierarchy_ = false;
@@ -214,6 +215,7 @@ void Run(const Vector<String>& arguments)
             "\n"
             "Options:\n"
             "-b          Save scene in binary format, default format is XML\n"
+            "-j          Save scene in JSON format, default format is XML\n"
             "-h          Generate hard instead of smooth normals if input file has no normals\n"
             "-i          Use local ID's for scene nodes\n"
             "-l          Output a material list file for models\n"
@@ -281,6 +283,8 @@ void Run(const Vector<String>& arguments)
 
             if (argument == "b")
                 saveBinary_ = true;
+            else if(argument == "j")
+                saveJson_ = true;
             else if (argument == "h")
             {
                 flags &= ~aiProcess_GenSmoothNormals;
@@ -1525,17 +1529,21 @@ void BuildAndSaveScene(OutScene& scene, bool asPrefab)
         ErrorExit("Could not open output file " + scene.outName_);
     if (!asPrefab)
     {
-        if (!saveBinary_)
-            outScene->SaveXML(file);
-        else
+        if (saveBinary_)
             outScene->Save(file);
+        else if(saveJson_)
+            outScene->SaveJSON(file);
+        else
+            outScene->SaveXML(file);
     }
     else
     {
-        if (!saveBinary_)
-            outRootNode->SaveXML(file);
-        else
+        if (saveBinary_)
             outRootNode->Save(file);
+        else if(saveJson_)
+            outRootNode->SaveJSON(file);
+        else
+            outRootNode->SaveXML(file);
     }
 }