-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
fix(io): Handle duplicate URIs on read/write #1511
Conversation
A related question came up for me in JglTF recently. In that context, I did a few experiments with glTF-Transform, and referred to that in a comment at javagl/JglTF#115 (comment) The test that I did there, and where one could argue about whether it is a "bug" or only a "maybe somewhat surprising behavior" of glTF-Transform is this:
It only sets the URI of the second texture, via Crying wolf: The part in the comment above that says
sounds like it could cause unexpected behavior, but I haven't looked into the details yet. |
This reverts commit 13d83a7.
Reverting in 84e77f5, due to #1513. The immediate the problem seems to be the "import" side, though I think you raise some good points about export. The export side might be better served if unique URL generation were aware of every other resource URL in the document, and not just the unnamed resources. |
That generalization is also a valid point. I could imagine that some of the functions in JglTF will produce unexpected results when someone creates a buffer and a texture that both have a URI like Given these complications, I think that it may indeed be warranted to sort out some of these things in the context of KhronosGroup/glTF#2446 , and maybe add 'Implementation Notes' about this sort of duplication.
... iff this should be done. The question is whether it should realy be impossible to create a glTF like the one that you posted in the issue.... |
)" Partially restores commit 13d83a7.
Updates to this PR coming in: I may consider making this handling more strict in v5 or another major release, whether it's considered invalid by the spec or not, but still TBD.
Currently happening here: glTF-Transform/packages/core/src/io/writer-context.ts Lines 233 to 252 in 93ca869
The result won't always be |
Changes:
To explicitly consolidate duplicate resources, the
dedup()
orunpartition()
functions may be used.