-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing typecheck for GLTFExporter #26992
Comments
Related pull request: |
Merged Pearces1997#1 into dev, will monitor for feedback. Thanks! |
When the error occurs, I would say the exporter gets some kind of invalid input that has to be avoided on application level. However, I understand that making three.js/src/renderers/webgl/WebGLTextures.js Lines 68 to 70 in de5932e
However, even with an additional check the exporter should throw an error so the application ensures valid input. You have not implemented this in your version but it should be done in this repo. Silently ignoring incompatible texture input can be very confusing for developers. |
Description
TypeError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The provided value is not of type '(CSSImageValue or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or OffscreenCanvas or SVGImageElement or VideoFrame)'.
Reproduction steps
ctx.drawImage(image, 0, 0)
Code
Scene is gotten from blend file, other converts work fine. Seems like a texture bug for GLTFExporter
Live example
[(https://www.filer.dev/convert/blend-to-glb)]
www.filer.dev uses threejs as well as other software to allow blender files to be rendered and converted in the web in an offline first manner.
Screenshots
ctx.drawImage(image, 0, 0)
Seems to run regardless if the image value is valid. Some type check can hopefully fix this is my hunch.
I tried this type of check in a ColladaExporter and it fixed my issue:
const iType = typeof image if (iType === 'CSSImageValue' || iType === 'HTMLCanvasElement' || iType === 'HTMLVideoElement' || iType === 'ImageBitmap' || iType === 'OffscreenCanvas' || iType === 'SVGImageElement' || iType === 'VideoFrame') ctx.drawImage(image, 0, 0)
Version
0.157.0 (latest)
Device
Desktop, Mobile
Browser
Chrome, Firefox, Safari, Edge
OS
Windows, MacOS, Linux, Android, iOS
The text was updated successfully, but these errors were encountered: