Skip to content

How do I approach transferring material and it's dependencies from one glb doc to another #597

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

You must be logged in to vote

UPDATE, APRIL 2024

A more complete solution is proposed in #1375.


PREVIOUS ANSWER

I'd expect it will probably be easiest to approach like this:

  1. load each glb to a separate document
  2. for each 'variant' document, annotate the materials (by name, extras, etc.) to identify the document
  3. merge all documents
  4. iterate over materials in the merged document and assign variants as needed

A simple, non-destructive way of tagging the materials would be:

for (const material in document.getRoot().listMaterials()) {
  material.setExtras({variantName: 'some-name'});
}

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@tanaydimri
Comment options

@donmccurdy
Comment options

@donmccurdy
Comment options

Answer selected by donmccurdy
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