How do I approach transferring material and it's dependencies from one glb doc to another #597
-
Hey All, I have been working on a tool that takes a list of glbs and merges all their materials as variants in the first glb provided in that list. I am stuck at trying to figure out how to copy material and it's resources from one glb to another because I keep encountering "Error: Cannot connect disconnected graphs.". Which is obvious because I don't think copying across documents would be possible since gltf heavily relies on indices for mappings internally and simply copying the material won't work. One possible way is to just merge all these documents into one and them perform the required operations on them but how do I access the merged doc vs the main doc? I was hoping to get my process validated from experienced devs in the community before moving forward. I am very new to the gltf realm and specially gltf-transform. Any help is appreciated. Thank you in Advance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
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:
A simple, non-destructive way of tagging the materials would be: for (const material in document.getRoot().listMaterials()) {
material.setExtras({variantName: 'some-name'});
} |
Beta Was this translation helpful? Give feedback.
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:
A simple, non-destructive way of tagging the materials would be: