Skip to content

Can't merge document using dataset #629

Answered by donmccurdy
leefsmp asked this question in Q&A
Discussion options

You must be logged in to vote

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();
}

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@leefsmp
Comment options

@donmccurdy
Comment options

Answer selected by leefsmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants