Wrap user properties in a command line option.

This commit is contained in:
Pär Winzell 2018-10-14 21:46:49 -07:00
parent bbbba646de
commit 319c0fe460
3 changed files with 10 additions and 2 deletions

View File

@ -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;
}

View File

@ -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. */

View File

@ -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);