question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serializing any Object3D with nested NodeMaterial throws error

See original GitHub issue

Describe the bug

As the toJSON method on a THREE Node expects a nodes field in the meta object, it throws an error if the meta comes from an Object3D which never supplies that field.

To Reproduce

Steps to reproduce the behavior:

  1. Setup a simple THREE project
  2. Add a mesh to the scene with a NodeMaterial
  3. Serialize scene using scene.toJSON()

Live example

See Sandbox example

Expected behavior

Object3D should serialize just fine. Solution would be to include a nodes field in the default meta-object.

Platform:

  • Device: [Desktop, Mobile]
  • OS: [Windows, MacOS, Linux, Android, iOS]
  • Browser: [Chrome, Firefox, Safari, Edge]
  • Three.js version: 0.125.2

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
emilwidlundcommented, Feb 25, 2021

@Mugen87 Thanks for clarifying. I managed to get an alternative workflow up and running using the NodeMaterialLoader. However, TypeScript definitions for NodeMaterialLoader seem to be missing. Let me know if you want me to track that separately.

0reactions
Mugen87commented, Feb 28, 2021

Merging this issue into #16440.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# Invalid Option Error deserializing nested dynamic object ...
1 Answer 1 ... Wait, you want to go from an object to a string? That's serialization, no deserialization. Also, if you read...
Read more >
Error loading Node Material that contains VectorMergeBlock
I'm getting a exception thrown when loading a Node Material either using loadFromSerialization or loadAsync.
Read more >
https://ondoc.logand.com/d/7164/txt
This includes datatype conversion, error checking, state tracking, ... Structured clone is roughly equivalent to serializing an object to JSON and then ...
Read more >
Untitled
Contribute to timoxley/threejs development by creating an account on GitHub. ... all of the morph frames into my geometry, I'm having trouble getting...
Read more >
Bug - Recursive Nested Serialization does not work with ...
I get an error must be a non-nullable type when using nested serialization with network variables. Expected: Nested serialization works per ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found