-
Notifications
You must be signed in to change notification settings - Fork 65
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
2.0.0-dev.2.2 #83
2.0.0-dev.2.2 #83
Conversation
Looks good so far! |
Since |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking great. Left some small comments.
The recent commit adds a new check re: KhronosGroup/glTF#1345 for all byte-based inputs (command-line, web drag-n-drop, @emackey Is it possible to check document's encoding from VS Code to ensure that it's UTF-8 without BOM? As soon as an asset becomes a /cc @bghgary |
It does not appear so. There are UI controls for changing the encoding, including adding or removing the BOM, but those controls don't appear to have an associated API. To make matters worse, the interactive / real-time validation of glTF happens in a "Language Server" which is a separate process from the rest of the extension, and it is passed a copy of the document's contents over the Language Server Protocol, outside of our control. I can't imagine that protocol allowing the BOM to slip through. The API on the language server side is just querying the copy that has been passed over to the separate process. One piece of good news though, users can already run the validator directly on a file (typically by right-clicking in VSCode's File Explorer). This is an extra step but is the only way to get VSCode to save out the full JSON conformance report, and is the only way to validate a .glb. When this option is used, only the filename is passed from VSCode to the validator, so it is up to the validator to load the raw file, and a BOM would then be detected and flagged in the report. |
Could we ask VS Code to at least provide that information (e.g., with getter /cc @najadojo |
There's a minor known issue where the right-click options only show up in the folder view (you have to select "Open Folder..." and pick the top of the sample model repo or some other tree with glTFs in it). The "Open Editors" list doesn't do it, I'm not sure why not. I don't think we have a GitHub issue on that actually, so I'll write one.
I agree that's bad UX. I'm not sure I agree that we should be nitpicking the user's BOMs. Several editors, source control systems, and other toolchains impose their own rules for BOMs or lack thereof, and I don't quite see the need for
If there are solid reasons to be warning the user about such things, then yes, I think that's the right approach here. |
Please see the beginning of KhronosGroup/glTF#1345. |
FYI, I opened the issue because we found out recently that some of our apps reject glTF files that have a BOM. I am proposing to the app teams that they relax this specific case since none of the implementations that I've seen elsewhere enforce this. |
A quick web search of "JSON BOM" shows lots of friction in different projects. So I'd prefer that we keep the restriction in the spec, especially since even JSON RFC mentions that. |
So, readers should be tolerant of BOMs, but writers should endeavor not to write BOMs. Just like the FCC's warning stickers (must not generate radio interference... must tolerate any received radio interference). Since one of the main uses of the validator is to check the work of the exporters, I suppose it does make sense for it to say something about the BOM if found. On the VSCode side, there's no API, and I don't expect it to be a quick add since we would need it to propagate over to the language server. The protocol there only does utf-8 and doesn't appear to preserve information about the source file's encoding or BOM status. One possibility, and this is a bit of a stretch, but the language server does have access to the filename. So in theory, it could access the actual file directly, to check for a BOM, but do the rest of the validation on the document contents, which may contain unsaved edits. The BOM check could even happen out-of-band with the rest of the validation, as it likely wouldn't need to happen as frequently. |
Agreed, not advocating changing the restriction in the spec. I'll respond to your question in KhronosGroup/glTF#1345. |
@emackey I'll integrate your |
af1a075
to
fdf93bb
Compare
Online version updated. |
Published to npm. |
The node package uses a couple tricks to work both in node vm and in browser - sometimes something goes wrong; I'll investigate that asap. The online drag-n-drop version is built end-to-end with Dart toolkit, so it's unaffected. |
Found the issue. It's a bug in the building process (which has changed in this release). |
@donmccurdy |
There’s no rush 👍 |
UNUSED_OBJECT
hint (Top-level orphan objects #80).Other planned features for this PR (please tell if you'd prefer something else):
KHR_lights
KHR_texture_transform
/cc @emackey @donmccurdy