Converting circular structure to JSON

hi all,
Today I received this error and I can’t find any related topics on Google. I have a scene with 5 animated characters, when click “export to Babylon scene” I receive this error in the console.

Uncaught TypeError: Converting circular structure to JSON
→ starting at object with constructor ‘t’
| property ‘animations’ → object with constructor ‘Array’
| index 0 → object with constructor ‘e’
| …
| index 0 → object with constructor ‘e’
— property ‘_currentActiveTarget’ closes the circle
at JSON.stringify ()
at tp.exportBabylon (toolsTabComponent.tsx:293:31)
at Object.onClick (toolsTabComponent.tsx:437:88)
at onClick (buttonLineComponent.tsx:19:51)
at Object.We (react-dom.production.min.js:52:317)
at Qe (react-dom.production.min.js:52:471)
at react-dom.production.min.js:53:35
at Mr (react-dom.production.min.js:100:68)
at Nr (react-dom.production.min.js:101:380)
at react-dom.production.min.js:113:65

Any ideas, suggestions, how to solve it? Please let me know if you need more details.
Thanks

Hey there, welcome to the forum. :slight_smile: I was able to reproduce this error using this simple playground from the built-in examples, e.g. using the Inspector to export to Babylon or GLB.

CC @bghgary, it seems to stem from this recent PR adding the skinnedMesh metadata: deleting that reference fixes the error below (on line 51).

2 Likes

Ugh, I was afraid of issues like this. I will investigate.

I decided to change the reference into a callback like I was thinking to do originally. It has the least likely chance of breaking something. Clients will have to create their own map. (cc @MackeyK24)

PR: Change glTF skinned mesh reference to a callback by bghgary · Pull Request #12565 · BabylonJS/Babylon.js (github.com)

2 Likes

YO @bghgary

How do i use this new call back ?

Something like this: https://playground.babylonjs.com/?snapshot=refs/pull/12565/merge#EL5HK0#1

PR is merged. Sorry for the troubles.