Error when using a "linked" file more than once in the Blender to GLTF workflow

One of the reasons I went with GLTF files is that blender will export models “linked” in. This is fantastic, because I can build a library of props and parts, and when I update one prop, it’ll update in all of the other files where it is linked. All I need to do is re-export to GLTF.

However, I’ve found that I get an error if I link the same blender file more than once:

Uncaught (in promise) Error: /nodes/8: Invalid recursive node hierarchy
    at GLTFLoader.loadNodeAsync (glTF.js:3725)
    at ExtrasAsMetadata.loadNodeAsync (glTF.js:7288)
    at glTF.js:5149
    at GLTFLoader._applyExtensions (glTF.js:5126)
    at GLTFLoader._extensionsLoadNodeAsync (glTF.js:5149)
    at GLTFLoader.loadNodeAsync (glTF.js:3720)
    at loadNode (glTF.js:3742)
    at GLTFLoader._loadMeshAsync (glTF.js:3809)
    at GLTFLoader.loadNodeAsync (glTF.js:3758)
    at ExtrasAsMetadata.loadNodeAsync (glTF.js:7288)

I can get around this by “appending” the blend files instead of linking them, but then I have to delete and re-append every time I update one of these props. Not ideal.

Does anyone have any pointers to get around this error? Can I plug into the GLTF loader and make a copy everywhere there’s a link?

An example GLB file is attached:
example.zip (58.8 KB)

What is your setup in Blender?

'cause I can’t reproduce the issue, here my tiny test file:

  • in master.blend (left on my screen), i’ve linked “suzanne” object from suzanne.blend (top right in my screen) (and also add a library override to move its position)
  • suzanne was then duplicate instanced
  • when I export to glb (default settings), I haven’t any errors in the BJS sandbox (while I have the Invalid recursive node hierarchy with your glb example file)

Hm, maybe I’m linking them wrong? I’m linking the collection, and here’s the settings I’m using

image

I’ve also tried linking the meshs instead of the collection, which I believe is what I see in your screenshot, but that didn’t help either.

I’m on blender 2.91.2.

What is yout gltf export settings? In my tiny scene I’m able to export with collection linked in place of objects.

Compression seems to be a hit or miss sometimes. So that is on or off depending on if it’s going to crash blender or not.

My assumption was that the linking was what was creating the recursion, but maybe I’m looking in the wrong place. I’ll start over with a minimal setup, see if I can track down what’s causing the issue.

Thanks for your help in proving it should be possible.

Yes maybe try to isolate a potential issue in the exporter, here the default settings:

(from your .glb example I just see we can’t import gltf file in Blender when Draco compression is used, hope this will be fixed soon [edit] just find a workaround about that)

Yeah I still get the issue with the default export settings.

Is it possible to share your .blend files to take a look?

Certainly. I appreciate you taking the time to troubleshoot this with me.

example.zip (221.7 KB)

OK it seems that unparenting your light meshes do the trick
image

We have also this errors when using another gltf viewer than BJS sandbox (here I tried this one).

I’m not sure if it’s an issue to adress on Blender exporter, probably yes.

Yeah, un-parenting fixed it. Weird.