-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Merging documents with extensions #1367
Comments
KHR_xmp_json_ld does not really allow multiple packets associated with the top-level asset – assigning the packet to the root in glTF Transform is equivalent to setting:
... and the root-level list of packets is still generated automatically, but there can only be one packet on the asset. Moreover, there is a special process by which one should technically create a new packet with 'ingredients' based on other packets: https://developer.adobe.com/xmp/docs/XMPNamespaces/xmpMM/ See It is ... complicated. And there's no obvious right answer for what 'merge' is to XMP, so I've left that in userland. None of the above helps you with Would something like #924 be better here? I think that might allow you to exercise more control over what is actually happening rather than just calling |
The reference to (For example, I now saw that the "root-level" packets list is also only generated by the writer, and ... the packet reference is snuck into the
I think that the goal would not be to transfer properties. The source should be unaffected by whatever is happening there. But maybe I'm overlooking a connection on a lower level of the implementation.
Preferably, that should not be necessary. The
It might be that the The general problem of having to do a manual merge operation for a specific |
Sorry for the "walls of text" and the (probably just distracting) reference to The core of this issue could be boiled down to:
As such, this is not a "bug". It is, at most, a limitation in corner cases, where some special handling is required for merging the data of two 'instances' of extensions into a single object. Depending on your preference, this issue (with the distracting first part) could be closed, and the summary that I gave above could be moved into a new issue. In any case, it's not something where a quick and good solution could be pulled out of a hat (and I'll try to find any solution for the specific case of |
Ignoring the move vs. copy distinction, what I mean is a more granular way to get specific contents of Document A into Document B. Currently the only method is const meshesA = documentA.getRoot().listMeshes().slice(0, 5);
const meshesB = documentB.cloneExternal(meshesA);
I think that's the crux of the problem, yes. For I am tempted to remove the |
I now see the connection to the 'transferring properties' issue. And yes, I'm currently thinking that it will be necessary to define "copy-constructors" or clone functions for the classes that are part of the extension. This should allow something like It would probably be possible to implement such a The current All these points are reasons to consider this as 'out of scope' for now. |
Proposed solution: tl;dr - Root-level properties, including the generator string and root-level extensions, are not transferred when merging two documents. For more granular control, the new |
Just a short "Ack 👍 " here: I started implementing the merge functionality for |
Describe the bug
This issue has two levels of abstraction:
KHR_xmp_json_ld
merge
operation in generalThe second one is related to #958, and very specifically to some difficulties when trying to merge documents that both contain an instance of the
EXT_structural_metadata
implementation. I spent a few hours debug-stepping through various parts of the code, but no avail.Eventually, I started to compare the behavior to another extension that defines
ROOT
-level elements - namely,KHR_xmp_json_ld
. This leads to the first point: It looks likeKHR_xmp_json_ld
can not be merged properly...To Reproduce
The following program creates two documents, each containing the
KHR_xmp_json_ld
extension, with onepacket
. It then merges these documents. The resulting document is written properly. But the "root type" of the extension isPacket
- so it's not possible to access both packets.Expected behavior
The general question is: When there is an extension that defines top-level
PropertyType.ROOT
elements: Which precautions have to be taken or which "hooks" into the code can be employed to properly handle these during amerge
operation?For
KHR_xmp_json_ld
, one path might be to have to be some (trivial)class PacketList extends ExtensionProperty
that just is an array ofPacket
objects and serves as the top-level type for the extension. (Further details and an example are actually given in the extension specs). Then, the question will be: At which point of themerge
process will the contents of thesePacketList
-objects be merged?(For the more general case, I hope that any draft/sketch/idea of how this could be handled for
KHR_xmp_json_ld
could help me to figure out a solution forEXT_structural_metadata
as well 🤞 )Versions:
The text was updated successfully, but these errors were encountered: