From acdce2ca8ad56b035c07d4000db813a4938f0a4d Mon Sep 17 00:00:00 2001 From: Fabrice Robinet Date: Wed, 23 Oct 2013 23:15:49 -0700 Subject: [PATCH] https://github.com/KhronosGroup/glTF/issues/13 --- converter/COLLADA2GLTF/COLLADA2GLTFWriter.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/converter/COLLADA2GLTF/COLLADA2GLTFWriter.cpp b/converter/COLLADA2GLTF/COLLADA2GLTFWriter.cpp index 1e214e5d74..584318ed32 100644 --- a/converter/COLLADA2GLTF/COLLADA2GLTFWriter.cpp +++ b/converter/COLLADA2GLTF/COLLADA2GLTFWriter.cpp @@ -1057,7 +1057,20 @@ namespace GLTF lightsInNode->appendValue(shared_ptr (new JSONString(lightUID))); lights->setValue(lightUID, light); } - nodeObject->setValue("lights", lightsInNode); + //We just want a single light per node + //https://github.com/KhronosGroup/glTF/issues/13 + //nodeObject->setValue("lights", lightsInNode); + nodeObject->setValue("light", lightsInNode->values()[0]); + if (count > 1) { + //FR: AFAIK no authoring tool export multiple light per node, but we'll warn if that's the case + //To fix this, dummy sub nodes should be created. + static bool printedOnce = false; + if (printedOnce) { + printf("WARNING: some unhandled lights because some nodes carry more than a single light\n"); + printedOnce = false; + } + + } } return true;