Skip to content

Conversation

@Floppy
Copy link
Contributor

@Floppy Floppy commented May 22, 2025

Fixed #31149

LDraw materials that had been preloaded were being discarded by the load() method. Following suggestions by @Mugen87, this PR:

  • renames setMaterials to addMaterials, and removes the reset of the material arrays.
  • adds clearMaterials to explicitly clear the material arrays.
  • re-adds setMaterials which calls clear then add, to reproduce the old behaviour and API.

@Floppy Floppy force-pushed the ldraw-materials branch 3 times, most recently from cd86728 to fefbb4c Compare May 22, 2025 21:29
@Floppy
Copy link
Contributor Author

Floppy commented May 22, 2025

Tested and working!

Screenshot 2025-05-22 at 22 34 12

@Floppy Floppy marked this pull request as ready for review May 22, 2025 21:34
@mrdoob
Copy link
Owner

mrdoob commented May 23, 2025

/fyi @gkjohnson

@Floppy
Copy link
Contributor Author

Floppy commented May 23, 2025

Just in case anyone wants to see it in action... https://manyfold.floppy.org.uk/models/5mhxr25tck64/model_files/lnd3c43pl62w

@Floppy Floppy force-pushed the ldraw-materials branch from ca06693 to 88a3057 Compare May 23, 2025 09:13
@Mugen87 Mugen87 added this to the r177 milestone May 23, 2025
@Mugen87 Mugen87 merged commit 523e440 into mrdoob:dev May 23, 2025
11 checks passed
@Floppy
Copy link
Contributor Author

Floppy commented May 23, 2025

Amazing, thank you all for your reviews and suggestions :)

@Mugen87 Mugen87 changed the title LDraw: don't clear already-loaded materials on load LDrawLoader: Don't clear already-loaded materials onload. May 25, 2025
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* LDraw: don't clear already-loaded materials on load

* make addDefaultMaterials an explicit call
RuthySheffi pushed a commit to RuthySheffi/three.js that referenced this pull request Jun 5, 2025
* LDraw: don't clear already-loaded materials on load

* make addDefaultMaterials an explicit call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants