Skip to content

MaterialLoader: Error when loading MeshToonMaterial. #20521

@sir-aureus

Description

@sir-aureus

I have a scene I had been working on, which previously worked fine in the editor. As of a recent update, however, it fails to load with the following console errors:

[Error] TypeError: undefined is not an object (evaluating 'material.specular.setHex')
parse (three.module.js:40084)
parseMaterials (three.module.js:41083)
parse (three.module.js:40721)
handleJSON (Loader.js:598)
(anonymous function) (Loader.js:333)

[Error] ReferenceError: Cannot access uninitialized variable.
(anonymous function) (three.module.js:40716)
(anonymous function) (three.module.js:36133)
onImageLoad (three.module.js:36816)

Looking at the code, it looks like the issue stems from an instance of MeshToonMaterial which has a specular parameter in its serialized data, but specular appears to have been removed from the MeshToonMaterial class.

The serialized material in question is:
"{"uuid":"86936197-6FFA-4E61-B36E-9CEC7890DFB1","type":"MeshToonMaterial","color":15986151,"emissive":0,"specular":1118481,"shininess":30,"depthFunc":3,"depthTest":true,"depthWrite":true,"stencilWrite":false,"stencilWriteMask":255,"stencilFunc":519,"stencilRef":0,"stencilFuncMask":255,"stencilFail":7680,"stencilZFail":7680,"stencilZPass":7680}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions