Search code examples
javascriptxml3d

XML3D: XFLOW syntax


I have two question regarding XFLOW syntax:

  1. Can I use xflow data gained from <assetdata>node?

  2. What is the difference between <data> and <assetdata> it seem that those two have the same functionalities. Or in the other words does assetdata node is considered DataContainer.


Solution

  • 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.