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 vector whose components read as x, y and z axes, each with its own colour.
24struct Xyz
25{
26};
27
28// A pair of floats read as the start and end of an arc, drawn as a dial.
30{
31 enum Option
32 {
33 ORDERED,
34 CAPTION
35 };
36
37 std::vector<std::shared_ptr<prm::Parameter>> options = {
38 std::make_shared<prm::Parameter>(
39 Template(Type::BOOL, Name("ordered", "Ordered"), Default(false))
40 ),
41 std::make_shared<prm::Parameter>(
42 Template(Type::STRING, Name("caption", "Caption"), Default(""))
43 ),
44 };
45
46 // Whether the low bound stays below the high one rather than the arc
47 // wrapping past the end of the range.
48 bool ordered() const { return options[ORDERED]->evalInt() != 0; }
49
50 // The label shown with the arc's reading, e.g. "arc", empty for none.
51 String caption() const { return options[CAPTION]->evalString(); }
52};
53
54// A bool drawn as an icon rather than a checkbox.
56{
57 enum Option
58 {
59 ICON,
60 SCALE
61 };
62
63 std::vector<std::shared_ptr<prm::Parameter>> options = {
64 std::make_shared<prm::Parameter>(
65 Template(Type::STRING, Name("icon", "Icon"), Default("eye"))
66 ),
67 std::make_shared<prm::Parameter>(
68 Template(Type::FLOAT, Name("scale", "Scale"), Default(0.95f))
69 ),
70 };
71
72 String icon() const { return options[ICON]->evalString(); }
73 floatT scale() const { return options[SCALE]->evalFloat(); }
74};
75
76// A string naming a geometry attribute, with a list of the attributes on the
77// node's input to pick from.
79{
80 enum Option
81 {
82 OWNERS,
83 ATTRIBUTE_TYPES
84 };
85
86 std::vector<std::shared_ptr<prm::Parameter>> options = {
87 std::make_shared<prm::Parameter>(
88 Template(Type::STRING, Name("owners", "Owners"), Default("all"))
89 ),
90 std::make_shared<prm::Parameter>(
91 Template(Type::STRING, Name("attributeTypes", "Attribute Types"), Default("all"))
92 ),
93 };
94
96 String owners() const { return options[OWNERS]->evalString(); }
97
99 String attributeTypes() const { return options[ATTRIBUTE_TYPES]->evalString(); }
100};
101
102} // 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:126
Basic attribute, parameter, and node types for Enzo.
Definition Default.h:7
Definition PrmName.h:6
Definition Template.h:18
Definition Styles.h:79
String attributeTypes() const
Returns the value types the attributes can hold, e.g. "float vector".
Definition Styles.h:99
String owners() const
Returns the parts of the geometry the attributes come from, e.g. "point vertex".
Definition Styles.h:96
Definition Styles.h:56
Definition Styles.h:20
Definition Styles.h:30
Definition Styles.h:25