Enzo
Loading...
Searching...
No Matches
ExpressionContext.h
1#pragma once
2#include "Engine/Core/Types.h"
3#include "Engine/NetworkGraph/Unit.h"
4#include <vector>
5
6namespace enzo::expr {
7
21{
22 public:
23 explicit ExpressionContext(nt::NodeId currentNode) : currentNode_(currentNode) {}
24
26 nt::NodeId currentNode() const { return currentNode_; }
27
29 void recordExpressionDependency(const nt::Unit& dependency) const
30 {
31 expressionDependencies_.push_back(dependency);
32 }
33
35 const std::vector<nt::Unit>& getExpressionDependencies() const
36 {
37 return expressionDependencies_;
38 }
39
41 void recordTimeDependency() const { readsTime_ = true; }
42
44 bool dependsOnTime() const { return readsTime_; }
45
46 private:
47 nt::NodeId currentNode_;
48
49 // Filled as prm() and friends resolve, so const reads can still accumulate.
50 mutable std::vector<nt::Unit> expressionDependencies_;
51 mutable bool readsTime_ = false;
52};
53
54} // namespace enzo::expr
Basic attribute, parameter, and node types for Enzo.
uint64_t NodeId
The unique ID assigned to each node in the network.
Definition Types.h:306
The world a single expression evaluation reads and writes to.
Definition ExpressionContext.h:21
void recordExpressionDependency(const nt::Unit &dependency) const
Notes a parameter the expression read, so it becomes a dependency.
Definition ExpressionContext.h:29
bool dependsOnTime() const
Returns whether the expression read the scene time during this evaluation.
Definition ExpressionContext.h:44
void recordTimeDependency() const
Notes that the expression read the scene time.
Definition ExpressionContext.h:41
const std::vector< nt::Unit > & getExpressionDependencies() const
Every parameter the expression read during this evaluation.
Definition ExpressionContext.h:35
nt::NodeId currentNode() const
The node a relative parameter path resolves against.
Definition ExpressionContext.h:26
A point in the network graph, either a node output or a parameter.
Definition Unit.h:20