Enzo
Loading...
Searching...
No Matches
enzo::expr::ExpressionContext Class Reference

The world a single expression evaluation reads and writes to. More...

#include <ExpressionContext.h>

Inheritance diagram for enzo::expr::ExpressionContext:
enzo::script::ScriptContext

Public Member Functions

 ExpressionContext (nt::NodeId currentNode)
 
nt::NodeId currentNode () const
 The node a relative parameter path resolves against.
 
template<typename Value >
std::optional< Value > readParameter (const String &path, unsigned int index) const
 Returns a parameter's value, evaluated on the first read and reused after.
 
const std::vector< nt::Unit > & getExpressionDependencies () const
 Every parameter the expression read during this evaluation.
 
void recordTimeDependency () const
 Notes that the expression read the scene time.
 
bool dependsOnTime () const
 Returns whether the expression read the scene time during this evaluation.
 

Detailed Description

The world a single expression evaluation reads and writes to.

One of these lives for the span of one evaluation, and a script run shares one across all its threads.

Parameter functions like prm() take a path that may be relative, so they need to know which node the expression belongs to.

It also keeps track of dependencies, like other parameters. Once all the dependencies are known they are passed to the network graph at once, so it can use them for tracking updates.

Member Function Documentation

◆ readParameter()

template<typename Value >
template std::optional< String > enzo::expr::ExpressionContext::readParameter< String > ( const String & path,
unsigned int index ) const

Returns a parameter's value, evaluated on the first read and reused after.

Returns
The value, or nothing when the path matches no parameter.
Note
The first read records the parameter's node as a dependency.
Reads from several threads evaluate one at a time.

The documentation for this class was generated from the following files: