Skip to content

Expose TextureHandler#parsers as public API with addParser/removeParser methods#7878

Open
killerdevildog wants to merge 1 commit intoplaycanvas:mainfrom
killerdevildog:fix-texture-parsers-public-api-7564
Open

Expose TextureHandler#parsers as public API with addParser/removeParser methods#7878
killerdevildog wants to merge 1 commit intoplaycanvas:mainfrom
killerdevildog:fix-texture-parsers-public-api-7564

Conversation

@killerdevildog
Copy link

@killerdevildog killerdevildog commented Aug 1, 2025

Expose TextureHandler#parsers as public API with addParser/removeParser methods

  • Add comprehensive JSDoc documentation for parsers property
  • Implement addParser() method following ModelHandler pattern for extensibility
  • Implement removeParser() method to enable tree-shaking of unused parsers
  • Add private _customParsers array to store custom parsers with decider functions
  • Update _getParser() method to check custom parsers before default parsers
  • Update maxRetries setter to handle both default and custom parsers
  • Maintained 100% backward compatibility with existing functionality
  • Enable configuration, tree-shaking, and better developer experience

This resolves the architectural inconsistency between TextureHandler and ModelHandler by applying the proven addParser pattern to texture handling. Custom parsers are checked first, allowing developers to override default behavior or add support for new formats like 16-bit PNGs or headerless textures.

Rebased onto latest main (Feb 2026).

Fixes #7564

I confirm I have read the contributing guidelines.

…er methods

- Add comprehensive JSDoc documentation for parsers property
- Implement addParser() method following ModelHandler pattern for extensibility
- Implement removeParser() method to enable tree-shaking of unused parsers
- Add private _customParsers array to store custom parsers with decider functions
- Update _getParser() method to check custom parsers before default parsers
- Update maxRetries setter to handle both default and custom parsers
- Maintain 100% backward compatibility with existing functionality
- Enable configuration, treeshaking, and better developer experience

This resolves the architectural inconsistency between TextureHandler and
ModelHandler by applying the proven addParser pattern to texture handling.
Custom parsers are checked first, allowing developers to override default
behavior or add support for new formats like 16-bit PNGs or headerless textures.

Fixes playcanvas#7564
@killerdevildog killerdevildog force-pushed the fix-texture-parsers-public-api-7564 branch from 63f8d49 to 566badb Compare February 22, 2026 04:31
@killerdevildog killerdevildog changed the title Expose TextureHandler#parsers as public API with addParser/removePars… Expose TextureHandler#parsers as public API with addParser/removeParser methods Feb 22, 2026
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.

Should texture parsers be public API?

1 participant