Right now the main difference between <data>
and <assetdata>
is the includes
attribute, which can reference another <assetdata>
's name
attribute and is scoped to the enclosing <asset>
. It was designed this way to make it possible to nest assets or declare many assets in the same document without having to worry about making sure all the IDs they may use are unique (like you would if you were to use the src
attribute of <data>
elements, which reference an HTML ID).
The other differences are:
- You can't nest
<assetdata>
elements. You can get the same functionality using their includes
attribute though.
<assetdata>
elements can only be used inside an <asset>
element
Aside from that they work like <data>
elements do, you can give them compute operators or nest other data inside them or overwrite data like you would with <data>
elements. They may even be merged in a future version of XML3D.
Have a look at the recursive asset example for a more complicated use case.