45using AttrType = AttributeType;
46using AttrOwner = AttributeOwner;
51 return {AttributeOwner::POINT,
52 AttributeOwner::VERTEX,
54 AttributeOwner::PRIMITIVE};
60 return {AttributeType::intT,
61 AttributeType::floatT,
63 AttributeType::vectorT,
65 AttributeType::matrixT};
73 case AttributeOwner::POINT:
75 case AttributeOwner::VERTEX:
77 case AttributeOwner::FACE:
79 case AttributeOwner::PRIMITIVE:
90 case AttributeType::intT:
92 case AttributeType::floatT:
94 case AttributeType::listT:
96 case AttributeType::vectorT:
98 case AttributeType::boolT:
100 case AttributeType::matrixT:
108inline std::optional<AttributeOwner>
getOwner(
const std::string& name)
117inline std::optional<AttributeType>
getType(
const std::string& name)
133enum class TransformClass : uint8_t
143inline TransformClass operator|(TransformClass a, TransformClass b)
145 return static_cast<TransformClass
>(
static_cast<uint8_t
>(a) |
static_cast<uint8_t
>(b));
147inline TransformClass operator&(TransformClass a, TransformClass b)
149 return static_cast<TransformClass
>(
static_cast<uint8_t
>(a) &
static_cast<uint8_t
>(b));
152inline bool hasFlag(TransformClass value, TransformClass flag)
154 return (value & flag) != TransformClass::NONE;
161using Vector2 = Eigen::Vector2f;
162using Vector3 = Eigen::Vector3f;
163using Vector4 = Eigen::Vector4f;
164using Matrix3 = Eigen::Matrix3f;
165using Matrix4 = Eigen::Matrix4f;
166using String = std::string;
188 if constexpr (std::is_same_v<T, intT>)
return AttributeType::intT;
189 else if constexpr (std::is_same_v<T, floatT>)
return AttributeType::floatT;
190 else if constexpr (std::is_same_v<T, boolT>)
return AttributeType::boolT;
191 else if constexpr (std::is_same_v<T, Vector3>)
return AttributeType::vectorT;
192 else if constexpr (std::is_same_v<T, Matrix4>)
return AttributeType::matrixT;
193 else static_assert(
sizeof(T) == 0,
"No attribute type stores this C++ type");
205 using Result =
decltype(action.template operator()<intT>());
208 case AttributeType::intT:
209 return action.template operator()<intT>();
210 case AttributeType::floatT:
211 return action.template operator()<floatT>();
212 case AttributeType::vectorT:
213 return action.template operator()<Vector3>();
214 case AttributeType::boolT:
215 return action.template operator()<boolT>();
216 case AttributeType::matrixT:
217 return action.template operator()<Matrix4>();
218 case AttributeType::listT:
299inline std::optional<Type>
toType(
const std::string& name)
302 if (
toString(type) == name)
return type;
312 return ValueType::Float;
321 return ValueType::Int;
324 return ValueType::String;
326 return ValueType::Float;
328 return ValueType::Float;
340enum class SocketIOType
size_t Offset
enzo::Offset is the internal discontinuous index of an element in a given AttributeOwner.
Definition Types.h:182
std::string getOwnerName(AttributeOwner owner)
Returns the name of a part of the geometry, e.g. "point".
Definition Types.h:69
ValueType toValueType(Type type)
Returns the kind of value a parameter of this type stores.
Definition Types.h:307
AttributeType
Data types available to store attribute values in.
Definition Types.h:37
constexpr AttributeType getAttributeType()
Returns the attribute type that stores values of the given C++ type.
Definition Types.h:186
std::vector< AttributeType > getAllTypes()
Returns every type an attribute can store.
Definition Types.h:58
std::vector< AttributeOwner > getAllOwners()
Returns every part of the geometry that can own an attribute.
Definition Types.h:49
constexpr NodeId nullNode
The id that names no node, since real ids start at 1.
Definition Types.h:338
std::string toString(Type type)
The lowercase canonical name of a parameter type, e.g. "dropdown".
Definition Types.h:257
uint64_t NodeId
The unique ID assigned to each node in the network.
Definition Types.h:335
constexpr std::array kAllTypes
Every parameter type, in declaration order.
Definition Types.h:285
AttributeOwner
The segment of geometry that owns a particular attribute.
Definition Types.h:27
size_t Index
enzo::Index is the continuous index of an element in a given AttributeOwner.
Definition Types.h:173
std::optional< AttributeType > getType(const std::string &name)
Returns the type a name stands for, e.g. "vector".
Definition Types.h:117
ValueType
Which kind of value a parameter stores.
Definition Types.h:250
auto visitType(AttributeType type, Action &&action)
Calls an action with the C++ type that stores an attribute type.
Definition Types.h:203
std::optional< Type > toType(const std::string &name)
Returns the parameter type a canonical name stands for, e.g. "dropdown".
Definition Types.h:299
std::string getTypeName(AttributeType type)
Returns the name of a type an attribute can store, e.g. "vector".
Definition Types.h:86
std::optional< AttributeOwner > getOwner(const std::string &name)
Returns the part of the geometry a name stands for, e.g. "point".
Definition Types.h:108