From 319c0fe460f1d3d0db4b928bea1d940cd64c046e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A4r=20Winzell?= Date: Sun, 14 Oct 2018 21:46:49 -0700 Subject: [PATCH] Wrap user properties in a command line option. --- src/FBX2glTF.cpp | 5 ++++- src/FBX2glTF.h | 3 +++ src/gltf/Raw2Gltf.cpp | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/FBX2glTF.cpp b/src/FBX2glTF.cpp index a01a48b..11dab2c 100644 --- a/src/FBX2glTF.cpp +++ b/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(gltfOptions.useKHRMatUnlit)) + ( + "user-properties", "Transcribe FBX User Properties into glTF node 'extras'.", + cxxopts::value(gltfOptions.enableUserProperties)) ( "blend-shape-normals", "Include blend shape normals, if reported present by the FBX SDK.", cxxopts::value(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; } diff --git a/src/FBX2glTF.h b/src/FBX2glTF.h index db79739..ecc9c7c 100644 --- a/src/FBX2glTF.h +++ b/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. */ diff --git a/src/gltf/Raw2Gltf.cpp b/src/gltf/Raw2Gltf.cpp index 467eb04..aa89c06 100644 --- a/src/gltf/Raw2Gltf.cpp +++ b/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);