Creates a new XMP packet, to be linked with a Document or Properties.
Disables and removes the extension from the Document.
Indicates to the client whether it is OK to load the asset when this extension is not recognized. Optional extensions are generally preferred, if there is not a good reason to require a client to completely fail when an extension isn't known.
Lists XMP packets currently defined in a Document.
Lists all ExtensionProperty instances associated with, or created by, this extension. Includes only instances that are attached to the Document's graph; detached instances will be excluded.
Indicates to the client whether it is OK to load the asset when this extension is not recognized. Optional extensions are generally preferred, if there is not a good reason to require a client to completely fail when an extension isn't known.
Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.
KHR_xmp_json_ld defines XMP metadata associated with a glTF asset.
XMP metadata provides standardized fields describing the content, provenance, usage restrictions, or other attributes of a 3D model. XMP metadata does not generally affect the parsing or runtime behavior of the content — for that, use custom extensions, custom vertex attributes, or extras. Similarly, storage mechanisms other than XMP should be preferred for binary content like mesh data, animations, or textures.
Generally XMP metadata is associated with the entire glTF asset by attaching an XMP Packet to the document Root. In less common cases where metadata must be associated with specific subsets of a document, XMP Packets may be attached to Scene, Node, Mesh, Material, Texture, or Animation properties.
Within each packet, XMP properties become available when an XMP namespace is registered with Packet.setContext. Packets cannot use properties whose namespaces are not registered as context. While not all XMP namespaces are relevant to 3D assets, some common namespaces provide useful metadata about authorship and provenance. Additionally, the
model3d
namespace provides certain properties specific to 3D content, such as Augmented Reality (AR) orientation data.Common XMP contexts for 3D models include:
dc
model3d
rdf
xmp
xmpRights
Only the XMP contexts required for a packet should be assigned, and different packets in the same asset may use different contexts. For greater detail on available XMP contexts and how to use them in glTF assets, see the 3DC Metadata Recommendations.
Properties:
Example
import { KHRXMP, Packet } from '@gltf-transform/extensions'; // Create an Extension attached to the Document. const xmpExtension = document.createExtension(KHRXMP); // Create Packet property. const packet = xmpExtension.createPacket() .setContext({ dc: 'http://purl.org/dc/elements/1.1/', }) .setProperty('dc:Creator', {"@list": ["Acme, Inc."]}); // Option 1: Assign to Document Root. document.getRoot().setExtension('KHR_xmp_json_ld', packet); // Option 2: Assign to a specific Property. texture.setExtension('KHR_xmp_json_ld', packet);