Browse Source

Wrap user properties in a command line option.

Pär Winzell 7 năm trước cách đây
mục cha
commit
319c0fe460
3 tập tin đã thay đổi với 10 bổ sung2 xóa
  1. 4 1
      src/FBX2glTF.cpp
  2. 3 0
      src/FBX2glTF.h
  3. 3 1
      src/gltf/Raw2Gltf.cpp

+ 4 - 1
src/FBX2glTF.cpp

@@ -94,6 +94,9 @@ int main(int argc, char *argv[])
                (
                    "khr-materials-unlit", "Use KHR_materials_unlit extension to specify Unlit shader.",
                    cxxopts::value<bool>(gltfOptions.useKHRMatUnlit))
+               (
+                   "user-properties", "Transcribe FBX User Properties into glTF node 'extras'.",
+                   cxxopts::value<bool>(gltfOptions.enableUserProperties))
                (
                    "blend-shape-normals", "Include blend shape normals, if reported present by the FBX SDK.",
                    cxxopts::value<bool>(gltfOptions.useBlendShapeNormals))
@@ -117,7 +120,7 @@ int main(int argc, char *argv[])
     }
 
     if (options.count("version")) {
-        fmt::printf("FBX2glTF version %s\nCopyright (c) 2016-2017 Oculus VR, LLC.\n", FBX2GLTF_VERSION);
+        fmt::printf("FBX2glTF version %s\nCopyright (c) 2016-2018 Oculus VR, LLC.\n", FBX2GLTF_VERSION);
         return 0;
     }
 

+ 3 - 0
src/FBX2glTF.h

@@ -84,6 +84,9 @@ struct GltfOptions
         int quantBitsGeneric = -1;
     } draco;
 
+    /** Whether to include FBX User Properties as 'extras' metadata in glTF nodes. */
+    bool enableUserProperties { false };
+
     /** Whether to use KHR_materials_unlit to extend materials definitions. */
     bool useKHRMatUnlit { false };
     /** Whether to populate the pbrMetallicRoughness substruct in materials. */

+ 3 - 1
src/gltf/Raw2Gltf.cpp

@@ -142,7 +142,9 @@ ModelData *Raw2Gltf(
             auto nodeData = gltf->nodes.hold(
                 new NodeData(node.name, node.translation, node.rotation, node.scale, node.isJoint));
 
-            nodeData->userProperties = node.userProperties;
+            if (options.enableUserProperties) {
+                nodeData->userProperties = node.userProperties;
+            }
 
             for (const auto &childId : node.childIds) {
                 int childIx = raw.GetNodeById(childId);