Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Fix loadModel() options parsing and texture-coordinate flips - #9371

Open
bababananaa wants to merge 1 commit into
processing:mainfrom
bababananaa:fix-loadmodel-options
Open

bababananaa wants to merge 1 commit into
processing:mainfrom
bababananaa:fix-loadmodel-options

Conversation

@bababananaa

Copy link
Copy Markdown

Resolves #9302

Changes:

  • In loadModel(), an options object passed as the second argument is stored in fileType. The old code reassigned fileType before reading flipU and flipV, which caused two bugs:
    • Without options.fileType, fileType stayed as the options object and crashed at fileType.toLowerCase().
    • With options.fileType, flipU and flipV were read from a string, so they were always false and the flips were ignored.
  • The fix reads all options from the options object first, then assigns fileType.
  • When options.fileType is omitted, it now falls back to the extension from path, matching how the positional-argument form already behaves.
  • Also guards against null being passed as the second argument, since typeof null === 'object'.

Tests:

  • Added an options object suite to test/unit/io/loadModel.js covering:
    • options without fileType ({} and { normalize: true })
    • inferring STL from the path when fileType is omitted
    • an explicit fileType on an extensionless path
    • flipU without fileType, and flipU + flipV with fileType (compared against calling model.flipU() / model.flipV() manually)
    • no flip options leaving UVs unchanged
    • successCallback passed inside options
  • The new tests fail on the previous code (6 failures) and all 37 loadModel tests pass with this change.

PR Checklist

  • npm run lint passes
  • Unit tests are included / updated

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@p5-bot

p5-bot Bot commented Nov 4, 2026

Copy link
Copy Markdown

Continuous Release

CDN link

Published Packages

Commit hash: bb75816

Previous deployments

This is an automated message.

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.

loadModel() options break without fileType and ignore flipU/flipV

1 participant