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

◆ write() [7/16]

void MayaFlux::Portal::Forma::Bridge::write ( const ElementRef &  ref,
std::shared_ptr< Nodes::Constant >  node 
)

Route element value into a Constant node via set_constant().

Parameters
refOwning Layer and element id.
nodeConstant node updated each frame.

Definition at line 279 of file Bridge.cpp.

280{
281 auto* rec = find_record(ref);
282 if (!rec) {
284 "Bridge::write: unknown element id {}", ref.second);
285 return;
286 }
287
288 auto name = make_task_name(ref.second, "constant");
289 rec->outbound_tasks.push_back(name);
290
291 auto reader = rec->reader;
292
293 auto routine = [](Vruta::TaskScheduler&,
294 std::function<float()> r,
295 std::shared_ptr<Nodes::Constant> n)
296 -> Vruta::GraphicsRoutine {
297 auto& p = co_await Kriya::GetGraphicsPromise {};
298 while (!p.should_terminate) {
299 n->set_constant(static_cast<double>(r()));
300 co_await Kriya::FrameDelay { .frames_to_wait = 1 };
301 }
302 };
303
305 std::make_shared<Vruta::GraphicsRoutine>(
306 routine(m_scheduler, std::move(reader), std::move(node))),
307 name, false);
308}
#define MF_ERROR(comp, ctx,...)
std::string name
Definition VKDevice.cpp:123
Vruta::TaskScheduler & m_scheduler
Definition Bridge.hpp:693
std::string make_task_name(uint32_t id, const char *suffix) const
Definition Bridge.cpp:416
ElementRecord * find_record(const ElementRef &ref)
Definition Bridge.cpp:406
void add_task(const std::shared_ptr< Routine > &routine, const std::string &name="", bool initialize=false)
Add a routine to the scheduler based on its processing token.
Definition Scheduler.cpp:94
@ Init
Engine/subsystem initialization.
@ Portal
High-level user-facing API layer.
GetPromiseBase< Vruta::graphics_promise > GetGraphicsPromise
Graphics domain promise accessor.

References MayaFlux::Vruta::TaskScheduler::add_task(), find_record(), MayaFlux::Kriya::FrameDelay::frames_to_wait, MayaFlux::Journal::Init, m_scheduler, make_task_name(), MF_ERROR, name, and MayaFlux::Journal::Portal.

+ Here is the call graph for this function: