Can't merge document using dataset #629
-
I've looked at that SO thread and doing something pretty similar:
However it seems to overwrite the data in gltf so I'm just seeing the 3rd document. Trying to open each gltf independently in the viewer works just fine. Is this a problem specific to my dataset (see the 3 models attached below in input.zip and result.zip)? Thanks in advance for any insights. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The code above creates a glTF file containing three scenes — one for each input file. That's completely valid, but unusual, and viewers will just show one scene by default (perhaps with an option to change scenes somewhere). If you would like to merge them into a single scene viewers will show all at once, you'll need to add a bit more code from the SO answer: const root = merged.getRoot();
const mainScene = root.listScenes()[0];
for (const scene of root.listScenes()) {
if (scene === mainScene) continue;
for (const child of scene.listChildren()) {
mainScene.addChild(child);
}
scene.dispose();
} |
Beta Was this translation helpful? Give feedback.
The code above creates a glTF file containing three scenes — one for each input file. That's completely valid, but unusual, and viewers will just show one scene by default (perhaps with an option to change scenes somewhere). If you would like to merge them into a single scene viewers will show all at once, you'll need to add a bit more code from the SO answer: