MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ instantiate_document() [2/3]

template<typename Source, typename Access = Reflect::RecordAccess<Source>>
std::optional< PlacedInstances > MayaFlux::Portal::Forma::instantiate_document ( const FactoryTable< Source, Access > & table,
const Source & root,
SurfaceMap & surfaces,
std::string & error )
nodiscard

Place every instance of a document through a table.

The document is a tree of a root element named forma carrying a version of 1. The root may also carry xmlns declarations, which are ignored, so the mf: prefix below can be declared for tools that validate namespaces. Its templates element holds template elements, each with an id and exactly one child, the factory, whose name is looked up in the table. Its surface elements hold instance elements with an id, a template naming a template, and the placement attributes the factory describes. Ids are unique across the document. A surface id is a name the host binds in surfaces.

An instance may also carry attributes of the document's own, all beginning with mf: and applied to the placed element through its Layer:

  • mf:hidden and mf:interactive take true or false.
  • mf:relate names another instance of the same surface that this one belongs with, so hiding, moving or removing that one reaches this one.
  • mf:front and mf:back move the element, and its relations, to the top or the bottom of the paint and hit order. They exclude each other.
  • mf:clip takes x y width height and confines hit testing to that region. Every placed element is also named after its instance, so Layer::find reaches it by the id the document gave it.

Placement is two phases. The structure is checked and every instance is decoded first, so a bad document fails before any Surface is touched. Then each prepared instance is placed in document order and the Layer attributes are applied.

Template Parameters
SourceElement type of the document tree, with a Reflect::RecordAccess.
Parameters
tableFactories by name.
rootRoot element of the document.
surfacesSurfaces by the name the document's surface elements use.
errorReceives the reason, with a row, when nullopt is returned.
Returns
Each placed instance by id, with its surface and element.
Note
A failure while placing may leave earlier instances on their Surface.

Definition at line 777 of file Instantiate.hpp.

780{
781 return Detail::instantiate<Source, Access>(table, nullptr, nullptr, root, surfaces, error);
782}
std::optional< PlacedInstances > instantiate(const FactoryTable< Source, Access > &table, const ActionTable< Source, Access > *actions, const CallTable< Source, Access > *calls, const Source &root, SurfaceMap &surfaces, std::string &error)

References MayaFlux::Portal::Forma::Detail::instantiate(), and instantiate_document().

Referenced by instantiate_document(), instantiate_document(), instantiate_document(), and instantiate_xml().

Here is the call graph for this function:
Here is the caller graph for this function: