3#include "Engine/Parameter/Template.h"
4#include <boost/signals2.hpp>
11class ExpressionContext;
16using PrmValues = std::variant<std::vector<floatT>, std::vector<intT>, std::vector<String>>;
24 std::string getName()
const;
25 std::string getLabel()
const;
26 enzo::prm::Type getType()
const;
28 unsigned int getVectorSize()
const;
30 floatT evalFloat(
unsigned int index = 0)
const;
31 String evalString(
unsigned int index = 0)
const;
32 intT evalInt(
unsigned int index = 0)
const;
37 floatT evalFloat(
unsigned int index, String& error)
const;
38 intT evalInt(
unsigned int index, String& error)
const;
39 String evalString(
unsigned int index, String& error)
const;
44 std::vector<floatT> evalFloats()
const;
45 std::vector<String> evalStrings()
const;
46 std::vector<intT> evalInts()
const;
48 void setInt(intT value,
unsigned int index = 0);
49 void setFloat(floatT value,
unsigned int index = 0);
50 void setString(String value,
unsigned int index = 0);
55 void setExpression(String expression,
unsigned int index = 0);
56 void clearExpression(
unsigned int index = 0);
57 bool hasExpression(
unsigned int index = 0)
const;
61 std::optional<String>
getExpression(
unsigned int index = 0)
const;
73 floatT
previewFloat(
const String& expression, String& error)
const;
75 intT
previewInt(
const String& expression, String& error)
const;
77 String
previewString(
const String& expression, String& error)
const;
79 PrmValues getValues()
const;
80 void setValues(
const PrmValues& values);
84 unsigned int getInstanceCount()
const;
85 const std::vector<std::shared_ptr<Parameter>>& getInstance(
unsigned int instanceIndex)
const;
86 std::shared_ptr<Parameter>
87 getInstanceField(
unsigned int instanceIndex, std::string_view fieldName)
const;
89 void removeInstance(
unsigned int instanceIndex);
90 void moveInstance(
unsigned int fromIndex,
unsigned int toIndex);
94 boost::signals2::signal<void()> valueChanged;
97 void handleValueChange_();
113 floatT
clampToRange_(floatT value,
unsigned int index)
const;
120 floatT readFloatLiteral_(
unsigned int index)
const;
121 intT readIntLiteral_(
unsigned int index)
const;
122 String readStringLiteral_(
unsigned int index)
const;
123 std::vector<std::shared_ptr<Parameter>> buildInstance_(
unsigned int instanceIndex);
129 std::vector<std::optional<String>> expressions_;
130 std::vector<std::vector<std::shared_ptr<Parameter>>> instances_;
Basic attribute, parameter, and node types for Enzo.
ValueType
Which kind of value a parameter stores.
Definition Types.h:221
The world a single expression evaluation reads and writes to.
Definition ExpressionContext.h:21
Definition Parameter.h:19
std::optional< String > getExpressionError(unsigned int index=0) const
Evaluates a component's expression and reports any failure.
std::optional< String > getExpression(unsigned int index=0) const
The expression on a component.
Definition Parameter.cpp:303
floatT previewFloat(const String &expression, String &error) const
Evaluates arbitrary text as an uncommitted live preview.
Definition Parameter.cpp:165
virtual void submitExpressionDependencies_(const expr::ExpressionContext &context, unsigned int index) const
Hands the dependencies an expression captured to the network graph.
Definition Parameter.h:108
floatT clampToRange_(floatT value, unsigned int index) const
Returns the value pulled within a component's locked range bounds.
Definition Parameter.cpp:317
intT previewInt(const String &expression, String &error) const
Evaluates arbitrary text as an uncommitted live preview.
Definition Parameter.cpp:174
String previewString(const String &expression, String &error) const
Evaluates arbitrary text as an uncommitted live preview.
Definition Parameter.cpp:183
virtual std::unique_ptr< expr::ExpressionContext > makeExpressionContext_() const
The world an expression on this parameter reads, e.g. for prm().
Definition Parameter.cpp:133