From 65f4fac99304217eee4adabbf3df063b88194f89 Mon Sep 17 00:00:00 2001
From: raveenajain <jain.rav@husky.neu.edu>
Date: Fri, 19 Apr 2019 21:40:57 +0100
Subject: [PATCH 1/2] move debug code

---
 libraries/fbx/src/GLTFSerializer.cpp | 40 ++++++++++++++++++++++++----
 libraries/fbx/src/GLTFSerializer.h   |  1 +
 2 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/libraries/fbx/src/GLTFSerializer.cpp b/libraries/fbx/src/GLTFSerializer.cpp
index a4d18fb111..fe8bd3167f 100755
--- a/libraries/fbx/src/GLTFSerializer.cpp
+++ b/libraries/fbx/src/GLTFSerializer.cpp
@@ -909,7 +909,6 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::URL& url) {
         auto& node = _file.nodes[nodeIndex];
 
         if (node.defined["mesh"]) {
-            qCDebug(modelformat) << "node_transforms" << node.transforms;
             foreach(auto &primitive, _file.meshes[node.mesh].primitives) {
                 hfmModel.meshes.append(HFMMesh());
                 HFMMesh& mesh = hfmModel.meshes[hfmModel.meshes.size() - 1];
@@ -1276,7 +1275,6 @@ HFMTexture GLTFSerializer::getHFMTexture(const GLTFTexture& texture) {
 
         QString fname = hifi::URL(url).fileName();
         hifi::URL textureUrl = _url.resolved(url);
-        qCDebug(modelformat) << "fname: " << fname;
         fbxtex.name = fname;
         fbxtex.filename = textureUrl.toEncoded();
         
@@ -1371,10 +1369,7 @@ bool GLTFSerializer::readArray(const hifi::ByteArray& bin, int byteOffset, int c
     blobstream.setVersion(QDataStream::Qt_5_9);
     blobstream.setFloatingPointPrecision(QDataStream::FloatingPointPrecision::SinglePrecision);
 
-    qCDebug(modelformat) << "size1: " << count;
     int dataskipped = blobstream.skipRawData(byteOffset);
-    qCDebug(modelformat) << "dataskipped: " << dataskipped;
-
     int bufferCount = 0;
     switch (accessorType) {
     case GLTFAccessorType::SCALAR:
@@ -1467,6 +1462,38 @@ void GLTFSerializer::retriangulate(const QVector<int>& inIndices, const QVector<
     }
 }
 
+void GLTFSerializer::glTFDebugDump() {
+    qCDebug(modelformat) << "---------------- Nodes ----------------";
+    for (GLTFNode node : _file.nodes) {
+        if (node.defined["mesh"]) {
+            qCDebug(modelformat) << "\n";
+            qCDebug(modelformat) << "    node_transforms" << node.transforms;
+            qCDebug(modelformat) << "\n";
+        }
+    }
+
+    qCDebug(modelformat) << "---------------- Accessors ----------------";
+    for (GLTFAccessor accessor : _file.accessors) {
+        qCDebug(modelformat) << "\n";
+        qCDebug(modelformat) << "count: " << accessor.count;
+        qCDebug(modelformat) << "byteOffset: " << accessor.byteOffset;
+        qCDebug(modelformat) << "\n";
+    }
+
+    qCDebug(modelformat) << "---------------- Textures ----------------";
+    for (GLTFTexture texture : _file.textures) {
+        if (texture.defined["source"]) {
+            qCDebug(modelformat) << "\n";
+            QString url = _file.images[texture.source].uri;
+            QString fname = hifi::URL(url).fileName();
+            qCDebug(modelformat) << "fname: " << fname;
+            qCDebug(modelformat) << "\n";
+        }
+    }
+
+    qCDebug(modelformat) << "\n";
+}
+
 void GLTFSerializer::hfmDebugDump(const HFMModel& hfmModel) {
     qCDebug(modelformat) << "---------------- hfmModel ----------------";
     qCDebug(modelformat) << "  hasSkeletonJoints =" << hfmModel.hasSkeletonJoints;
@@ -1607,5 +1634,8 @@ void GLTFSerializer::hfmDebugDump(const HFMModel& hfmModel) {
         qCDebug(modelformat) << "\n";
     }
 
+    qCDebug(modelformat) << "---------------- GLTF Model ----------------";
+    glTFDebugDump();
+
     qCDebug(modelformat) << "\n";
 }
diff --git a/libraries/fbx/src/GLTFSerializer.h b/libraries/fbx/src/GLTFSerializer.h
index a9e7152e5b..8784667d1e 100755
--- a/libraries/fbx/src/GLTFSerializer.h
+++ b/libraries/fbx/src/GLTFSerializer.h
@@ -784,6 +784,7 @@ private:
 
     void setHFMMaterial(HFMMaterial& fbxmat, const GLTFMaterial& material);
     HFMTexture getHFMTexture(const GLTFTexture& texture);
+    void glTFDebugDump();
     void hfmDebugDump(const HFMModel& hfmModel);
 };
 

From f2312f77c1936d8d89768178f7972e900a3b8f04 Mon Sep 17 00:00:00 2001
From: raveenajain <jain.rav@husky.neu.edu>
Date: Fri, 19 Apr 2019 22:47:47 +0100
Subject: [PATCH 2/2] remove unused var

---
 libraries/fbx/src/GLTFSerializer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libraries/fbx/src/GLTFSerializer.cpp b/libraries/fbx/src/GLTFSerializer.cpp
index fe8bd3167f..0264accdc3 100755
--- a/libraries/fbx/src/GLTFSerializer.cpp
+++ b/libraries/fbx/src/GLTFSerializer.cpp
@@ -1368,8 +1368,8 @@ bool GLTFSerializer::readArray(const hifi::ByteArray& bin, int byteOffset, int c
     blobstream.setByteOrder(QDataStream::LittleEndian);
     blobstream.setVersion(QDataStream::Qt_5_9);
     blobstream.setFloatingPointPrecision(QDataStream::FloatingPointPrecision::SinglePrecision);
+    blobstream.skipRawData(byteOffset);
 
-    int dataskipped = blobstream.skipRawData(byteOffset);
     int bufferCount = 0;
     switch (accessorType) {
     case GLTFAccessorType::SCALAR: