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

◆ instantiate()

template<typename Source, typename Access>
std::optional< PlacedInstances > MayaFlux::Portal::Forma::Detail::instantiate ( const FactoryTable< Source, Access > & table,
const ActionTable< Source, Access > * actions,
const CallTable< Source, Access > * calls,
const Source & root,
SurfaceMap & surfaces,
std::string & error )

Definition at line 711 of file Instantiate.hpp.

714 {
715 error.clear();
716 DocumentWalk<Source, Access> walk(table, root, error, actions, calls);
717 if (!walk.read_structure())
718 return std::nullopt;
719 const auto prepared = walk.prepare(surfaces);
720 if (!prepared)
721 return std::nullopt;
722
723 PlacedInstances placed;
724 std::vector<uint32_t> elements;
725 elements.reserve(prepared->size());
726 for (const auto& item : *prepared) {
727 const auto element = item.placer(*item.surface, error);
728 if (!element)
729 return std::nullopt;
730 elements.push_back(*element);
731 placed.emplace(item.id, PlacedInstance { .surface = item.surface_id, .element = *element });
732 }
733 if (!DocumentWalk<Source, Access>::apply(*prepared, elements, error))
734 return std::nullopt;
735 return placed;
736 }
static bool apply(const Prepared &prepared, const std::vector< uint32_t > &elements, std::string &error)
Names every placed element after its instance, then applies the document's Layer attributes: relation...
std::map< std::string, PlacedInstance, std::less<> > PlacedInstances
The placed instances of a document by the id the document gave them.
Where an instance of a document ended up.

References MayaFlux::Portal::Forma::Detail::DocumentWalk< Source, Access >::apply(), instantiate(), MayaFlux::Portal::Forma::Detail::DocumentWalk< Source, Access >::prepare(), and MayaFlux::Portal::Forma::Detail::DocumentWalk< Source, Access >::read_structure().

Referenced by instantiate(), MayaFlux::Portal::Forma::instantiate_document(), MayaFlux::Portal::Forma::instantiate_document(), and MayaFlux::Portal::Forma::instantiate_document().

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