Enzo
Loading...
Searching...
No Matches
Styles.h
Go to the documentation of this file.
1#pragma once
2
8
9#include "Engine/Core/Types.h"
10#include "Engine/Parameter/Parameter.h"
11#include "Engine/Parameter/PrmName.h"
12#include "Engine/Parameter/Template.h"
13
14#include <memory>
15#include <vector>
16
17namespace enzo::prm::style {
18
20{
21};
22
23// A string edited as multi line code.
24struct Code
25{
26};
27
28// A vector whose components read as x, y and z axes, each with its own colour.
29struct Xyz
30{
31};
32
33// A pair of floats read as the start and end of an arc, drawn as a dial.
35{
36 enum Option
37 {
38 ORDERED,
39 CAPTION
40 };
41
42 std::vector<std::shared_ptr<prm::Parameter>> options = {
43 std::make_shared<prm::Parameter>(
44 Template(Type::BOOL, Name("ordered", "Ordered"), Default(false))
45 ),
46 std::make_shared<prm::Parameter>(
47 Template(Type::STRING, Name("caption", "Caption"), Default(""))
48 ),
49 };
50
51 // Whether the low bound stays below the high one rather than the arc
52 // wrapping past the end of the range.
53 bool ordered() const { return options[ORDERED]->evalInt() != 0; }
54
55 // The label shown with the arc's reading, e.g. "arc", empty for none.
56 String caption() const { return options[CAPTION]->evalString(); }
57};
58
59// A bool drawn as an icon rather than a checkbox.
61{
62 enum Option
63 {
64 ICON,
65 SCALE
66 };
67
68 std::vector<std::shared_ptr<prm::Parameter>> options = {
69 std::make_shared<prm::Parameter>(
70 Template(Type::STRING, Name("icon", "Icon"), Default("eye"))
71 ),
72 std::make_shared<prm::Parameter>(
73 Template(Type::FLOAT, Name("scale", "Scale"), Default(0.95f))
74 ),
75 };
76
77 String icon() const { return options[ICON]->evalString(); }
78 floatT scale() const { return options[SCALE]->evalFloat(); }
79};
80
81// A string naming a geometry attribute, with a list of the attributes on the
82// node's input to pick from.
84{
85 enum Option
86 {
87 OWNERS,
88 ATTRIBUTE_TYPES
89 };
90
91 std::vector<std::shared_ptr<prm::Parameter>> options = {
92 std::make_shared<prm::Parameter>(
93 Template(Type::STRING, Name("owners", "Owners"), Default("all"))
94 ),
95 std::make_shared<prm::Parameter>(
96 Template(Type::STRING, Name("attributeTypes", "Attribute Types"), Default("all"))
97 ),
98 };
99
101 String owners() const { return options[OWNERS]->evalString(); }
102
104 String attributeTypes() const { return options[ATTRIBUTE_TYPES]->evalString(); }
105};
106
107} // namespace enzo::prm::style
std::vector< std::shared_ptr< prm::Parameter > > options(const std::any &style)
Returns the options a style exposes to node.yaml.
Definition StyleAccess.h:129
Basic attribute, parameter, and node types for Enzo.
Definition Default.h:7
Definition PrmName.h:6
Definition Template.h:18
Definition Styles.h:84
String attributeTypes() const
Returns the value types the attributes can hold, e.g. "float vector".
Definition Styles.h:104
String owners() const
Returns the parts of the geometry the attributes come from, e.g. "point vertex".
Definition Styles.h:101
Definition Styles.h:61
Definition Styles.h:20
Definition Styles.h:25
Definition Styles.h:35
Definition Styles.h:30