TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_node_view_types.h
Go to the documentation of this file.
1#pragma once
2
3#include <gui_core/gui_base_types.h> // int2, float3x2, color4f
4#include <gui_core/gui_id.h>
5#include <gui_core/elements/gui_element.h> // ElementRef
6#include <gui_core/input/gui_command_manager.h> // CommandMode
8#include <gui_core/graphics/gui_custom_draw_context.h> // VisualColorStyleIndex
9
10#include <gui_controls/gui_widget_state_types.h> // DoubleClickTracker
11
12#include <functional>
13#include <optional>
14#include <span>
15#include <type_traits>
16#include <string>
17#include <unordered_map>
18#include <unordered_set>
19#include <vector>
20
21// Node-view (graph editor) data model. The caller owns one NodeView per view.
22
23namespace tachyon
24{
27
30 {
31 int nodeIdx = -1;
32 int propIdx = -1;
33
35 bool valid() const { return nodeIdx >= 0 && propIdx >= 0; }
36 bool operator==(const PropertyEndpoint&) const = default;
37 };
38
41 {
43 std::optional<PropertyEndpoint> input;
44
46 bool output = false;
47
49 std::function<void()> renderBody;
50
52 tachyon::color4f socketColor{ 0.9f, 0.9f, 0.9f, 1.0f };
53
56 int rowSpan = 1;
57
62 std::string name;
63 std::string type;
64 std::function<std::string()> value;
65 };
66
68 struct NodeModel
69 {
73
74 std::string title;
76 std::string category;
83 bool collapsed = false;
88 bool reroute = false;
89 std::vector<NodeProperty> properties;
91 bool hidden = false;
94 bool subMachine = false;
95 };
96
99 enum class NodeViewKind : uint8_t
100 {
103 };
104
115
119 {
123 std::string title;
132 bool collapsed = false;
137 std::optional<std::vector<tachyon::ID>> members;
138
139 bool operator==(const NodeFrame&) const = default;
140 };
141
159
162 enum class WireHandle : uint8_t { None, LaneX, ExitX, EntryX, LaneY };
163
166 struct WireLane
167 {
168 int32_t offset = 0;
169 int32_t index = 0;
170 int32_t count = 1;
171
172 bool operator==(const WireLane&) const = default;
173 };
174
178 {
179 std::optional<int32_t> laneX;
180 std::optional<int32_t> exitX;
181 std::optional<int32_t> entryX;
182 std::optional<int32_t> laneY;
184
185 bool operator==(const WireRouteOverrides&) const = default;
186 };
187
195
198 {
199 std::vector<tachyon::int2> points;
200 std::vector<WireSegmentHandle> handles;
203 bool curved = false;
204 };
205
207 enum class NodeWireShape : uint8_t
208 {
211 };
212
216 {
217 uint32_t wireKey = 0;
219 bool vertical = false;
221 };
222
226 {
228 struct Move { int node = -1; tachyon::int2 from {}, to {}; };
232 struct Collapse { int node = -1; bool from = false, to = false; };
234 struct Lanes { uint32_t wireKey = 0; WireRouteOverrides from, to; };
239 struct Node
240 {
241 int index = -1;
242 bool added = true;
245 std::vector<std::pair<PropertyEndpoint, int>> fed;
246 std::vector<std::pair<uint32_t, WireRouteOverrides>> lanes;
247 };
248
250 struct FrameChange { int frame = -1; NodeFrame from, to; };
253 struct Frame { int index = -1; bool added = true; NodeFrame frame; };
256 struct Transition { int index = -1; bool added = true; StateTransition transition; };
261
262 std::vector<Move> moves;
263 std::vector<Rewire> rewires;
264 std::vector<Collapse> collapses;
265 std::vector<Lanes> lanes;
267 std::vector<Node> nodes;
268 std::vector<FrameChange> frameChanges;
270 std::vector<Frame> frames;
272 std::vector<Transition> transitions;
273 std::vector<TransitionChange> transitionChanges;
274 std::optional<Initial> initial;
275
277 bool empty() const
278 {
279 return moves.empty() && rewires.empty() && collapses.empty() && lanes.empty() && nodes.empty()
280 && frameChanges.empty() && frames.empty() && transitions.empty() && transitionChanges.empty()
281 && !initial;
282 }
283 };
284
287 {
288 uint32_t wireKey = 0;
289 std::vector<tachyon::int2> points;
290 bool curved = false;
291 };
292
304
305
307 enum class FrameEdges : uint8_t { None = 0, Right = 1, Bottom = 2, Corner = Right | Bottom };
308
311 {
317 std::vector<std::pair<int, NodeFrame>> frames;
318 std::vector<std::pair<int, tachyon::int2>> nodes;
319 };
320
322 template <class T>
324 {
325 std::vector<T> items;
326 std::vector<uint32_t> first{ 0 };
327
328 size_t size() const { return first.size() - 1; }
329 std::span<T> operator[](size_t n) { return { items.data() + first[n], first[n + 1] - first[n] }; }
330 std::span<const T> operator[](size_t n) const { return { items.data() + first[n], first[n + 1] - first[n] }; }
331 };
332
335 {
336 int node = -1;
337 int prop = -1;
338 bool output = false;
339 int row = 0;
340 };
341
353 {
354 std::vector<NodeModel> nodes;
358
363 std::vector<StateTransition> transitions;
369 float activeStateTime = -1.0f;
372 std::vector<NodeFrame> frames;
374 std::vector<int> ordering;
375
378 bool snapToGrid = true;
384 std::unordered_map<uint32_t, WireRouteOverrides> wireOverrides;
385
387 std::function<void(const NodeViewEdit&)> onEdit;
390 std::function<bool(const NodeGraph& graph,
391 PropertyEndpoint output,
393
396 uint32_t revision = 0;
397 };
398
403 {
404 std::unordered_set<tachyon::ID> selectedTransitionIDs;
407 std::function<void(int node)> onOpenState;
410 std::function<void(int transition)> onTransitionContextMenu;
413 std::unordered_set<tachyon::ID> selectedFrameIDs;
416 std::function<void(int frame)> onFrameContextMenu;
417
419 std::vector<std::string> breadcrumb;
420 std::function<void(int)> onBreadcrumb;
421 bool showZoomControls = true;
422 bool showMinimap = true;
425 float minZoom = 0.1f;
426 float maxZoom = 4.0f;
431 bool virtualizeLayout = true;
432
434 float minimapScale = 0.0f;
436
450
452 std::unordered_set<tachyon::ID> selectedNodeIDs;
456 std::function<void()> onSelectionChanged;
460 std::unordered_set<tachyon::ID> reportedSelection;
461 std::unordered_set<tachyon::ID> reportedFrameSelection;
464
467
471 {
472 std::unordered_set<tachyon::ID> nodes;
473 std::unordered_set<tachyon::ID> frames;
474 bool shift = false;
475 bool ctrl = false;
476 };
477
481
483 std::vector<CachedWireHandle> wireHandleCache;
485
493 std::function<void(PropertyEndpoint from, bool fromOutput, float2 canvasPos)> onWireDroppedOnCanvas;
494 std::optional<uint32_t> wireMenuWire;
500 std::function<void(float2 canvasPos)> onCanvasContextMenu;
504 std::function<void(int node)> onNodeContextMenu;
505 std::optional<float2> canvasMenuPos;
506 std::optional<tachyon::ID> nodeMenuNode;
507 std::optional<tachyon::ID> frameMenuFrame;
510 std::optional<tachyon::ID> renamingFrame;
511 std::string renameText;
512 bool renameFocused = false;
513 int32_t gridSize = 0;
516 std::vector<tachyon::IntRect> frameBoxes;
522 std::vector<tachyon::ElementRef> nodeRefs;
523 std::vector<uint32_t> drivenOutputs;
524 std::vector<int> nodeHiddenBy;
525 std::vector<tachyon::IntRect> hiddenBox;
529 std::vector<std::vector<PropertyEndpoint>> framePortsIn, framePortsOut;
530 std::vector<std::pair<tachyon::ID, int>> nodesByID;
531 std::vector<std::pair<tachyon::ID, int>> framesByID;
532 std::string portText;
541
549 bool transitionPicking = false;
558 std::vector<std::pair<tachyon::ID, tachyon::IntRect>> transitionLabelBoxes;
559 std::optional<tachyon::ID> renamingTransition;
560 std::optional<tachyon::ID> transitionMenuTransition;
561
565 std::unordered_map<uint32_t, tachyon::VisualColorStyleIndex> wireColorStyles;
567 uint32_t seenRevision = 0;
571 };
572
576 {
577 };
578
581 template<class Graph, class State>
583 {
585 State& state;
586
587 BasicNodeViewRef(Graph& g, State& s) : graph(g), state(s) {}
588 template<class View> requires std::is_convertible_v<View&, Graph&> && std::is_convertible_v<View&, State&>
589 BasicNodeViewRef(View& view) : graph(view), state(view) {}
590 template<class G, class S> requires std::is_convertible_v<G&, Graph&> && std::is_convertible_v<S&, State&>
592 };
596}
BasicNodeViewRef< const NodeGraph, const NodeViewState > ConstNodeViewRef
Definition gui_node_view_types.h:594
FrameEdges
Which edges of a frame a resize moves.
Definition gui_node_view_types.h:307
NodeViewKind
What a node view edits: a graph of nodes with fields wired output to input, or a state machine,...
Definition gui_node_view_types.h:100
BasicNodeViewRef< NodeGraph, NodeViewState > NodeViewRef
Definition gui_node_view_types.h:593
WireHandle
Interior lane a drag handle adjusts: the corridor route's vertical lane (LaneX), or the detour route'...
Definition gui_node_view_types.h:162
NodeWireShape
How a node view draws its wires (NodeGraph::wireShape).
Definition gui_node_view_types.h:208
@ Corner
Definition gui_node_view_types.h:307
@ None
Definition gui_node_view_types.h:307
@ Graph
nodes with properties and sockets, wired output to input
Definition gui_node_view_types.h:101
@ StateMachine
states (nodes without properties) and transitions between them
Definition gui_node_view_types.h:102
@ LaneY
Definition gui_node_view_types.h:162
@ EntryX
Definition gui_node_view_types.h:162
@ None
Definition gui_node_view_types.h:162
@ ExitX
Definition gui_node_view_types.h:162
@ LaneX
Definition gui_node_view_types.h:162
@ Curved
one smooth curve from output to input
Definition gui_node_view_types.h:210
@ Orthogonal
along the grid, round the nodes, with lanes that drag
Definition gui_node_view_types.h:209
@ None
Definition gui_element_flags.h:18
CommandMode
A set of shortcuts that is active while the app says so (e.g.
Definition gui_command_manager.h:25
@ Dragging
held and moved the drag distance (or a drag from the press on)
Definition gui_gesture.h:20
@ Default
Definition gui_command_manager.h:26
@ Right
Definition gui_input_enums.h:42
@ Bottom
Definition gui_style.h:255
Definition gui_logging.h:24
A graph and one view of it, as RenderNodeView and the helpers take them: a NodeView passes as one,...
Definition gui_node_view_types.h:583
NodeViewState & state
Definition gui_node_view_types.h:585
BasicNodeViewRef(Graph &g, State &s)
Definition gui_node_view_types.h:587
BasicNodeViewRef(View &view)
Definition gui_node_view_types.h:589
BasicNodeViewRef(const BasicNodeViewRef< G, S > &other)
Definition gui_node_view_types.h:591
NodeGraph & graph
Definition gui_node_view_types.h:584
Last frame's draggable segment (node.pos space), for laying out its grab element.
Definition gui_node_view_types.h:216
uint32_t wireKey
Definition gui_node_view_types.h:217
bool vertical
Definition gui_node_view_types.h:219
tachyon::int2 a
Definition gui_node_view_types.h:220
tachyon::int2 b
Definition gui_node_view_types.h:220
WireHandle role
Definition gui_node_view_types.h:218
Click-gesture tracker, owned per widget instance so instances (and tests) don't share it.
Definition gui_widget_state_types.h:77
A wire as drawn this frame, for hit-testing; points in node.pos space.
Definition gui_node_view_types.h:287
std::vector< tachyon::int2 > points
Definition gui_node_view_types.h:289
bool curved
as WireRoute::curved
Definition gui_node_view_types.h:290
uint32_t wireKey
Definition gui_node_view_types.h:288
A press on a frame's title or one of its edges, and what it moves.
Definition gui_node_view_types.h:311
tachyon::ID frameID
Definition gui_node_view_types.h:313
tachyon::Gesture press
a move's press becomes a drag past the drag distance; a resize's at once
Definition gui_node_view_types.h:312
std::vector< std::pair< int, tachyon::int2 > > nodes
Definition gui_node_view_types.h:318
FrameEdges edges
None: a move, by the title.
Definition gui_node_view_types.h:314
std::vector< std::pair< int, NodeFrame > > frames
At the press: the frames it moves (it, and those inside it) and the nodes inside them,...
Definition gui_node_view_types.h:317
One press that may become a drag, with what every control does around it: the focus and the capture o...
Definition gui_gesture.h:60
GesturePhase Phase() const noexcept
Definition gui_gesture.h:67
The part of a drawn control under the pointer (a key, a handle, a clip's end), for its hover look.
Definition gui_gesture.h:115
A 64-bit element ID whose bit layout depends on its IDMode.
Definition gui_id.h:23
static constexpr ID Invalid()
The "no element" ID (all bits zero); also the default for optional ID parameters.
Definition gui_id.h:66
Definition gui_base_types.h:406
A frame (a comment box): a titled, colored box behind a group of nodes.
Definition gui_node_view_types.h:119
bool operator==(const NodeFrame &) const =default
tachyon::ID stableID
Assigned once on creation, as a node's: the ID of its elements and of its selection.
Definition gui_node_view_types.h:122
bool collapsed
Shown as one node: its title bar, and a row for each wire crossing its edge, an input on the left for...
Definition gui_node_view_types.h:132
tachyon::int2 size
width and height, the title bar included, while expanded
Definition gui_node_view_types.h:128
std::optional< std::vector< tachyon::ID > > members
While collapsed: the nodes and frames it held when it collapsed, by stableID.
Definition gui_node_view_types.h:137
tachyon::color4f color
Its tint; alpha 0 uses the theme's neutral one.
Definition gui_node_view_types.h:126
tachyon::int2 pos
top-left, in node.pos space
Definition gui_node_view_types.h:127
std::string title
shown in its title bar; double-click to rename
Definition gui_node_view_types.h:123
What a node view's graph is: its nodes, frames and wires (or a state machine's states and transitions...
Definition gui_node_view_types.h:353
tachyon::ID activeState
The state the machine is in, as the app runs it: ringed. Invalid: none.
Definition gui_node_view_types.h:366
uint32_t revision
Goes up by one with each edit applied (ApplyNodeViewEdit).
Definition gui_node_view_types.h:396
std::function< void(const NodeViewEdit &)> onEdit
Called once per finished user edit (a whole drag is one), after it is applied.
Definition gui_node_view_types.h:387
std::vector< NodeFrame > frames
Frames, drawn behind the nodes and wires, the first at the back.
Definition gui_node_view_types.h:372
bool snapToGrid
Keeps node positions on the grid: dragged nodes land on it, and positions set in code are moved onto ...
Definition gui_node_view_types.h:378
std::function< bool(const NodeGraph &graph, PropertyEndpoint output, PropertyEndpoint input)> canConnect
Whether an output -> input wire is allowed; null allows any.
Definition gui_node_view_types.h:392
tachyon::ID initialState
where the machine starts: marked with an arrow in
Definition gui_node_view_types.h:364
std::vector< int > ordering
Z-order, last == front (a clicked node moves there).
Definition gui_node_view_types.h:374
float activeStateTime
How long the machine has been in activeState, in seconds, shown under it ("1.24 s"); negative shows n...
Definition gui_node_view_types.h:369
std::unordered_map< uint32_t, WireRouteOverrides > wireOverrides
Pinned wire lanes, keyed by WireKey() of the wire's target endpoint.
Definition gui_node_view_types.h:384
std::vector< NodeModel > nodes
the graph; endpoints and edits refer to nodes by index
Definition gui_node_view_types.h:354
NodeViewKind kind
A graph of fields and wires, or a state machine.
Definition gui_node_view_types.h:357
std::vector< StateTransition > transitions
Definition gui_node_view_types.h:363
NodeWireShape wireShape
Orthogonal: wires run along the grid, round the nodes, their lanes dragged by hand.
Definition gui_node_view_types.h:382
Internal: a socket of a node hidden in a collapsed frame, on that frame's box edge.
Definition gui_node_view_types.h:335
int node
Definition gui_node_view_types.h:336
int prop
Definition gui_node_view_types.h:337
int row
the box's row it's on
Definition gui_node_view_types.h:339
bool output
Definition gui_node_view_types.h:338
Internal: a list per node, all in one array, refilled each frame in the storage it has.
Definition gui_node_view_types.h:324
std::span< const T > operator[](size_t n) const
Definition gui_node_view_types.h:330
std::vector< uint32_t > first
node n's are items[first[n] .. first[n + 1])
Definition gui_node_view_types.h:326
std::span< T > operator[](size_t n)
Definition gui_node_view_types.h:329
size_t size() const
Definition gui_node_view_types.h:328
std::vector< T > items
Definition gui_node_view_types.h:325
One node of a node view.
Definition gui_node_view_types.h:69
bool hidden
Internal: inside a collapsed frame, as last drawn: not shown, clicked or selected.
Definition gui_node_view_types.h:91
std::string category
Category name, shown right-aligned in the header.
Definition gui_node_view_types.h:76
bool collapsed
rows hidden, header only (double-click toggles)
Definition gui_node_view_types.h:83
tachyon::int2 startPos
internal: pos at drag start
Definition gui_node_view_types.h:81
bool reroute
A reroute: a dot that a wire passes through, a waypoint, instead of a box.
Definition gui_node_view_types.h:88
tachyon::int2 lastSize
outer-rect size from last frame's layout
Definition gui_node_view_types.h:82
tachyon::ID stableID
Assigned once on creation; the node's element ID and the salt for its sub-IDs, so ID-keyed state surv...
Definition gui_node_view_types.h:72
std::vector< NodeProperty > properties
the rows, top to bottom
Definition gui_node_view_types.h:89
bool subMachine
In a state machine (NodeViewKind::StateMachine): the state holds a machine of its own.
Definition gui_node_view_types.h:94
tachyon::color4f categoryColor
Color of the header's category square; alpha 0 uses the accent.
Definition gui_node_view_types.h:78
std::string title
header text
Definition gui_node_view_types.h:74
tachyon::int2 pos
Top-left in canvas layout space (whole pixels relative to the canvas, before pan/zoom).
Definition gui_node_view_types.h:80
One row of a node: an optional input socket, a body, and an optional output socket.
Definition gui_node_view_types.h:41
std::function< std::string()> value
Definition gui_node_view_types.h:64
std::string type
Definition gui_node_view_types.h:63
std::function< void()> renderBody
Row body, built between the two sockets; may call any widget (Label, Field, ...).
Definition gui_node_view_types.h:49
bool output
Right socket, rendered when true. It drives every input that names it as its source.
Definition gui_node_view_types.h:46
int rowSpan
Row height in row pitches, for tall bodies (previews, multi-line).
Definition gui_node_view_types.h:56
tachyon::color4f socketColor
Socket dot colour, also used for wires leaving this output.
Definition gui_node_view_types.h:52
std::optional< PropertyEndpoint > input
Left socket, rendered when has_value(); holds the source output feeding it (one at most).
Definition gui_node_view_types.h:43
std::string name
What its sockets' tooltip says: the pin's name, its type (muted, monospace) and its value now,...
Definition gui_node_view_types.h:62
A node (index) collapsed or expanded.
Definition gui_node_view_types.h:232
bool from
Definition gui_node_view_types.h:232
int node
Definition gui_node_view_types.h:232
bool to
Definition gui_node_view_types.h:232
A frame (index) moved, resized, renamed or recolored: all of it before and after.
Definition gui_node_view_types.h:250
NodeFrame to
Definition gui_node_view_types.h:250
NodeFrame from
Definition gui_node_view_types.h:250
int frame
Definition gui_node_view_types.h:250
A frame added at index (or, when !added, taken from there); the frames after it move up or down one.
Definition gui_node_view_types.h:253
NodeFrame frame
Definition gui_node_view_types.h:253
bool added
Definition gui_node_view_types.h:253
int index
Definition gui_node_view_types.h:253
The initial state changed (by stableID; Invalid: none).
Definition gui_node_view_types.h:260
tachyon::ID from
Definition gui_node_view_types.h:260
tachyon::ID to
Definition gui_node_view_types.h:260
A wire's (by WireKey) lane overrides changed; default means no overrides.
Definition gui_node_view_types.h:234
uint32_t wireKey
Definition gui_node_view_types.h:234
WireRouteOverrides to
Definition gui_node_view_types.h:234
WireRouteOverrides from
Definition gui_node_view_types.h:234
A node (index) moved; positions in node.pos space.
Definition gui_node_view_types.h:228
tachyon::int2 from
Definition gui_node_view_types.h:228
tachyon::int2 to
Definition gui_node_view_types.h:228
int node
Definition gui_node_view_types.h:228
A node added at index (or, when !added, taken from there), with the wires from its outputs into other...
Definition gui_node_view_types.h:240
NodeModel node
Definition gui_node_view_types.h:243
std::vector< std::pair< uint32_t, WireRouteOverrides > > lanes
WireKey -> overrides.
Definition gui_node_view_types.h:246
std::vector< std::pair< PropertyEndpoint, int > > fed
Another node's input and the property of this node whose output feeds it.
Definition gui_node_view_types.h:245
bool added
Definition gui_node_view_types.h:242
int index
Definition gui_node_view_types.h:241
An input's source changed; an invalid endpoint means unwired.
Definition gui_node_view_types.h:230
PropertyEndpoint to
Definition gui_node_view_types.h:230
PropertyEndpoint from
Definition gui_node_view_types.h:230
PropertyEndpoint input
Definition gui_node_view_types.h:230
A transition (index) relabelled or redirected: all of it before and after.
Definition gui_node_view_types.h:258
StateTransition from
Definition gui_node_view_types.h:258
StateTransition to
Definition gui_node_view_types.h:258
int index
Definition gui_node_view_types.h:258
A transition added at index (or, when !added, taken from there); the ones after it move up or down on...
Definition gui_node_view_types.h:256
StateTransition transition
Definition gui_node_view_types.h:256
bool added
Definition gui_node_view_types.h:256
int index
Definition gui_node_view_types.h:256
One thing the user did in a node view, as values before and after, so a host can keep the undo histor...
Definition gui_node_view_types.h:226
std::vector< Transition > transitions
Applied before transitionChanges, and undone after.
Definition gui_node_view_types.h:272
std::vector< Move > moves
Definition gui_node_view_types.h:262
std::optional< Initial > initial
Definition gui_node_view_types.h:274
std::vector< Frame > frames
Applied before frameChanges, as nodes are, and undone after.
Definition gui_node_view_types.h:270
std::vector< Rewire > rewires
Definition gui_node_view_types.h:263
std::vector< FrameChange > frameChanges
Definition gui_node_view_types.h:268
std::vector< Node > nodes
Applied before the others (so a rewire may name an added node) and undone after.
Definition gui_node_view_types.h:267
std::vector< TransitionChange > transitionChanges
Definition gui_node_view_types.h:273
std::vector< Collapse > collapses
Definition gui_node_view_types.h:264
std::vector< Lanes > lanes
Definition gui_node_view_types.h:265
bool empty() const
True when nothing changed.
Definition gui_node_view_types.h:277
What a marquee starts from: the selection before it, put back by Escape, and the modifiers held at it...
Definition gui_node_view_types.h:471
bool ctrl
Definition gui_node_view_types.h:475
bool shift
Definition gui_node_view_types.h:474
std::unordered_set< tachyon::ID > nodes
the nodes selected
Definition gui_node_view_types.h:472
std::unordered_set< tachyon::ID > frames
the frames selected
Definition gui_node_view_types.h:473
How one view shows a NodeGraph: its pan and zoom, what's selected in it, what the user is doing in it...
Definition gui_node_view_types.h:403
tachyon::int2 transitionPointer
Definition gui_node_view_types.h:546
WireSegmentDrag wireDrag
Definition gui_node_view_types.h:484
std::vector< int > nodeHiddenBy
the collapsed frame hiding each node, or -1
Definition gui_node_view_types.h:524
std::vector< std::vector< PropertyEndpoint > > framePortsIn
Each collapsed frame's rows: the inputs wired from outside it, and the outputs inside it feeding a no...
Definition gui_node_view_types.h:529
std::unordered_set< tachyon::ID > selectedTransitionIDs
selected transition stableIDs
Definition gui_node_view_types.h:404
std::unordered_set< tachyon::ID > reportedSelection
internal: the selection last reported
Definition gui_node_view_types.h:460
tachyon::int2 lastInnerSize
last frame's canvas size, for centering
Definition gui_node_view_types.h:439
tachyon::int2 marqueeCurrentScreen
Definition gui_node_view_types.h:480
tachyon::Gesture< tachyon::float3x2 > pan
Internal: the view dragged (middle, or Alt + left); once dragged, not a click.
Definition gui_node_view_types.h:536
std::optional< tachyon::ID > transitionMenuTransition
internal: the transition the open menu is for
Definition gui_node_view_types.h:560
std::optional< float2 > canvasMenuPos
internal: where the open canvas menu is for
Definition gui_node_view_types.h:505
CommandMode commandMode
Command mode set while the canvas has focus.
Definition gui_node_view_types.h:449
std::string portText
a collapsed frame's port name, as built
Definition gui_node_view_types.h:532
std::vector< uint32_t > drivenOutputs
the wired outputs' WireKeys, sorted
Definition gui_node_view_types.h:523
std::function< void()> onSelectionChanged
Called when the selection changed, once per RenderNodeView that finds it changed: by the user (clicks...
Definition gui_node_view_types.h:456
tachyon::Gesture nodeDrag
internal: the press on a node; moves the selection once dragged
Definition gui_node_view_types.h:538
std::function< void(PropertyEndpoint from, bool fromOutput, float2 canvasPos)> onWireDroppedOnCanvas
A new wire was released over the empty canvas (not on a node), e.g.
Definition gui_node_view_types.h:493
float2 wireMenuPos
internal: where on the canvas it was opened
Definition gui_node_view_types.h:495
std::function< void(float2 canvasPos)> onCanvasContextMenu
Builds the canvas's context menu (MenuItem and the like), each frame while it's open; without it ther...
Definition gui_node_view_types.h:500
tachyon::ID transitionFrom
Definition gui_node_view_types.h:545
std::vector< CachedWireHandle > wireHandleCache
Last frame's draggable segments, since grab elements are laid out before routing.
Definition gui_node_view_types.h:483
float minZoom
The zoom range (1 = 100%) the wheel, the keys and the zoom controls stay in.
Definition gui_node_view_types.h:425
std::vector< std::pair< tachyon::ID, int > > nodesByID
(stableID, index), sorted: a collapsed frame's members
Definition gui_node_view_types.h:530
std::unordered_set< tachyon::ID > reportedFrameSelection
internal: the frames selected last reported
Definition gui_node_view_types.h:461
std::vector< tachyon::IntRect > hiddenBox
that frame's box, for a hidden node with crossing wires
Definition gui_node_view_types.h:525
bool showZoomControls
zoom overlay, bottom-left
Definition gui_node_view_types.h:421
tachyon::Gesture transitionDrag
Internal: a transition being drawn from a state's edge, the state it leaves, and where the pointer is...
Definition gui_node_view_types.h:544
std::unordered_set< tachyon::ID > selectedFrameIDs
Selected frame stableIDs.
Definition gui_node_view_types.h:413
std::vector< tachyon::ElementRef > nodeRefs
each node's element, as last built
Definition gui_node_view_types.h:522
std::optional< tachyon::ID > frameMenuFrame
internal: the stableID the open frame menu is for
Definition gui_node_view_types.h:507
bool renameFocused
internal: the field has had the focus
Definition gui_node_view_types.h:512
NodeLists< NodeHiddenPort > hiddenPorts
a hidden node's sockets on that box
Definition gui_node_view_types.h:526
bool virtualizeLayout
Lays out (and calls renderBody for) only the nodes in or near view: one far out of view stands in as ...
Definition gui_node_view_types.h:431
std::string renameText
internal: its title as edited so far
Definition gui_node_view_types.h:511
std::unordered_set< tachyon::ID > selectedNodeIDs
Selected node stableIDs.
Definition gui_node_view_types.h:452
tachyon::HoverPart< tachyon::ID > stateEdgeHover
Internal: the state whose edge is under the pointer (a transition starts there).
Definition gui_node_view_types.h:551
tachyon::int2 lastGridOrigin
Last frame's canvas border box less its content box: node.pos is measured from the border box,...
Definition gui_node_view_types.h:445
std::function< void(int frame)> onFrameContextMenu
As onNodeContextMenu, for frame frame (an index into frames): a right click on its title opens it and...
Definition gui_node_view_types.h:416
bool showMinimap
minimap overlay, bottom-right
Definition gui_node_view_types.h:422
tachyon::HoverPart< std::optional< tachyon::ID > > hoveredTransition
Internal: the transition under the pointer, from the last frame: highlighted, and what a click select...
Definition gui_node_view_types.h:554
NodeLists< tachyon::ElementRef > socketRefs
Definition gui_node_view_types.h:521
tachyon::ID canvasID
Internal: the canvas element as last built; its nodes' element IDs are scoped under it (NodeElementID...
Definition gui_node_view_types.h:570
FrameDrag frameDrag
internal: a frame being moved or resized
Definition gui_node_view_types.h:508
uint32_t seenRevision
Internal: the graph's revision this view last saw (NodeGraph::revision).
Definition gui_node_view_types.h:567
PendingConnection pendingConnection
internal: the wire being dragged
Definition gui_node_view_types.h:437
std::vector< std::pair< tachyon::ID, int > > framesByID
Definition gui_node_view_types.h:531
std::function< void(int node)> onNodeContextMenu
As onCanvasContextMenu, for node node (an index into nodes): opened by a right click on it,...
Definition gui_node_view_types.h:504
std::optional< uint32_t > wireMenuWire
the wire the open context menu is for
Definition gui_node_view_types.h:494
tachyon::Gesture menuPress
internal: a right press; its release without a drag opens a menu
Definition gui_node_view_types.h:537
DoubleClickTracker frameDoubleClick
internal: a double-click on a title renames
Definition gui_node_view_types.h:509
std::vector< tachyon::IntRect > frameBoxes
Internal: each frame's box as last drawn, by index (node.pos space): a collapsed one's node-like box,...
Definition gui_node_view_types.h:516
float minimapScale
Last frame's minimap mapping (canvas = origin + minimap pixels / scale), for clicks.
Definition gui_node_view_types.h:434
float maxZoom
Definition gui_node_view_types.h:426
std::vector< std::string > breadcrumb
Breadcrumb overlay at the canvas top-left, shown when non-empty.
Definition gui_node_view_types.h:419
bool transitionPicking
Internal: a transition started from a menu (StartTransition): it follows the pointer until a click on...
Definition gui_node_view_types.h:549
std::function< void(int transition)> onTransitionContextMenu
As onNodeContextMenu, for transition transition (an index into transitions): a right click on its arr...
Definition gui_node_view_types.h:410
DoubleClickTracker nodeDoubleClick
Double-click-to-collapse, per view so views (and test frames) don't share it.
Definition gui_node_view_types.h:466
tachyon::Gesture< MarqueeStart > marquee
A press on the empty background: a marquee once it moves the drag distance.
Definition gui_node_view_types.h:479
std::vector< std::vector< PropertyEndpoint > > framePortsOut
Definition gui_node_view_types.h:529
std::optional< tachyon::ID > nodeMenuNode
internal: the stableID the open node menu is for
Definition gui_node_view_types.h:506
tachyon::float3x2 transform
identity = centered view (no pan/zoom)
Definition gui_node_view_types.h:438
tachyon::float2 minimapOrigin
Definition gui_node_view_types.h:435
DoubleClickTracker transitionClicks
internal: a double-click on a transition relabels it
Definition gui_node_view_types.h:555
uint32_t selectionGeneration
Goes up by one each time onSelectionChanged would be called, for an app that would rather compare it ...
Definition gui_node_view_types.h:459
std::function< void(int node)> onOpenState
A double-click on a state that holds a machine of its own (NodeModel::subMachine): open it,...
Definition gui_node_view_types.h:407
std::optional< tachyon::ID > renamingFrame
internal: the frame whose title is being edited
Definition gui_node_view_types.h:510
tachyon::ID revealedFocusID
internal: the focus last scrolled into view
Definition gui_node_view_types.h:446
std::function< void(int)> onBreadcrumb
called with the clicked segment index
Definition gui_node_view_types.h:420
std::vector< std::pair< tachyon::ID, tachyon::IntRect > > transitionLabelBoxes
Internal: each transition's label chip as last laid out (node.pos space): a click on it is a click on...
Definition gui_node_view_types.h:558
tachyon::ID lastClickedNodeID
StableID of the last clicked node.
Definition gui_node_view_types.h:463
std::optional< tachyon::ID > renamingTransition
internal: the transition whose label is being edited
Definition gui_node_view_types.h:559
std::unordered_map< uint32_t, tachyon::VisualColorStyleIndex > wireColorStyles
This frame's colors from the app (sockets, nodes, frames): packed RGBA -> its color style,...
Definition gui_node_view_types.h:565
int32_t gridSize
internal: the grid the view was last drawn with
Definition gui_node_view_types.h:513
tachyon::IntRect lastCanvasRect
Last frame's canvas padding box, in screen pixels (as events have them), for NodeViewScreenToCanvas a...
Definition gui_node_view_types.h:442
tachyon::HoverPart< std::optional< uint32_t > > hoveredWire
The wire under the mouse (by WireKey), from the last frame: highlighted, removed by a middle click,...
Definition gui_node_view_types.h:488
tachyon::Gesture< tachyon::float3x2 > minimapDrag
Internal: a press in the minimap; the transform before it, put back by Escape.
Definition gui_node_view_types.h:540
tachyon::ID focusedNodeID
internal: the node holding the focus last frame
Definition gui_node_view_types.h:447
A graph shown in one place: the graph and the one view of it together.
Definition gui_node_view_types.h:576
A wire being dragged. Committed wires are the reciprocal endpoints on NodeProperty.
Definition gui_node_view_types.h:144
std::optional< PropertyEndpoint > detachedInput
the input the wire was pulled off, if any
Definition gui_node_view_types.h:157
tachyon::int2 currentScreen
most recent mouse screen pos
Definition gui_node_view_types.h:153
PropertyEndpoint target
This frame: the socket it is over and may connect to (an input, or an output when fromInput).
Definition gui_node_view_types.h:156
bool IsActive() const
A wire drag is in progress: the press has become a drag.
Definition gui_node_view_types.h:149
bool fromInput
dragged from an input, towards an output
Definition gui_node_view_types.h:152
PropertyEndpoint source
The socket the wire starts from: an output, or an unwired input when fromInput.
Definition gui_node_view_types.h:151
tachyon::Gesture press
The socket's press.
Definition gui_node_view_types.h:147
A property on a node. Default-constructed is invalid: in a socket it means "present,...
Definition gui_node_view_types.h:30
int nodeIdx
index into NodeGraph::nodes
Definition gui_node_view_types.h:31
bool operator==(const PropertyEndpoint &) const =default
bool valid() const
True when both indices are set.
Definition gui_node_view_types.h:35
int propIdx
index into that node's properties
Definition gui_node_view_types.h:32
A transition of a state machine: from one state to another, or to itself.
Definition gui_node_view_types.h:107
tachyon::ID from
the state it leaves, by stableID
Definition gui_node_view_types.h:109
tachyon::ID to
the state it enters (from for a loop)
Definition gui_node_view_types.h:110
tachyon::ID stableID
assigned once on creation, as a node's
Definition gui_node_view_types.h:108
std::string label
shown on its arrow: an event or a condition
Definition gui_node_view_types.h:111
bool operator==(const StateTransition &) const =default
A wire's place among the wires between the same two nodes, so their default lanes nest instead of coi...
Definition gui_node_view_types.h:167
int32_t index
by input, top first
Definition gui_node_view_types.h:169
int32_t offset
grid steps right for the corridor lane
Definition gui_node_view_types.h:168
int32_t count
wires in the group
Definition gui_node_view_types.h:170
bool operator==(const WireLane &) const =default
User-pinned lanes of one wire (unset = default), in the route's space.
Definition gui_node_view_types.h:178
std::optional< int32_t > laneX
corridor vertical lane X
Definition gui_node_view_types.h:179
std::optional< int32_t > exitX
detour vertical lane near the output
Definition gui_node_view_types.h:180
std::optional< int32_t > laneY
detour horizontal return-lane Y
Definition gui_node_view_types.h:182
bool operator==(const WireRouteOverrides &) const =default
std::optional< int32_t > entryX
detour vertical lane near the input
Definition gui_node_view_types.h:181
WireLane lane
where the unpinned lanes go in its group
Definition gui_node_view_types.h:183
Polyline plus its draggable interior segments (never the end stubs).
Definition gui_node_view_types.h:198
std::vector< tachyon::int2 > points
the polyline, output to input
Definition gui_node_view_types.h:199
bool curved
The points are a curved line's four instead: output, two control points, input (see WireCurvePoint).
Definition gui_node_view_types.h:203
std::vector< WireSegmentHandle > handles
Definition gui_node_view_types.h:200
Segment drag via mouse capture rather than DnD, so the resize cursor sticks.
Definition gui_node_view_types.h:295
bool vertical
Definition gui_node_view_types.h:301
int32_t startValue
lane coordinate at drag start (node.pos space)
Definition gui_node_view_types.h:302
uint32_t wireKey
Definition gui_node_view_types.h:299
WireHandle role
Definition gui_node_view_types.h:300
tachyon::Gesture< WireRouteOverrides > press
The handle's press, a drag from the start; the wire's overrides as they were, for the edit and for Es...
Definition gui_node_view_types.h:298
Draggable interior segment; vertical segments drag horizontally and vice versa.
Definition gui_node_view_types.h:190
WireHandle role
which lane dragging it changes
Definition gui_node_view_types.h:192
tachyon::int2 b
segment endpoints, same space as the route points
Definition gui_node_view_types.h:191
bool vertical
Definition gui_node_view_types.h:193
tachyon::int2 a
Definition gui_node_view_types.h:191
Definition gui_base_types.h:394
Definition gui_base_types.h:120
2D affine transform matrix (2 rows x 3 columns): x' = r0.x*x + r0.y*y + r0.z y' = r1....
Definition gui_base_types.h:218
Integer 2D vector.
Definition gui_base_types.h:18